| @@ -4,25 +4,22 @@ | ||
| 4 | 4 | |
| 5 | 5 | use Kibo\PhastPlugins\SDK\AdminPanel\InstallNoticeRenderer; |
| 6 | 6 | |
| 7 | 7 | class InstallNoticeRendererImplementation implements InstallNoticeRenderer { |
| 8 | + | |
| 8 | 9 | public function render($notice, $onCloseJSFunction) { |
| 9 | - return phastpress_script(sprintf( | |
| 10 | - ' | |
| 11 | - (function () { | |
| 12 | - var notice = document.createElement("div"); | |
| 13 | - notice.className = "notice notice-success is-dismissible"; | |
| 14 | - notice.addEventListener("click", %s); | |
| 15 | - notice.innerHTML = %s; | |
| 10 | + $template = ' | |
| 11 | + <script> | |
| 12 | + jQuery(document).ready(function ($) { | |
| 13 | + $("#phastpress-activated-notice").on("click", " .notice-dismiss", function() { | |
| 14 | + (%s)() | |
| 15 | + }) | |
| 16 | + }); | |
| 17 | + </script>'; | |
| 18 | + $template = sprintf($template, $onCloseJSFunction); | |
| 19 | + $template .= '<div class="notice notice-success is-dismissible" id="phastpress-activated-notice">'; | |
| 20 | + $template .= '<p>' . $notice . '</p>'; | |
| 21 | + $template .= '</div>'; | |
| 22 | + return $template; | |
| 23 | + } | |
| 16 | 24 | |
| 17 | - var hr = | |
| 18 | - document.querySelector(".wp-header-end") || | |
| 19 | - document.querySelector("#wpbody-content > .wrap > h1"); | |
| 20 | - | |
| 21 | - hr.parentNode.insertBefore(notice, hr.nextSibling); | |
| 22 | - })(); | |
| 23 | - ', | |
| 24 | - $onCloseJSFunction, | |
| 25 | - json_encode("<p>{$notice}</p>") | |
| 26 | - )); | |
| 27 | - } | |
| 28 | 25 | } |