From 7a6d29d935aa15691459456142b27df5122b1848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Taro?= Date: Sun, 22 May 2016 22:35:06 +0200 Subject: [PATCH] Move .js files to /js and /lib folders (#47) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomáš Taro --- Info.plist | 14 +-- background.html | 14 +-- background_safari.html | 14 +-- button/popup.html | 8 +- filters/adblock_custom.txt | 64 ------------ img/white-bg.png | Bin 144 -> 0 bytes jquery/jquery.cookie.js | 96 ------------------ .../adblock_safari_beforeload.js | 0 .../adblock_safari_contentblocking.js | 0 .../adblock_start_chrome.js | 0 .../adblock_start_common.js | 0 .../adblock_start_safari.js | 0 background.js => js/background.js | 22 ++-- bandaids.js => js/bandaids.js | 0 checkupdates.js => js/checkupdates.js | 0 edge-updates.js => js/edge-updates.js | 0 functions.js => js/functions.js | 2 +- idlehandler.js => js/idlehandler.js | 0 port.js => js/port.js | 0 safari_bg.js => js/safari_bg.js | 14 +-- ytchannel.js => js/ytchannel.js | 0 {jquery => lib}/jquery-ui.custom.min.js | 0 {jquery => lib}/jquery.min.js | 0 punycode.min.js => lib/punycode.min.js | 0 manifest.json | 10 +- options/index.html | 10 +- pages/adreport.html | 10 +- pages/resourceblock.html | 10 +- pages/subscribe.html | 6 +- tools/tests/safari_test.html | 10 +- tools/tests/test.html | 10 +- 31 files changed, 77 insertions(+), 237 deletions(-) delete mode 100644 filters/adblock_custom.txt delete mode 100644 img/white-bg.png delete mode 100644 jquery/jquery.cookie.js rename adblock_safari_beforeload.js => js/adblock_safari_beforeload.js (100%) rename adblock_safari_contentblocking.js => js/adblock_safari_contentblocking.js (100%) rename adblock_start_chrome.js => js/adblock_start_chrome.js (100%) rename adblock_start_common.js => js/adblock_start_common.js (100%) rename adblock_start_safari.js => js/adblock_start_safari.js (100%) rename background.js => js/background.js (99%) rename bandaids.js => js/bandaids.js (100%) rename checkupdates.js => js/checkupdates.js (100%) rename edge-updates.js => js/edge-updates.js (100%) rename functions.js => js/functions.js (99%) rename idlehandler.js => js/idlehandler.js (100%) rename port.js => js/port.js (100%) rename safari_bg.js => js/safari_bg.js (97%) rename ytchannel.js => js/ytchannel.js (100%) rename {jquery => lib}/jquery-ui.custom.min.js (100%) rename {jquery => lib}/jquery.min.js (100%) rename punycode.min.js => lib/punycode.min.js (100%) diff --git a/Info.plist b/Info.plist index e85db51d..5a61db54 100644 --- a/Info.plist +++ b/Info.plist @@ -44,7 +44,7 @@ End - punycode.min.js + lib/punycode.min.js uiscripts/load_jquery_ui.js uiscripts/blacklisting/rightclick_hook.js uiscripts/blacklisting/overlay.js @@ -58,13 +58,13 @@ Start - jquery/jquery.min.js - port.js - functions.js + lib/jquery.min.js + js/port.js + js/functions.js filtering/filteroptions.js - bandaids.js - adblock_start_common.js - adblock_start_safari.js + js/bandaids.js + js/adblock_start_common.js + js/adblock_start_safari.js catblock/contentscript.js diff --git a/background.html b/background.html index f6998363..8e77e75c 100644 --- a/background.html +++ b/background.html @@ -1,19 +1,19 @@ - - - - + + + + - + - - + + diff --git a/background_safari.html b/background_safari.html index beaabb82..4e372244 100644 --- a/background_safari.html +++ b/background_safari.html @@ -1,9 +1,9 @@ - - - - + + + + @@ -11,10 +11,10 @@ - + - - + + diff --git a/button/popup.html b/button/popup.html index 7d761849..2acb56b8 100644 --- a/button/popup.html +++ b/button/popup.html @@ -2,10 +2,10 @@ - - - - + + + +
diff --git a/filters/adblock_custom.txt b/filters/adblock_custom.txt deleted file mode 100644 index 52973d26..00000000 --- a/filters/adblock_custom.txt +++ /dev/null @@ -1,64 +0,0 @@ -[Adblock Plus 2.0] -! Chrome AdBlock auxiliarly filters -! Last update: Thu Sep 28 02:43:00 EST 2014 - -! Ad providers. Filter lists don't care they are blocked -@@||advertising.apple.com^$domain=advertising.apple.com -@@||ads.tapit.com^$domain=ads.tapit.com -@@||google.co.uk/ads/$domain=google.co.uk -@@||google.com/adsense/$document,domain=google.com -@@||openx.com^$domain=openx.com -@@||support.google.com/adwords/$document,domain=support.google.com -@@||ads.senddroid.com/$document,domain=ads.senddroid.com -@@||ads.socialbakers.com$domain=ads.socialbakers.com - -! Over-aggressive EasyList rules -#@#.mw > #rcnt > #center_col > #taw + div[style] - -! Because of the asdf[style] Chrome bug -@@||apollohq.com^$elemhide,domain=apollohq.com -@@||ginzaworld.com^$elemhide,domain=ginzaworld.com -@@||instantservice.com/client/$elemhide,domain=instantservice.com -@@||smartsheet.com^$elemhide,domain=smartsheet.com - -! Because acid3 doesn't like our style block -@@||acid3.acidtests.org^$document,domain=acid3.acidtests.org - -! WebKit-specific -@@||doubleclick.net/adj/ftd-rubriken/$script,domain=ftd.de -@@||washingtonpost.com^*=/ad/audsci.js$domain=washingtonpost.com -||gamecopyworld.com/games/js/abd.js$domain=gamecopyworld.com - -! Don't block extension resources injected in pages -@@|chrome-extension: -@@|safari-extension: - -! They contain spaces in the URL so purging doesn't work properly -cistor.pl##img[src*="/ads_files/"] -nysa.eu##img[src*="/ads_files/"] -wrzesnia.pl##img[src*="/ads_files/"] - -! Opera doesn't support regex rules -74.ru##.banner -74.ru##object[id^="ban"] -74.ru##div[id^="sb_"] - -! Should bypass pirateproxy.net's popup mechanism -||*^$popup,domain=pirateproxy.net - -! Unblock Mixpanel on our website -@@||getadblock.com/js/mixpanel.js -@@||mxpnl.com$domain=getadblock.com -@@||mixpanel.com$domain=getadblock.com - -! Don't break navigation on Flickr.com -@@.com/ad?$domain=flickr.com - -! whitelist to avoid AdBlock detection on CBS.com -@@/adblock.js$domain=cbs.com -@@/adblockr.javascript$domain=cbs.com - -! Whitelist the outlook office 365 site to prevent -! Safari users from send emails that are identified as -! Spam (issue #444) -@@||outlook.office365.com/$document \ No newline at end of file diff --git a/img/white-bg.png b/img/white-bg.png deleted file mode 100644 index 9fc29a1f2b9fba112c3cbcbc65fc5fd20bd8a682..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 144 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1|;Q0k8}blmSQK*5Dp-y;YjHK@;M7UB8!3Q zuY)k7lg8`{prB-lYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt;TsE{-7_ hGn0S(|Np;^fpa(W-lM0#zXnP$c)I$ztaD0e0sy!^C)EG| diff --git a/jquery/jquery.cookie.js b/jquery/jquery.cookie.js deleted file mode 100644 index 6df1faca..00000000 --- a/jquery/jquery.cookie.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Cookie plugin - * - * Copyright (c) 2006 Klaus Hartl (stilbuero.de) - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ - -/** - * Create a cookie with the given name and value and other optional parameters. - * - * @example $.cookie('the_cookie', 'the_value'); - * @desc Set the value of a cookie. - * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); - * @desc Create a cookie with all available options. - * @example $.cookie('the_cookie', 'the_value'); - * @desc Create a session cookie. - * @example $.cookie('the_cookie', null); - * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain - * used when the cookie was set. - * - * @param String name The name of the cookie. - * @param String value The value of the cookie. - * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. - * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. - * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. - * If set to null or omitted, the cookie will be a session cookie and will not be retained - * when the the browser exits. - * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). - * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). - * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will - * require a secure protocol (like HTTPS). - * @type undefined - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ - -/** - * Get the value of a cookie with the given name. - * - * @example $.cookie('the_cookie'); - * @desc Get the value of a cookie. - * - * @param String name The name of the cookie. - * @return The value of the cookie. - * @type String - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ -jQuery.cookie = function(name, value, options) { - if (typeof value != 'undefined') { // name and value given, set cookie - options = options || {}; - if (value === null) { - value = ''; - options.expires = -1; - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - // CAUTION: Needed to parenthesize options.path and options.domain - // in the following expressions, otherwise they evaluate to undefined - // in the packed version for some reason... - var path = options.path ? '; path=' + (options.path) : ''; - var domain = options.domain ? '; domain=' + (options.domain) : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - } else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; - } -}; \ No newline at end of file diff --git a/adblock_safari_beforeload.js b/js/adblock_safari_beforeload.js similarity index 100% rename from adblock_safari_beforeload.js rename to js/adblock_safari_beforeload.js diff --git a/adblock_safari_contentblocking.js b/js/adblock_safari_contentblocking.js similarity index 100% rename from adblock_safari_contentblocking.js rename to js/adblock_safari_contentblocking.js diff --git a/adblock_start_chrome.js b/js/adblock_start_chrome.js similarity index 100% rename from adblock_start_chrome.js rename to js/adblock_start_chrome.js diff --git a/adblock_start_common.js b/js/adblock_start_common.js similarity index 100% rename from adblock_start_common.js rename to js/adblock_start_common.js diff --git a/adblock_start_safari.js b/js/adblock_start_safari.js similarity index 100% rename from adblock_start_safari.js rename to js/adblock_start_safari.js diff --git a/background.js b/js/background.js similarity index 99% rename from background.js rename to js/background.js index 5cc00aa4..5207ecbd 100644 --- a/background.js +++ b/js/background.js @@ -727,9 +727,9 @@ adblock_is_paused = function(newValue) { // add it back when AdBlock is un-paused if (SAFARI && !get_settings().safari_content_blocking) { if (newValue) { - safari.extension.removeContentScript(safari.extension.baseURI + "adblock_safari_beforeload.js"); + safari.extension.removeContentScript(safari.extension.baseURI + "js/adblock_safari_beforeload.js"); } else { - safari.extension.addContentScriptFromURL(safari.extension.baseURI + "adblock_safari_beforeload.js", [], [], false); + safari.extension.addContentScriptFromURL(safari.extension.baseURI + "js/adblock_safari_beforeload.js", [], [], false); } } } @@ -1000,7 +1000,7 @@ add_custom_filter = function(filter) { // Injects jQuery UI injectjQueryUI = function() { if (SAFARI) { - safari.extension.addContentScriptFromURL(safari.extension.baseURI + "jquery/jquery-ui.custom.min.js", [], [], false); + safari.extension.addContentScriptFromURL(safari.extension.baseURI + "lib/jquery-ui.custom.min.js", [], [], false); return true; } }; @@ -1071,9 +1071,9 @@ if (!SAFARI) { 'top_open_whitelist_ui': { allFrames: false, include: [ - "punycode.min.js", - "jquery/jquery.min.js", - "jquery/jquery-ui.custom.min.js", + "lib/punycode.min.js", + "lib/jquery.min.js", + "lib/jquery-ui.custom.min.js", "uiscripts/load_jquery_ui.js", "uiscripts/top_open_whitelist_ui.js" ] @@ -1081,9 +1081,9 @@ if (!SAFARI) { 'top_open_blacklist_ui': { allFrames: false, include: [ - "punycode.min.js", - "jquery/jquery.min.js", - "jquery/jquery-ui.custom.min.js", + "lib/punycode.min.js", + "lib/jquery.min.js", + "lib/jquery-ui.custom.min.js", "uiscripts/load_jquery_ui.js", "uiscripts/blacklisting/overlay.js", "uiscripts/blacklisting/clickwatcher.js", @@ -1529,11 +1529,11 @@ chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { if (request.command === "inject_jquery") { if (!SAFARI) { - chrome.tabs.executeScript(undefined, { allFrames: request.allFrames, file: "../jquery/jquery.min.js" }, + chrome.tabs.executeScript(undefined, { allFrames: request.allFrames, file: "../lib/jquery.min.js" }, function() { sendResponse({}); }); } else { - safari.extension.addContentScriptFromURL(safari.extension.baseURI + "jquery/jquery.min.js", [], [], false); + safari.extension.addContentScriptFromURL(safari.extension.baseURI + "lib/jquery.min.js", [], [], false); } } } diff --git a/bandaids.js b/js/bandaids.js similarity index 100% rename from bandaids.js rename to js/bandaids.js diff --git a/checkupdates.js b/js/checkupdates.js similarity index 100% rename from checkupdates.js rename to js/checkupdates.js diff --git a/edge-updates.js b/js/edge-updates.js similarity index 100% rename from edge-updates.js rename to js/edge-updates.js diff --git a/functions.js b/js/functions.js similarity index 99% rename from functions.js rename to js/functions.js index 6d8a8d56..a55396bd 100644 --- a/functions.js +++ b/js/functions.js @@ -1,7 +1,7 @@ // Set to true to get noisier console.log statements VERBOSE_DEBUG = false; -// Global variable for detection of Opera, Edge and Safari +// Global variable for detection of Opera, Edge and Firefox OPERA = navigator.userAgent.indexOf("OPR") > -1; EDGE = navigator.userAgent.indexOf("Edge") > -1; FIREFOX = navigator.userAgent.indexOf("Firefox") > -1; diff --git a/idlehandler.js b/js/idlehandler.js similarity index 100% rename from idlehandler.js rename to js/idlehandler.js diff --git a/port.js b/js/port.js similarity index 100% rename from port.js rename to js/port.js diff --git a/safari_bg.js b/js/safari_bg.js similarity index 97% rename from safari_bg.js rename to js/safari_bg.js index e1bb32ea..1e81cb74 100644 --- a/safari_bg.js +++ b/js/safari_bg.js @@ -224,11 +224,11 @@ if (!LEGACY_SAFARI) { // Add and remove the specific content script based on the safari_content_blocking setting function set_content_scripts() { if (get_settings().safari_content_blocking) { - safari.extension.addContentScriptFromURL(safari.extension.baseURI + "adblock_safari_contentblocking.js", [], [], false); - safari.extension.removeContentScript(safari.extension.baseURI + "adblock_safari_beforeload.js"); + safari.extension.addContentScriptFromURL(safari.extension.baseURI + "js/adblock_safari_contentblocking.js", [], [], false); + safari.extension.removeContentScript(safari.extension.baseURI + "js/adblock_safari_beforeload.js"); } else { - safari.extension.addContentScriptFromURL(safari.extension.baseURI + "adblock_safari_beforeload.js", [], [], false); - safari.extension.removeContentScript(safari.extension.baseURI + "adblock_safari_contentblocking.js"); + safari.extension.addContentScriptFromURL(safari.extension.baseURI + "js/adblock_safari_beforeload.js", [], [], false); + safari.extension.removeContentScript(safari.extension.baseURI + "js/adblock_safari_contentblocking.js"); } } set_content_scripts(); @@ -237,13 +237,13 @@ safari.application.addEventListener("beforeNavigate", function(event) { //remove bandaids.js from YouTube.com when a user pauses AdBlock or if the enabled click to flash compatibility mode if (/youtube.com/.test(event.url) && (is_adblock_paused() || (get_settings().clicktoflash_compatibility_mode === true))) { - safari.extension.removeContentScript(safari.extension.baseURI + "bandaids.js"); + safari.extension.removeContentScript(safari.extension.baseURI + "js/bandaids.js"); } // YouTube Channel Whitelist if (/youtube.com/.test(event.url) && get_settings().youtube_channel_whitelist && !parseUri.parseSearch(event.url).ab_channel) { - safari.extension.addContentScriptFromURL(safari.extension.baseURI + "ytchannel.js", [], [], false); + safari.extension.addContentScriptFromURL(safari.extension.baseURI + "js/ytchannel.js", [], [], false); } else { - safari.extension.removeContentScript(safari.extension.baseURI + "ytchannel.js"); + safari.extension.removeContentScript(safari.extension.baseURI + "js/ytchannel.js"); } }, true); diff --git a/ytchannel.js b/js/ytchannel.js similarity index 100% rename from ytchannel.js rename to js/ytchannel.js diff --git a/jquery/jquery-ui.custom.min.js b/lib/jquery-ui.custom.min.js similarity index 100% rename from jquery/jquery-ui.custom.min.js rename to lib/jquery-ui.custom.min.js diff --git a/jquery/jquery.min.js b/lib/jquery.min.js similarity index 100% rename from jquery/jquery.min.js rename to lib/jquery.min.js diff --git a/punycode.min.js b/lib/punycode.min.js similarity index 100% rename from punycode.min.js rename to lib/punycode.min.js diff --git a/manifest.json b/manifest.json index 283e3a81..afcdb585 100644 --- a/manifest.json +++ b/manifest.json @@ -45,12 +45,12 @@ { "matches": ["http://*/*", "https://*/*"], "js": [ - "port.js", - "functions.js", - "jquery/jquery.min.js", + "lib/jquery.min.js", + "js/port.js", + "js/functions.js", "filtering/filteroptions.js", - "adblock_start_common.js", - "adblock_start_chrome.js", + "js/adblock_start_common.js", + "js/adblock_start_chrome.js", "catblock/contentscript.js" ], "run_at": "document_start", diff --git a/options/index.html b/options/index.html index 05dcad28..7f68ee15 100644 --- a/options/index.html +++ b/options/index.html @@ -4,11 +4,11 @@ - - - - - + + + + + diff --git a/pages/adreport.html b/pages/adreport.html index 9f45005a..ff49a31f 100644 --- a/pages/adreport.html +++ b/pages/adreport.html @@ -8,11 +8,11 @@ - - - - - + + + + +