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
},
{
"matches": [
"https://*.adblockplus.org/*",
"https://*.adblockplus.me/*",
"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"
"matches": ["http://*/*", "https://*/*"],
"js": ["js/scriptlets/subscriber.js"],
"run_at": "document_idle",
"all_frames": false
}
],
"incognito": "split",

View File

@ -421,10 +421,10 @@ var contentObserver = {
lss(this.contentBaseURI + 'contentscript-end.js', sandbox);
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'
) {
lss(this.contentBaseURI + 'subscriber.js', sandbox);
lss(this.contentBaseURI + 'scriptlets/subscriber.js', sandbox);
}
};

View File

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

View File

@ -28,7 +28,10 @@
</div>
<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">
<textarea id="externalLists" dir="ltr" spellcheck="false"></textarea>
<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 = [
'! Examples:',
'! 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_comments.txt',
'! https://easylist-downloads.adblockplus.org/yt_annoyances_suggestions.txt',
'! https://easylist-downloads.adblockplus.org/yt_annoyances_other.txt'
''
].join('\n');
/******************************************************************************/

View File

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