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

Side by Side Diff: options.js

Issue 8616118: Fixed: Options display doesn`t adapt correctly when a custom filter group is added/removed (Closed)
Patch Set: Created Oct. 22, 2012, 8:47 a.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 | « no previous file | 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 var backgroundPage = chrome.extension.getBackgroundPage(); 1 var backgroundPage = chrome.extension.getBackgroundPage();
2 var imports = ["FilterStorage", "FilterNotifier", "Subscription", "SpecialSubscr iption", 2 var imports = ["FilterStorage", "FilterNotifier", "Subscription", "SpecialSubscr iption",
3 "DownloadableSubscription", "Filter", "WhitelistFilter", 3 "DownloadableSubscription", "Filter", "WhitelistFilter",
4 "Synchronizer", "Prefs", "Utils", "require"]; 4 "Synchronizer", "Prefs", "Utils", "require"];
5 for (var i = 0; i < imports.length; i++) 5 for (var i = 0; i < imports.length; i++)
6 window[imports[i]] = backgroundPage[imports[i]]; 6 window[imports[i]] = backgroundPage[imports[i]];
7 7
8 // Loads options from localStorage and sets UI elements accordingly 8 // Loads options from localStorage and sets UI elements accordingly
9 function loadOptions() 9 function loadOptions()
10 { 10 {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 case "subscription.title": 350 case "subscription.title":
351 case "subscription.disabled": 351 case "subscription.disabled":
352 case "subscription.homepage": 352 case "subscription.homepage":
353 case "subscription.lastDownload": 353 case "subscription.lastDownload":
354 case "subscription.downloadStatus": 354 case "subscription.downloadStatus":
355 var element = findSubscriptionElement(item); 355 var element = findSubscriptionElement(item);
356 if (element) 356 if (element)
357 updateSubscriptionInfo(element); 357 updateSubscriptionInfo(element);
358 break; 358 break;
359 case "subscription.added": 359 case "subscription.added":
360 if (!(item instanceof SpecialSubscription) && !findSubscriptionElement(ite m)) 360 if (item instanceof SpecialSubscription)
361 { 361 {
362 if (item.url == Prefs.subscriptions_exceptionsurl) 362 for (var i = 0; i < item.filters.length; i++)
363 $("#acceptableAds").prop("checked", true); 363 onFilterChange("filter.added", item.filters[i]);
364 else
365 addSubscriptionEntry(item);
366 } 364 }
365 else if (item.url == Prefs.subscriptions_exceptionsurl)
366 $("#acceptableAds").prop("checked", true);
367 else if (!findSubscriptionElement(item))
368 addSubscriptionEntry(item);
367 break; 369 break;
368 case "subscription.removed": 370 case "subscription.removed":
369 if (item.url == Prefs.subscriptions_exceptionsurl) 371 if (item instanceof SpecialSubscription)
372 {
373 for (var i = 0; i < item.filters.length; i++)
374 onFilterChange("filter.removed", item.filters[i]);
375 }
376 else if (item.url == Prefs.subscriptions_exceptionsurl)
370 $("#acceptableAds").prop("checked", false); 377 $("#acceptableAds").prop("checked", false);
371 else 378 else
372 { 379 {
373 var element = findSubscriptionElement(item); 380 var element = findSubscriptionElement(item);
374 if (element) 381 if (element)
375 element.parentNode.removeChild(element); 382 element.parentNode.removeChild(element);
376 } 383 }
377 break; 384 break;
378 case "filter.added": 385 case "filter.added":
379 if (item instanceof WhitelistFilter && /^@@\|\|([^\/:]+)\^\$document$/.tes t(item.text)) 386 if (item instanceof WhitelistFilter && /^@@\|\|([^\/:]+)\^\$document$/.tes t(item.text))
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 if (subscription.disabled == !enabled.checked) 584 if (subscription.disabled == !enabled.checked)
578 return; 585 return;
579 586
580 subscription.disabled = !enabled.checked; 587 subscription.disabled = !enabled.checked;
581 }, false); 588 }, false);
582 589
583 updateSubscriptionInfo(element); 590 updateSubscriptionInfo(element);
584 591
585 document.getElementById("filterLists").appendChild(element); 592 document.getElementById("filterLists").appendChild(element);
586 } 593 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld