mirror of https://github.com/gorhill/uBlock.git
Work on vendor API abstraction, and near complete Safari support
This commit is contained in:
parent
96c4e2e256
commit
5b79bf3536
|
@ -2,9 +2,9 @@
|
|||
|
||||
1. The **user decides** what web content is acceptable or not in their browser.
|
||||
|
||||
The µBlock project does not support Adblock Plus' _"Acceptable Ads Manifesto"_,
|
||||
because the _"Acceptable Ads"_ marketing campaign is really the business
|
||||
The µBlock project does not support Adblock Plus' _"Acceptable Ads Manifesto"_,
|
||||
because the _"Acceptable Ads"_ marketing campaign is really the business
|
||||
plan of a for-profit entity.
|
||||
|
||||
Users are best placed to know what is or is not acceptable to them. µBlock's
|
||||
Users are best placed to know what is or is not acceptable to them. µBlock's
|
||||
sole purpose is to give users the mean to enforce their own choices.
|
||||
|
|
44
README.md
44
README.md
|
@ -2,10 +2,10 @@
|
|||
|
||||
**Foreword:** Using a blocker is **NOT** [theft](https://twitter.com/LeaVerou/status/518154828166725632). Do not fall for this creepy idea. The _ultimate_ logical consequence of "blocking = theft" is the criminalisation of the inalienable right to privacy.
|
||||
|
||||
See [releases page](https://github.com/gorhill/uBlock/releases) for recent changes.
|
||||
See [releases page](https://github.com/gorhill/uBlock/releases) for recent changes.
|
||||
See [Wiki](https://github.com/gorhill/uBlock/wiki) for more information.
|
||||
|
||||
An efficient blocker for Chromium-based browsers. Fast and lean. Written from scratch. Development
|
||||
An efficient blocker for Chromium-based browsers. Fast and lean. Written from scratch. Development
|
||||
through benchmarking.
|
||||
|
||||
**µBlock is not an "ad blocker", it's a blocker in the broad sense**, which happens to block ads through its support of [Adblock Plus filter syntax](https://adblockplus.org/en/filters). µBlock [extends](https://github.com/gorhill/uBlock/wiki/Filter-syntax-extensions) the syntax.
|
||||
|
@ -25,31 +25,31 @@ My main goal with µBlock is to help users neutralize as much as can be privacy-
|
|||
<p align="center">
|
||||
Chromium on Linux 64-bit<br>
|
||||
<img src="https://raw.githubusercontent.com/gorhill/uBlock/master/doc/img/ss-chromium-2.png" /><br><br>
|
||||
<sup>The screenshots above were taken after visiting links in
|
||||
<a href="https://github.com/gorhill/uBlock/wiki/Reference-benchmark">reference benchmark</a>
|
||||
plus a bit of random browsing. All blockers were active at the same time,
|
||||
thus they had to deal with exactly the same workload. Before the screenshots were
|
||||
taken, I left the browser idle for many minutes so as to let the browser's
|
||||
<sup>The screenshots above were taken after visiting links in
|
||||
<a href="https://github.com/gorhill/uBlock/wiki/Reference-benchmark">reference benchmark</a>
|
||||
plus a bit of random browsing. All blockers were active at the same time,
|
||||
thus they had to deal with exactly the same workload. Before the screenshots were
|
||||
taken, I left the browser idle for many minutes so as to let the browser's
|
||||
garbage collector kicks in. Also, after a while idling, it's good to open the dev
|
||||
console for each extension and force a garbage collection cycle by clicking a couple of times
|
||||
the trashcan icon in the _Timeline_ tab (this caused a ~15MB drop for µBlock and Adguard in Opera)
|
||||
console for each extension and force a garbage collection cycle by clicking a couple of times
|
||||
the trashcan icon in the _Timeline_ tab (this caused a ~15MB drop for µBlock and Adguard in Opera)
|
||||
as garbage collectors sometimes work in a very lazy way, so I did this for each extension.</sup>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Being lean doesn't mean blocking less.<br>
|
||||
<img src="https://raw.githubusercontent.com/gorhill/uBlock/master/doc/benchmarks/privex-201409-30.png" /><br>
|
||||
<sup>For details of benchmark, see latest
|
||||
<sup>For details of benchmark, see latest
|
||||
<a href="https://github.com/gorhill/uBlock/wiki/%C2%B5Block-and-others:-Blocking-ads,-trackers,-malwares">µBlock and others: Blocking ads, trackers, malwares</a>.
|
||||
</p>
|
||||
|
||||
## Installation
|
||||
|
||||
From the [Chrome store](https://chrome.google.com/webstore/detail/µblock/cjpalhdlnbpafiamejdnhcphjbkeiagm),
|
||||
From the [Chrome store](https://chrome.google.com/webstore/detail/µblock/cjpalhdlnbpafiamejdnhcphjbkeiagm),
|
||||
the [Opera store](https://addons.opera.com/en-gb/extensions/details/ublock/), or [manually](https://github.com/gorhill/uBlock/tree/master/dist#install).
|
||||
|
||||
To benefit from the higher efficiency, it is of course not advised to use an
|
||||
inefficient blocker at the same time. µBlock will do as well or better than the
|
||||
To benefit from the higher efficiency, it is of course not advised to use an
|
||||
inefficient blocker at the same time. µBlock will do as well or better than the
|
||||
popular blockers out there.
|
||||
|
||||
Also of interest: [About the required permissions](https://github.com/gorhill/uBlock/wiki/About-the-required-permissions).
|
||||
|
@ -61,8 +61,8 @@ I think it is pretty obvious, except for this I suppose:
|
|||
![Popup](https://raw.githubusercontent.com/gorhill/uBlock/master/doc/img/popup-1.png)  ![Popup](https://raw.githubusercontent.com/gorhill/uBlock/master/doc/img/popup-2.png)
|
||||
|
||||
The big power button is to disable/enable µBlock **for the specific hostname
|
||||
which can be extracted from the URL address of the current page**. (It applies to
|
||||
the current web site only, it is **not** a global power button.) The state of the power
|
||||
which can be extracted from the URL address of the current page**. (It applies to
|
||||
the current web site only, it is **not** a global power button.) The state of the power
|
||||
switch for a specific site will be remembered.
|
||||
|
||||
The right-hand screenshot shows optional [dynamic filtering](https://github.com/gorhill/uBlock/wiki/Dynamic-filtering) at work.
|
||||
|
@ -71,22 +71,22 @@ The right-hand screenshot shows optional [dynamic filtering](https://github.com/
|
|||
|
||||
µBlock is born out of [HTTP Switchboard](https://github.com/gorhill/httpswitchboard).
|
||||
All the niceties of HTTPSB have been removed, and what is left is a straightforward
|
||||
blocker which support EasyList and the likes, and also support host files.
|
||||
blocker which support EasyList and the likes, and also support host files.
|
||||
Cosmetic filters ("element hiding") are supported.
|
||||
|
||||
There is nothing more to it. But it does what popular blockers out there do, at a
|
||||
fraction of CPU and memory usage for the same blocking power. Also, no unique user id
|
||||
fraction of CPU and memory usage for the same blocking power. Also, no unique user id
|
||||
and no home means no phoning home (some popular blockers do this, just be careful).
|
||||
|
||||
Free. Open source. For users by users. No donations sought.
|
||||
|
||||
Without the preset lists of filters, this extension is nothing. So if ever you
|
||||
really do want to contribute something, think about the people working hard
|
||||
to maintain the filter lists you are using, which were made available to use by
|
||||
Without the preset lists of filters, this extension is nothing. So if ever you
|
||||
really do want to contribute something, think about the people working hard
|
||||
to maintain the filter lists you are using, which were made available to use by
|
||||
all for free.
|
||||
|
||||
You may contribute by helping to translate this project. I created an
|
||||
[entry on Crowdin](https://crowdin.net/project/ublock), where you may contribute
|
||||
You may contribute by helping to translate this project. I created an
|
||||
[entry on Crowdin](https://crowdin.net/project/ublock), where you may contribute
|
||||
to the translation work.
|
||||
|
||||
## License
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This script assumes a linux environment
|
||||
|
||||
echo "*** uBlock: Importing from Crowdin archive"
|
||||
rm -r ~/Downloads/crowdin
|
||||
unzip -q ~/Downloads/ublock.zip -d ~/Downloads/crowdin
|
||||
cp ~/Downloads/crowdin/ar/messages.json ./_locales/ar/messages.json
|
||||
cp ~/Downloads/crowdin/cs/messages.json ./_locales/cs/messages.json
|
||||
cp ~/Downloads/crowdin/da/messages.json ./_locales/da/messages.json
|
||||
cp ~/Downloads/crowdin/el/messages.json ./_locales/el/messages.json
|
||||
cp ~/Downloads/crowdin/es-ES/messages.json ./_locales/es/messages.json
|
||||
cp ~/Downloads/crowdin/et/messages.json ./_locales/et/messages.json
|
||||
cp ~/Downloads/crowdin/fi/messages.json ./_locales/fi/messages.json
|
||||
cp ~/Downloads/crowdin/he/messages.json ./_locales/he/messages.json
|
||||
cp ~/Downloads/crowdin/hi/messages.json ./_locales/hi/messages.json
|
||||
cp ~/Downloads/crowdin/hr/messages.json ./_locales/hr/messages.json
|
||||
cp ~/Downloads/crowdin/hu/messages.json ./_locales/hu/messages.json
|
||||
cp ~/Downloads/crowdin/id/messages.json ./_locales/id/messages.json
|
||||
cp ~/Downloads/crowdin/it/messages.json ./_locales/it/messages.json
|
||||
cp ~/Downloads/crowdin/ja/messages.json ./_locales/ja/messages.json
|
||||
cp ~/Downloads/crowdin/mr/messages.json ./_locales/mr/messages.json
|
||||
cp ~/Downloads/crowdin/no/messages.json ./_locales/nb/messages.json
|
||||
cp ~/Downloads/crowdin/nl/messages.json ./_locales/nl/messages.json
|
||||
cp ~/Downloads/crowdin/pl/messages.json ./_locales/pl/messages.json
|
||||
cp ~/Downloads/crowdin/pt-BR/messages.json ./_locales/pt_BR/messages.json
|
||||
cp ~/Downloads/crowdin/pt-PT/messages.json ./_locales/pt_PT/messages.json
|
||||
cp ~/Downloads/crowdin/ro/messages.json ./_locales/ro/messages.json
|
||||
cp ~/Downloads/crowdin/ru/messages.json ./_locales/ru/messages.json
|
||||
cp ~/Downloads/crowdin/sv-SE/messages.json ./_locales/sv/messages.json
|
||||
cp ~/Downloads/crowdin/tr/messages.json ./_locales/tr/messages.json
|
||||
cp ~/Downloads/crowdin/uk/messages.json ./_locales/uk/messages.json
|
||||
cp ~/Downloads/crowdin/vi/messages.json ./_locales/vi/messages.json
|
||||
cp ~/Downloads/crowdin/zh-CN/messages.json ./_locales/zh_CN/messages.json
|
||||
|
||||
#
|
||||
|
||||
cp ~/Downloads/crowdin/ar/description.txt ./dist/description/description-ar.txt
|
||||
cp ~/Downloads/crowdin/cs/description.txt ./dist/description/description-cs.txt
|
||||
cp ~/Downloads/crowdin/da/description.txt ./dist/description/description-da.txt
|
||||
#cp ~/Downloads/crowdin/el/description.txt ./dist/description/description-el.txt
|
||||
cp ~/Downloads/crowdin/es-ES/description.txt ./dist/description/description-es.txt
|
||||
cp ~/Downloads/crowdin/et/description.txt ./dist/description/description-et.txt
|
||||
cp ~/Downloads/crowdin/fi/description.txt ./dist/description/description-fi.txt
|
||||
cp ~/Downloads/crowdin/he/description.txt ./dist/description/description-he.txt
|
||||
cp ~/Downloads/crowdin/hr/description.txt ./dist/description/description-hr.txt
|
||||
cp ~/Downloads/crowdin/hu/description.txt ./dist/description/description-hu.txt
|
||||
cp ~/Downloads/crowdin/id/description.txt ./dist/description/description-id.txt
|
||||
cp ~/Downloads/crowdin/it/description.txt ./dist/description/description-it.txt
|
||||
#cp ~/Downloads/crowdin/ja/description.txt ./dist/description/description-ja.txt
|
||||
cp ~/Downloads/crowdin/no/description.txt ./dist/description/description-no.txt
|
||||
cp ~/Downloads/crowdin/nl/description.txt ./dist/description/description-nl.txt
|
||||
cp ~/Downloads/crowdin/pl/description.txt ./dist/description/description-pl.txt
|
||||
cp ~/Downloads/crowdin/pt-BR/description.txt ./dist/description/description-pt_BR.txt
|
||||
cp ~/Downloads/crowdin/pt-PT/description.txt ./dist/description/description-pt_PT.txt
|
||||
cp ~/Downloads/crowdin/ro/description.txt ./dist/description/description-ro.txt
|
||||
cp ~/Downloads/crowdin/ru/description.txt ./dist/description/description-ru.txt
|
||||
cp ~/Downloads/crowdin/sv-SE/description.txt ./dist/description/description-sv.txt
|
||||
cp ~/Downloads/crowdin/tr/description.txt ./dist/description/description-tr.txt
|
||||
cp ~/Downloads/crowdin/uk/description.txt ./dist/description/description-uk.txt
|
||||
#cp ~/Downloads/crowdin/vi/description.txt ./dist/description/description-vi.txt
|
||||
cp ~/Downloads/crowdin/zh-CN/description.txt ./dist/description/description-zh_CN.txt
|
||||
|
||||
#
|
||||
|
||||
rm -r ~/Downloads/crowdin
|
||||
echo "*** uBlock: Import done."
|
|
@ -1,141 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
µBlock - a Chromium browser extension to block requests.
|
||||
Copyright (C) 2014 Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
// This is the reference client-side implementation of µBlock's messaging
|
||||
// infrastructure. The "server"-side implementation is in messaging.js.
|
||||
|
||||
// The client-side implementation creates a port in order to connect to
|
||||
// µBlock's background page. With this port we can "ask", "tell" or "announce":
|
||||
//
|
||||
// "ask": send a request and expect an answer using a callback.
|
||||
// "tell": send a request with no expectation of an answer.
|
||||
// "announce": send a request to be relayed to all connections -- no answer
|
||||
// expected.
|
||||
//
|
||||
// The tricky part in this implementation is to ensure all the requests are
|
||||
// uniquely identified, so that the background-page can keep track of these
|
||||
// until it is ready to send back an answer, which will be tagged with the
|
||||
// same id. The uniqueness must be true for all ports which connect to the
|
||||
// background page at any given time.
|
||||
//
|
||||
// Currently using Math.random() to generate this id... I don't know about the
|
||||
// implementation of Math.random(), but as long as I have a good expectation
|
||||
// of uniqueness, it's ok, we are not dealing with critical stuff here.
|
||||
|
||||
/* global chrome */
|
||||
|
||||
var messaging = (function(name){
|
||||
var port = null;
|
||||
var requestId = 1;
|
||||
var requestIdToCallbackMap = {};
|
||||
var listenCallback = null;
|
||||
|
||||
var onPortMessage = function(details) {
|
||||
if ( typeof details.id !== 'number' ) {
|
||||
return;
|
||||
}
|
||||
// Announcement?
|
||||
if ( details.id < 0 ) {
|
||||
if ( listenCallback ) {
|
||||
listenCallback(details.msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var callback = requestIdToCallbackMap[details.id];
|
||||
if ( !callback ) {
|
||||
return;
|
||||
}
|
||||
// Must be removed before calling client to be sure to not execute
|
||||
// callback again if the client stops the messaging service.
|
||||
delete requestIdToCallbackMap[details.id];
|
||||
callback(details.msg);
|
||||
};
|
||||
|
||||
var start = function(name) {
|
||||
port = chrome.runtime.connect({ name: name });
|
||||
port.onMessage.addListener(onPortMessage);
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/193
|
||||
port.onDisconnect.addListener(stop);
|
||||
};
|
||||
|
||||
var stop = function() {
|
||||
listenCallback = null;
|
||||
port.disconnect();
|
||||
port = null;
|
||||
flushCallbacks();
|
||||
};
|
||||
|
||||
if ( typeof name === 'string' && name !== '' ) {
|
||||
start(name);
|
||||
}
|
||||
|
||||
var ask = function(msg, callback) {
|
||||
if ( port === null ) {
|
||||
if ( typeof callback === 'function' ) {
|
||||
callback();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( callback === undefined ) {
|
||||
tell(msg);
|
||||
return;
|
||||
}
|
||||
var id = requestId++;
|
||||
port.postMessage({ id: id, msg: msg });
|
||||
requestIdToCallbackMap[id] = callback;
|
||||
};
|
||||
|
||||
var tell = function(msg) {
|
||||
if ( port !== null ) {
|
||||
port.postMessage({ id: 0, msg: msg });
|
||||
}
|
||||
};
|
||||
|
||||
var listen = function(callback) {
|
||||
listenCallback = callback;
|
||||
};
|
||||
|
||||
var flushCallbacks = function() {
|
||||
var callback;
|
||||
for ( var id in requestIdToCallbackMap ) {
|
||||
if ( requestIdToCallbackMap.hasOwnProperty(id) === false ) {
|
||||
continue;
|
||||
}
|
||||
callback = requestIdToCallbackMap[id];
|
||||
if ( !callback ) {
|
||||
continue;
|
||||
}
|
||||
// Must be removed before calling client to be sure to not execute
|
||||
// callback again if the client stops the messaging service.
|
||||
delete requestIdToCallbackMap[id];
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
start: start,
|
||||
stop: stop,
|
||||
ask: ask,
|
||||
tell: tell,
|
||||
listen: listen
|
||||
};
|
||||
})();
|
252
js/messaging.js
252
js/messaging.js
|
@ -1,252 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
µBlock - a Chromium browser extension to block requests.
|
||||
Copyright (C) 2014 Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
/* global chrome, µBlock */
|
||||
|
||||
// So there might be memory leaks related to the direct use of sendMessage(),
|
||||
// as per https://code.google.com/p/chromium/issues/detail?id=320723. The issue
|
||||
// is not marked as resolved, and the last message from chromium dev is:
|
||||
//
|
||||
// "You can construct Port objects (runtime.connect) and emulate sendMessage
|
||||
// "behaviour. The bug is that sendMessage doesn't clean up its Ports."
|
||||
//
|
||||
// So the point here is to have an infrastructure which allows relying more on
|
||||
// direct use of Port objects rather than going through sendMessage().
|
||||
|
||||
/******************************************************************************/
|
||||
/*******************************************************************************
|
||||
|
||||
// Here this is the "server"-side implementation.
|
||||
//
|
||||
// Reference client-side implementation is found in:
|
||||
//
|
||||
// messaging-client.js
|
||||
//
|
||||
// For instance, it needs to be cut & pasted for content scripts since
|
||||
// I can not include in a simple way js file content from another js file.
|
||||
|
||||
*******************************************************************************/
|
||||
/******************************************************************************/
|
||||
|
||||
µBlock.messaging = (function() {
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var runtimeIdGenerator = 1;
|
||||
var nameToPortMap = {};
|
||||
var nameToListenerMap = {};
|
||||
var nullFunc = function(){};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var listenerNameFromPortName = function(portName) {
|
||||
var pos = portName.indexOf('/');
|
||||
if ( pos === -1 ) {
|
||||
return '';
|
||||
}
|
||||
return portName.slice(0, pos);
|
||||
};
|
||||
|
||||
var listenerFromPortName = function(portName) {
|
||||
return nameToListenerMap[listenerNameFromPortName(portName)];
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var listen = function(portName, callback) {
|
||||
var listener = nameToListenerMap[portName];
|
||||
if ( listener && listener !== callback ) {
|
||||
throw 'Only one listener allowed';
|
||||
}
|
||||
nameToListenerMap[portName] = callback;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var tell = function(target, msg) {
|
||||
target += '/';
|
||||
for ( var portName in nameToPortMap ) {
|
||||
if ( nameToPortMap.hasOwnProperty(portName) === false ) {
|
||||
continue;
|
||||
}
|
||||
if ( portName.indexOf(target) === 0 ) {
|
||||
nameToPortMap[portName].postMessage({ id: -1, msg: msg });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var announce = function(msg) {
|
||||
// Background page handler
|
||||
defaultHandler(msg, null, nullFunc);
|
||||
|
||||
// Extension pages & content scripts handlers
|
||||
for ( var portName in nameToPortMap ) {
|
||||
if ( nameToPortMap.hasOwnProperty(portName) === false ) {
|
||||
continue;
|
||||
}
|
||||
nameToPortMap[portName].postMessage({ id: -1, msg: msg });
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var onMessage = function(request, port) {
|
||||
var reqId = request.id;
|
||||
// Annoucement: dispatch everywhere.
|
||||
if ( reqId < 0 ) {
|
||||
announce(request.msg);
|
||||
return;
|
||||
}
|
||||
var listener = listenerFromPortName(port.name) || defaultHandler;
|
||||
// Being told
|
||||
if ( reqId === 0 ) {
|
||||
listener(request.msg, port.sender, nullFunc);
|
||||
return;
|
||||
}
|
||||
// Being asked
|
||||
listener(request.msg, port.sender, function(response) {
|
||||
port.postMessage({
|
||||
id: reqId,
|
||||
msg: response !== undefined ? response : null
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Default is for commonly used messages.
|
||||
|
||||
function defaultHandler(request, sender, callback) {
|
||||
var µb = µBlock;
|
||||
|
||||
// Async
|
||||
switch ( request.what ) {
|
||||
case 'getAssetContent':
|
||||
return µb.assets.getLocal(request.url, callback);
|
||||
|
||||
case 'loadUbiquitousAllowRules':
|
||||
return µb.loadUbiquitousWhitelists();
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Sync
|
||||
var response;
|
||||
|
||||
switch ( request.what ) {
|
||||
case 'contextMenuEvent':
|
||||
µb.contextMenuClientX = request.clientX;
|
||||
µb.contextMenuClientY = request.clientY;
|
||||
break;
|
||||
|
||||
case 'forceReloadTab':
|
||||
µb.forceReload(request.pageURL);
|
||||
break;
|
||||
|
||||
case 'getUserSettings':
|
||||
response = µb.userSettings;
|
||||
break;
|
||||
|
||||
case 'gotoExtensionURL':
|
||||
µb.utils.gotoExtensionURL(request.url);
|
||||
break;
|
||||
|
||||
case 'gotoURL':
|
||||
µb.utils.gotoURL(request);
|
||||
break;
|
||||
|
||||
case 'reloadAllFilters':
|
||||
µb.reloadPresetBlacklists(request.switches, request.update);
|
||||
break;
|
||||
|
||||
case 'userSettings':
|
||||
response = µb.changeUserSettings(request.name, request.value);
|
||||
break;
|
||||
|
||||
default:
|
||||
// console.error('µBlock> messaging.js / defaultHandler > unknown request: %o', request);
|
||||
break;
|
||||
}
|
||||
|
||||
callback(response);
|
||||
}
|
||||
|
||||
// https://www.youtube.com/watch?v=rrzRgUAHqc8
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Port disconnected, relay this information to apropriate listener.
|
||||
|
||||
var onDisconnect = function(port) {
|
||||
// Notify listener of the disconnection -- using a reserved message id.
|
||||
var listener = listenerFromPortName(port.name) || defaultHandler;
|
||||
var msg = {
|
||||
'what': 'disconnected',
|
||||
'which': listenerNameFromPortName(port.name)
|
||||
};
|
||||
listener(msg, port.sender, nullFunc);
|
||||
|
||||
// Cleanup port if no longer in use.
|
||||
if ( nameToPortMap.hasOwnProperty(port.name) ) {
|
||||
delete nameToPortMap[port.name];
|
||||
port.onMessage.removeListener(onMessage);
|
||||
port.onDisconnect.removeListener(onDisconnect);
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var onConnect = function(port) {
|
||||
// We must have a port name.
|
||||
if ( typeof port.name !== 'string' || port.name === '' ) {
|
||||
console.error('µBlock> messaging.js / onConnectHandler(): no port name!');
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure port name is unique
|
||||
port.name += '/' + runtimeIdGenerator++;
|
||||
|
||||
nameToPortMap[port.name] = port;
|
||||
port.onMessage.addListener(onMessage);
|
||||
port.onDisconnect.addListener(onDisconnect);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
chrome.runtime.onConnect.addListener(onConnect);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
return {
|
||||
listen: listen,
|
||||
tell: tell,
|
||||
announce: announce,
|
||||
defaultHandler: defaultHandler
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
})();
|
||||
|
||||
/******************************************************************************/
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This script assumes a linux environment
|
||||
|
||||
echo "*** uBlock: Creating web store package"
|
||||
echo "*** uBlock: Copying files"
|
||||
cp -R assets dist/ublock/
|
||||
rm dist/ublock/assets/*.sh
|
||||
cp -R css dist/ublock/
|
||||
cp -R img dist/ublock/
|
||||
cp -R js dist/ublock/
|
||||
cp -R lib dist/ublock/
|
||||
cp -R _locales dist/ublock/
|
||||
cp *.html dist/ublock/
|
||||
cp *.txt dist/ublock/
|
||||
cp manifest.json dist/ublock/
|
||||
echo "*** uBlock: Package done."
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This script assumes a linux environment
|
||||
|
||||
echo "*** uBlock: Creating web store package"
|
||||
echo "*** uBlock: Copying files"
|
||||
cp -R css dist/ublock/
|
||||
cp -R img dist/ublock/
|
||||
cp -R js dist/ublock/
|
||||
cp -R lib dist/ublock/
|
||||
cp -R _locales dist/ublock/
|
||||
cp *.html dist/ublock/
|
||||
cp *.txt dist/ublock/
|
||||
cp manifest.json dist/ublock/
|
||||
echo "*** uBlock: Package done."
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "µBlock",
|
||||
"clean_name": "ublock",
|
||||
"url": "https://github.com/gorhill/uBlock",
|
||||
"author": "Raymond Hill",
|
||||
"author_email": "rhill@raymondhill.net",
|
||||
"author_www": "http://raymondhill.net/",
|
||||
"version": "0.7.0.7",
|
||||
"def_lang": "en",
|
||||
"vendors": {
|
||||
"crx": {
|
||||
"app_id": "cjpalhdlnbpafiamejdnhcphjbkeiagm",
|
||||
"manifest": "manifest.json",
|
||||
"locales": "_locales",
|
||||
"file_ext": ".crx",
|
||||
"cert_key": "../meta/crx/key.pem"
|
||||
},
|
||||
"safariextz": {
|
||||
"app_id": "net.gorhill.uBlock",
|
||||
"dir": "uBlock.safariextension",
|
||||
"manifest": {
|
||||
"Info": "Info.plist",
|
||||
"Settings": "Settings.plist"
|
||||
},
|
||||
"file_ext": ".safariextz",
|
||||
"developer_identifier": "T7HSFKB9M5",
|
||||
"cert_dir": "../meta/safariextz/certs/",
|
||||
"cert_key": "../meta/safariextz/certs/key.pem"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"minimum_chrome_version": "22.0",
|
||||
"default_locale": "{def_lang}",
|
||||
"update_url": "https://clients2.google.com/service/update2/crx",
|
||||
|
||||
"version": "{version}",
|
||||
"name": "__MSG_extName__",
|
||||
"description": "__MSG_extShortDesc__",
|
||||
"homepage_url": "{url}",
|
||||
"author": "{author}",
|
||||
"developer": {
|
||||
"name": "{author}",
|
||||
"email": "{author_email}"
|
||||
},
|
||||
|
||||
"icons": {
|
||||
"16": "img/icon_16.png",
|
||||
"128": "img/icon_128.png"
|
||||
},
|
||||
|
||||
"permissions": [
|
||||
"contextMenus",
|
||||
"downloads",
|
||||
"storage",
|
||||
"tabs",
|
||||
"unlimitedStorage",
|
||||
"webNavigation",
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"http://*/*",
|
||||
"https://*/*"
|
||||
],
|
||||
|
||||
"background": {
|
||||
"page": "background.html"
|
||||
},
|
||||
"options_page": "dashboard.html",
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["http://*/*", "https://*/*"],
|
||||
"js": ["js/vapi-client.js", "js/contentscript-start.js"],
|
||||
"run_at": "document_start",
|
||||
"all_frames": true
|
||||
},
|
||||
{
|
||||
"matches": ["http://*/*", "https://*/*"],
|
||||
"js": ["js/contentscript-end.js"],
|
||||
"run_at": "document_end",
|
||||
"all_frames": true
|
||||
}
|
||||
],
|
||||
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"19": "img/browsericons/icon19-off.png",
|
||||
"38": "img/browsericons/icon38-off.png"
|
||||
},
|
||||
"default_title": "{name}",
|
||||
"default_popup": "popup.html"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gupdate xmlns="http://www.google.com/update2/response" protocol="2.0">
|
||||
<app appid="{app_id}">
|
||||
<updatecheck codebase="{url}{name}.crx" version="{version}"/>
|
||||
</app>
|
||||
</gupdate>
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Author</key>
|
||||
<string>{author}</string>
|
||||
<key>Builder Version</key>
|
||||
<string>534.57.2</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>{name}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>{app_id}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>{version}</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{build_number}</string>
|
||||
<key>Chrome</key>
|
||||
<dict>
|
||||
<key>Database Quota</key>
|
||||
<real>52428800</real>
|
||||
<key>Global Page</key>
|
||||
<string>background.html</string>
|
||||
<key>Popovers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>popover</string>
|
||||
<key>Filename</key>
|
||||
<string>popup.html</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Toolbar Items</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>toolbarItem</string>
|
||||
<key>Image</key>
|
||||
<string>img/icon_16.png</string>
|
||||
<key>Label</key>
|
||||
<string>{name}</string>
|
||||
<key>Popover</key>
|
||||
<string>popover</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Content</key>
|
||||
<dict>
|
||||
<key>Scripts</key>
|
||||
<dict>
|
||||
<key>Start</key>
|
||||
<array>
|
||||
<string>js/vapi-client.js</string>
|
||||
<string>js/contentscript-start.js</string>
|
||||
</array>
|
||||
<key>End</key>
|
||||
<array>
|
||||
<string>js/contentscript-end.js</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Whitelist</key>
|
||||
<array>
|
||||
<string>http://*/*</string>
|
||||
<string>https://*/*</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Description</key>
|
||||
<string>{description}</string>
|
||||
<key>ExtensionInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>Permissions</key>
|
||||
<dict>
|
||||
<key>Website Access</key>
|
||||
<dict>
|
||||
<key>Include Secure Pages</key>
|
||||
<true/>
|
||||
<key>Level</key>
|
||||
<string>All</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<!-- <key>Update Manifest URL</key>
|
||||
<string>{url}update_safariextz.plist</string> -->
|
||||
<key>Website</key>
|
||||
<string>{url}</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Extension Updates</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>{app_id}</string>
|
||||
<key>Developer Identifier</key>
|
||||
<string>{developer_identifier}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>{version}</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{build_number}</string>
|
||||
<key>URL</key>
|
||||
<string>{url}{name}.safariextz</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -18,11 +18,14 @@
|
|||
<p><button id="userFiltersApply" disabled="true" data-i18n="1pApplyChanges"></button></p>
|
||||
</div>
|
||||
|
||||
<script src="js/udom.js"></script>
|
||||
<script src="js/i18n.js"></script>
|
||||
<script src="js/dashboard-common.js"></script>
|
||||
<script src="js/messaging-client.js"></script>
|
||||
<script src="js/1p-filters.js"></script>
|
||||
<script src="js/js-loader.js" data-jsList="
|
||||
js/vapi-common.js
|
||||
js/vapi-client.js
|
||||
js/udom.js
|
||||
js/i18n.js
|
||||
js/dashboard-common.js
|
||||
js/1p-filters.js
|
||||
"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>HTTP Switchboard — Ubiquitous rules</title>
|
||||
<title>µBlock — Ubiquitous rules</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/common.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/dashboard-common.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/3p-filters.css">
|
||||
|
@ -31,11 +31,16 @@
|
|||
|
||||
<div id="busyOverlay"></div>
|
||||
|
||||
<script src="js/udom.js"></script>
|
||||
<script src="js/i18n.js"></script>
|
||||
<script src="js/dashboard-common.js"></script>
|
||||
<script src="js/messaging-client.js"></script>
|
||||
<script src="js/3p-filters.js"></script>
|
||||
<script src="js/js-loader.js" data-jsList="
|
||||
lib/publicsuffixlist.min.js
|
||||
js/vapi-common.js
|
||||
js/vapi-client.js
|
||||
js/udom.js
|
||||
js/i18n.js
|
||||
js/uritools.js
|
||||
js/dashboard-common.js
|
||||
js/3p-filters.js
|
||||
"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Author</key>
|
||||
<string>Raymond Hill</string>
|
||||
<key>Builder Version</key>
|
||||
<string>534.57.2</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>µBlock</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.gorhill.uBlock</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.7.0.7</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1452035</string>
|
||||
<key>Chrome</key>
|
||||
<dict>
|
||||
<key>Database Quota</key>
|
||||
<real>52428800</real>
|
||||
<key>Global Page</key>
|
||||
<string>background.html</string>
|
||||
<key>Popovers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>popover</string>
|
||||
<key>Filename</key>
|
||||
<string>popup.html</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Toolbar Items</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>toolbarItem</string>
|
||||
<key>Image</key>
|
||||
<string>img/icon_16.png</string>
|
||||
<key>Label</key>
|
||||
<string>µBlock</string>
|
||||
<key>Popover</key>
|
||||
<string>popover</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Content</key>
|
||||
<dict>
|
||||
<key>Scripts</key>
|
||||
<dict>
|
||||
<key>Start</key>
|
||||
<array>
|
||||
<string>js/vapi-client.js</string>
|
||||
<string>js/contentscript-start.js</string>
|
||||
</array>
|
||||
<key>End</key>
|
||||
<array>
|
||||
<string>js/contentscript-end.js</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Whitelist</key>
|
||||
<array>
|
||||
<string>http://*/*</string>
|
||||
<string>https://*/*</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Description</key>
|
||||
<string>Finally, an efficient blocker for Chromium-based browsers. Easy on CPU and memory.</string>
|
||||
<key>ExtensionInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>Permissions</key>
|
||||
<dict>
|
||||
<key>Website Access</key>
|
||||
<dict>
|
||||
<key>Include Secure Pages</key>
|
||||
<true/>
|
||||
<key>Level</key>
|
||||
<string>All</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<!-- <key>Update Manifest URL</key>
|
||||
<string>https://github.com/gorhill/uBlockupdate_safariextz.plist</string> -->
|
||||
<key>Website</key>
|
||||
<string>https://github.com/gorhill/uBlock</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -13,7 +13,7 @@
|
|||
<h2>µBlock <span id="aboutVersion"></span></h2>
|
||||
<ul>
|
||||
<li><a href="https://github.com/gorhill/uBlock/releases" data-i18n="aboutChangelog"></a>
|
||||
<li><a href="https://github.com/gorhill/ublock" data-i18n="aboutCode"></a>
|
||||
<li><a href="https://github.com/gorhill/uBlock" data-i18n="aboutCode"></a>
|
||||
<li><span data-i18n="aboutContributors"></span>
|
||||
<ul>
|
||||
<li><a href="https://github.com/gorhill/uBlock/graphs/contributors">Github</a>
|
||||
|
@ -31,11 +31,14 @@
|
|||
<p><button type="button" id="reset" data-i18n="aboutResetDataButton">Start from scratch...</button>
|
||||
</div>
|
||||
|
||||
<script src="js/udom.js"></script>
|
||||
<script src="js/i18n.js"></script>
|
||||
<script src="js/dashboard-common.js"></script>
|
||||
<script src="js/messaging-client.js"></script>
|
||||
<script src="js/about.js"></script>
|
||||
<script src="js/js-loader.js" data-jsList="
|
||||
js/vapi-common.js
|
||||
js/vapi-client.js
|
||||
js/udom.js
|
||||
js/i18n.js
|
||||
js/dashboard-common.js
|
||||
js/about.js
|
||||
"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -12,8 +12,12 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script src="js/udom.js"></script>
|
||||
<script src="js/messaging-client.js"></script>
|
||||
<script src="js/asset-viewer.js"></script>
|
||||
|
||||
<script src="js/js-loader.js" data-jsList="
|
||||
js/udom.js
|
||||
js/vapi-client.js
|
||||
js/asset-viewer.js
|
||||
"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue