aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/plugin_admin.js
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-02-27 20:24:28 +0100
committerGitHub <noreply@github.com>2017-02-27 20:24:28 +0100
commit5978588578ca103152598ccfbe41019b12e00a4f (patch)
treeeedbb83c420f6af103440bcafbe6b79738ce7521 /inc/plugin_admin.js
parent9e5a37cc7f4eb1c83222a94eb83d4e99ce4460a4 (diff)
parent7dcbfde5ffbc057a44f710e3be7e4856d235e90b (diff)
downloadShaarli-5978588578ca103152598ccfbe41019b12e00a4f.tar.gz
Shaarli-5978588578ca103152598ccfbe41019b12e00a4f.tar.zst
Shaarli-5978588578ca103152598ccfbe41019b12e00a4f.zip
Merge pull request #754 from ArthurHoaro/webdesign2
New default template
Diffstat (limited to 'inc/plugin_admin.js')
-rw-r--r--inc/plugin_admin.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/inc/plugin_admin.js b/inc/plugin_admin.js
index 134ffb33..055ac285 100644
--- a/inc/plugin_admin.js
+++ b/inc/plugin_admin.js
@@ -22,14 +22,22 @@ function changePos(elem, toPos)
22function changeOrder(pos, move) 22function changeOrder(pos, move)
23{ 23{
24 var newpos = parseInt(pos) + move; 24 var newpos = parseInt(pos) + move;
25 var line = document.querySelector('[data-order="'+ pos +'"]'); 25 var lines = document.querySelectorAll('[data-order="'+ pos +'"]');
26 var changeline = document.querySelector('[data-order="'+ newpos +'"]'); 26 var changelines = document.querySelectorAll('[data-order="'+ newpos +'"]');
27 var parent = changeline.parentNode; 27
28 // If we go down reverse lines to preserve the rows order
29 if (move > 0) {
30 lines = [].slice.call(lines).reverse();
31 }
32
33 for (var i = 0 ; i < lines.length ; i++) {
34 var parent = changelines[0].parentNode;
35 changePos(lines[i], newpos);
36 changePos(changelines[i], parseInt(pos));
37 var changeItem = move < 0 ? changelines[0] : changelines[changelines.length - 1].nextSibling;
38 parent.insertBefore(lines[i], changeItem);
39 }
28 40
29 changePos(line, newpos);
30 changePos(changeline, parseInt(pos));
31 var changeItem = move < 0 ? changeline : changeline.nextSibling;
32 parent.insertBefore(line, changeItem);
33} 41}
34 42
35/** 43/**