Add plugin-hook "js"
Use $link_head_script in a smarty-template to emit the path to the generated virtual javascript file
This commit is contained in:
parent
33ff9c1f7c
commit
be3d4d1d74
@ -264,6 +264,7 @@ function serendipity_initPermalinks() {
|
||||
@define('PAT_FILENAME_MATCH', '[' . PAT_FILENAME . ']+');
|
||||
@define('PAT_DIRNAME_MATCH', '[' . PAT_FILENAME . '/]*');
|
||||
@define('PAT_CSS', '@/(serendipity\.css|serendipity_admin\.css)@');
|
||||
@define('PAT_JS', '@/(serendipity\.js|serendipity_admin\.js)@');
|
||||
@define('PAT_FEED', '@/(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)@');
|
||||
@define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
|
||||
|
||||
|
@ -970,7 +970,17 @@ function serendipity_smarty_init($vars = array()) {
|
||||
} else {
|
||||
$serendipity['smarty_vars']['head_link_stylesheet'] .= '?v=' . $serendipity['last_template_change'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($serendipity['smarty_vars']['head_link_script'])) {
|
||||
$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'], '?')) {
|
||||
$serendipity['smarty_vars']['head_link_script'] .= '&v=' . $serendipity['last_template_change'];
|
||||
} else {
|
||||
$serendipity['smarty_vars']['head_link_script'] .= '?v=' . $serendipity['last_template_change'];
|
||||
}
|
||||
}
|
||||
|
||||
$serendipity['smarty']->assign(
|
||||
@ -980,6 +990,7 @@ function serendipity_smarty_init($vars = array()) {
|
||||
'head_title' => $serendipity['head_title'],
|
||||
'head_subtitle' => $serendipity['head_subtitle'],
|
||||
'head_link_stylesheet' => $serendipity['smarty_vars']['head_link_stylesheet'],
|
||||
'head_link_script' => $serendipity['smarty_vars']['head_link_script'],
|
||||
|
||||
'is_xhtml' => true,
|
||||
'use_popups' => $serendipity['enablePopup'],
|
||||
|
@ -8,6 +8,7 @@
|
||||
<link rel="stylesheet" href="{$head_link_stylesheet}">
|
||||
<script src="{serendipity_getFile file='admin/js/modernizr-2.6.2.min.js'}"></script>
|
||||
{if $admin_vars.admin_installed}{serendipity_hookPlugin hook="backend_header" hookAll="true"}{/if}
|
||||
<script src="{$head_link_script}"></script>
|
||||
</head>
|
||||
<body id="serendipity_admin_page">
|
||||
{if NOT $admin_vars.no_banner}
|
||||
|
@ -33,6 +33,7 @@
|
||||
<link rel="pingback" href="{$serendipityBaseURL}comment.php?type=pingback&entry_id={$entry_id}">
|
||||
{/if}
|
||||
{serendipity_hookPlugin hook="frontend_header"}
|
||||
<script src="{$head_link_script}"></script>
|
||||
</head>
|
||||
<body{if $template_option.webfonts != 'none'} class="{$template_option.webfonts}"{/if}>
|
||||
{else}
|
||||
|
Loading…
x
Reference in New Issue
Block a user