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

Side by Side Diff: options.js

Issue 29339284: Issue 3884 - Show original subscription title in the Advanced tab of the options page (Closed)
Patch Set: Created April 1, 2016, 2:58 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 | « 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 /* 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 Collection.prototype.updateItem = function(item) 161 Collection.prototype.updateItem = function(item)
162 { 162 {
163 var access = (item.url || item.text).replace(/'/g, "\\'"); 163 var access = (item.url || item.text).replace(/'/g, "\\'");
164 for (var i = 0; i < this.details.length; i++) 164 for (var i = 0; i < this.details.length; i++)
165 { 165 {
166 var table = E(this.details[i].id); 166 var table = E(this.details[i].id);
167 var element = table.querySelector("[data-access='" + access + "']"); 167 var element = table.querySelector("[data-access='" + access + "']");
168 if (!element) 168 if (!element)
169 continue; 169 continue;
170 170
171 var title = item.title || item.url || item.text; 171 var title = null;
172 if (this.details[i].useOriginalTitle)
173 title = item.originalTitle;
174 if (!title)
175 title = item.title || item.url || item.text;
172 element.querySelector(".display").textContent = title; 176 element.querySelector(".display").textContent = title;
173 if (title) 177 if (title)
174 element.setAttribute("data-search", title.toLowerCase()); 178 element.setAttribute("data-search", title.toLowerCase());
175 var control = element.querySelector(".control[role='checkbox']"); 179 var control = element.querySelector(".control[role='checkbox']");
176 if (control) 180 if (control)
177 control.setAttribute("aria-checked", item.disabled == false); 181 control.setAttribute("aria-checked", item.disabled == false);
178 182
179 var downloadStatus = item.downloadStatus; 183 var downloadStatus = item.downloadStatus;
180 var dateElement = element.querySelector(".date"); 184 var dateElement = element.querySelector(".date");
181 var timeElement = element.querySelector(".time"); 185 var timeElement = element.querySelector(".time");
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 [ 355 [
352 { 356 {
353 id: "custom-filters-table", 357 id: "custom-filters-table",
354 emptyText: "options_customFilters_empty" 358 emptyText: "options_customFilters_empty"
355 } 359 }
356 ]); 360 ]);
357 collections.filterLists = new Collection( 361 collections.filterLists = new Collection(
358 [ 362 [
359 { 363 {
360 id: "all-filter-lists-table", 364 id: "all-filter-lists-table",
361 onClick: toggleDisableSubscription 365 onClick: toggleDisableSubscription,
366 useOriginalTitle: true
362 } 367 }
363 ]); 368 ]);
364 369
365 function observeSubscription(subscription) 370 function observeSubscription(subscription)
366 { 371 {
367 function onObjectChanged(change) 372 function onObjectChanged(change)
368 { 373 {
369 for (var i = 0; i < change.length; i++) 374 for (var i = 0; i < change.length; i++)
370 { 375 {
371 if (change[i].name == "disabled") 376 if (change[i].name == "disabled")
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 }) 486 })
482 .then(function(text) 487 .then(function(text)
483 { 488 {
484 var list = document.getElementById("subscriptionSelector"); 489 var list = document.getElementById("subscriptionSelector");
485 var doc = new DOMParser().parseFromString(text, "application/xml"); 490 var doc = new DOMParser().parseFromString(text, "application/xml");
486 var elements = doc.documentElement.getElementsByTagName("subscription"); 491 var elements = doc.documentElement.getElementsByTagName("subscription");
487 for (var i = 0; i < elements.length; i++) 492 for (var i = 0; i < elements.length; i++)
488 { 493 {
489 var element = elements[i]; 494 var element = elements[i];
490 var subscription = Object.create(null); 495 var subscription = Object.create(null);
491 subscription.title = element.getAttribute("title"); 496 subscription.originalTitle = element.getAttribute("title");
492 subscription.url = element.getAttribute("url"); 497 subscription.url = element.getAttribute("url");
493 subscription.disabled = null; 498 subscription.disabled = null;
494 subscription.downloadStatus = null; 499 subscription.downloadStatus = null;
495 subscription.homepage = null; 500 subscription.homepage = null;
496 var recommendation = Object.create(null); 501 var recommendation = Object.create(null);
497 recommendation.type = element.getAttribute("type"); 502 recommendation.type = element.getAttribute("type");
498 var prefix = element.getAttribute("prefixes"); 503 var prefix = element.getAttribute("prefixes");
499 if (prefix) 504 if (prefix)
500 { 505 {
501 prefix = prefix.replace(/\W/g, "_"); 506 prefix = prefix.replace(/\W/g, "_");
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 updateFilter(filters[i]); 846 updateFilter(filters[i]);
842 }); 847 });
843 } 848 }
844 }); 849 });
845 loadRecommendations(); 850 loadRecommendations();
846 getAcceptableAdsURL(function(acceptableAdsUrl) 851 getAcceptableAdsURL(function(acceptableAdsUrl)
847 { 852 {
848 var subscription = Object.create(null); 853 var subscription = Object.create(null);
849 subscription.url = acceptableAdsUrl; 854 subscription.url = acceptableAdsUrl;
850 subscription.disabled = true; 855 subscription.disabled = true;
851 subscription.title = getMessage("options_acceptableAds_description"); 856 subscription.title = getMessage("options_acceptableAds_description");
saroyanm 2016/04/01 15:17:50 I think we also should specify original title here
Sebastian Noack 2016/04/01 15:20:37 If I don't miss something we don't have the origin
saroyanm 2016/04/01 15:33:54 Well, currently AA title is "Allow non-intrusive a
Sebastian Noack 2016/04/01 15:55:02 Well, "Own filter list", referring to the Special
852 updateSubscription(subscription); 857 updateSubscription(subscription);
853 858
854 // Load user subscriptions 859 // Load user subscriptions
855 ext.backgroundPage.sendMessage( 860 ext.backgroundPage.sendMessage(
856 { 861 {
857 type: "subscriptions.get", 862 type: "subscriptions.get",
858 downloadable: true 863 downloadable: true
859 }, 864 },
860 function(subscriptions) 865 function(subscriptions)
861 { 866 {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 }); 1149 });
1145 ext.backgroundPage.sendMessage( 1150 ext.backgroundPage.sendMessage(
1146 { 1151 {
1147 type: "subscriptions.listen", 1152 type: "subscriptions.listen",
1148 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1153 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1149 "title"] 1154 "title"]
1150 }); 1155 });
1151 1156
1152 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1157 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1153 })(); 1158 })();
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