Introduce js_backend hook
Will help when JS shall only be emitted in the frontend/backend, as with the CSS
This commit is contained in:
@ -50,6 +50,8 @@ Version 2.0-beta2 ()
|
|||||||
* Improve non-WYSIWYG editor tag insertion, url insertion
|
* Improve non-WYSIWYG editor tag insertion, url insertion
|
||||||
|
|
||||||
* Improve less DOM firing on certain javascript tasks
|
* Improve less DOM firing on certain javascript tasks
|
||||||
|
|
||||||
|
* Introduce js_backend event hook
|
||||||
|
|
||||||
Version 2.0-beta1 (April 14th, 2014)
|
Version 2.0-beta1 (April 14th, 2014)
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
@ -968,10 +968,13 @@ function serendipity_smarty_init($vars = array()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($serendipity['smarty_vars']['head_link_script'])) {
|
if (!isset($serendipity['smarty_vars']['head_link_script'])) {
|
||||||
$serendipity['smarty_vars']['head_link_script'] = serendipity_rewriteURL('serendipity.js');
|
if (IN_serendipity_admin === true) {
|
||||||
|
$serendipity['smarty_vars']['head_link_script'] = serendipity_rewriteURL('serendipity_admin.js');
|
||||||
|
} else {
|
||||||
|
$serendipity['smarty_vars']['head_link_script'] = serendipity_rewriteURL('serendipity.js');
|
||||||
|
}
|
||||||
|
|
||||||
// When templates are switched, append a specific version string to make sure the browser does not cache the CSS
|
if (strstr($serendipity['smarty_vars']['head_link_script'], '?')) {
|
||||||
if (strstr($serendipity['smarty_vars']['head_link_stylesheet'], '?')) {
|
|
||||||
$serendipity['smarty_vars']['head_link_script'] .= '&v=' . $serendipity['last_template_change'];
|
$serendipity['smarty_vars']['head_link_script'] .= '&v=' . $serendipity['last_template_change'];
|
||||||
} else {
|
} else {
|
||||||
$serendipity['smarty_vars']['head_link_script'] .= '?v=' . $serendipity['last_template_change'];
|
$serendipity['smarty_vars']['head_link_script'] .= '?v=' . $serendipity['last_template_change'];
|
||||||
|
@ -568,7 +568,11 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
|
|||||||
|
|
||||||
$out = "";
|
$out = "";
|
||||||
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
|
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
|
||||||
serendipity_plugin_api::hook_event('js', $out);
|
if ($matches[1] == "serendipity_admin.js") {
|
||||||
|
serendipity_plugin_api::hook_event('js_backend', $out);
|
||||||
|
} else {
|
||||||
|
serendipity_plugin_api::hook_event('js', $out);
|
||||||
|
}
|
||||||
echo $out;
|
echo $out;
|
||||||
exit;
|
exit;
|
||||||
} else if (preg_match(PAT_COMMENTS, $uri, $matches)) {
|
} else if (preg_match(PAT_COMMENTS, $uri, $matches)) {
|
||||||
|
Reference in New Issue
Block a user