Skip to content

Commit 492b7f5

Browse files
committed
Сокрытие вкладок при обновлении инфы, необязательные полномочия
1 parent c62b1aa commit 492b7f5

File tree

8 files changed

+211
-39
lines changed

8 files changed

+211
-39
lines changed

_locales/en/messages.json

+36-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
"extensionDescription":
88
{
9-
"message": "Organize frequently visited sites in a convenient menu of visual bookmarks\ninstead of a blank browser page. Bookmarks can be divided into folders, and\nfolders - into other folders. You can quickly open a bookmark or folder from\nany other tab using keyboard shortcuts. Each folder can be stylized. If you\ndonot want to draw attention to a bookmark, it is not necessary to hide it\nsomewhere far away, but you can only hide its preview and / or title and\narrange it as it conveniently does. The structure of the bookmarks can be\neasily synchronized between different devices or saved to disk.\n\nWhy does this extension needed various permissions?\n- Store unlimited amount of client-side data:\n - storing of information about bookmarks and folders;\n - storing of settings;\n- Access browsing history:\n - compiling a list of proposals during the creation of the bookmark;\n- Access browser tabs:\n - opening bookmarks in existing or new tabs;\n - processing keyboard shortcuts for navigating bookmarks from the keyboard;\n- Access data on other sites\n - retrieve information about pages while creating bookmarks (page title,\n icon, screenshot-preview);\n - placement on the pages of interface elements for navigation from the keyboard."
9+
"message": "Organize frequently visited sites in a convenient menu of visual bookmarks\ninstead of a blank browser page. Bookmarks can be divided into folders, and\nfolders - into other folders. You can quickly open a bookmark or folder from\nany other tab using keyboard shortcuts. Each folder can be stylized. If you\ndon't want to draw attention to a bookmark, it is not necessary to hide it\nsomewhere far away, but you can only hide its preview and/or title and\narrange it as it conveniently does. The structure of the bookmarks can be\neasily synchronized between different devices or saved to disk.\n\nWhy does this extension needed various permissions?\n- Store unlimited amount of client-side data:\n - storing of information about bookmarks and folders;\n - storing of settings;\n- Access browsing history:\n - compiling a list of proposals during the creation of the bookmark;\n- Access browser tabs:\n - opening bookmarks in existing or new tabs;\n - processing keyboard shortcuts for navigating bookmarks from the keyboard;\n- Access data on other sites (optional):\n - retrieve information about pages while creating bookmarks (page title,\n icon, screenshot-preview);\n - placement on the pages of interface elements for navigation from the\n keyboard;\n- Hide and show browser tabs:\n - request pages info (title, icon, preview screenshot) without displaying a\n new tab on the tabs panel when creating or updating bookmarks."
1010
},
1111

1212
"developerName":
@@ -262,5 +262,40 @@
262262
"noStructureInSync":
263263
{
264264
"message": "No bookmarks structure found in remote storage"
265+
},
266+
267+
"permissionsSettings":
268+
{
269+
"message": "Extension extra permissions"
270+
},
271+
272+
"historyPermission":
273+
{
274+
"message": "Access browsing history - when you will enter bookmark's URL, there will be suggested variants from browsing history"
275+
},
276+
277+
"tabHidePermission":
278+
{
279+
"message": "Hide and show browser tabs - when you're creating or updating bookmarks, request pages info (title, icon, preview screenshot) will be carried out without displaying a new tab on the tabs panel"
280+
},
281+
282+
"permissionEnable":
283+
{
284+
"message": "Enable"
285+
},
286+
287+
"permissionDisable":
288+
{
289+
"message": "Disable"
290+
},
291+
292+
"permissionEnabled":
293+
{
294+
"message": "ENABLED"
295+
},
296+
297+
"permissionDisabled":
298+
{
299+
"message": "DISABLED"
265300
}
266301
}

_locales/ru/messages.json

+36-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
"extensionDescription":
88
{
9-
"message": "Организуй часто посещаемые сайты в удобное меню визуальных закладкок вместо\nпустой страницы браузера. Закладки можно собирать в папки, а папки - в другие\nпапки. Быстро открыть закладку или папку можно с любой другой вкладки,\nиспользуя сочетания клавиш на клавиатуре. Каждую папку можно стилизовать.\nЕсли не хочешь привлекать внимание к какой-либо закладке, её не обязательно\nпрятать куда-нибудь подальше, а можно лишь скрыть её превью и/или заголовок\nи расположить так, как бдует удобно. Структуру закладок можно лекго\nсинхронизировать между разными устройствами или сохранить на диск.\n\nЗачем этому расширению различные полномочия?\n- Хранение неограниченного количества клиентских данных:\n - хранение информации о закладках и папках;\n - хранение настроек;\n- Доступ к истории просмотров:\n - составление списка предложений во время сздания закладки;\n- Доступ ко вкладкам браузера:\n - открытие закладок в существующих или новых вкладках;\n - обработка сочетаний клавиш для навигации по закладкам с клавиатуры;\n- Доступ к данным других сайтов\n - получение информации о страницах во время создания закладок (заголовок\n страницы, иконка, скриншот-превью);\n - размещение на страницах элементов интерфейса для навигации с клавиатуры."
9+
"message": "Организуй часто посещаемые сайты в удобное меню визуальных закладкок вместо\nпустой страницы браузера. Закладки можно собирать в папки, а папки - в другие\nпапки. Быстро открыть закладку или папку можно с любой другой вкладки,\nиспользуя сочетания клавиш на клавиатуре. Каждую папку можно стилизовать.\nЕсли не хочешь привлекать внимание к какой-либо закладке, её не обязательно\nпрятать куда-нибудь подальше, а можно лишь скрыть её превью и/или заголовок\nи расположить так, как бдует удобно. Структуру закладок можно лекго\nсинхронизировать между разными устройствами или сохранить на диск.\n\nЗачем этому расширению различные полномочия?\n- Хранение неограниченного количества клиентских данных:\n - хранение информации о закладках и папках;\n - хранение настроек;\n- Доступ к истории просмотров:\n - составление списка предложений во время создания закладки;\n- Доступ ко вкладкам браузера:\n - открытие закладок в существующих или новых вкладках;\n - обработка сочетаний клавиш для навигации по закладкам с клавиатуры;\n- Доступ к данным других сайтов (не обязательно):\n - получение информации о страницах во время создания закладок (заголовок\n страницы, иконка, скриншот-превью);\n - размещение на страницах элементов интерфейса для навигации с клавиатуры;\n- Сокрытие и отображение вкладок (не обязательно):\n - запрос информации о страницах (заголовка, иконки, скриншота-превью) при\n создании и обновлении закладок без отображения новой вкладки на панели\n вкладок."
1010
},
1111

1212
"developerName":
@@ -262,5 +262,40 @@
262262
"noStructureInSync":
263263
{
264264
"message": "Структура закладок не найдена в удалённом хранилище"
265+
},
266+
267+
"permissionsSettings":
268+
{
269+
"message": "Дополнительные полномочия расширения"
270+
},
271+
272+
"historyPermission":
273+
{
274+
"message": "Доступ к истории просмотров - во время ввода URL закладки будут предлагаться варианты из истории просмотров"
275+
},
276+
277+
"tabHidePermission":
278+
{
279+
"message": "Сокрытие вкладок браузера - запрос информации о страницах (заголовка, иконки, скриншота-превью) при создании и обновлении закладок будет происходить без отображения новой вкладки на панели вкладок"
280+
},
281+
282+
"permissionEnable":
283+
{
284+
"message": "Включить"
285+
},
286+
287+
"permissionDisable":
288+
{
289+
"message": "Отключить"
290+
},
291+
292+
"permissionEnabled":
293+
{
294+
"message": "ВКЛЮЧЕНО"
295+
},
296+
297+
"permissionDisabled":
298+
{
299+
"message": "ОТКЛЮЧЕНО"
265300
}
266301
}

elements/Bookmark.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ Bookmark.prototype.getInnerHtml = function () {
102102
* {@link FilledElement.prototype.refresh}
103103
*/
104104
Bookmark.prototype.refresh = function() {
105+
document.getElementById(StrongString.NUMBER +
106+
StrongString.SEPARATOR + this.number).
107+
textContent = "...";
108+
105109
FilledElement.prototype.refresh.call(this);
106110
getPagePreviewInfo(this.url).then(function(data) {
107111
this.caption = data.title;
@@ -110,5 +114,9 @@ Bookmark.prototype.refresh = function() {
110114
overwriteElement(currPath, this);
111115
//getFolderByPath(currPath).elements[this.number - 1] = this;
112116
//rebuildElement(this);
113-
}.bind(this), onPromiseFailed);
117+
}.bind(this), onPromiseFailed). then(function() {
118+
document.getElementById(StrongString.NUMBER +
119+
StrongString.SEPARATOR + this.number).
120+
textContent = this.number;
121+
}.bind(this));
114122
}

manifest.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
"200": "icons/icon.svg"
4141
},
4242

43-
"permissions": ["storage", "history", "tabs", "<all_urls>"],
43+
"permissions": ["storage", "tabs", "<all_urls>"],
44+
45+
"optional_permissions": ["history", "tabHide"],
4446

4547
"chrome_url_overrides":
4648
{
@@ -63,7 +65,7 @@
6365
"gecko":
6466
{
6567
"id": "multilevelspeeddial@mozilla.org",
66-
"strict_min_version": "42.0"
68+
"strict_min_version": "61.0"
6769
}
6870
},
6971

mlsd.js

+22-13
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,24 @@ window.onload = function() {
127127
let urlTf = document.getElementById("urlTf");
128128

129129
urlSugDL.innerHTML = "";
130-
browser.history.search({
131-
text: urlTf.value,
132-
startTime: 0,
133-
maxResults: 20
134-
}).then(function(results) {
135-
urlSugDL.innerHTML = "";
136-
for (let item of results) {
137-
let option = document.createElement("option");
138-
option.value = item.url;
139-
urlSugDL.appendChild(option);
130+
browser.permissions.contains({
131+
permissions: ["history"]
132+
}).then(function(granted) {
133+
if (granted) {
134+
browser.history.search({
135+
text: urlTf.value,
136+
startTime: 0,
137+
maxResults: 20
138+
}).then(function(results) {
139+
urlSugDL.innerHTML = "";
140+
for (let item of results) {
141+
let option = document.createElement("option");
142+
option.value = item.url;
143+
urlSugDL.appendChild(option);
144+
}
145+
}, onPromiseFailed);
140146
}
141-
}, onPromiseFailed);
147+
});
142148
}
143149

144150
document.getElementById("cancelBtn").onclick = hideAssignmentForm;
@@ -638,8 +644,11 @@ export function getPagePreviewInfo(url) {
638644
return new Promise((resolve, reject) => {
639645
let result;
640646
browser.tabs.create({url: url, active: false}).then(function(tab) {
641-
//TODO: hide() на данный момент является эксперементальной функцией, стоит ли дождаться релиза?
642-
//browser.tabs.hide(tab.id);
647+
browser.permissions.contains({permissions: ["tabHide"]}).then(function(granted) {
648+
if (granted) {
649+
browser.tabs.hide(tab.id);
650+
}
651+
});
643652
let handledOnce = false;
644653
let handler = function(tabId, changeInfo, tabInfo) {
645654
if (!handledOnce && tabId == tab.id && changeInfo.status && changeInfo.status == "complete") {

options.css

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
@import 'folder-form.css';
22

3+
body {
4+
background-color: var(--grey-10);
5+
}
6+
37
label.description {
4-
font-size: 13px;
8+
font-size: 13px;
59
}
610

711
#structureManagingForm input[type="button"] {
8-
width: 250px;
12+
width: 250px;
913
}
1014

1115
#jsonStructureTa {
12-
resize: none;
16+
resize: none;
17+
}
18+
19+
#historyPermissionStatusLabel,
20+
#tabHidePermissionStatusLabel {
21+
font-style: bold;
22+
margin-left: 8px;
23+
}
24+
25+
#historyPermissionStatusLabel[tag="enabled"],
26+
#tabHidePermissionStatusLabel[tag="enabled"] {
27+
color: darkgreen;
28+
}
29+
30+
#historyPermissionStatusLabel[tag="disabled"],
31+
#tabHidePermissionStatusLabel[tag="disabled"] {
32+
color: darkred;
1333
}

options.html

+14
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77
</head>
88
<body>
99
<div style="width: 800px;">
10+
<form id="permissionsSettingsForm">
11+
<fieldset id="permissionsSettings">
12+
<legend id="permissionsSettingsLabel"></legend>
13+
<p>
14+
<label id="historyPermissionLabel"></label>
15+
<br><input type="button" id="historyPermissionBtn" disabled="true"><label id="historyPermissionStatusLabel">...</label>
16+
</p>
17+
<p>
18+
<label id="tabHidePermissionLabel"></label>
19+
<br><input type="button" id="tabHidePermissionBtn" disabled="true"><label id="tabHidePermissionStatusLabel">...</label>
20+
</p>
21+
</fieldset>
22+
</form>
23+
<hr width="0">
1024
<form id="folderSettingsForm" method="post">
1125
<fieldset id="folderSettings">
1226
<legend id="rootFolderSettingsLabel"></legend>

0 commit comments

Comments
 (0)