gorhill 10 years ago
parent dac3bab44f
commit 3fe5d48c05

@ -153,24 +153,6 @@ var collapser = (function() {
var newRequests = [];
var pendingRequests = {};
var pendingRequestCount = 0;
var backgroundImage = [
'linear-gradient(',
'0deg,',
'rgba(0,0,0,0.02) 25%,',
'rgba(0,0,0,0.05) 25%,',
'rgba(0,0,0,0.05) 75%,',
'rgba(0,0,0,0.02) 75%,',
'rgba(0,0,0,0.02)',
') center center / 10px 10px repeat scroll,',
'linear-gradient(',
'90deg,',
'rgba(0,0,0,0.02) 25%,',
'rgba(0,0,0,0.05) 25%,',
'rgba(0,0,0,0.05) 75%,',
'rgba(0,0,0,0.02) 75%,',
'rgba(0,0,0,0.02)',
') center center / 10px 10px repeat scroll'
].join('');
var srcProps = {
'iframe': 'src',
'img': 'src'
@ -205,7 +187,7 @@ var collapser = (function() {
return;
}
var collapse = response.collapse;
var bgImg = backgroundImage;
var bgImg = response.backgroundImage;
var i = requests.length;
var request, entry, target, tagName;
while ( i-- ) {

@ -509,6 +509,9 @@ var onMessage = function(request, sender, callback) {
collapse: µm.userSettings.collapseBlocked,
requests: evaluateURLs(tabId, request.requests)
};
if ( !response.collapse ) {
response.backgroundImage = vAPI.localStorage.getItem('placeholderBackgroundImage');
}
break;
case 'getUserAgentReplaceStr':

@ -44,6 +44,24 @@ var µm = µMatrix;
/******************************************************************************/
// Browser data jobs
var jobCallback = function() {
if ( !µm.userSettings.clearBrowserCache ) {
return;
}
µm.clearBrowserCacheCycle -= 15;
if ( µm.clearBrowserCacheCycle > 0 ) {
return;
}
µm.clearBrowserCacheCycle = µm.userSettings.clearBrowserCacheAfter;
µm.browserCacheClearedCounter++;
vAPI.browserCache.clearByTime(0);
// console.debug('clearBrowserCacheCallback()> vAPI.browserCache.clearByTime() called');
};
/******************************************************************************/
var onAllDone = function() {
µm.webRequest.start();
@ -54,26 +72,31 @@ var onAllDone = function() {
µm.assetUpdater.onAssetUpdated.addListener(µm.assetUpdatedHandler.bind(µm));
µm.assets.onAssetCacheRemoved.addListener(µm.assetCacheRemovedHandler.bind(µm));
// Browser data jobs
var jobCallback = function() {
if ( !µm.userSettings.clearBrowserCache ) {
return;
}
µm.clearBrowserCacheCycle -= 15;
if ( µm.clearBrowserCacheCycle > 0 ) {
return;
}
µm.clearBrowserCacheCycle = µm.userSettings.clearBrowserCacheAfter;
µm.browserCacheClearedCounter++;
vAPI.browserCache.clearByTime(0);
// console.debug('clearBrowserCacheCallback()> vAPI.browserCache.clearByTime() called');
};
µMatrix.asyncJobs.add('clearBrowserCache', null, jobCallback, 15 * 60 * 1000, true);
// Important: remove barrier to remote fetching, this was useful only
// for launch time.
µm.assets.remoteFetchBarrier -= 1;
if ( vAPI.localStorage.getItem('placeholderBackgroundImage') === null ) {
vAPI.localStorage.setItem('placeholderBackgroundImage', [
'linear-gradient(0deg,',
'rgba(0,0,0,0.02) 25%,',
'rgba(0,0,0,0.05) 25%,',
'rgba(0,0,0,0.05) 75%,',
'rgba(0,0,0,0.02) 75%,',
'rgba(0,0,0,0.02)',
') center center / 10px 10px repeat scroll,',
'linear-gradient(',
'90deg,',
'rgba(0,0,0,0.02) 25%,',
'rgba(0,0,0,0.05) 25%,',
'rgba(0,0,0,0.05) 75%,',
'rgba(0,0,0,0.02) 75%,',
'rgba(0,0,0,0.02)',
') center center / 10px 10px repeat scroll'
].join(''));
}
};
var onTabsReady = function(tabs) {

Loading…
Cancel
Save