Commit c2a07b51 authored by Manvel Saroyan's avatar Manvel Saroyan

Issue 5873 - Show original subscription title in languages table

parent 6bffb724
......@@ -86,7 +86,7 @@
<ul class="list" id="recommend-protection-list-table">
<template>
<button data-action="toggle-remove-subscription" role="checkbox" class="control icon"></button>
<label class="display"></label>
<span data-display="title"></span>
<span data-tooltip="options_protection_%value%_tooltip"></span>
</template>
</ul>
......@@ -134,7 +134,12 @@
<div id="blocking-languages">
<ul id="blocking-languages-table" class="table list bottom-control">
<template>
<label class="display"></label>
<span>
<span data-display="title"></span>
<span class="dimmed">
(<span data-display="originalTitle"></span>)
</span>
</span>
<button data-single="hidden" data-action="remove-subscription" class="icon delete control" title="options_control_remove_title"></button>
<button data-single="visible" data-action="open-dialog" data-dialog="language-change" class="i18n_options_language_change link"></button>
</template>
......@@ -151,7 +156,7 @@
<div>
<ul id="more-list-table" class="table list">
<template>
<label class="display"></label>
<span data-display="title"></span>
<button data-action="remove-subscription" class="i18n_options_control_remove_title link control" title="options_control_remove_title"></button>
</template>
</ul>
......@@ -179,7 +184,7 @@
</form>
<ul id="whitelisting-table" class="table list">
<template>
<label class="display"></label>
<span data-display="title"></span>
<button data-action="remove-filter" class="icon delete control"
title="options_control_remove_title">
</button>
......@@ -199,17 +204,17 @@
<ul id="customize" class="list">
<li data-pref="shouldShowBlockElementMenu">
<button class="icon" role="checkbox" data-action="toggle-pref"></button>
<span class="i18n_options_customize_blockElement display"></span>
<span class="i18n_options_customize_blockElement" data-display="title"></span>
<span data-tooltip="options_customize_blockElement_tooltip"></span>
</li>
<li data-pref="show_devtools_panel">
<button class="icon" role="checkbox" data-action="toggle-pref"></button>
<span class="i18n_options_customize_showDevToolsPanel display"></span>
<span class="i18n_options_customize_showDevToolsPanel" data-display="title"></span>
<span data-tooltip="options_customize_showDevToolsPanel_tooltip"></span>
</li>
<li data-pref="notifications_ignoredcategories">
<button class="icon" role="checkbox" data-action="toggle-pref"></button>
<span class="i18n_options_customize_showNotifications display"></span>
<span class="i18n_options_customize_showNotifications" data-display="title"></span>
<span data-tooltip="options_customize_showNotifications_tooltip"></span>
</li>
</ul>
......@@ -242,7 +247,7 @@
</div>
</div>
<div class="col5">
<label class="display"></label>
<span data-display="originalTitle"></span>
</div>
<div class="col5">
<span class="last-update"></span>
......@@ -371,10 +376,20 @@
<ul id="all-lang-table-add" class="table list default-focus">
<template>
<button data-action="add-language-subscription,close-dialog" class="control icon add" role="checkbox">
<label class="display"></label>
<span>
<span data-display="title"></span>
<span class="dimmed">
(<span data-display="originalTitle"></span>)
</span>
</span>
</button>
<button data-action="change-language-subscription,close-dialog" class="control icon change" role="checkbox">
<label class="display"></label>
<span>
<span data-display="title"></span>
<span class="dimmed">
(<span data-display="originalTitle"></span>)
</span>
</span>
</button>
</template>
</ul>
......
......@@ -89,10 +89,8 @@
Collection.prototype._getItemTitle = function(item, i)
{
if (this.details[i].useSpecialization && item.specialization)
return item.specialization;
if (this.details[i].useOriginalTitle && item.originalTitle)
return item.originalTitle;
if (this.details[i].getTitleFunction)
return this.details[i].getTitleFunction(item);
return item.title || item.url || item.text;
};
......@@ -223,9 +221,14 @@
continue;
let title = this._getItemTitle(item, i);
let displays = element.querySelectorAll(".display");
let displays = element.querySelectorAll("[data-display]");
for (let j = 0; j < displays.length; j++)
displays[j].textContent = title;
{
if (item[displays[j].dataset.display])
displays[j].textContent = item[displays[j].dataset.display];
else
displays[j].textContent = title;
}
element.setAttribute("aria-label", title);
if (this.details[i].searchable)
......@@ -351,14 +354,14 @@
{
id: "blocking-languages-table",
emptyTexts: ["options_language_empty"],
useSpecialization: true
getTitleFunction: getLanguageTitle
}
]);
collections.allLangs = new Collection([
{
id: "all-lang-table-add",
emptyTexts: ["options_dialog_language_other_empty"],
useSpecialization: true
getTitleFunction: getLanguageTitle
}
]);
collections.more = new Collection([
......@@ -377,8 +380,7 @@
collections.filterLists = new Collection([
{
id: "all-filter-lists-table",
emptyTexts: ["options_filterList_empty"],
useOriginalTitle: true
emptyTexts: ["options_filterList_empty"]
}
]);
......@@ -485,6 +487,14 @@
customFiltersListElement.value = customFilters.join("\n");
}
function getLanguageTitle(item)
{
let title = item.specialization;
if (item.originalTitle && item.originalTitle.indexOf("+EasyList") > -1)
title += " + " + getMessage("options_english");
return title;
}
function loadRecommendations()
{
fetch("subscriptions.xml")
......
......@@ -147,6 +147,10 @@
"description": "More filters section note in General tab",
"message": "<strong>Note:</strong> You should only use third party filter lists from authors that you trust."
},
"options_english": {
"description": "Language section text inside 'Language' table and 'Select language' dialog in General tab",
"message": "English"
},
"options_language_add": {
"description": "Add other language button in General Tab",
"message": "+ add a language"
......
......@@ -887,12 +887,12 @@ ul.list
border-bottom: 0px;
}
li .display
.list li > span
{
margin: 0rem 1rem;
}
.table.list li .display
.table.list li > span
{
flex: 1;
margin: 0rem;
......@@ -982,7 +982,7 @@ li .display
-webkit-margin-end: 1.8rem;
}
.table.cols .display
.table.cols > span
{
margin: 0rem;
}
......@@ -1030,12 +1030,13 @@ li .display
background-color: #E1F2FA;
}
#dialog .table.list li button[aria-checked="true"]
#dialog .table.list li button[aria-checked="true"],
.table.list li .dimmed
{
color: #BBB;
}
#dialog .table.list li button .display
#dialog .table.list li button > span
{
flex: none;
margin: 0rem 0.8rem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment