load main.js last

This commit is contained in:
friendica 2014-06-13 17:33:03 -07:00
parent b5ea259666
commit 64a370056c
2 changed files with 19 additions and 1 deletions

View File

@ -986,6 +986,10 @@ class App {
'$js_strings' => js_strings(),
'$zid' => get_my_address(),
)) . $this->page['htmlhead'];
// always put main.js at the end
$this->page['htmlhead'] .= head_get_main_js();
}
/**

View File

@ -573,11 +573,25 @@ function head_get_js() {
$str = '';
$sources = get_app()->js_sources;
if(count($sources))
foreach($sources as $source)
foreach($sources as $source) {
if($source === 'main.js')
continue;
$str .= format_js_if_exists($source);
}
return $str;
}
function head_get_main_js() {
$str = '';
$sources = array('main.js');
if(count($sources))
foreach($sources as $source)
$str .= format_js_if_exists($source,true);
return $str;
}
function format_js_if_exists($source) {
if(strpos($source,'/') !== false)