Skip to content

Commit d19fb2a

Browse files
committed
Автокомплит URL'ов из истории (close #9), заготовка настроек (ref #7)
1 parent 47ca377 commit d19fb2a

8 files changed

+151
-76
lines changed

folder-form.css

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@import 'photon.css';
2+
3+
input[type='number'] {
4+
-moz-appearance: textfield;
5+
}
6+
7+
.doLeading {
8+
line-height: 180%;
9+
}
10+
11+
.warning {
12+
font-size: 75%;
13+
height: 20px;
14+
background-color: var(--yellow-50);
15+
display: none; /*none or initial*/
16+
padding: 6px 2px 3px 2px;
17+
}
18+
19+
.warning::before {
20+
content: url('icons/photon/warning-16.svg');
21+
position: relative;
22+
margin: 0px 2px 0px 2px;
23+
top: 2px;
24+
}
25+
26+
#bgcolorPicker {
27+
height: 24px;
28+
position: relative;
29+
top: 4px;
30+
}
31+
32+
#imgLocalBgSpinner {
33+
height: 25px;
34+
position: relative;
35+
top: 7px;
36+
display: none; /*none or initial*/
37+
}
38+
39+
#controlButtons {
40+
margin-top: 3px;
41+
margin-left: 2px;
42+
}

kbd-navigation.css

+34-28
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,71 @@
1111
}
1212

1313
#navCurtain {
14-
position: fixed;
15-
top: 0px;
16-
bottom: 0px;
17-
left: 0px;
18-
right: 0px;
19-
display: none;
20-
justify-content: center;
21-
align-items: center;
22-
z-index: 9999;
14+
all: initial;
15+
position: fixed;
16+
top: 0px;
17+
bottom: 0px;
18+
left: 0px;
19+
right: 0px;
20+
display: none;
21+
justify-content: center;
22+
align-items: center;
23+
z-index: 9999;
2324
}
2425

2526
#previewRect {
26-
min-width: 700px;
27-
max-width: 90%;
28-
height: auto; /*200px*/
29-
overflow: hidden;
30-
background-color: var(--grey-90-a90);
31-
display: flex;
32-
flex-direction: column;
33-
justify-content: center;
34-
align-items: center;
27+
all: initial;
28+
min-width: 700px;
29+
max-width: 90%;
30+
height: auto; /*200px*/
31+
overflow: hidden;
32+
background-color: var(--grey-90-a90);
33+
display: flex;
34+
flex-direction: column;
35+
justify-content: center;
36+
align-items: center;
3537
}
3638

3739
#addressLabel, #captionLabel {
38-
text-decoration: none;
39-
font-weight: normal;
40+
all: initial;
41+
text-decoration: none;
42+
font-weight: normal;
4043
}
4144

4245
#addressLabel {
43-
font-family: 'Fira Sans Heavy';
46+
font-family: 'Fira Sans Heavy';
4447
font-size: 40pt;
4548
text-shadow: 0px 0px 3px var(--white-100);
4649
color: transparent;
4750
-webkit-text-stroke: 2px black; /*Non-standard*/
4851
}
4952

5053
#miniature {
51-
width: 550px;
52-
height: 200px;
54+
all: initial;
55+
width: 550px;
56+
height: 200px;
5357
background-position: center top;
5458
background-repeat: no-repeat;
5559
background-size: cover;
5660
}
5761

5862
#iconPlusCaption {
59-
margin: 8px;
63+
all: initial;
64+
margin: 8px;
6065
}
6166

6267
#iconImg {
63-
height: 20px;
68+
all: initial;
69+
height: 20px;
6470
}
6571

6672
#iconImg[src=''] {
67-
display: none;
73+
display: none;
6874
}
6975

7076
#captionLabel {
71-
margin-left: 8px;
72-
font-family: 'Fira Sans';
77+
margin-left: 8px;
78+
font-family: 'Fira Sans';
7379
font-size: 16pt;
7480
color: var(--grey-10);
7581
}

manifest.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"version": "1.0",
66
"default_locale": "en",
77

8-
"permissions": ["storage", "tabs", "<all_urls>"],
8+
"permissions": ["storage", "history", "tabs", "<all_urls>"],
99

1010
"chrome_url_overrides":
1111
{
@@ -32,6 +32,12 @@
3232
}
3333
},
3434

35+
"options_ui":
36+
{
37+
"page": "options.html",
38+
"browser_style": true
39+
},
40+
3541
"web_accessible_resources": [
3642
"kbd-navigation.css",
3743
"icons/folder.svg",

mlsd.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
<legend id="bookmarkSettingsLabel"></legend>
3737
<p>
3838
<label id="urlLabel"></label>
39-
<input type="url" id="urlTf" name="url" size="80" placeholder="https://www.google.com/" required>
39+
<input type="url" id="urlTf" name="url" size="80" placeholder="https://www.google.com/" list="urlSuggectionsDL" autocomplete="off" required>
40+
<datalist id="urlSuggectionsDL">
41+
</datalist>
4042
</p>
4143
</fieldset>
4244
<fieldset id="folderSettings" disabled>
@@ -68,7 +70,7 @@
6870
</p>
6971
</fieldset>
7072
</fieldset>
71-
<div id="assignmentFormButtons">
73+
<div id="controlButtons">
7274
<input type="submit" id="okBtn">
7375
<input type="button" id="cancelBtn">
7476
</div>

mlsd.js

+22-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ window.onload = function() {
7070
browser.storage.local.get().then(function(all) { //DEBUG
7171
console.log("Stored data: ");
7272
for (let key in all) {
73-
console.log(key + " = " + all[key]);
73+
console.log(key, " = ", all[key]);
7474
}
7575
}, onPromiseFailed);
7676

@@ -184,6 +184,25 @@ window.onload = function() {
184184
item.oninput = onGridSizeChanged;
185185
});
186186

187+
document.getElementById("urlTf").oninput = function() {
188+
let urlSugDL = document.getElementById("urlSuggectionsDL");
189+
let urlTf = document.getElementById("urlTf");
190+
191+
urlSugDL.innerHTML = "";
192+
browser.history.search({
193+
text: urlTf.value,
194+
startTime: 0,
195+
maxResults: 20
196+
}).then(function(results) {
197+
urlSugDL.innerHTML = "";
198+
for (let item of results) {
199+
let option = document.createElement("option");
200+
option.value = item.url;
201+
urlSugDL.appendChild(option);
202+
}
203+
}, onPromiseFailed);
204+
}
205+
187206
document.getElementById("cancelBtn").onclick = hideAssignmentForm;
188207
}
189208

@@ -199,9 +218,9 @@ window.onload = function() {
199218
* @param mixed results Результат чтения
200219
*/
201220
function onStructureLoaded(results) {
202-
console.log("results in onStructureLoaded:")
221+
/*console.log("results in onStructureLoaded:")
203222
console.log(results);
204-
console.log("-- onStructureLoaded end --");
223+
console.log("-- onStructureLoaded end --");*/
205224
if (results.structure) {
206225
rootFolder = results.structure;
207226
} else {

options.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import 'folder-form.css';

options.html

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="stylesheet" type="text/css" href="options.css">
6+
<script type="module" src="mlsd.js"></script>
7+
</head>
8+
<body>
9+
<form method="post">
10+
<fieldset id="rootFolderSettings">
11+
<legend id="rootFolderTitle"></legend>
12+
<p>
13+
<label id="gridSizeLabel"></label>
14+
<input type="number" id="rowsSpin" name="gridSize" value="3" style="width: 30px;" min="1" max="30" required>
15+
<label> x </label>
16+
<input type="number" id="colsSpin" name="gridSize" value="3" style="width: 30px;" min="1" max="30" required>
17+
<input type="hidden" id="rowsOld">
18+
<input type="hidden" id="colsOld">
19+
<label id="elemsWillBeLostLabel" class="warning"></label>
20+
</p>
21+
<p>
22+
<label id="bgLabel"></label>
23+
<input type="hidden" id="bgimgBase64">
24+
<br><label id="defaultBgLabel" class="doLeading"><input type="radio" id="defaultBgRb" name="bgtype" value="DEFAULT"></label>
25+
<br><label id="colorBgLabel" class="doLeading"><input type="radio" id="colorBgRb" name="bgtype" value="SOLID"></label>
26+
<input type="color" id="bgcolorPicker" name="bgcolor" value="#F9F9FA" disabled>
27+
<br><label id="imgLocalBgLabel" class="doLeading"><input type="radio" id="imgLocalBgRb" name="bgtype" value="IMAGE_LOCAL"></label>
28+
<input type="file" id="bgimgPicker" name="bgimgLocal" accept="image/*" required disabled>
29+
<img id="imgLocalBgSpinner" src="icons/tail-spin.svg">
30+
<br><label id="imgRemoteBgLabel" class="doLeading"><input type="radio" id="imgRemoteBgRb" name="bgtype" value="IMAGE_REMOTE"></label>
31+
<input type="url" id="bgimgUrlTf" name="bgimgRemote" size="80" required pattern=".*\.+(png|jpg|jpeg|PNG|JPG|JPEG)" disabled>
32+
</p>
33+
</fieldset>
34+
<div id="controlButtons">
35+
<input type="submit" id="okBtn">
36+
<input type="button" id="defaultBtn">
37+
</div>
38+
</form>
39+
</body>
40+
</html>

style.css

+1-42
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import 'photon.css';
1+
@import 'folder-form.css';
22

33
@font-face {
44
font-family: 'Fira Sans Heavy';
@@ -18,29 +18,6 @@ body {
1818
background-color: var(--grey-10);
1919
}
2020

21-
input[type='number'] {
22-
-moz-appearance: textfield;
23-
}
24-
25-
.doLeading {
26-
line-height: 180%;
27-
}
28-
29-
.warning {
30-
font-size: 75%;
31-
height: 20px;
32-
background-color: var(--yellow-50);
33-
display: none; /*none or initial*/
34-
padding: 6px 2px 3px 2px;
35-
}
36-
37-
.warning::before {
38-
content: url('icons/photon/warning-16.svg');
39-
position: relative;
40-
margin: 0px 2px 0px 2px;
41-
top: 2px;
42-
}
43-
4421
.fullscreenElement {
4522
position: absolute;
4623
top: 0px;
@@ -220,21 +197,3 @@ td {
220197
.element:hover .elementNumber {
221198
opacity: 0.1;
222199
}
223-
224-
#bgcolorPicker {
225-
height: 24px;
226-
position: relative;
227-
top: 4px;
228-
}
229-
230-
#imgLocalBgSpinner {
231-
height: 25px;
232-
position: relative;
233-
top: 7px;
234-
display: none; /*none or initial*/
235-
}
236-
237-
#assignmentFormButtons {
238-
margin-top: 3px;
239-
margin-left: 2px;
240-
}

0 commit comments

Comments
 (0)