aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
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 7a69d575..8a7409b2 100644
--- a/inc/shaarli.css
+++ b/inc/shaarli.css
@@ -1102,6 +1102,66 @@ ul.errors {
1102 float: left; 1102 float: left;
1103} 1103}
1104 1104
1105#pluginsadmin {
1106 width: 80%;
1107 padding: 20px 0 0 20px;
1108}
1109
1110#pluginsadmin section {
1111 padding: 20px 0;
1112}
1113
1114#pluginsadmin .plugin_parameters {
1115 margin: 10px 0;
1116}
1117
1118#pluginsadmin h1 {
1119 font-style: normal;
1120}
1121
1122#pluginsadmin h2 {
1123 font-size: 1.4em;
1124 font-weight: bold;
1125}
1126
1127#pluginsadmin table {
1128 width: 100%;
1129}
1130
1131#pluginsadmin table, #pluginsadmin th, #pluginsadmin td {
1132 border-width: 1px 0;
1133 border-style: solid;
1134 border-color: #c0c0c0;
1135}
1136
1137#pluginsadmin table th {
1138 font-weight: bold;
1139 padding: 10px 0;
1140}
1141
1142#pluginsadmin table td {
1143 padding: 5px 0;
1144}
1145
1146#pluginsadmin input[type=submit] {
1147 margin: 10px 0;
1148}
1149
1150#pluginsadmin .plugin_parameter {
1151 padding: 5px 0;
1152 border-width: 1px 0;
1153 border-style: solid;
1154 border-color: #c0c0c0;
1155}
1156
1157#pluginsadmin .float_label {
1158 float: left;
1159 width: 20%;
1160}
1161
1162#pluginsadmin a {
1163 color: black;
1164}
1105/* 404 page */ 1165/* 404 page */
1106.error-container { 1166.error-container {
1107 1167