Browse Source

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.
pull/2/head
Deathamns 10 years ago
committed by gorhill
parent
commit
9f23b45651
  1. 8
      src/js/vapi-common.js

8
src/js/vapi-common.js

@ -3,7 +3,7 @@
(function() {
'use strict';
window.vAPI = window.vAPI || {};
self.vAPI = self.vAPI || {};
// http://www.w3.org/International/questions/qa-scripts#directions
var setScriptDirection = function(langugae) {
@ -38,8 +38,8 @@ vAPI.download = function(details) {
}
};
if (window.chrome) {
var chrome = window.chrome;
if (self.chrome) {
var chrome = self.chrome;
vAPI.getURL = function(path) {
return chrome.runtime.getURL(path);
@ -50,7 +50,7 @@ if (window.chrome) {
};
setScriptDirection(vAPI.i18n('@@ui_locale'));
} else if (window.safari) {
} else if (self.safari) {
vAPI.getURL = function(path) {
return safari.extension.baseURI + path;
};

Loading…
Cancel
Save