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

Side by Side Diff: desktop-options.js

Issue 29572786: Issue 5842 - use specialization instead of translating the language (Closed)
Patch Set: Created Oct. 10, 2017, 5:22 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 | locale/en-US/desktop-options.json » ('j') | locale/en-US/desktop-options.json » ('J')
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 { 81 {
82 let access = (item.url || item.text).replace(/'/g, "\\'"); 82 let access = (item.url || item.text).replace(/'/g, "\\'");
83 return function(container) 83 return function(container)
84 { 84 {
85 return container.querySelector("[data-access='" + access + "']"); 85 return container.querySelector("[data-access='" + access + "']");
86 }; 86 };
87 }; 87 };
88 88
89 Collection.prototype._getItemTitle = function(item, i) 89 Collection.prototype._getItemTitle = function(item, i)
90 { 90 {
91 if (this.details[i].useSpecialization && item.specialization)
92 return item.specialization;
91 if (this.details[i].useOriginalTitle && item.originalTitle) 93 if (this.details[i].useOriginalTitle && item.originalTitle)
92 return item.originalTitle; 94 return item.originalTitle;
93 return item.title || item.url || item.text; 95 return item.title || item.url || item.text;
94 }; 96 };
95 97
96 Collection.prototype._sortItems = function() 98 Collection.prototype._sortItems = function()
97 { 99 {
98 this.items.sort((a, b) => 100 this.items.sort((a, b) =>
99 { 101 {
100 // Make sure that Acceptable Ads is always last, since it cannot be 102 // Make sure that Acceptable Ads is always last, since it cannot be
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 342 }
341 343
342 collections.protection = new Collection([ 344 collections.protection = new Collection([
343 { 345 {
344 id: "recommend-protection-list-table" 346 id: "recommend-protection-list-table"
345 } 347 }
346 ]); 348 ]);
347 collections.langs = new Collection([ 349 collections.langs = new Collection([
348 { 350 {
349 id: "blocking-languages-table", 351 id: "blocking-languages-table",
350 emptyTexts: ["options_language_empty"] 352 emptyTexts: ["options_language_empty"],
353 useSpecialization: true
351 } 354 }
352 ]); 355 ]);
353 collections.allLangs = new Collection([ 356 collections.allLangs = new Collection([
354 { 357 {
355 id: "all-lang-table-add", 358 id: "all-lang-table-add",
356 emptyTexts: ["options_dialog_language_other_empty"] 359 emptyTexts: ["options_dialog_language_other_empty"],
360 useSpecialization: true
357 } 361 }
358 ]); 362 ]);
359 collections.more = new Collection([ 363 collections.more = new Collection([
360 { 364 {
361 id: "more-list-table", 365 id: "more-list-table",
362 setEmptyAction: "hide-more-filters-section", 366 setEmptyAction: "hide-more-filters-section",
363 removeEmptyAction: "show-more-filters-section" 367 removeEmptyAction: "show-more-filters-section"
364 } 368 }
365 ]); 369 ]);
366 collections.whitelist = new Collection([ 370 collections.whitelist = new Collection([
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 { 494 {
491 let doc = new DOMParser().parseFromString(text, "application/xml"); 495 let doc = new DOMParser().parseFromString(text, "application/xml");
492 let elements = doc.documentElement.getElementsByTagName("subscription"); 496 let elements = doc.documentElement.getElementsByTagName("subscription");
493 for (let element of elements) 497 for (let element of elements)
494 { 498 {
495 let type = element.getAttribute("type"); 499 let type = element.getAttribute("type");
496 let subscription = { 500 let subscription = {
497 disabled: true, 501 disabled: true,
498 downloadStatus: null, 502 downloadStatus: null,
499 homepage: null, 503 homepage: null,
504 specialization: element.getAttribute("specialization"),
500 originalTitle: element.getAttribute("title"), 505 originalTitle: element.getAttribute("title"),
501 recommended: type, 506 recommended: type,
502 url: element.getAttribute("url") 507 url: element.getAttribute("url")
503 }; 508 };
504 509
505 let prefix = element.getAttribute("prefixes"); 510 let prefix = element.getAttribute("prefixes");
506 if (prefix) 511 if (prefix)
507 { 512 {
508 prefix = prefix.replace(/\W/g, "_"); 513 prefix = prefix.replace(/\W/g, "_");
509 subscription.title = getMessage("options_language_" + prefix); 514 subscription.title = getMessage("options_language_" + prefix);
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 }); 1380 });
1376 ext.backgroundPage.sendMessage({ 1381 ext.backgroundPage.sendMessage({
1377 type: "subscriptions.listen", 1382 type: "subscriptions.listen",
1378 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1383 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1379 "title", "downloadStatus", "downloading"] 1384 "title", "downloadStatus", "downloading"]
1380 }); 1385 });
1381 1386
1382 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1387 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1383 window.addEventListener("hashchange", onHashChange, false); 1388 window.addEventListener("hashchange", onHashChange, false);
1384 } 1389 }
OLDNEW
« no previous file with comments | « no previous file | locale/en-US/desktop-options.json » ('j') | locale/en-US/desktop-options.json » ('J')

Powered by Google App Engine
This is Rietveld