aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-11-18 17:40:42 +0100
committerArthurHoaro <arthur@hoa.ro>2016-01-31 18:54:48 +0100
commitdea0ba28f950867532eae572e7bcda49e81bbcf0 (patch)
tree8a9c4f9d7525a2ba249bbaaabe456c2d0941293b /inc
parent423e2a8b13dc0069c83f3e540f576aa1b89fe5d5 (diff)
downloadShaarli-dea0ba28f950867532eae572e7bcda49e81bbcf0.tar.gz
Shaarli-dea0ba28f950867532eae572e7bcda49e81bbcf0.tar.zst
Shaarli-dea0ba28f950867532eae572e7bcda49e81bbcf0.zip
Fixes #378 - Plugin administration UI.
Diffstat (limited to 'inc')
-rw-r--r--inc/plugin_admin.js67
-rw-r--r--inc/shaarli.css60
2 files changed, 127 insertions, 0 deletions
diff --git a/inc/plugin_admin.js b/inc/plugin_admin.js
new file mode 100644
index 00000000..134ffb33
--- /dev/null
+++ b/inc/plugin_admin.js
@@ -0,0 +1,67 @@
1/**
2 * Change the position counter of a row.
3 *
4 * @param elem Element Node to change.
5 * @param toPos int New position.
6 */
7function changePos(elem, toPos)
8{
9 var elemName = elem.getAttribute('data-line')
10
11 elem.setAttribute('data-order', toPos);
12 var hiddenInput = document.querySelector('[name="order_'+ elemName +'"]');
13 hiddenInput.setAttribute('value', toPos);
14}
15
16/**
17 * Move a row up or down.
18 *
19 * @param pos Element Node to move.
20 * @param move int Move: +1 (down) or -1 (up)
21 */
22function changeOrder(pos, move)
23{
24 var newpos = parseInt(pos) + move;
25 var line = document.querySelector('[data-order="'+ pos +'"]');
26 var changeline = document.querySelector('[data-order="'+ newpos +'"]');
27 var parent = changeline.parentNode;
28
29 changePos(line, newpos);
30 changePos(changeline, parseInt(pos));
31 var changeItem = move < 0 ? changeline : changeline.nextSibling;
32 parent.insertBefore(line, changeItem);
33}
34
35/**
36 * Move a row up in the table.
37 *
38 * @param pos int row counter.
39 *
40 * @returns false
41 */
42function orderUp(pos)
43{
44 if (pos == 0) {
45 return false;
46 }
47 changeOrder(pos, -1);
48 return false;
49}
50
51/**
52 * Move a row down in the table.
53 *
54 * @param pos int row counter.
55 *
56 * @returns false
57 */
58function orderDown(pos)
59{
60 var lastpos = document.querySelector('[data-order]:last-child').getAttribute('data-order');
61 if (pos == lastpos) {
62 return false;
63 }
64
65 changeOrder(pos, +1);
66 return false;
67}
diff --git a/inc/shaarli.css b/inc/shaarli.css
index 96e2cae1..f137555e 100644
--- a/inc/shaarli.css
+++ b/inc/shaarli.css
@@ -1103,6 +1103,66 @@ ul.errors {
1103 float: left; 1103 float: left;
1104} 1104}
1105 1105
1106#pluginsadmin {
1107 width: 80%;
1108 padding: 20px 0 0 20px;
1109}
1110
1111#pluginsadmin section {
1112 padding: 20px 0;
1113}
1114
1115#pluginsadmin .plugin_parameters {
1116 margin: 10px 0;
1117}
1118
1119#pluginsadmin h1 {
1120 font-style: normal;
1121}
1122
1123#pluginsadmin h2 {
1124 font-size: 1.4em;
1125 font-weight: bold;
1126}
1127
1128#pluginsadmin table {
1129 width: 100%;
1130}
1131
1132#pluginsadmin table, #pluginsadmin th, #pluginsadmin td {
1133 border-width: 1px 0;
1134 border-style: solid;
1135 border-color: #c0c0c0;
1136}
1137
1138#pluginsadmin table th {
1139 font-weight: bold;
1140 padding: 10px 0;
1141}
1142
1143#pluginsadmin table td {
1144 padding: 5px 0;
1145}
1146
1147#pluginsadmin input[type=submit] {
1148 margin: 10px 0;
1149}
1150
1151#pluginsadmin .plugin_parameter {
1152 padding: 5px 0;
1153 border-width: 1px 0;
1154 border-style: solid;
1155 border-color: #c0c0c0;
1156}
1157
1158#pluginsadmin .float_label {
1159 float: left;
1160 width: 20%;
1161}
1162
1163#pluginsadmin a {
1164 color: black;
1165}
1106/* 404 page */ 1166/* 404 page */
1107.error-container { 1167.error-container {
1108 1168