mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-21 05:16:39 +02:00
commit
0fe69618e3
13 changed files with 260 additions and 231 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
|||
*.bak
|
||||
*.pem
|
||||
/meta/safariextz/certs/
|
||||
/dist/build/
|
|
@ -1,91 +0,0 @@
|
|||
<?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.10</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1456132</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>Filename</key>
|
||||
<string>popup.html</string>
|
||||
<key>Height</key>
|
||||
<real>310</real>
|
||||
<key>Identifier</key>
|
||||
<string>popover</string>
|
||||
<key>Width</key>
|
||||
<real>180</real>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Toolbar Items</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>toolbarItem</string>
|
||||
<key>Image</key>
|
||||
<string>img/icon16.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>End</key>
|
||||
<array>
|
||||
<string>js/contentscript-end.js</string>
|
||||
</array>
|
||||
<key>Start</key>
|
||||
<array>
|
||||
<string>js/vapi-client.js</string>
|
||||
<string>js/contentscript-start.js</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Whitelist</key>
|
||||
<array>
|
||||
<string>http://*/*</string>
|
||||
<string>https://*/*</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Description</key>
|
||||
<string>Finally, an efficient blocker. 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>
|
|
@ -1,22 +0,0 @@
|
|||
<?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">
|
||||
<array>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
<key>FalseValue</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>open_prefs</string>
|
||||
<key>Secure</key>
|
||||
<false/>
|
||||
<key>Title</key>
|
||||
<string>Click to see the Preferences</string>
|
||||
<key>TrueValue</key>
|
||||
<true/>
|
||||
<key>Type</key>
|
||||
<string>CheckBox</string>
|
||||
</dict>
|
||||
</array>
|
||||
</plist>
|
91
platform/safari/Info.plist
Normal file
91
platform/safari/Info.plist
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?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.2.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</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>Filename</key>
|
||||
<string>popup.html</string>
|
||||
<key>Height</key>
|
||||
<real>310</real>
|
||||
<key>Identifier</key>
|
||||
<string>popover</string>
|
||||
<key>Width</key>
|
||||
<real>180</real>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Toolbar Items</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>toolbarItem</string>
|
||||
<key>Image</key>
|
||||
<string>img/icon16.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>End</key>
|
||||
<array>
|
||||
<string>js/contentscript-end.js</string>
|
||||
</array>
|
||||
<key>Start</key>
|
||||
<array>
|
||||
<string>js/vapi-client.js</string>
|
||||
<string>js/contentscript-start.js</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Whitelist</key>
|
||||
<array>
|
||||
<string>http://*/*</string>
|
||||
<string>https://*/*</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Description</key>
|
||||
<string>Finally, an efficient blocker. 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>
|
22
platform/safari/Settings.plist
Normal file
22
platform/safari/Settings.plist
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?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">
|
||||
<array>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
<key>FalseValue</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>open_prefs</string>
|
||||
<key>Secure</key>
|
||||
<false/>
|
||||
<key>Title</key>
|
||||
<string>Click to see the Preferences</string>
|
||||
<key>TrueValue</key>
|
||||
<true/>
|
||||
<key>Type</key>
|
||||
<string>CheckBox</string>
|
||||
</dict>
|
||||
</array>
|
||||
</plist>
|
|
@ -10,9 +10,9 @@
|
|||
<key>Developer Identifier</key>
|
||||
<string></string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.7.0.10</string>
|
||||
<string>0.7.0.11</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1456132</string>
|
||||
<string>1</string>
|
||||
<key>URL</key>
|
||||
<string>https://.../uBlock.safariextz</string>
|
||||
</dict>
|
|
@ -36,6 +36,13 @@ vAPI.safari = true;
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.app = {
|
||||
name: 'µBlock',
|
||||
version: '0.7.2.0'
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// addContentScriptFromURL allows whitelisting,
|
||||
// so load sitepaching this way, instead of adding it to the Info.plist
|
||||
|
||||
|
@ -132,6 +139,10 @@ vAPI.storage = {
|
|||
callback();
|
||||
},
|
||||
getBytesInUse: function(keys, callback) {
|
||||
if (typeof callback !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
var key, size = 0;
|
||||
|
||||
if (keys === null) {
|
||||
|
@ -183,12 +194,9 @@ vAPI.tabs.registerListeners = function() {
|
|||
safari.application.addEventListener('navigate', this.onNavigation, true);
|
||||
}
|
||||
|
||||
// ??
|
||||
/* if (typeof this.onUpdated === 'function') { } */
|
||||
|
||||
// onClosed handled in the main tab-close event
|
||||
// onPopup is handled in window.open on web-pages?
|
||||
/* if (typeof onPopup === 'function') { } */
|
||||
// onUpdated handled via monitoring the history.pushState on web-pages
|
||||
// onPopup is handled in window.open on web-pages
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -230,15 +238,16 @@ vAPI.tabs.get = function(tabId, callback) {
|
|||
title: tab.title
|
||||
});
|
||||
};
|
||||
// properties of the details object:
|
||||
// url: 'URL', // the address that will be opened
|
||||
// tabId: 1, // the tab is used if set, instead of creating a new one
|
||||
// index: -1, // undefined: end of the list, -1: following tab, or after index
|
||||
// active: false, // opens the tab in background - true and undefined: foreground
|
||||
// select: true // if a tab is already opened with that url, then select it instead of opening a new one
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// properties of the details object:
|
||||
// url: 'URL', // the address that will be opened
|
||||
// tabId: 1, // the tab is used if set, instead of creating a new one
|
||||
// index: -1, // undefined: end of the list, -1: following tab, or after index
|
||||
// active: false, // opens the tab in background - true and undefined: foreground
|
||||
// select: true // if a tab is already opened with that url, then select it instead of opening a new one
|
||||
|
||||
vAPI.tabs.open = function(details) {
|
||||
if (!details.url) {
|
||||
return null;
|
||||
|
@ -293,13 +302,19 @@ vAPI.tabs.open = function(details) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.tabs.close = function(tab) {
|
||||
if (!(tab instanceof SafariBrowserTab)) {
|
||||
tab = this.stack[tab];
|
||||
vAPI.tabs.remove = function(tabIds) {
|
||||
if (tabIds instanceof SafariBrowserTab) {
|
||||
tabIds = this.getTabId(tabIds);
|
||||
}
|
||||
|
||||
if (tab) {
|
||||
tab.close();
|
||||
if (!Array.isArray(tabIds)) {
|
||||
tabIds = [tabIds];
|
||||
}
|
||||
|
||||
for (var i = 0; i < tabIds.length; i++) {
|
||||
if (this.stack[tabIds[i]]) {
|
||||
this.stack[tabIds[i]].close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -560,10 +575,32 @@ vAPI.messaging.broadcast = function(message) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.net = {}
|
||||
safari.application.addEventListener('beforeNavigate', function(e) {
|
||||
if (!vAPI.tabs.expectPopUpFrom || e.url === 'about:blank') {
|
||||
return;
|
||||
}
|
||||
|
||||
var details = {
|
||||
url: e.url,
|
||||
tabId: vAPI.tabs.getTabId(e.target),
|
||||
sourceTabId: vAPI.tabs.expectPopUpFrom
|
||||
};
|
||||
|
||||
vAPI.tabs.expectPopUpFrom = null;
|
||||
|
||||
if (vAPI.tabs.onPopup(details)) {
|
||||
e.preventDefault();
|
||||
|
||||
if (vAPI.tabs.stack[details.sourceTabId]) {
|
||||
vAPI.tabs.stack[details.sourceTabId].activate();
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.net = {}
|
||||
|
||||
vAPI.net.registerListeners = function() {
|
||||
var onBeforeRequest = this.onBeforeRequest;
|
||||
|
||||
|
@ -592,19 +629,28 @@ vAPI.net.registerListeners = function() {
|
|||
return e.message;
|
||||
}
|
||||
|
||||
// when the URL changes, but the document doesn't
|
||||
if (e.message.type === 'popstate') {
|
||||
vAPI.tabs.onUpdated(
|
||||
vAPI.tabs.getTabId(e.target),
|
||||
{url: e.message.url},
|
||||
{url: e.message.url}
|
||||
);
|
||||
return;
|
||||
}
|
||||
// blocking unwanted pop-ups
|
||||
if (e.message.type === 'popup') {
|
||||
if (typeof vAPI.tabs.onPopup === 'function') {
|
||||
e.message.type = 'main_frame';
|
||||
e.message.sourceTabId = vAPI.tabs.getTabId(e.target);
|
||||
|
||||
if (vAPI.tabs.onPopup(e.message)) {
|
||||
e.message = false;
|
||||
return;
|
||||
}
|
||||
else if (e.message.type === 'popup') {
|
||||
if (e.message.url === 'about:blank') {
|
||||
vAPI.tabs.expectPopUpFrom = vAPI.tabs.getTabId(e.target);
|
||||
e.message = true;
|
||||
return;
|
||||
}
|
||||
|
||||
e.message = true;
|
||||
e.message = !vAPI.tabs.onPopup({
|
||||
url: e.message.url,
|
||||
tabId: 0,
|
||||
sourceTabId: vAPI.tabs.getTabId(e.target)
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -620,7 +666,7 @@ vAPI.net.registerListeners = function() {
|
|||
// truthy return value will allow the request,
|
||||
// except when redirectUrl is present
|
||||
if (block && typeof block === 'object') {
|
||||
if (block.cancel) {
|
||||
if (block.cancel === true) {
|
||||
e.message = false;
|
||||
}
|
||||
else if (e.message.type === 'script'
|
||||
|
@ -638,7 +684,11 @@ vAPI.net.registerListeners = function() {
|
|||
return e.message;
|
||||
};
|
||||
|
||||
safari.application.addEventListener('message', this.onBeforeRequest.callback, true);
|
||||
safari.application.addEventListener(
|
||||
'message',
|
||||
this.onBeforeRequest.callback,
|
||||
true
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
/******************************************************************************/
|
||||
|
||||
self.vAPI = self.vAPI || {};
|
||||
self.vAPI.safari = true;
|
||||
vAPI.safari = true;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
@ -39,11 +39,15 @@ var messagingConnector = function(response) {
|
|||
return;
|
||||
}
|
||||
|
||||
var channels = vAPI.messaging.channels;
|
||||
var channel, listener;
|
||||
|
||||
if ( response.broadcast === true ) {
|
||||
for ( channel in vAPI.messaging.channels ) {
|
||||
listener = vAPI.messaging.channels[channel].listener;
|
||||
for ( channel in channels ) {
|
||||
if ( channels.hasOwnProperty(channel) === false ) {
|
||||
continue;
|
||||
}
|
||||
listener = channels[channel].listener;
|
||||
if ( typeof listener === 'function' ) {
|
||||
listener(response.msg);
|
||||
}
|
||||
|
@ -58,7 +62,7 @@ var messagingConnector = function(response) {
|
|||
}
|
||||
|
||||
if ( !listener ) {
|
||||
channel = vAPI.messaging.channels[response.portName];
|
||||
channel = channels[response.portName];
|
||||
listener = channel && channel.listener;
|
||||
}
|
||||
|
||||
|
@ -171,9 +175,16 @@ vAPI.messaging = {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
// content scripts are loaded into extension pages by default, but they shouldn't
|
||||
vAPI.canExecuteContentScript = function() {
|
||||
return /^https?:/.test(location.protocol);
|
||||
};
|
||||
|
||||
if (location.protocol === "safari-extension:") {
|
||||
/******************************************************************************/
|
||||
|
||||
// This file can be included into extensin pages,
|
||||
// but the following code should run only in content pages.
|
||||
|
||||
if (location.protocol === 'safari-extension:') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -209,7 +220,7 @@ var onBeforeLoad = function(e, details) {
|
|||
|
||||
linkHelper.href = details ? details.url : e.url;
|
||||
|
||||
if (!/^https?:/.test(linkHelper.protocol)) {
|
||||
if (!(/^https?:/.test(linkHelper.protocol) || (details && details.type === 'popup'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -319,28 +330,51 @@ var firstMutation = function() {
|
|||
// the extension context is unable to reach the page context,
|
||||
// also this only works when Content Security Policy allows inline scripts
|
||||
var tmpJS = document.createElement('script');
|
||||
var tmpScript = ["(function() {",
|
||||
"var block = function(u, t) {",
|
||||
"var e = document.createEvent('CustomEvent'),",
|
||||
"d = {url: u, type: t};",
|
||||
"e.initCustomEvent('" + randEventName + "', !1, !1, d);",
|
||||
"dispatchEvent(e);",
|
||||
"return d.url === !1;",
|
||||
"}, wo = open, xo = XMLHttpRequest.prototype.open;",
|
||||
"open = function(u) {",
|
||||
"return block(u, 'popup') ? null : wo.apply(this, [].slice.call(arguments));",
|
||||
"};",
|
||||
"XMLHttpRequest.prototype.open = function(m, u, s) {",
|
||||
"return xo.apply(this, block(u, 'xmlhttprequest') ? ['HEAD', u, s] : [].slice.call(arguments));",
|
||||
"};"
|
||||
var tmpScript = ['(function() {',
|
||||
'var block = function(u, t) {',
|
||||
'var e = document.createEvent("CustomEvent"),',
|
||||
'd = {url: u, type: t};',
|
||||
'e.initCustomEvent("' + randEventName + '", !1, !1, d);',
|
||||
'dispatchEvent(e);',
|
||||
'return d.url === !1;',
|
||||
'}, wo = open, xo = XMLHttpRequest.prototype.open;',
|
||||
'open = function(u) {',
|
||||
'return block(u, "popup") ? null : wo.apply(this, arguments);',
|
||||
'};',
|
||||
'XMLHttpRequest.prototype.open = function(m, u, s) {',
|
||||
'return xo.apply(this, block(u, "xmlhttprequest") ? ["HEAD", u, s] : arguments);',
|
||||
'};'
|
||||
];
|
||||
|
||||
if (vAPI.sitePatch
|
||||
&& !safari.self.tab.canLoad(beforeLoadEvent, {isWhiteListed: location.href})) {
|
||||
if (frameId === 0) {
|
||||
tmpScript.push(
|
||||
'var pS = history.pushState, rS = history.replaceState,',
|
||||
'onpopstate = function(e) {',
|
||||
'if (!e || e.state !== null) block(location.href, "popstate");',
|
||||
'};',
|
||||
'window.addEventListener("popstate", onpopstate, true);',
|
||||
'history.pushState = function() {',
|
||||
'var r = pS.apply(this, arguments);',
|
||||
'onpopstate();',
|
||||
'return r;',
|
||||
'};',
|
||||
'history.replaceState = function() {',
|
||||
'var r = pR.apply(this, arguments);',
|
||||
'onpopstate();',
|
||||
'return r;',
|
||||
'};'
|
||||
);
|
||||
}
|
||||
|
||||
var block = safari.self.tab.canLoad(beforeLoadEvent, {
|
||||
isWhiteListed: location.href
|
||||
});
|
||||
|
||||
if (vAPI.sitePatch && !block) {
|
||||
tmpScript.push('(' + vAPI.sitePatch + ')();');
|
||||
}
|
||||
|
||||
tmpScript.push("})();");
|
||||
tmpScript.push('})();');
|
||||
tmpJS.textContent = tmpScript.join('');
|
||||
document.documentElement.removeChild(document.documentElement.appendChild(tmpJS));
|
||||
};
|
||||
|
@ -358,7 +392,7 @@ var onContextMenu = function(e) {
|
|||
|
||||
details.editable = details.tagName === 'textarea' || details.tagName === 'input';
|
||||
|
||||
if ('checked' in e.target) {
|
||||
if (e.target.hasOwnProperty('checked')) {
|
||||
details.checked = e.target.checked;
|
||||
}
|
||||
|
||||
|
@ -366,7 +400,7 @@ var onContextMenu = function(e) {
|
|||
details.linkUrl = e.target.href;
|
||||
}
|
||||
|
||||
if ('src' in e.target) {
|
||||
if (e.target.hasOwnProperty('src')) {
|
||||
details.srcUrl = e.target.src;
|
||||
|
||||
if (details.tagName === 'img') {
|
||||
|
@ -394,12 +428,6 @@ if (frameId === 0) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
self.vAPI.canExecuteContentScript = function() {
|
||||
return /^https?:/.test(location.protocol);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
})();
|
||||
|
||||
/******************************************************************************/
|
|
@ -55,7 +55,6 @@ vAPI.download = function(details) {
|
|||
a.dispatchEvent(new MouseEvent('click'));
|
||||
return;
|
||||
}
|
||||
|
||||
var messager = vAPI.messaging.channel('_download');
|
||||
messager.send({
|
||||
what: 'gotoURL',
|
|
@ -1,43 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
µBlock - a Chromium browser extension to block requests.
|
||||
Copyright (C) 2014 The µBlock authors
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
// Can be included anywhere if it's needed
|
||||
|
||||
/* global self */
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
(function(){
|
||||
|
||||
'use strict';
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
self.vAPI = self.vAPI || {};
|
||||
|
||||
self.vAPI.app = {
|
||||
name: 'µBlock',
|
||||
version: '0.7.2.0'
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
})();
|
|
@ -80,15 +80,12 @@ vAPI.tabs.onPopup = function(details) {
|
|||
|
||||
// Blocked
|
||||
|
||||
// Safari blocks before the pop-up opens, so there is no window to remove.
|
||||
// TODO: Can't this test be done within the platform-specific code?
|
||||
if ( vAPI.safari ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// It is a popup, block and remove the tab.
|
||||
µBlock.unbindTabFromPageStats(details.tabId);
|
||||
vAPI.tabs.remove(details.tabId);
|
||||
|
||||
// for Safari
|
||||
return true;
|
||||
};
|
||||
|
||||
vAPI.tabs.registerListeners();
|
||||
|
|
|
@ -15,8 +15,7 @@ cp -R src/lib $DES/
|
|||
cp -R src/_locales $DES/
|
||||
cp src/*.html $DES/
|
||||
cp src/img/icon_128.png $DES/Icon.png
|
||||
cp platform/vapi-appinfo.js $DES/js/
|
||||
cp meta/safariextz/*.js $DES/js/
|
||||
cp meta/safariextz/Info.plist $DES/
|
||||
cp meta/safariextz/Settings.plist $DES/
|
||||
cp platform/safari/*.js $DES/js/
|
||||
cp platform/safari/Info.plist $DES/
|
||||
cp platform/safari/Settings.plist $DES/
|
||||
echo "*** uBlock.safariextension: Package done."
|
||||
|
|
Loading…
Reference in a new issue