From 5b16418e6069ea6f586441db6514836f88362d2a Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 9 Feb 2015 22:47:45 -0700 Subject: [PATCH] Safari: don't double inject, and cleanup stray unicode --- assets/ublock/filter-lists.json | 4 ++-- platform/safari/vapi-client.js | 6 +++++- platform/safari/vapi-popup.js | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/assets/ublock/filter-lists.json b/assets/ublock/filter-lists.json index f53e9e93a..688775d7b 100644 --- a/assets/ublock/filter-lists.json +++ b/assets/ublock/filter-lists.json @@ -55,7 +55,7 @@ }, "www.fanboy.co.nz/fanboy-antifacebook.txt": { "off": true, - "title": "Anti-ThirdpartySocial‎ (see warning inside list)", + "title": "Anti-ThirdpartySocial (see warning inside list)", "group": "social", "homeURL": "https://www.fanboy.co.nz/fanboy-antifacebook.txt" }, @@ -279,4 +279,4 @@ "group": "regions", "homeURL": "" } -} \ No newline at end of file +} diff --git a/platform/safari/vapi-client.js b/platform/safari/vapi-client.js index f38f615cd..fb5dbc4b0 100644 --- a/platform/safari/vapi-client.js +++ b/platform/safari/vapi-client.js @@ -24,6 +24,10 @@ (function() { 'use strict'; var vAPI = self.vAPI = self.vAPI || {}; + if(vAPI.vapiClientInjected) { + return; + } + vAPI.vapiClientInjected = true; vAPI.safari = true; /******************************************************************************/ var messagingConnector = function(response) { @@ -143,7 +147,7 @@ }; vAPI.canExecuteContentScript = function() { - return(/^https?:/.test(location.protocol) && typeof safari === "object"); + return (/^https?:/.test(location.protocol) && typeof safari === "object"); }; // The following code should run only in content pages diff --git a/platform/safari/vapi-popup.js b/platform/safari/vapi-popup.js index de5497acc..70c8ff7e8 100644 --- a/platform/safari/vapi-popup.js +++ b/platform/safari/vapi-popup.js @@ -18,6 +18,8 @@ Home: https://github.com/gorhill/uBlock */ +(function() { +'use strict'; var whenSizeChanges = function(elm, callback) { var reset = function() { @@ -63,3 +65,4 @@ var onLoaded = function() { whenSizeChanges(body, updateSize); }; window.addEventListener('load', onLoaded); +})();