/** * Print flash messages in frontend if this has not been done from theme */ function _action_fw_flash_message_frontend_print() { if (FW_Flash_Messages::_frontend_printed()) { return; } if (!FW_Flash_Messages::_print_frontend()) { return; } ?> <script type="text/javascript"> (function(){ if (typeof jQuery === "undefined") { return; } jQuery(function($){ var $container; // Try to find the content element { var selector, selectors = [ '#main #content', '#content #main', '#main', '#content', '#content-container', '#container', '.container:first' ]; while (selector = selectors.shift()) { $container = $(selector); if ($container.length) { break; } } } if (!$container.length) { // Try to find main page H1 container $container = $('h1:first').parent(); } if (!$container.length) { // If nothing found, just add to body $container = $(document.body); } $(".fw-flash-messages").prependTo($container); }); })(); </script> <style type="text/css"> .fw-flash-messages .fw-flash-type-error { color: #f00; } .fw-flash-messages .fw-flash-type-warning { color: #f70; } .fw-flash-messages .fw-flash-type-success { color: #070; } .fw-flash-messages .fw-flash-type-info { color: #07f; } </style> <?php }
/** * Print flash messages in frontend if this has not been done from theme */ function _action_fw_flash_message_frontend_print() { if (FW_Flash_Messages::_frontend_printed()) { return; } if (!FW_Flash_Messages::_print_frontend()) { return; } echo '<script type="text/javascript">' . ' (function(){' . ' if (typeof jQuery === "undefined") return;' . ' jQuery(function($){' . ' var $container = $("#content .entry-content:first");' . ' if (!$container.length) $container = $(document.body);' . ' $(".fw-flash-messages").prependTo($container);' . ' });' . ' })();' . '</script>' . '<style type="text/css">' . ' .fw-flash-messages .fw-flash-type-error { color: #f00; }' . ' .fw-flash-messages .fw-flash-type-warning { color: #f70; }' . ' .fw-flash-messages .fw-flash-type-success { color: #070; }' . ' .fw-flash-messages .fw-flash-type-info { color: #07f; }' . '</style>'; }