Skip to content

Commit aad95d8

Browse files
committed
Added options page
1 parent 281fcb9 commit aad95d8

File tree

8 files changed

+184
-77
lines changed

8 files changed

+184
-77
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"role": "Developer"
1313
}
1414
],
15-
"version": "2.2.0",
15+
"version": "2.2.1",
1616
"repositories": [
1717
{
1818
"type": "composer",

localization/de_DE.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22
$labels = array();
3-
$labels['bookmarks'] = 'Bookmarks';
3+
$labels['bookmarks'] = 'Syncmarks';
44
$labels['bookmarks_new'] = 'Neuen URL hinzufügen';
55
$labels['bookmarks_url'] = 'Bitte den neuen URL eingeben:';
66
$labels['bookmarks_del'] = 'Soll das Bookmark "%b%" wirklich gelöscht werden?';
7+
$labels['bookmarks_not'] = 'Aktiviere Desktop Notifications';
78
?>

localization/en_US.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22
$labels = array();
3-
$labels['bookmarks'] = 'Bookmarks';
3+
$labels['bookmarks'] = 'Syncmarks';
44
$labels['bookmarks_new'] = 'Add new URL';
55
$labels['bookmarks_url'] = 'Please enter a new URL:';
66
$labels['bookmarks_del'] = 'Should the bookmark "%b%" really be deleted?';
7+
$labels['bookmarks_not'] = 'Enable Desktop Notifications';
78
?>

skins/elastic/plugin.css

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@
3333
background: #f4f4f4;
3434
top: 0;
3535
position: absolute;
36-
height: 18px;
36+
height: 25px;
3737
width: 100%;
3838
border: thin solid #d4dbde;
3939
right: 0;
4040
border-right: unset;
4141
text-align: center;
4242
vertical-align: middle;
43-
line-height: 15px;
43+
line-height: 25px;
4444
overflow: hidden;
45+
border-top: unset;
4546
}
4647
#bookmarks {
4748
display: block;
@@ -50,9 +51,9 @@
5051
bottom: 15px;
5152
transition: 1s;
5253
overflow: auto;
53-
top: 15px;
54+
top: 24px;
5455
background-color: #EEF3FA;
55-
padding-top: 10px;
56+
padding-top: 0;
5657
margin-bottom: 10px!important;
5758
right: 0;
5859
white-space: nowrap;
@@ -75,6 +76,9 @@
7576
color: #000;
7677
margin: 0;
7778
}
79+
#bookmarks h1 {
80+
display: none;
81+
}
7882
#bookmarks dd {
7983
display: none;
8084
}
@@ -103,10 +107,10 @@
103107
margin-left: -1px!important;
104108
}
105109
#bookmarks li.file a {
106-
background: url(images/globe.png) 0 0 no-repeat;
110+
background: url(images/globe.png) 2px 2px no-repeat;
107111
background-size: 13px;
108112
color: #000;
109-
padding-left: 21px;
113+
padding-left: 20px;
110114
text-decoration: none;
111115
display: block;
112116
white-space: nowrap;
@@ -137,13 +141,13 @@
137141
padding-left: 1px;
138142
}
139143
#bookmarks li label {
140-
background: url(images/folder-horizontal.png) 12px 2px no-repeat;
144+
background: url(images/folder-horizontal.png) 12px 0 no-repeat;
141145
cursor: pointer;
142146
display: block;
143147
padding-left: 35px;
144148
}
145149
#bookmarks li input:checked+ol {
146-
background: url(images/toggle-small.png) 40px 3px no-repeat;
150+
background: url(images/toggle-small.png) 39px 3px no-repeat;
147151
margin: -2em 0 0 -44px;
148152
padding: 1.563em 0 0 80px;
149153
height: auto;
@@ -154,4 +158,7 @@
154158
}
155159
#bookmarks li input:checked+ol>li:last-child {
156160
margin: 0 0 .063em;
161+
}
162+
.listing.iconized tr.syncmarks > td.section::before {
163+
content: "\f02e";
157164
}

skins/elastic/plugin.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

syncmarks.js

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
/**
22
* Roundcube Bookmarks Plugin
33
*
4-
* @version 2.2.0
4+
* @version 2.2.1
55
* @author Offerel
66
* @copyright Copyright (c) 2020, Offerel
77
* @license GNU General Public License, version 3
88
*/
9-
function h_del(t, o) {
9+
function h_del(t, o, format) {
1010
t.preventDefault();
11-
var e = rcmail.gettext("bookmarks_del", "syncmarks").replace("%b%", o.innerHTML);
11+
var e = rcmail.gettext("bookmarks_del", "syncmarks").replace("%b%", o.innerHTML);
1212
if (1 == confirm(e)) {
13-
var r = encodeURIComponent(o.href);
14-
rcmail.http_post("syncmarks/del_url", "_url=" + r + "&_format=html")
15-
}
16-
}
17-
18-
function j_del(t, o) {
19-
t.preventDefault();
20-
var e = rcmail.gettext("bookmarks_del", "syncmarks").replace("%b%", o.innerHTML);
21-
if (1 == confirm(e)) {
22-
var r = encodeURIComponent(o.href);
23-
rcmail.http_post("syncmarks/del_url", "_url=" + r + "&_format=json")
13+
let r = encodeURIComponent(o.href);
14+
let i = o.attributes['bid']['value'];
15+
rcmail.http_post("syncmarks/del_url", "_url=" + r + "&_format=" + format + "&_bid=" + i)
2416
}
2517
}
2618

@@ -33,14 +25,9 @@ function bookmarks_cmd() {
3325
}
3426
}
3527

36-
function add_url() {
37-
var t = encodeURIComponent(prompt(rcmail.gettext("bookmarks_url", "syncmarks")));
38-
0 < t.length && (t.startsWith("http") || t.startsWith("ftp")) && rcmail.http_post("syncmarks/add_url", "_url=" + t + "&_format=html")
39-
}
40-
41-
function jadd_url() {
42-
var t = encodeURIComponent(prompt(rcmail.gettext("bookmarks_url", "syncmarks")));
43-
0 < t.length && (t.startsWith("http") || t.startsWith("ftp")) && rcmail.http_post("syncmarks/add_url", "_url=" + t + "&_format=json")
28+
function add_url(format) {
29+
var t = encodeURIComponent(prompt(rcmail.gettext("bookmarks_url", "syncmarks")));
30+
0 < t.length && (t.startsWith("http") || t.startsWith("ftp")) && rcmail.http_post("syncmarks/add_url", "_url=" + t + "&_format=" + format)
4431
}
4532

4633
function urladded(t) {
@@ -50,13 +37,29 @@ function urladded(t) {
5037
function get_bookmarks(response) {
5138
bookmarks = JSON.parse(response.data);
5239

53-
if(response.message == 'php') {
54-
$('#bmframe').attr('srcdoc',bookmarks);
55-
document.getElementById("bookmarkpane").style.width = "300px";
40+
$('#bookmarkpane').html(bookmarks);
41+
document.getElementById("bookmarkpane").style.width = "300px";
42+
}
43+
44+
function en_noti() {
45+
if (!("Notification" in window)) {
46+
alert("This browser does not support desktop notification");
5647
}
57-
else {
58-
$('#bookmarkpane').html(bookmarks);
59-
document.getElementById("bookmarkpane").style.width = "300px";
48+
else if (Notification.permission === "granted") {
49+
var notification = new Notification("Syncmarks", {
50+
body: "Notifications are now enabled for Syncmarks.",
51+
icon: './plugins/syncmarks/bookmarks.png'
52+
});
53+
}
54+
else if (Notification.permission !== "denied") {
55+
Notification.requestPermission().then(function (permission) {
56+
if (permission === "granted") {
57+
var notification = new Notification("Syncmarks", {
58+
body: "Notifications are now enabled for Syncmarks.",
59+
icon: './plugins/syncmarks/bookmarks.png'
60+
});
61+
}
62+
});
6063
}
6164
}
6265

syncmarks.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)