mirror of https://github.com/gorhill/uBlock.git
code review
This commit is contained in:
parent
9406e40fdc
commit
34485a0465
|
@ -1,42 +1,44 @@
|
|||
#uBlock-legacy-button {
|
||||
list-style-image: url('../img/browsericons/icon-large.svg');
|
||||
#uBlock0-legacy-button {
|
||||
list-style-image: url('../img/browsericons/icon-large.svg');
|
||||
}
|
||||
#uBlock-legacy-button.off {
|
||||
list-style-image: url('../img/browsericons/icon-large-off.svg');
|
||||
#uBlock0-legacy-button.off {
|
||||
list-style-image: url('../img/browsericons/icon-large-off.svg');
|
||||
}
|
||||
|
||||
toolbar[iconsize="small"] #uBlock-legacy-button {
|
||||
list-style-image: url('../img/browsericons/icon16.svg');
|
||||
toolbar[iconsize="small"] #uBlock0-legacy-button {
|
||||
list-style-image: url('../img/browsericons/icon16.svg');
|
||||
}
|
||||
toolbar[iconsize="small"] #uBlock-legacy-button.off {
|
||||
list-style-image: url('../img/browsericons/icon16-off.svg');
|
||||
toolbar[iconsize="small"] #uBlock0-legacy-button.off {
|
||||
list-style-image: url('../img/browsericons/icon16-off.svg');
|
||||
}
|
||||
#uBlock-legacy-button[badge]::before {
|
||||
position: fixed;
|
||||
margin-top: -2px;
|
||||
padding: 1px 2px;
|
||||
font-size: 9px;
|
||||
font-weight: bold;
|
||||
#uBlock0-legacy-button[badge]::before {
|
||||
background: #555;
|
||||
color: #fff;
|
||||
background: #666;
|
||||
content: attr(badge);
|
||||
font: bold 10px sans-serif;
|
||||
margin-top: -2px;
|
||||
padding: 0 2px;
|
||||
position: fixed;
|
||||
}
|
||||
/* This hack required because if the before content changes it de-pops the popup (without firing any events). So just hide it instead. Note, can't actually *hide* it, or the same thing happens. '*/
|
||||
#uBlock-legacy-button[badge=""]::before {
|
||||
padding: 0;
|
||||
/* This hack required because if the before content changes it de-pops the
|
||||
popup (without firing any events). So just hide it instead. Note, can't
|
||||
actually *hide* it, or the same thing happens.
|
||||
**/
|
||||
#uBlock0-legacy-button[badge=""]::before {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Override off state when in palette */
|
||||
toolbarpaletteitem #uBlock-legacy-button.off {
|
||||
list-style-image: url('../img/browsericons/icon-large.svg');
|
||||
toolbarpaletteitem #uBlock0-legacy-button.off {
|
||||
list-style-image: url('../img/browsericons/icon-large.svg');
|
||||
}
|
||||
|
||||
/* Override badge when in palette */
|
||||
toolbarpaletteitem #uBlock-legacy-button[badge]::before {
|
||||
content: none;
|
||||
toolbarpaletteitem #uBlock0-legacy-button[badge]::before {
|
||||
content: none;
|
||||
}
|
||||
|
||||
/* Prevent pale moon from showing the arrow underneath the button */
|
||||
#uBlock-legacy-button .toolbarbutton-menu-dropmarker {
|
||||
-moz-box-orient: horizontal;
|
||||
#uBlock0-legacy-button .toolbarbutton-menu-dropmarker {
|
||||
-moz-box-orient: horizontal;
|
||||
}
|
|
@ -331,17 +331,6 @@ const contentObserver = {
|
|||
let docReady = (e) => {
|
||||
let doc = e.target;
|
||||
doc.removeEventListener(e.type, docReady, true);
|
||||
|
||||
if (doc.docShell) {
|
||||
// It is possible, in some cases (#1140) for document-element-inserted to occur *before* nsIWebProgressListener.onLocationChange, so ensure that the URL is correct before continuing
|
||||
let messageManager = doc.docShell.getInterface(Ci.nsIContentFrameMessageManager);
|
||||
|
||||
messageManager.sendSyncMessage(locationChangedMessageName, {
|
||||
url: loc.href,
|
||||
noRefresh: true, // If the URL is the same, then don't refresh it so that if this occurs after onLocationChange, no the block count isn't reset
|
||||
});
|
||||
}
|
||||
|
||||
lss(this.contentBaseURI + 'contentscript-end.js', sandbox);
|
||||
|
||||
if ( doc.querySelector('a[href^="abp:"]') ) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -38,8 +38,8 @@ vAPI.sessionId = String.fromCharCode(Date.now() % 26 + 97) +
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.setTimeout = vAPI.setTimeout || function(callback, delay, args) {
|
||||
return setTimeout(function(args) { callback(args); }, delay, args);
|
||||
vAPI.setTimeout = vAPI.setTimeout || function(callback, delay, extra) {
|
||||
return setTimeout(function(a) { callback(a); }, delay, extra);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -40,8 +40,8 @@ var vAPI = self.vAPI = self.vAPI || {};
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.setTimeout = vAPI.setTimeout || function(callback, delay, args) {
|
||||
return setTimeout(function(args) { callback(args); }, delay, args);
|
||||
vAPI.setTimeout = vAPI.setTimeout || function(callback, delay, extra) {
|
||||
return setTimeout(function(a) { callback(a); }, delay, extra);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -125,14 +125,19 @@ vAPI.closePopup = function() {
|
|||
// background page or auxiliary pages.
|
||||
// This storage is optional, but it is nice to have, for a more polished user
|
||||
// experience.
|
||||
const branchName = 'extensions.' + location.host + '.';
|
||||
|
||||
vAPI.localStorage = {
|
||||
PB: Services.prefs.getBranch(branchName),
|
||||
pbName: '',
|
||||
pb: null,
|
||||
str: Components.classes['@mozilla.org/supports-string;1']
|
||||
.createInstance(Components.interfaces.nsISupportsString),
|
||||
.createInstance(Components.interfaces.nsISupportsString),
|
||||
init: function(pbName) {
|
||||
this.pbName = pbName;
|
||||
this.pb = Services.prefs.getBranch(pbName);
|
||||
},
|
||||
getItem: function(key) {
|
||||
try {
|
||||
return this.PB.getComplexValue(
|
||||
return this.pb.getComplexValue(
|
||||
key,
|
||||
Components.interfaces.nsISupportsString
|
||||
).data;
|
||||
|
@ -142,7 +147,7 @@ vAPI.localStorage = {
|
|||
},
|
||||
setItem: function(key, value) {
|
||||
this.str.data = value;
|
||||
this.PB.setComplexValue(
|
||||
this.pb.setComplexValue(
|
||||
key,
|
||||
Components.interfaces.nsISupportsString,
|
||||
this.str
|
||||
|
@ -150,25 +155,27 @@ vAPI.localStorage = {
|
|||
},
|
||||
getBool: function(key) {
|
||||
try {
|
||||
return this.PB.getBoolPref(key);
|
||||
return this.pb.getBoolPref(key);
|
||||
} catch (ex) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
setBool: function(key, value) {
|
||||
this.PB.setBoolPref(key, value);
|
||||
this.pb.setBoolPref(key, value);
|
||||
},
|
||||
setDefaultBool: function(key, defaultValue) {
|
||||
Services.prefs.getDefaultBranch(branchName).setBoolPref(key, defaultValue);
|
||||
Services.prefs.getDefaultBranch(this.pbName).setBoolPref(key, defaultValue);
|
||||
},
|
||||
removeItem: function(key) {
|
||||
this.PB.clearUserPref(key);
|
||||
this.pb.clearUserPref(key);
|
||||
},
|
||||
clear: function() {
|
||||
this.PB.deleteBranch('');
|
||||
this.pb.deleteBranch('');
|
||||
}
|
||||
};
|
||||
|
||||
vAPI.localStorage.init('extensions.' + location.host + '.');
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
})();
|
||||
|
|
|
@ -952,6 +952,9 @@ var startPicker = function(details) {
|
|||
showDialog({ modifier: true });
|
||||
return;
|
||||
}
|
||||
|
||||
// A target was specified, but it wasn't found: abort.
|
||||
stopPicker();
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -17,6 +17,7 @@ cp -R src/lib $DES/
|
|||
cp -R src/_locales $DES/
|
||||
cp src/*.html $DES/
|
||||
mv $DES/img/icon_128.png $DES/icon.png
|
||||
cp platform/firefox/css/* $DES/css/
|
||||
cp platform/firefox/vapi-*.js $DES/js/
|
||||
cp platform/firefox/bootstrap.js $DES/
|
||||
cp platform/firefox/frame*.js $DES/
|
||||
|
|
Loading…
Reference in New Issue