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:
onli
2014-05-11 23:57:19 +02:00
parent ccbfcf2e66
commit a815b217b8
3 changed files with 13 additions and 4 deletions
+6 -3
View File
@@ -968,10 +968,13 @@ function serendipity_smarty_init($vars = array()) {
}
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_stylesheet'], '?')) {
if (strstr($serendipity['smarty_vars']['head_link_script'], '?')) {
$serendipity['smarty_vars']['head_link_script'] .= '&v=' . $serendipity['last_template_change'];
} else {
$serendipity['smarty_vars']['head_link_script'] .= '?v=' . $serendipity['last_template_change'];