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

Side by Side Diff: options.js

Issue 29339613: Issue 3907 - Make sure that the title of Acceptable Ads subscription used (Closed)
Patch Set: Created April 8, 2016, 4:47 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 { 58 {
59 var access = (item.url || item.text).replace(/'/g, "\\'"); 59 var access = (item.url || item.text).replace(/'/g, "\\'");
60 return function(container) 60 return function(container)
61 { 61 {
62 return container.querySelector("[data-access='" + access + "']"); 62 return container.querySelector("[data-access='" + access + "']");
63 }; 63 };
64 }; 64 };
65 65
66 Collection.prototype._getItemTitle = function(item, i) 66 Collection.prototype._getItemTitle = function(item, i)
67 { 67 {
68 var title = null; 68 if (item.url == acceptableAdsUrl)
69 if (this.details[i].useOriginalTitle) 69 return getMessage("options_acceptableAds_description");
70 title = item.originalTitle; 70 if (this.details[i].useOriginalTitle && item.originalTitle)
71 if (!title) 71 return item.originalTitle;
72 title = item.title || item.url || item.text; 72 return item.title || item.url || item.text;
73 return title;
74 }; 73 };
75 74
76 Collection.prototype.addItems = function() 75 Collection.prototype.addItems = function()
77 { 76 {
78 var length = Array.prototype.push.apply(this.items, arguments); 77 var length = Array.prototype.push.apply(this.items, arguments);
79 if (length == 0) 78 if (length == 0)
80 return; 79 return;
81 80
82 this.items.sort(function(a, b) 81 this.items.sort(function(a, b)
83 { 82 {
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 ext.backgroundPage.sendMessage( 864 ext.backgroundPage.sendMessage(
866 { 865 {
867 type: "prefs.get", 866 type: "prefs.get",
868 key: "subscriptions_exceptionsurl" 867 key: "subscriptions_exceptionsurl"
869 }, 868 },
870 function(url) 869 function(url)
871 { 870 {
872 acceptableAdsUrl = url; 871 acceptableAdsUrl = url;
873 updateSubscription({ 872 updateSubscription({
874 url: acceptableAdsUrl, 873 url: acceptableAdsUrl,
875 disabled: true, 874 disabled: true
876 title: getMessage("options_acceptableAds_description")
877 }); 875 });
878 876
879 // Load user subscriptions 877 // Load user subscriptions
880 ext.backgroundPage.sendMessage( 878 ext.backgroundPage.sendMessage(
881 { 879 {
882 type: "subscriptions.get", 880 type: "subscriptions.get",
883 downloadable: true 881 downloadable: true
884 }, 882 },
885 function(subscriptions) 883 function(subscriptions)
886 { 884 {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 }); 1151 });
1154 ext.backgroundPage.sendMessage( 1152 ext.backgroundPage.sendMessage(
1155 { 1153 {
1156 type: "subscriptions.listen", 1154 type: "subscriptions.listen",
1157 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1155 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1158 "title", "downloadStatus", "downloading"] 1156 "title", "downloadStatus", "downloading"]
1159 }); 1157 });
1160 1158
1161 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1159 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1162 })(); 1160 })();
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