Skip to content

Commit cc324fb

Browse files
committed
Merge branch 'development'
2 parents fbbaed4 + d577dd1 commit cc324fb

File tree

6 files changed

+111
-25
lines changed

6 files changed

+111
-25
lines changed

wallabagger/_locales/ru/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
"description": "Options"
217217
},
218218
"Unread": {
219-
"message": "Нерочитано",
219+
"message": "Непрочитано",
220220
"description": "background"
221221
},
222222
"Unset_this_article_as_archived_into_Wallabag": {

wallabagger/js/background.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,19 @@ function onRuntimeConnect (port) {
310310
Port.onMessage.addListener(onPortMessage);
311311
}
312312

313+
function onRuntimeInstalled (details) {
314+
if (details.reason === 'install') {
315+
browser.tabs.create({
316+
url: chrome.runtime.getURL('/options.html')
317+
});
318+
}
319+
}
320+
313321
function addListeners () {
314322
browser.contextMenus.onClicked.addListener(onContextMenusClicked);
315323
browser.commands.onCommand.addListener(onCommandsCommand);
316324
browser.runtime.onConnect.addListener(onRuntimeConnect);
325+
browser.runtime.onInstalled.addListener(onRuntimeInstalled);
317326
}
318327

319328
const browserIcon = {
@@ -444,7 +453,7 @@ function savePageToWallabag (url, resetIcon) {
444453
postIfConnected({ response: 'article', article: cutArticle(data) });
445454
cache.set(url, cutArticle(data));
446455
saveExistFlag(url, existStates.exists);
447-
if (api.data.AllowExistCheck === false || resetIcon) {
456+
if (api.data.AllowExistCheck !== true || resetIcon) {
448457
browserIcon.timedToDefault();
449458
}
450459
} else {
@@ -484,7 +493,7 @@ const requestExists = (url) =>
484493
let icon = 'default';
485494
if (data.exists) {
486495
icon = 'good';
487-
if (api.data.AllowExistCheck === false) {
496+
if (api.data.AllowExistCheck !== true) {
488497
browserIcon.setTimed(icon);
489498
}
490499
}

wallabagger/js/options.js

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,26 +301,46 @@ OptionsController.prototype = {
301301

302302
checkUrlClick: function (e) {
303303
e.preventDefault();
304-
305-
if (this.wallabagurlinput_.value !== '') {
306-
this.wallabagurlinput_.value = this._urlSanitized(this.wallabagurlinput_.value);
307-
Object.assign(this.data, { Url: this.protocolLabel_.textContent + this.wallabagurlinput_.value });
304+
const urlDirty = this._getUrl();
305+
if (urlDirty !== '') {
306+
this._setProtocolCheck(urlDirty);
307+
this._setUrl(urlDirty);
308+
Object.assign(this.data, { Url: this.protocolLabel_.textContent + this._getUrl() });
308309
this.port.postMessage({request: 'setup-checkurl', data: this.data});
309310
}
310311
},
311312

312-
_urlSanitized: function (url) {
313-
return url.replace(/\/$/, '');
313+
_urlSanitized: function (urlDirty) {
314+
const url = urlDirty
315+
.replace(new RegExp(/^http(s?):\/\//, 'gm'), '')
316+
.replace(/\/$/, '');
317+
return url;
314318
},
315319

316-
setFields: function () {
320+
_setProtocolCheck (url) {
317321
const re = /^(http|https):\/\/(.*)/;
318-
if (re.test(this.data.Url)) {
319-
const res = re.exec(this.data.Url);
322+
if (re.test(url)) {
323+
const res = re.exec(url);
320324
this.protocolCheck_.checked = (res[1] === 'https');
321325
this.protocolLabel_.textContent = res[1] + '://';
322-
this.wallabagurlinput_.value = res[2];
323326
};
327+
},
328+
329+
_getUrl () {
330+
return this.wallabagurlinput_.value;
331+
},
332+
333+
_setUrl (urlDirty) {
334+
const url = this._urlSanitized(urlDirty);
335+
this.wallabagurlinput_.value = url;
336+
},
337+
338+
setFields: function () {
339+
const urlDirty = this.data.Url;
340+
if (typeof (urlDirty) === 'string' && urlDirty.length > 0) {
341+
this._setProtocolCheck(urlDirty);
342+
this._setUrl(urlDirty);
343+
}
324344

325345
if (this.wallabagurlinput_.value !== '') {
326346
this._show(this.tokenSection_);

wallabagger/manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Wallabagger",
33
"manifest_version": 2,
44
"default_locale": "en",
5-
"version": "1.6.0",
5+
"version": "1.7.0",
66
"description": "__MSG_Extension_description__",
77
"icons": {
88
"16": "img/wallabag-icon-48a.png",
@@ -28,7 +28,8 @@
2828
"contextMenus"
2929
],
3030
"options_ui": {
31-
"page": "options.html"
31+
"page": "options.html",
32+
"open_in_tab": true
3233
},
3334
"commands": {
3435
"_execute_browser_action": {

wallabagger/options.html

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,26 @@
44
<head>
55
<meta charset="utf-8" />
66
<title>Wallabagger options</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
78
<link rel="stylesheet" href="css/spectre.min.css">
89
<style>
9-
body { padding: 0 10px 10px; min-width: 800px; background-color: transparent; font-size: 1.3rem }
10+
body {
11+
display: flex;
12+
margin: 10px auto;
13+
max-width: 800px;
14+
flex-direction: column;
15+
background-color: transparent;
16+
font-size: 1.3rem;
17+
}
1018
form, section { margin-top: 5px; }
19+
.main-logo {
20+
margin: 0 auto;
21+
width: 64px;
22+
height: 64px;
23+
}
24+
.columns {
25+
display: block;
26+
}
1127
.btn,
1228
.form-input,
1329
.input-group .input-group-addon {
@@ -27,18 +43,57 @@
2743
.wallabag-url .form-input {
2844
max-width: 60%;
2945
}
46+
47+
.url-group {
48+
display: flex;
49+
min-width: 70%;
50+
flex-grow: 1;
51+
}
52+
53+
.wallabag-url-group {
54+
flex-wrap: wrap;
55+
}
56+
57+
.params-buttons {
58+
display: flex;
59+
flex-wrap: wrap;
60+
justify-content: space-around;
61+
}
62+
63+
.params-button {
64+
margin-bottom: 5px;
65+
}
66+
67+
@media (min-width: 500px) {
68+
.columns {
69+
display: flex;
70+
flex-wrap: wrap;
71+
justify-content: center;
72+
}
73+
74+
.main-column {
75+
min-width: 500px;
76+
}
77+
78+
.side-column {
79+
min-width: 300px;
80+
}
81+
}
3082
</style>
3183
</head>
3284

3385
<body>
86+
<img src="img/wallabag-icon-128.png" alt="wallabag logo" class="main-logo">
3487
<div class="columns">
35-
<div class="column col-6">
88+
<div class="column main-column">
3689
<form action="." id="wallabagurl-section">
3790
<div class="form-group">
3891
<label class="form-label" for="input-wallabagurl" data-i18n="Wallabag_URL">Wallabag URL</label>
39-
<div class="input-group wallabag-url">
40-
<span class="input-group-addon" id="input-group-wallabagurl">https://</span>
41-
<input class="form-input" type="text" id="input-wallabagurl" placeholder="app.wallabag.it" />
92+
<div class="input-group wallabag-url-group">
93+
<span class="url-group">
94+
<span class="input-group-addon" id="input-group-wallabagurl">https://</span>
95+
<input class="form-input wallabag-url" type="text" id="input-wallabagurl" placeholder="app.wallabag.it" />
96+
</span>
4297
<button class="btn input-group-btn" id="checkurl-button" data-i18n="Check_URL">Check URL</button>
4398

4499
</div>
@@ -83,7 +138,7 @@
83138

84139
</form>
85140
</div>
86-
<div class="column col-6">
141+
<div class="column side-column">
87142
<table class="table">
88143
<thead>
89144
<tr>
@@ -136,10 +191,10 @@
136191
</div>
137192
</div>
138193
</div>
139-
<div class="column col-12 pt-10">
140-
<button class="btn" id="clear-button" data-i18n="Reset_parameters">Reset parameters</button>
141-
<button class="btn" id="saveToFile-button" data-i18n="Save_to_file">Save to file</button>
142-
<button class="btn" id="loadFromFile-button" data-i18n="Load_from_file">Load from file</button>
194+
<div class="column col-12 pt-10 params-buttons">
195+
<button class="btn params-button" id="clear-button" data-i18n="Reset_parameters">Reset parameters</button>
196+
<button class="btn params-button" id="saveToFile-button" data-i18n="Save_to_file">Save to file</button>
197+
<button class="btn params-button" id="loadFromFile-button" data-i18n="Load_from_file">Load from file</button>
143198
<input type="file" style="display:none" id="openFile-dialog"/>
144199
</div>
145200

wallabagger/popup.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html>
33

44
<head>
5+
<meta charset="utf-8">
56
<title>Wallabagger</title>
67
<link rel="stylesheet" href="css/spectre.min.css">
78
<link rel="stylesheet" href="css/icomoon.css">

0 commit comments

Comments
 (0)