Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: new-options.js

Issue 29545663: Issue 5631 - do not show disabled filters in more section (Closed)
Patch Set: Created Sept. 15, 2017, 4:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « new-options.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 id: "blocking-languages-table", 345 id: "blocking-languages-table",
346 emptyText: ["options_language_empty"] 346 emptyText: ["options_language_empty"]
347 } 347 }
348 ]); 348 ]);
349 collections.allLangs = new Collection([ 349 collections.allLangs = new Collection([
350 { 350 {
351 id: "all-lang-table-add", 351 id: "all-lang-table-add",
352 emptyText: ["options_dialog_language_other_empty"] 352 emptyText: ["options_dialog_language_other_empty"]
353 } 353 }
354 ]); 354 ]);
355 collections.custom = new Collection([ 355 collections.more = new Collection([
saroyanm 2017/09/15 16:38:00 I changed name from custom to more, as custom was
Thomas Greiner 2017/09/15 17:06:05 Acknowledged.
356 { 356 {
357 id: "custom-list-table" 357 id: "more-list-table"
358 } 358 }
359 ]); 359 ]);
360 collections.whitelist = new Collection([ 360 collections.whitelist = new Collection([
361 { 361 {
362 id: "whitelisting-table", 362 id: "whitelisting-table",
363 emptyText: ["options_whitelist_empty_1", "options_whitelist_empty_2"] 363 emptyText: ["options_whitelist_empty_1", "options_whitelist_empty_2"]
364 } 364 }
365 ]); 365 ]);
366 collections.filterLists = new Collection([ 366 collections.filterLists = new Collection([
367 { 367 {
368 id: "all-filter-lists-table", 368 id: "all-filter-lists-table",
369 useOriginalTitle: true 369 useOriginalTitle: true
370 } 370 }
371 ]); 371 ]);
372 372
373 function addSubscription(subscription) 373 function addSubscription(subscription)
374 { 374 {
375 let disabled = subscription.disabled;
375 let collection = null; 376 let collection = null;
376 if (subscription.recommended) 377 if (subscription.recommended)
377 { 378 {
378 if (subscription.recommended == "ads") 379 if (subscription.recommended == "ads")
379 { 380 {
380 if (subscription.disabled == false) 381 if (disabled == false)
381 collection = collections.langs; 382 collection = collections.langs;
382 383
383 collections.allLangs.addItem(subscription); 384 collections.allLangs.addItem(subscription);
384 } 385 }
385 else 386 else
386 { 387 {
387 collection = collections.protection; 388 collection = collections.protection;
388 } 389 }
389 } 390 }
390 else if (!isAcceptableAds(subscription.url)) 391 else if (!isAcceptableAds(subscription.url) && disabled == false)
391 { 392 {
392 collection = collections.custom; 393 collection = collections.more;
393 } 394 }
394 395
395 if (collection) 396 if (collection)
396 collection.addItem(subscription); 397 collection.addItem(subscription);
397 398
398 subscriptionsMap[subscription.url] = subscription; 399 subscriptionsMap[subscription.url] = subscription;
399 updateTooltips(); 400 updateTooltips();
400 } 401 }
401 402
402 function updateSubscription(subscription) 403 function updateSubscription(subscription)
403 { 404 {
404 for (let name in collections) 405 for (let name in collections)
405 collections[name].updateItem(subscription); 406 collections[name].updateItem(subscription);
406 407
407 if (subscription.recommended == "ads") 408 if (subscription.recommended == "ads")
408 { 409 {
409 if (subscription.disabled) 410 if (subscription.disabled)
410 collections.langs.removeItem(subscription); 411 collections.langs.removeItem(subscription);
411 else 412 else
412 collections.langs.addItem(subscription); 413 collections.langs.addItem(subscription);
413 } 414 }
414 else if (!subscription.recommended && !isAcceptableAds(subscription.url)) 415 else if (!subscription.recommended && !isAcceptableAds(subscription.url))
415 { 416 {
416 if (subscription.disabled == false) 417 if (subscription.disabled == false)
417 { 418 {
418 collections.custom.addItem(subscription); 419 collections.more.addItem(subscription);
419 updateTooltips(); 420 updateTooltips();
420 } 421 }
421 else 422 else
422 { 423 {
423 collections.custom.removeItem(subscription); 424 collections.more.removeItem(subscription);
424 } 425 }
425 } 426 }
426 } 427 }
427 428
428 function updateFilter(filter) 429 function updateFilter(filter)
429 { 430 {
430 let match = filter.text.match(whitelistedDomainRegexp); 431 let match = filter.text.match(whitelistedDomainRegexp);
431 if (match && !filtersMap[filter.text]) 432 if (match && !filtersMap[filter.text])
432 { 433 {
433 filter.title = match[1]; 434 filter.title = match[1];
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 } 1190 }
1190 else 1191 else
1191 { 1192 {
1192 delete subscriptionsMap[subscription.url]; 1193 delete subscriptionsMap[subscription.url];
1193 if (isAcceptableAds(subscription.url)) 1194 if (isAcceptableAds(subscription.url))
1194 { 1195 {
1195 setAcceptableAds(); 1196 setAcceptableAds();
1196 } 1197 }
1197 else 1198 else
1198 { 1199 {
1199 collections.custom.removeItem(subscription); 1200 collections.more.removeItem(subscription);
1200 } 1201 }
1201 } 1202 }
1202 collections.filterLists.removeItem(subscription); 1203 collections.filterLists.removeItem(subscription);
1203 break; 1204 break;
1204 } 1205 }
1205 1206
1206 } 1207 }
1207 1208
1208 function hidePref(key, value) 1209 function hidePref(key, value)
1209 { 1210 {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 }); 1333 });
1333 ext.backgroundPage.sendMessage({ 1334 ext.backgroundPage.sendMessage({
1334 type: "subscriptions.listen", 1335 type: "subscriptions.listen",
1335 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1336 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1336 "title", "downloadStatus", "downloading"] 1337 "title", "downloadStatus", "downloading"]
1337 }); 1338 });
1338 1339
1339 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1340 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1340 window.addEventListener("hashchange", onHashChange, false); 1341 window.addEventListener("hashchange", onHashChange, false);
1341 } 1342 }
OLDNEW
« no previous file with comments | « new-options.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld