mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-07-02 21:10:50 +12:00
Site-patching possibility for Safari
Safari's extension API doesn't provide a way to intercept requests initiated by plugins, so those cases need special care (or at least the popular sites). This commit adds a new JS file (sitepatch-safari.js), which will store the patches (if it's possible to create one) for specific sites. As an example, this commit includes a technique for removing in-video ads from YouTube videos.
This commit is contained in:
parent
686403af38
commit
9f23b45651
|
@ -3,7 +3,7 @@
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
window.vAPI = window.vAPI || {};
|
self.vAPI = self.vAPI || {};
|
||||||
|
|
||||||
// http://www.w3.org/International/questions/qa-scripts#directions
|
// http://www.w3.org/International/questions/qa-scripts#directions
|
||||||
var setScriptDirection = function(langugae) {
|
var setScriptDirection = function(langugae) {
|
||||||
|
@ -38,8 +38,8 @@ vAPI.download = function(details) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (window.chrome) {
|
if (self.chrome) {
|
||||||
var chrome = window.chrome;
|
var chrome = self.chrome;
|
||||||
|
|
||||||
vAPI.getURL = function(path) {
|
vAPI.getURL = function(path) {
|
||||||
return chrome.runtime.getURL(path);
|
return chrome.runtime.getURL(path);
|
||||||
|
@ -50,7 +50,7 @@ if (window.chrome) {
|
||||||
};
|
};
|
||||||
|
|
||||||
setScriptDirection(vAPI.i18n('@@ui_locale'));
|
setScriptDirection(vAPI.i18n('@@ui_locale'));
|
||||||
} else if (window.safari) {
|
} else if (self.safari) {
|
||||||
vAPI.getURL = function(path) {
|
vAPI.getURL = function(path) {
|
||||||
return safari.extension.baseURI + path;
|
return safari.extension.baseURI + path;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue