Améliorations chargement JS async

En particulier pour global_view.js.
Suppression d'une requête avortée dans Chrome.
This commit is contained in:
Alexandre Alapetite
2013-11-04 20:23:46 +01:00
parent 6fbb62a2fc
commit 4a999fb628
3 changed files with 14 additions and 6 deletions

View File

@@ -151,7 +151,7 @@ function httpConditional($UnixTimeStamp,$cacheSeconds=0,$cachePrivacy=0,$feedMod
if ($cacheSeconds<0)
{
$cache='private, no-cache, no-store, must-revalidate';
header('Expires: 0');
//header('Expires: 0');
header('Pragma: no-cache');
}
else
@@ -159,7 +159,7 @@ function httpConditional($UnixTimeStamp,$cacheSeconds=0,$cachePrivacy=0,$feedMod
if ($cacheSeconds===0)
{
$cache='private, must-revalidate, ';
header('Expires: 0');
//header('Expires: 0');
}
elseif ($cachePrivacy===0) $cache='private, ';
elseif ($cachePrivacy===2) $cache='public, ';

View File

@@ -52,12 +52,19 @@ function init_global_view() {
init_stream_delegates($("#panel"));
}
if (document.readyState && document.readyState !== 'loading') {
function init_all_global_view() {
if (!(window.$ && window.init_stream_delegates)) {
window.setTimeout(init_all_global_view, 50); //Wait for all js to be loaded
return;
}
init_global_view();
init_close_panel();
}
if (document.readyState && document.readyState !== 'loading') {
init_all_global_view();
} else if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', function () {
init_global_view();
init_close_panel();
init_all_global_view();
}, false);
}

View File

@@ -492,6 +492,7 @@ function init_load_more() {
url_load_more = $next_link.attr("href");
var $prefetch = $('#prefetch');
if ($prefetch.attr('href') !== url_load_more) {
$prefetch.attr('rel', 'next'); //Remove prefetch
$.ajax({url: url_load_more, ifModified: true }); //TODO: Try to find a less agressive solution
$prefetch.attr('href', url_load_more);
}
@@ -504,7 +505,7 @@ function init_load_more() {
//</endless_mode>
function init_all() {
if (!(window.$ && window.shortcut && ((!full_lazyload) || $.fn.lazyload))) {
if (!(window.$ && window.shortcut && window.shortcuts && ((!full_lazyload) || $.fn.lazyload))) {
if (window.console) {
console.log('Waiting for JS…');
}