From ecd003ff4ae685d0e112efcd74d4176f3660d743 Mon Sep 17 00:00:00 2001 From: gorhill Date: Tue, 30 Jun 2015 01:59:22 -0400 Subject: [PATCH] this addresses #414 --- platform/chromium/manifest.json | 3 ++- platform/firefox/frameModule.js | 5 ++++- src/js/subscriber.js | 12 +++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index c47b895aa..cf75f2662 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -41,7 +41,8 @@ "matches": [ "https://*.adblockplus.org/*", "https://*.adblockplus.me/*", - "https://www.fanboy.co.nz/*" + "https://www.fanboy.co.nz/*", + "https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web" ], "js": ["js/subscriber.js"], "run_at": "document_idle" diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index fa5e76ba8..0e5ec4c3f 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -355,7 +355,10 @@ const contentObserver = { doc.removeEventListener(e.type, docReady, true); lss(this.contentBaseURI + 'contentscript-end.js', sandbox); - if ( doc.querySelector('a[href^="abp:"]') ) { + if ( + doc.querySelector('a[href^="abp:"]') || + loc.href === 'https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web' + ) { lss(this.contentBaseURI + 'subscriber.js', sandbox); } }; diff --git a/src/js/subscriber.js b/src/js/subscriber.js index dc49f50fe..b6d0651f4 100644 --- a/src/js/subscriber.js +++ b/src/js/subscriber.js @@ -41,7 +41,7 @@ if ( document instanceof HTMLDocument === false ) { } // Because in case -if ( !vAPI ) { +if ( typeof vAPI !== 'object' ) { //console.debug('subscriber.js > vAPI not found'); return; } @@ -52,7 +52,10 @@ if ( !vAPI ) { // The links look like this: // abp:subscribe?location=https://easylist-downloads.adblockplus.org/easyprivacy.txt[...] -if ( document.querySelector('a[href^="abp:"]') === null ) { +if ( + document.querySelector('a[href^="abp:"]') === null && + window.location.href !== 'https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web' +) { return; } @@ -81,7 +84,10 @@ var onAbpLinkClicked = function(ev) { } var matches = /^abp:\/*subscribe\/*\?location=([^&]+).*title=([^&]+)/.exec(href); if ( matches === null ) { - return; + matches = /^https?:\/\/[^?]+\?location=([^&]+).*title=([^&]+)/.exec(href); + if ( matches === null ) { + return; + } } var location = decodeURIComponent(matches[1]); var title = decodeURIComponent(matches[2]);