1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00
This commit is contained in:
gorhill 2017-01-27 13:44:52 -05:00
parent 5975832653
commit 0b4f31bd8a
3 changed files with 16 additions and 5 deletions

View File

@ -529,7 +529,7 @@
"group": "regions",
"off": true,
"title": "RUS: RU AdList (Дополнительная региональная подписка)",
"lang": "ru",
"lang": "be ru uk",
"contentURL": "https://easylist-downloads.adblockplus.org/advblock.txt",
"supportURL": "https://forums.lanik.us/viewforum.php?f=102"
},

View File

@ -430,8 +430,7 @@
/******************************************************************************/
µBlock.autoSelectRegionalFilterLists = function(lists) {
var lang = self.navigator.language.slice(0, 2),
selectedListKeys = [ this.userFiltersPath ],
var selectedListKeys = [ this.userFiltersPath ],
list;
for ( var key in lists ) {
if ( lists.hasOwnProperty(key) === false ) { continue; }
@ -440,7 +439,7 @@
selectedListKeys.push(key);
continue;
}
if ( list.lang === lang ) {
if ( this.matchCurrentLanguage(list.lang) ) {
selectedListKeys.push(key);
list.off = false;
}
@ -1135,7 +1134,7 @@
if ( details.entry.content === 'filters' ) {
if (
details.entry.off !== true ||
self.navigator.language.startsWith(details.entry.lang)
this.matchCurrentLanguage(details.entry.lang)
) {
this.saveSelectedFilterLists([ details.assetKey ], true);
}

View File

@ -245,3 +245,15 @@
};
/******************************************************************************/
// https://github.com/gorhill/uBlock/issues/2344
µBlock.matchCurrentLanguage = function(s) {
if ( typeof s !== 'string' ) { return false; }
if ( this.matchCurrentLanguage.reLang === undefined ) {
this.matchCurrentLanguage.reLang = new RegExp('\\b' + self.navigator.language.slice(0, 2) + '\\b');
}
return this.matchCurrentLanguage.reLang.test(s);
};
/******************************************************************************/