gorhill 10 years ago
parent
commit
3fe5d48c05
  1. 20
      src/js/contentscript-end.js
  2. 3
      src/js/messaging.js
  3. 43
      src/js/start.js

20
src/js/contentscript-end.js

@ -153,24 +153,6 @@ var collapser = (function() {
var newRequests = []; var newRequests = [];
var pendingRequests = {}; var pendingRequests = {};
var pendingRequestCount = 0; 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 = { var srcProps = {
'iframe': 'src', 'iframe': 'src',
'img': 'src' 'img': 'src'
@ -205,7 +187,7 @@ var collapser = (function() {
return; return;
} }
var collapse = response.collapse; var collapse = response.collapse;
var bgImg = backgroundImage;
var bgImg = response.backgroundImage;
var i = requests.length; var i = requests.length;
var request, entry, target, tagName; var request, entry, target, tagName;
while ( i-- ) { while ( i-- ) {

3
src/js/messaging.js

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

43
src/js/start.js

@ -44,17 +44,8 @@ var µm = µMatrix;
/******************************************************************************/ /******************************************************************************/
var onAllDone = function() {
µm.webRequest.start();
// https://github.com/chrisaljoudi/uBlock/issues/184
// Check for updates not too far in the future.
µm.assetUpdater.onStart.addListener(µm.updateStartHandler.bind(µm));
µm.assetUpdater.onCompleted.addListener(µm.updateCompleteHandler.bind(µm));
µm.assetUpdater.onAssetUpdated.addListener(µm.assetUpdatedHandler.bind(µm));
µm.assets.onAssetCacheRemoved.addListener(µm.assetCacheRemovedHandler.bind(µm));
// Browser data jobs // Browser data jobs
var jobCallback = function() { var jobCallback = function() {
if ( !µm.userSettings.clearBrowserCache ) { if ( !µm.userSettings.clearBrowserCache ) {
return; return;
@ -69,11 +60,43 @@ var onAllDone = function() {
// console.debug('clearBrowserCacheCallback()> vAPI.browserCache.clearByTime() called'); // console.debug('clearBrowserCacheCallback()> vAPI.browserCache.clearByTime() called');
}; };
/******************************************************************************/
var onAllDone = function() {
µm.webRequest.start();
// https://github.com/chrisaljoudi/uBlock/issues/184
// Check for updates not too far in the future.
µm.assetUpdater.onStart.addListener(µm.updateStartHandler.bind(µm));
µm.assetUpdater.onCompleted.addListener(µm.updateCompleteHandler.bind(µm));
µm.assetUpdater.onAssetUpdated.addListener(µm.assetUpdatedHandler.bind(µm));
µm.assets.onAssetCacheRemoved.addListener(µm.assetCacheRemovedHandler.bind(µm));
µMatrix.asyncJobs.add('clearBrowserCache', null, jobCallback, 15 * 60 * 1000, true); µMatrix.asyncJobs.add('clearBrowserCache', null, jobCallback, 15 * 60 * 1000, true);
// Important: remove barrier to remote fetching, this was useful only // Important: remove barrier to remote fetching, this was useful only
// for launch time. // for launch time.
µm.assets.remoteFetchBarrier -= 1; µ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) { var onTabsReady = function(tabs) {

Loading…
Cancel
Save