Skip to content

Commit

Permalink
Move script inclusions from HEAD to document footer
Browse files Browse the repository at this point in the history
Fixes #13285: Move script inclusions from HEAD to document footer
  • Loading branch information
syncguru authored and dregad committed Aug 20, 2015
1 parent aa9b4f8 commit 4a81ef1
Showing 1 changed file with 19 additions and 34 deletions.
53 changes: 19 additions & 34 deletions core/html_api.php
Expand Up @@ -31,7 +31,6 @@
* html_title
* html_css
* html_rss_link
* html_head_javascript
* (html_meta_redirect)
* html_page_top2
* html_page_top2a
Expand Down Expand Up @@ -207,8 +206,6 @@ function html_page_top1( $p_page_title = null ) {
# Advertise the availability of the browser search plug-ins.
echo "\t", '<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Text Search" href="' . string_sanitize_url( 'browser_search_plugin.php?type=text', true ) . '" />' . "\n";
echo "\t", '<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Issue Id" href="' . string_sanitize_url( 'browser_search_plugin.php?type=id', true ) . '" />' . "\n";

html_head_javascript();
}

/**
Expand Down Expand Up @@ -436,32 +433,9 @@ function require_js( $p_script_path ) {
$g_scripts_included[$p_script_path] = $p_script_path;
}

/**
* (6a) Javascript...
* @return void
*/
function html_head_javascript() {
global $g_scripts_included;

echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_config.php' ) . '"></script>' . "\n";
echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_translations.php' ) . '"></script>' . "\n";

if ( config_get_global( 'cdn_enabled' ) == ON ) {
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jquery/' . JQUERY_VERSION . '/jquery.min.js"></script>' . "\n";
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/' . JQUERY_UI_VERSION . '/jquery-ui.min.js"></script>' . "\n";
} else {
html_javascript_link( 'jquery-' . JQUERY_VERSION . '.min.js' );
html_javascript_link( 'jquery-ui-' . JQUERY_UI_VERSION . '.min.js' );
}

html_javascript_link( 'common.js' );
foreach ( $g_scripts_included as $t_script_path ) {
html_javascript_link( $t_script_path );
}
}

/**
* (7) End the <head> section
* (6) End the <head> section
* @return void
*/
function html_head_end() {
Expand All @@ -471,7 +445,7 @@ function html_head_end() {
}

/**
* (8) Begin the <body> section
* (7) Begin the <body> section
* @return void
*/
function html_body_begin() {
Expand All @@ -489,7 +463,7 @@ function html_body_begin() {
}

/**
* (9) Print a user-defined banner at the top of the page if there is one.
* (8) Print a user-defined banner at the top of the page if there is one.
* @return void
*/
function html_top_banner() {
Expand Down Expand Up @@ -527,7 +501,7 @@ function html_top_banner() {
}

/**
* (10) Print the user's account information
* (9) Print the user's account information
* Also print the select box where users can switch projects
* @return void
*/
Expand Down Expand Up @@ -622,7 +596,7 @@ function html_login_info() {
}

/**
* (11) Print a user-defined banner at the bottom of the page if there is one.
* (10) Print a user-defined banner at the bottom of the page if there is one.
* @return void
*/
function html_bottom_banner() {
Expand Down Expand Up @@ -660,7 +634,7 @@ function html_is_auto_refresh() {
}

/**
* (13) Print the page footer information
* (11) Print the page footer information
* @return void
*/
function html_footer() {
Expand Down Expand Up @@ -778,10 +752,21 @@ function html_footer() {
}

/**
* (14) End the <body> section
* (12) End the <body> section
* @return void
*/
function html_body_end() {
global $g_scripts_included;

echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_config.php' ) . '"></script>' . "\n";
echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_translations.php' ) . '"></script>' . "\n";
html_javascript_link( 'jquery-1.11.3.min.js' );
html_javascript_link( 'jquery-ui-1.11.4.min.js' );
html_javascript_link( 'common.js' );
foreach ( $g_scripts_included as $t_script_path ) {
html_javascript_link( $t_script_path );
}

event_signal( 'EVENT_LAYOUT_BODY_END' );

echo '</div>', "\n";
Expand All @@ -790,7 +775,7 @@ function html_body_end() {
}

/**
* (15) Print the closing <html> tag
* (13) Print the closing <html> tag
* @return void
*/
function html_end() {
Expand Down

0 comments on commit 4a81ef1

Please sign in to comment.