Skip to content

Commit

Permalink
Added options page
Browse files Browse the repository at this point in the history
  • Loading branch information
Offerel committed Jul 16, 2020
1 parent 281fcb9 commit aad95d8
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 77 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"role": "Developer"
}
],
"version": "2.2.0",
"version": "2.2.1",
"repositories": [
{
"type": "composer",
Expand Down
3 changes: 2 additions & 1 deletion localization/de_DE.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
$labels = array();
$labels['bookmarks'] = 'Bookmarks';
$labels['bookmarks'] = 'Syncmarks';
$labels['bookmarks_new'] = 'Neuen URL hinzufügen';
$labels['bookmarks_url'] = 'Bitte den neuen URL eingeben:';
$labels['bookmarks_del'] = 'Soll das Bookmark "%b%" wirklich gelöscht werden?';
$labels['bookmarks_not'] = 'Aktiviere Desktop Notifications';
?>
3 changes: 2 additions & 1 deletion localization/en_US.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
$labels = array();
$labels['bookmarks'] = 'Bookmarks';
$labels['bookmarks'] = 'Syncmarks';
$labels['bookmarks_new'] = 'Add new URL';
$labels['bookmarks_url'] = 'Please enter a new URL:';
$labels['bookmarks_del'] = 'Should the bookmark "%b%" really be deleted?';
$labels['bookmarks_not'] = 'Enable Desktop Notifications';
?>
23 changes: 15 additions & 8 deletions skins/elastic/plugin.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@
background: #f4f4f4;
top: 0;
position: absolute;
height: 18px;
height: 25px;
width: 100%;
border: thin solid #d4dbde;
right: 0;
border-right: unset;
text-align: center;
vertical-align: middle;
line-height: 15px;
line-height: 25px;
overflow: hidden;
border-top: unset;
}
#bookmarks {
display: block;
Expand All @@ -50,9 +51,9 @@
bottom: 15px;
transition: 1s;
overflow: auto;
top: 15px;
top: 24px;
background-color: #EEF3FA;
padding-top: 10px;
padding-top: 0;
margin-bottom: 10px!important;
right: 0;
white-space: nowrap;
Expand All @@ -75,6 +76,9 @@
color: #000;
margin: 0;
}
#bookmarks h1 {
display: none;
}
#bookmarks dd {
display: none;
}
Expand Down Expand Up @@ -103,10 +107,10 @@
margin-left: -1px!important;
}
#bookmarks li.file a {
background: url(images/globe.png) 0 0 no-repeat;
background: url(images/globe.png) 2px 2px no-repeat;
background-size: 13px;
color: #000;
padding-left: 21px;
padding-left: 20px;
text-decoration: none;
display: block;
white-space: nowrap;
Expand Down Expand Up @@ -137,13 +141,13 @@
padding-left: 1px;
}
#bookmarks li label {
background: url(images/folder-horizontal.png) 12px 2px no-repeat;
background: url(images/folder-horizontal.png) 12px 0 no-repeat;
cursor: pointer;
display: block;
padding-left: 35px;
}
#bookmarks li input:checked+ol {
background: url(images/toggle-small.png) 40px 3px no-repeat;
background: url(images/toggle-small.png) 39px 3px no-repeat;
margin: -2em 0 0 -44px;
padding: 1.563em 0 0 80px;
height: auto;
Expand All @@ -154,4 +158,7 @@
}
#bookmarks li input:checked+ol>li:last-child {
margin: 0 0 .063em;
}
.listing.iconized tr.syncmarks > td.section::before {
content: "\f02e";
}
2 changes: 1 addition & 1 deletion skins/elastic/plugin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 31 additions & 28 deletions syncmarks.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
/**
* Roundcube Bookmarks Plugin
*
* @version 2.2.0
* @version 2.2.1
* @author Offerel
* @copyright Copyright (c) 2020, Offerel
* @license GNU General Public License, version 3
*/
function h_del(t, o) {
function h_del(t, o, format) {
t.preventDefault();
var e = rcmail.gettext("bookmarks_del", "syncmarks").replace("%b%", o.innerHTML);
var e = rcmail.gettext("bookmarks_del", "syncmarks").replace("%b%", o.innerHTML);
if (1 == confirm(e)) {
var r = encodeURIComponent(o.href);
rcmail.http_post("syncmarks/del_url", "_url=" + r + "&_format=html")
}
}

function j_del(t, o) {
t.preventDefault();
var e = rcmail.gettext("bookmarks_del", "syncmarks").replace("%b%", o.innerHTML);
if (1 == confirm(e)) {
var r = encodeURIComponent(o.href);
rcmail.http_post("syncmarks/del_url", "_url=" + r + "&_format=json")
let r = encodeURIComponent(o.href);
let i = o.attributes['bid']['value'];
rcmail.http_post("syncmarks/del_url", "_url=" + r + "&_format=" + format + "&_bid=" + i)
}
}

Expand All @@ -33,14 +25,9 @@ function bookmarks_cmd() {
}
}

function add_url() {
var t = encodeURIComponent(prompt(rcmail.gettext("bookmarks_url", "syncmarks")));
0 < t.length && (t.startsWith("http") || t.startsWith("ftp")) && rcmail.http_post("syncmarks/add_url", "_url=" + t + "&_format=html")
}

function jadd_url() {
var t = encodeURIComponent(prompt(rcmail.gettext("bookmarks_url", "syncmarks")));
0 < t.length && (t.startsWith("http") || t.startsWith("ftp")) && rcmail.http_post("syncmarks/add_url", "_url=" + t + "&_format=json")
function add_url(format) {
var t = encodeURIComponent(prompt(rcmail.gettext("bookmarks_url", "syncmarks")));
0 < t.length && (t.startsWith("http") || t.startsWith("ftp")) && rcmail.http_post("syncmarks/add_url", "_url=" + t + "&_format=" + format)
}

function urladded(t) {
Expand All @@ -50,13 +37,29 @@ function urladded(t) {
function get_bookmarks(response) {
bookmarks = JSON.parse(response.data);

if(response.message == 'php') {
$('#bmframe').attr('srcdoc',bookmarks);
document.getElementById("bookmarkpane").style.width = "300px";
$('#bookmarkpane').html(bookmarks);
document.getElementById("bookmarkpane").style.width = "300px";
}

function en_noti() {
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
}
else {
$('#bookmarkpane').html(bookmarks);
document.getElementById("bookmarkpane").style.width = "300px";
else if (Notification.permission === "granted") {
var notification = new Notification("Syncmarks", {
body: "Notifications are now enabled for Syncmarks.",
icon: './plugins/syncmarks/bookmarks.png'
});
}
else if (Notification.permission !== "denied") {
Notification.requestPermission().then(function (permission) {
if (permission === "granted") {
var notification = new Notification("Syncmarks", {
body: "Notifications are now enabled for Syncmarks.",
icon: './plugins/syncmarks/bookmarks.png'
});
}
});
}
}

Expand Down
4 changes: 2 additions & 2 deletions syncmarks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aad95d8

Please sign in to comment.