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

Side by Side Diff: options.js

Issue 29333819: Issue 2375 - Implement "Blocking lists" section in new options page (Closed)
Patch Set: Created Jan. 18, 2016, 9:50 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
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 { 65 {
66 var item = arguments[i]; 66 var item = arguments[i];
67 var text = item.title || item.url || item.text; 67 var text = item.title || item.url || item.text;
68 var listItem = document.createElement("li"); 68 var listItem = document.createElement("li");
69 listItem.appendChild(document.importNode(template.content, true)); 69 listItem.appendChild(document.importNode(template.content, true));
70 listItem.setAttribute("data-access", item.url || item.text); 70 listItem.setAttribute("data-access", item.url || item.text);
71 listItem.querySelector(".display").textContent = text; 71 listItem.querySelector(".display").textContent = text;
72 if (text) 72 if (text)
73 listItem.setAttribute("data-search", text.toLowerCase()); 73 listItem.setAttribute("data-search", text.toLowerCase());
74 74
75 updateTimeDate(listItem, item);
75 var control = listItem.querySelector(".control"); 76 var control = listItem.querySelector(".control");
76 if (control) 77 if (control)
77 { 78 {
78 control.addEventListener("click", this.details[j].onClick, false); 79 control.addEventListener("click", this.details[j].onClick, false);
79 control.checked = item.disabled == false; 80 control.checked = item.disabled == false;
80 } 81 }
81 82
82 this._setEmpty(table, null); 83 this._setEmpty(table, null);
83 if (table.hasChildNodes()) 84 if (table.hasChildNodes())
84 table.insertBefore(listItem, table.childNodes[this.items.indexOf(item) ]); 85 {
86 var index = this.items.indexOf(item);
87 if (table.firstChild.classList.contains("head"))
88 index++;
89
90 table.insertBefore(listItem, table.childNodes[index]);
91 }
85 else 92 else
86 table.appendChild(listItem); 93 table.appendChild(listItem);
87 } 94 }
88 } 95 }
89 return length; 96 return length;
90 }; 97 };
91 98
92 Collection.prototype.removeItem = function(item) 99 Collection.prototype.removeItem = function(item)
93 { 100 {
94 var index = this.items.indexOf(item); 101 var index = this.items.indexOf(item);
95 if (index == -1) 102 if (index == -1)
96 return; 103 return;
97 104
98 this.items.splice(index, 1); 105 this.items.splice(index, 1);
106 var access = (item.url || item.text).replace(/'/g, "\\'");
Thomas Greiner 2016/01/19 11:27:28 I notice the issues with accessing elements by the
saroyanm 2016/01/22 09:55:08 Done, but wouldn't it be simpler to just have a pr
Thomas Greiner 2016/01/25 15:40:28 By returning a function we only create the "access
99 for (var i = 0; i < this.details.length; i++) 107 for (var i = 0; i < this.details.length; i++)
100 { 108 {
101 var table = E(this.details[i].id); 109 var table = E(this.details[i].id);
102 var element = table.childNodes[index]; 110 var element = table.querySelector("[data-access='" + access + "']");
103 element.parentElement.removeChild(element); 111 element.parentElement.removeChild(element);
104 if (this.items.length == 0) 112 if (this.items.length == 0)
105 this._setEmpty(table, this.details[i].emptyText); 113 this._setEmpty(table, this.details[i].emptyText);
106 } 114 }
107 }; 115 };
108 116
109 Collection.prototype.clearAll = function() 117 Collection.prototype.clearAll = function()
110 { 118 {
111 this.items = []; 119 this.items = [];
112 for (var i = 0; i < this.details.length; i++) 120 for (var i = 0; i < this.details.length; i++)
113 { 121 {
114 var table = E(this.details[i].id); 122 var table = E(this.details[i].id);
115 var template = table.querySelector("template"); 123 var template = table.querySelector("template");
124 var staticElements = [];
Thomas Greiner 2016/01/19 11:27:29 This logic is quite complicated. Assuming that you
saroyanm 2016/01/22 09:55:10 Currently we are not using createDocumentFragment
Thomas Greiner 2016/01/25 15:40:27 You could use `Element.nextElementSibling` to avoi
saroyanm 2016/01/26 18:36:15 I assume while you didn't commented under updated
Thomas Greiner 2016/01/27 17:16:56 Thanks for reminding me. I wrote down some parts t
125 var element = table.firstChild;
126 while (element)
127 {
128 if (element.tagName == "TEMPLATE" ||
129 (element.classList && element.classList.contains("static")))
130 staticElements.push(element);
131 element = element.nextSibling
132 }
133
116 table.innerHTML = ""; 134 table.innerHTML = "";
117 table.appendChild(template); 135 for (var j = 0; j < staticElements.length; j++)
136 table.appendChild(staticElements[j]);
137
118 this._setEmpty(table, this.details[i].emptyText); 138 this._setEmpty(table, this.details[i].emptyText);
119 } 139 }
120 }; 140 };
121 141
142 Collection.prototype.getTableIds = function()
Thomas Greiner 2016/01/19 11:27:29 This information is an implementation detail and s
saroyanm 2016/01/22 09:55:09 updated the method to check if the collection has
143 {
144 var ids = [];
145 for (var i = 0; i < this.details.length; i++)
146 ids.push(this.details[i].id)
147
148 return ids;
149 };
150
151 function updateTimeDate(listItem, subscription)
152 {
153 var dateElement = listItem.querySelector(".date");
154 var timeElement = listItem.querySelector(".time");
155
156 if(dateElement && timeElement)
157 {
158 if (subscription.downloadStatus &&
159 subscription.downloadStatus != "synchronize_ok")
160 {
161 var map =
162 {
163 "synchronize_invalid_url": "options_subscription_lastDownload_invalidU RL",
164 "synchronize_connection_error": "options_subscription_lastDownload_con nectionError",
165 "synchronize_invalid_data": "options_subscription_lastDownload_invalid Data",
166 "synchronize_checksum_mismatch": "options_subscription_lastDownload_ch ecksumMismatch"
167 };
168 if (subscription.downloadStatus in map)
169 timeElement.textContent = ext.i18n.getMessage(map[subscription.downloa dStatus]);
170 else
171 timeElement.textContent = subscription.downloadStatus;
172 }
173 else if (subscription.lastDownload > 0)
174 {
175 var timedate = i18n_timeDateStrings(subscription.lastDownload * 1000);
Thomas Greiner 2016/01/19 11:27:29 This function returns the localized date-time stri
saroyanm 2016/01/22 09:55:10 I see, I was trying to make it consistent with old
Thomas Greiner 2016/01/25 15:40:28 The mere formatting of the string should be generi
saroyanm 2016/01/26 18:36:15 Done.
176 if (timedate[1])
177 dateElement.textContent = timedate[1].split("/").reverse().join("-");
178 else
179 {
180 var today = new Date();
181 dateElement.textContent = today.getFullYear() + "-" +
182 today.getMonth()+1 + "-" + today.getDate();
183 }
184 var time = timedate[0].split(":");
185 time[2] = time[2].split(" ")[1];
186 if (time[2] == "AM" && time[0] == "12")
187 time[0] = 0;
188 else if (time[2] == "PM")
189 time[0] = parseInt(time[0]) + 12;
190
191 time.pop();
192 timeElement.textContent = time.join(":");
193 }
194 }
195 }
196
122 function onToggleSubscriptionClick(e) 197 function onToggleSubscriptionClick(e)
Thomas Greiner 2016/01/19 11:27:29 I'd suggest renaming this function to "toggleRemov
saroyanm 2016/01/22 09:55:08 Done.
123 { 198 {
124 e.preventDefault(); 199 e.preventDefault();
125 var subscriptionUrl = e.target.parentNode.getAttribute("data-access"); 200 var subscriptionUrl = e.target.parentNode.getAttribute("data-access");
126 if (!e.target.checked) 201 if (!e.target.checked)
127 { 202 {
128 ext.backgroundPage.sendMessage({ 203 ext.backgroundPage.sendMessage({
129 type: "subscriptions.remove", 204 type: "subscriptions.remove",
130 url: subscriptionUrl 205 url: subscriptionUrl
131 }); 206 });
132 } 207 }
133 else 208 else
134 addEnableSubscription(subscriptionUrl); 209 addEnableSubscription(subscriptionUrl);
135 } 210 }
136 211
212 function onToggleSubscriptionStateClick(e)
213 {
214 e.preventDefault();
215 var subscriptionUrl = e.target.parentNode.getAttribute("data-access");
Thomas Greiner 2016/01/19 11:27:29 What about reusing `getParentAccessElement()` sinc
saroyanm 2016/01/22 09:55:10 Done.
Thomas Greiner 2016/01/25 15:40:28 I don't see that you changed anything here.
saroyanm 2016/01/26 18:36:15 Now for sure, thanks.
216 ext.backgroundPage.sendMessage(
217 {
218 type: "subscriptions.toggleState",
219 url: subscriptionUrl
220 });
221 }
222
137 function onAddLanguageSubscriptionClick(e) 223 function onAddLanguageSubscriptionClick(e)
138 { 224 {
139 e.preventDefault(); 225 e.preventDefault();
140 var url = this.parentNode.getAttribute("data-access"); 226 var url = this.parentNode.getAttribute("data-access");
141 addEnableSubscription(url); 227 addEnableSubscription(url);
142 } 228 }
143 229
144 function onRemoveFilterClick() 230 function onRemoveFilterClick()
145 { 231 {
146 var filter = this.parentNode.getAttribute("data-access"); 232 var filter = this.parentNode.getAttribute("data-access");
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 onClick: onRemoveFilterClick 286 onClick: onRemoveFilterClick
201 } 287 }
202 ]); 288 ]);
203 collections.customFilters = new Collection( 289 collections.customFilters = new Collection(
204 [ 290 [
205 { 291 {
206 id: "custom-filters-table", 292 id: "custom-filters-table",
207 emptyText: "options_customFilters_empty" 293 emptyText: "options_customFilters_empty"
208 } 294 }
209 ]); 295 ]);
296 collections.blockingLists = new Collection(
297 [
298 {
299 id: "blocking-lists-table",
300 onClick: onToggleSubscriptionStateClick
301 }
302 ]);
210 303
211 function updateSubscription(subscription) 304 function observeSubscription(subscription)
212 { 305 {
213 var subscriptionUrl = subscription.url; 306 function onObjectChanged(change)
214 var knownSubscription = subscriptionsMap[subscriptionUrl];
215 if (knownSubscription)
216 knownSubscription.disabled = subscription.disabled;
217 else
218 { 307 {
219 getAcceptableAdsURL(function(acceptableAdsUrl) 308 for (var i = 0; i < change.length; i++)
220 { 309 {
221 function onObjectChanged() 310 var property = change[i].name;
311 if (property == "disabled")
222 { 312 {
223 var access = (subscriptionUrl || subscription.text).replace(/'/g, "\\' "); 313 var access = (subscription.url ||
314 subscription.text).replace(/'/g, "\\'");
224 var elements = document.querySelectorAll("[data-access='" + access + " ']"); 315 var elements = document.querySelectorAll("[data-access='" + access + " ']");
225 for (var i = 0; i < elements.length; i++) 316 for (var i = 0; i < elements.length; i++)
226 { 317 {
227 var element = elements[i]; 318 var element = elements[i];
319 var tableId = element.parentElement ? element.parentElement.id : "";
228 var control = element.querySelector(".control"); 320 var control = element.querySelector(".control");
229 if (control.localName == "input") 321 if (control && control.localName == "input")
230 control.checked = subscription.disabled == false; 322 control.checked = subscription.disabled == false;
231 if (subscriptionUrl in recommendationsMap) 323 if (subscription.url in recommendationsMap)
232 { 324 {
233 var recommendation = recommendationsMap[subscriptionUrl]; 325 var recommendation = recommendationsMap[subscription.url];
234 if (recommendation.type == "ads") 326 var langids = collections.langs.getTableIds();
327 var allLangIds = collections.allLangs.getTableIds();
328 if (recommendation.type == "ads" &&
329 langids.concat(allLangIds).indexOf(tableId) != -1)
235 { 330 {
236 if (subscription.disabled == false) 331 if (subscription.disabled == false)
237 { 332 {
238 collections.allLangs.removeItem(subscription); 333 collections.allLangs.removeItem(subscription);
239 collections.langs.addItems(subscription); 334 collections.langs.addItems(subscription);
240 } 335 }
241 else 336 else
242 { 337 {
243 collections.allLangs.addItems(subscription); 338 collections.allLangs.addItems(subscription);
244 collections.langs.removeItem(subscription); 339 collections.langs.removeItem(subscription);
245 } 340 }
246 } 341 }
247 } 342 }
248 } 343 }
249 } 344 }
345 else
346 {
347 var blockingListId = collections.blockingLists.details[0].id;
348 var blockingList = document.getElementById(blockingListId);
349 var listItem = blockingList.querySelector("[data-access='" +
350 subscription.url + "']");
351 updateTimeDate(listItem, subscription);
352 }
353 }
354 }
250 355
251 if (!Object.observe) 356 if (!Object.observe)
357 {
358 ["disabled", "lastDownload"].forEach(function(property)
359 {
360 subscription["$" + property] = subscription[property];
361 Object.defineProperty(subscription, property,
252 { 362 {
253 // Currently only "disabled" property of subscription used for observa tion 363 get: function()
254 // but with Advanced tab implementation we should also add more proper ties.
255 ["disabled"].forEach(function(property)
256 { 364 {
257 subscription["$" + property] = subscription[property]; 365 return this["$" + property];
258 Object.defineProperty(subscription, property, 366 },
259 { 367 set: function(value)
260 get: function() 368 {
261 { 369 this["$" + property] = value;
262 return this["$" + property]; 370 var change = Object.create(null);
263 }, 371 change.name = property;
264 set: function(value) 372 onObjectChanged([change]);
265 { 373 }
266 this["$" + property] = value; 374 });
267 onObjectChanged(); 375 });
268 } 376 }
269 }); 377 else
270 }); 378 {
271 } 379 Object.observe(subscription, onObjectChanged);
272 else 380 }
273 { 381 }
274 Object.observe(subscription, onObjectChanged);
275 }
276 382
383 function updateSubscription(subscription)
384 {
385 var subscriptionUrl = subscription.url;
386 var knownSubscription = subscriptionsMap[subscriptionUrl];
387 if (knownSubscription)
388 {
389 knownSubscription.disabled = subscription.disabled;
390 knownSubscription.lastDownload = subscription.lastDownload;
391 }
392 else
393 {
394 observeSubscription(subscription);
395 getAcceptableAdsURL(function(acceptableAdsUrl)
396 {
277 var collection = null; 397 var collection = null;
278 if (subscriptionUrl in recommendationsMap) 398 if (subscriptionUrl in recommendationsMap)
279 { 399 {
280 var recommendation = recommendationsMap[subscriptionUrl]; 400 var recommendation = recommendationsMap[subscriptionUrl];
281 if (recommendation.type != "ads") 401 if (recommendation.type != "ads")
282 collection = collections.popular; 402 collection = collections.popular;
283 else if (subscription.disabled == false) 403 else if (subscription.disabled == false)
284 collection = collections.langs; 404 collection = collections.langs;
285 else 405 else
286 collection = collections.allLangs; 406 collection = collections.allLangs;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 { 479 {
360 if (!element) 480 if (!element)
361 return; 481 return;
362 482
363 if (element.hasAttribute("data-action")) 483 if (element.hasAttribute("data-action"))
364 break; 484 break;
365 485
366 element = element.parentElement; 486 element = element.parentElement;
367 } 487 }
368 488
489 function getParentAccessElement()
Thomas Greiner 2016/01/19 11:27:30 Please avoid declaring functions inside other func
saroyanm 2016/01/22 09:55:09 Good point.
490 {
491 var elementCopy = element;
492 while (!elementCopy.dataset.access)
Thomas Greiner 2016/01/19 11:27:29 We can't use `Element.dataset` due to older Safari
saroyanm 2016/01/22 09:55:09 Right, done.
493 elementCopy = elementCopy.parentNode;
494
495 return elementCopy;
496 }
497
369 var actions = element.getAttribute("data-action").split(","); 498 var actions = element.getAttribute("data-action").split(",");
370 for (var i = 0; i < actions.length; i++) 499 for (var i = 0; i < actions.length; i++)
371 { 500 {
372 switch (actions[i]) 501 switch (actions[i])
373 { 502 {
374 case "add-domain-exception": 503 case "add-domain-exception":
375 addWhitelistedDomain(); 504 addWhitelistedDomain();
376 break; 505 break;
377 case "add-predefined-subscription": 506 case "add-predefined-subscription":
378 var dialog = E("dialog-content-predefined"); 507 var dialog = E("dialog-content-predefined");
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 { 541 {
413 type: "filters.importRaw", 542 type: "filters.importRaw",
414 text: E("custom-filters-raw").value 543 text: E("custom-filters-raw").value
415 }); 544 });
416 E("custom-filters").classList.remove("mode-edit"); 545 E("custom-filters").classList.remove("mode-edit");
417 break; 546 break;
418 case "switch-tab": 547 case "switch-tab":
419 document.body.setAttribute("data-tab", 548 document.body.setAttribute("data-tab",
420 element.getAttribute("data-tab")); 549 element.getAttribute("data-tab"));
421 break; 550 break;
551 case "update-all-subscriptions":
552 ext.backgroundPage.sendMessage(
553 {
554 type: "subscriptions.updateAll"
555 });
556 break;
557 case "open-context-menu":
Thomas Greiner 2016/01/19 11:27:29 We should improve this mechanism because it requir
saroyanm 2016/01/22 09:55:09 Done, but bit hacky, not sure if it's what you mea
Thomas Greiner 2016/01/27 17:16:56 Better but what about replacing it with "toggle-co
saroyanm 2016/01/28 17:00:10 Done.
558 var listItem = getParentAccessElement();
559 var contextMenu = listItem.querySelector(".content");
560 listItem.classList.add("context");
561
562 function mouseover()
563 {
564 contextMenu.addEventListener("mouseout", mouseout, false);
565 contextMenu.removeEventListener("mouseover", mouseover);
566 }
567 function mouseout(event)
568 {
569 if (event.target.parentElement != contextMenu)
570 {
571 var relatedTarget = event.relatedTarget;
572 if (relatedTarget.parentNode == this || relatedTarget == this)
573 return;
574 listItem.classList.remove("context");
575 contextMenu.removeEventListener("mouseout", mouseout);
576 }
577 }
578
579 contextMenu.addEventListener("mouseover", mouseover, false);
580 break;
581 case "update-now":
582 ext.backgroundPage.sendMessage(
583 {
584 type: "subscriptions.update",
585 url: getParentAccessElement().dataset.access
586 });
587 break;
588 case "website":
589 ext.backgroundPage.sendMessage(
590 {
591 type: "subscriptions.website",
592 url: getParentAccessElement().dataset.access
593 });
594 break;
595 case "source":
596 window.open(getParentAccessElement().dataset.access);
597 break;
598 case "delete":
599 ext.backgroundPage.sendMessage(
600 {
601 type: "subscriptions.remove",
602 url: getParentAccessElement().dataset.access
603 });
604 break;
422 } 605 }
423 } 606 }
424 } 607 }
425 608
426 function onDOMLoaded() 609 function onDOMLoaded()
427 { 610 {
428 var recommendationTemplate = document.querySelector("#recommend-list-table t emplate"); 611 function updateTemplate(template, selector, messageId)
Thomas Greiner 2016/01/19 11:27:29 This functionality belongs into "i18n.js". If elem
saroyanm 2016/01/22 09:55:08 Done.
429 var popularText = ext.i18n.getMessage("options_popular"); 612 {
430 recommendationTemplate.content.querySelector(".popular").textContent = popul arText; 613 template.content.querySelector(selector).
431 var languagesTemplate = document.querySelector("#all-lang-table template"); 614 textContent = ext.i18n.getMessage(messageId);
432 var buttonText = ext.i18n.getMessage("options_button_add"); 615 }
433 languagesTemplate.content.querySelector(".button-add span").textContent = bu ttonText; 616
617 var template = document.querySelector("#recommend-list-table template");
618 updateTemplate(template, ".popular", "options_popular");
619
620 template = document.querySelector("#all-lang-table template");
621 updateTemplate(template, ".button-add span", "options_button_add");
622
623 template = document.querySelector("#blocking-lists-table template");
624 updateTemplate(template, ".update-now", "options_blockingList_update_now");
625 updateTemplate(template, ".website", "options_blockingList_website");
626 updateTemplate(template, ".source", "options_blockingList_source");
627 updateTemplate(template, ".delete", "options_blockingList_delete");
434 628
435 populateLists(); 629 populateLists();
436 630
437 function onFindLanguageKeyUp() 631 function onFindLanguageKeyUp()
438 { 632 {
439 var searchStyle = E("search-style"); 633 var searchStyle = E("search-style");
440 if (!this.value) 634 if (!this.value)
441 searchStyle.innerHTML = ""; 635 searchStyle.innerHTML = "";
442 else 636 else
443 searchStyle.innerHTML = "#all-lang-table li:not([data-search*=\"" + this .value.toLowerCase() + "\"]) { display: none; }"; 637 searchStyle.innerHTML = "#all-lang-table li:not([data-search*=\"" + this .value.toLowerCase() + "\"]) { display: none; }";
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 updateShareLink(); 892 updateShareLink();
699 break; 893 break;
700 } 894 }
701 } 895 }
702 896
703 function onSubscriptionMessage(action, subscription) 897 function onSubscriptionMessage(action, subscription)
704 { 898 {
705 switch (action) 899 switch (action)
706 { 900 {
707 case "added": 901 case "added":
902 updateSubscription(subscription);
903 updateShareLink();
904
905 var knownSubscription = subscriptionsMap[subscription.url];
906 if (knownSubscription)
907 collections.blockingLists.addItems(knownSubscription);
908 else
909 collections.blockingLists.addItems(subscription);
910 break;
708 case "disabled": 911 case "disabled":
709 updateSubscription(subscription); 912 updateSubscription(subscription);
710 updateShareLink(); 913 updateShareLink();
711 break; 914 break;
915 case "updated":
916 updateSubscription(subscription);
Thomas Greiner 2016/01/19 11:27:29 That's not what "updated" is meant to notify you o
saroyanm 2016/01/22 09:55:10 Ahh right, thanks for pointing that out. Done.
917 break;
712 case "homepage": 918 case "homepage":
713 // TODO: NYI 919 // TODO: NYI
714 break; 920 break;
715 case "removed": 921 case "removed":
922 var knownSubscription = subscriptionsMap[subscription.url];
716 getAcceptableAdsURL(function(acceptableAdsUrl) 923 getAcceptableAdsURL(function(acceptableAdsUrl)
717 { 924 {
718 if (subscription.url == acceptableAdsUrl) 925 if (subscription.url == acceptableAdsUrl)
719 { 926 {
720 subscription.disabled = true; 927 subscription.disabled = true;
721 updateSubscription(subscription); 928 updateSubscription(subscription);
722 } 929 }
723 else 930 else
724 { 931 {
725 var knownSubscription = subscriptionsMap[subscription.url];
726 if (subscription.url in recommendationsMap) 932 if (subscription.url in recommendationsMap)
727 knownSubscription.disabled = true; 933 knownSubscription.disabled = true;
728 else 934 else
729 { 935 {
730 collections.custom.removeItem(knownSubscription); 936 collections.custom.removeItem(knownSubscription);
731 delete subscriptionsMap[subscription.url]; 937 delete subscriptionsMap[subscription.url];
732 } 938 }
733 } 939 }
734 updateShareLink(); 940 updateShareLink();
735 }); 941 });
942 collections.blockingLists.removeItem(knownSubscription);
736 break; 943 break;
737 case "title": 944 case "title":
738 // TODO: NYI 945 // TODO: NYI
739 break; 946 break;
740 } 947 }
741 } 948 }
742 949
743 function onShareLinkClick(e) 950 function onShareLinkClick(e)
744 { 951 {
745 e.preventDefault(); 952 e.preventDefault();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 filter: ["addSubscription", "error"] 1021 filter: ["addSubscription", "error"]
815 }); 1022 });
816 ext.backgroundPage.sendMessage( 1023 ext.backgroundPage.sendMessage(
817 { 1024 {
818 type: "filters.listen", 1025 type: "filters.listen",
819 filter: ["added", "loaded", "removed"] 1026 filter: ["added", "loaded", "removed"]
820 }); 1027 });
821 ext.backgroundPage.sendMessage( 1028 ext.backgroundPage.sendMessage(
822 { 1029 {
823 type: "subscriptions.listen", 1030 type: "subscriptions.listen",
824 filter: ["added", "disabled", "homepage", "removed", "title"] 1031 filter: ["added", "disabled", "updated", "homepage", "removed", "title"]
825 }); 1032 });
826 1033
827 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1034 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
828 })(); 1035 })();
OLDNEW

Powered by Google App Engine
This is Rietveld