This commit is contained in:
gorhill 2015-11-20 08:47:29 -05:00
parent 0540925b44
commit 77504cb561
6 changed files with 22 additions and 32 deletions

View File

@ -38,14 +38,10 @@
"all_frames": true "all_frames": true
}, },
{ {
"matches": [ "matches": ["http://*/*", "https://*/*"],
"https://*.adblockplus.org/*", "js": ["js/scriptlets/subscriber.js"],
"https://*.adblockplus.me/*", "run_at": "document_idle",
"https://www.fanboy.co.nz/*", "all_frames": false
"https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web"
],
"js": ["js/subscriber.js"],
"run_at": "document_idle"
} }
], ],
"incognito": "split", "incognito": "split",

View File

@ -421,10 +421,10 @@ var contentObserver = {
lss(this.contentBaseURI + 'contentscript-end.js', sandbox); lss(this.contentBaseURI + 'contentscript-end.js', sandbox);
if ( if (
doc.querySelector('a[href^="abp:"]') || doc.querySelector('a[href^="abp:"],a[href^="https://subscribe.adblockplus.org/?"]') ||
loc.href === 'https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web' loc.href === 'https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web'
) { ) {
lss(this.contentBaseURI + 'subscriber.js', sandbox); lss(this.contentBaseURI + 'scriptlets/subscriber.js', sandbox);
} }
}; };

View File

@ -38,13 +38,10 @@
"all_frames": true "all_frames": true
}, },
{ {
"matches": [ "matches": ["http://*/*", "https://*/*"],
"https://*.adblockplus.org/*", "js": ["js/scriptlets/subscriber.js"],
"https://*.adblockplus.me/*", "run_at": "document_idle",
"https://www.fanboy.co.nz/*" "all_frames": false
],
"js": ["js/subscriber.js"],
"run_at": "document_idle"
} }
], ],
"incognito": "split", "incognito": "split",

View File

@ -28,7 +28,10 @@
</div> </div>
<div id="externalListsDiv"> <div id="externalListsDiv">
<p data-i18n="3pExternalListsHint" style="margin: 0 0 0.25em 0; font-size: 13px;"></p> <p>
<span data-i18n="3pExternalListsHint" style="margin: 0 0 0.25em 0; font-size: 13px;"></span>
<a class="fa info" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-3rd-party-filters#parse-and-enforce-cosmetic-filters" target="_blank">&#xf05a;</a>
</p>
<p style="margin: 0.25em 0 0 0"> <p style="margin: 0.25em 0 0 0">
<textarea id="externalLists" dir="ltr" spellcheck="false"></textarea> <textarea id="externalLists" dir="ltr" spellcheck="false"></textarea>
<button id="externalListsApply" class="custom important" disabled="true" data-i18n="3pExternalListsApply"></button></p> <button id="externalListsApply" class="custom important" disabled="true" data-i18n="3pExternalListsApply"></button></p>

View File

@ -40,12 +40,8 @@ var oneHour = 60 * oneMinute;
var defaultExternalLists = [ var defaultExternalLists = [
'! Examples:', '! Examples:',
'! https://easylist-downloads.adblockplus.org/fb_annoyances_full.txt', '! https://easylist-downloads.adblockplus.org/fb_annoyances_full.txt',
'! https://easylist-downloads.adblockplus.org/fb_annoyances_sidebar.txt',
'! https://easylist-downloads.adblockplus.org/fb_annoyances_newsfeed.txt',
'! https://easylist-downloads.adblockplus.org/yt_annoyances_full.txt', '! https://easylist-downloads.adblockplus.org/yt_annoyances_full.txt',
'! https://easylist-downloads.adblockplus.org/yt_annoyances_comments.txt', ''
'! https://easylist-downloads.adblockplus.org/yt_annoyances_suggestions.txt',
'! https://easylist-downloads.adblockplus.org/yt_annoyances_other.txt'
].join('\n'); ].join('\n');
/******************************************************************************/ /******************************************************************************/

View File

@ -48,12 +48,10 @@ if ( typeof vAPI !== 'object' ) {
/******************************************************************************/ /******************************************************************************/
// Only if at least one relevant link exists on the page // Only if at least one subscribe link exists on the page.
// The links look like this:
// abp:subscribe?location=https://easylist-downloads.adblockplus.org/easyprivacy.txt[...]
if ( if (
document.querySelector('a[href^="abp:"]') === null && document.querySelector('a[href^="abp:"],a[href^="https://subscribe.adblockplus.org/?"]') === null &&
window.location.href !== 'https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web' window.location.href !== 'https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web'
) { ) {
return; return;
@ -117,17 +115,17 @@ var onAbpLinkClicked = function(ev) {
// List already subscribed to? // List already subscribed to?
// https://github.com/chrisaljoudi/uBlock/issues/1033 // https://github.com/chrisaljoudi/uBlock/issues/1033
// Split on line separators, not whitespaces. // Split on line separators, not whitespaces.
var externalLists = details.externalLists.trim().split(/\s*[\n\r]+\s*/); var text = details.externalLists.trim();
if ( externalLists.indexOf(location) !== -1 ) { var lines = text !== '' ? text.split(/\s*[\n\r]+\s*/) : [];
if ( lines.indexOf(location) !== -1 ) {
return; return;
} }
lines.push(location, '');
externalLists.push(location);
messager.send({ messager.send({
what: 'userSettings', what: 'userSettings',
name: 'externalLists', name: 'externalLists',
value: externalLists.join('\n') value: lines.join('\n')
}, onExternalListsSaved); }, onExternalListsSaved);
}; };