summaryrefslogtreecommitdiffstats
path: root/modules-available/sysconfig/clientscript.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/sysconfig/clientscript.js')
-rw-r--r--modules-available/sysconfig/clientscript.js170
1 files changed, 96 insertions, 74 deletions
diff --git a/modules-available/sysconfig/clientscript.js b/modules-available/sysconfig/clientscript.js
index 1553d678..cafe7b02 100644
--- a/modules-available/sysconfig/clientscript.js
+++ b/modules-available/sysconfig/clientscript.js
@@ -1,88 +1,110 @@
// Mouseover and clicking
-var $ct = $('#conftable').find('.confrow');
-$ct.click(function() {
- showmod(this, 'bold');
-}).mouseenter(function() {
- showmod(this, 'fade');
-}).mouseleave(function() {
- showmod(this, 'reset');
-});
-var $mt = $('#modtable').find('.modrow');
-$mt.click(function() {
- showconf(this, 'bold');
-}).mouseenter(function() {
- showconf(this, 'fade');
-}).mouseleave(function() {
- showconf(this, 'reset');
-});
+(function() {
+ var boldItem = false;
+ var revList = false;
-var boldItem = false;
-var revList = false;
-
-function showpre(e, action) {
- if (boldItem && action !== 'bold') return 'reset';
- if (boldItem) {
- if (e === boldItem) action = 'fade';
- boldItem = false;
- }
- $mt.removeClass("slx-bold slx-fade");
- $ct.removeClass("slx-bold slx-fade");
- return action;
-}
-
-function buildRevList() {
- revList = {};
- $ct.each(function() {
- var elem = $(this);
- var cid = elem.data('id')+'';
- var list = (elem.data('modlist')+'').split(',');
+ var $ct = $('#conftable').find('.confrow');
+ $ct.click(function () {
+ showmod(this, 'bold');
+ }).mouseenter(function () {
+ showmod(this, 'fade');
+ }).mouseleave(function () {
+ showmod(this, 'reset');
+ });
+ var $mt = $('#modtable').find('.modrow');
+ $mt.click(function () {
+ showconf(this, 'bold');
+ }).mouseenter(function () {
+ showconf(this, 'fade');
+ }).mouseleave(function () {
+ showconf(this, 'reset');
+ });
+ var $confirm = $('#delete-item-list');
+ $('.btn-del-module').click(function() {
+ if (!revList) buildRevList();
+ var mid = $(this).val() + '';
+ var list = revList[mid];
+ if (!list || !list.length) {
+ $confirm.append($msgs).addClass('hidden');
+ return;
+ }
+ var $msgs = $confirm.find('ul').empty();
for (var i = 0; i < list.length; ++i) {
- if (!revList[list[i]]) revList[list[i]] = [];
- revList[list[i]].push(cid);
+ $msgs.append($('<li>').text(
+ $('.confrow[data-id="' + list[i] + '"]').text()
+ ));
}
+ $confirm.removeClass('hidden');
+ });
+ $('.btn-del-config').click(function() {
+ $confirm.addClass('hidden');
});
-}
-function showconf(e, action) {
- action = showpre(e, action);
- if (action === 'reset') return;
- var $e = $(e);
- if (!revList) buildRevList();
- var mid = $e.data('id')+'';
- var list = revList[mid];
- if (list && list.length > 0) $ct.each(function() {
- var elem = $(this);
- var cid = elem.data('id')+'';
- if (list.indexOf(cid) === -1)
- elem.addClass('slx-fade');
- else if (action === 'bold')
- elem.addClass('slx-bold');
- }); else $ct.addClass('slx-fade');
- if (action === 'bold') {
- boldItem = e;
- $e.addClass("slx-bold");
+ function showpre(e, action) {
+ if (boldItem && action !== 'bold') return 'reset';
+ if (boldItem) {
+ if (e === boldItem) action = 'fade';
+ boldItem = false;
+ }
+ $mt.removeClass("slx-bold slx-fade");
+ $ct.removeClass("slx-bold slx-fade");
+ return action;
}
-}
-function showmod(e, action) {
- action = showpre(e, action);
- if (action === 'reset') return;
- var $e = $(e);
- var list = ($e.data('modlist')+'').split(',');
- $mt.each(function () {
- var elem = $(this);
- if (list.indexOf(elem.data('id')+'') === -1)
- elem.addClass("slx-fade");
- else if (action === 'bold')
- elem.addClass("slx-bold");
- });
- if (action === 'bold') {
- boldItem = e;
- $e.addClass("slx-bold");
+ function buildRevList() {
+ revList = {};
+ $ct.each(function () {
+ var elem = $(this);
+ var cid = elem.data('id') + '';
+ var list = (elem.data('modlist') + '').split(',');
+ for (var i = 0; i < list.length; ++i) {
+ if (!revList[list[i]]) revList[list[i]] = [];
+ revList[list[i]].push(cid);
+ }
+ });
}
-}
+
+ function showconf(e, action) {
+ action = showpre(e, action);
+ if (action === 'reset') return;
+ var $e = $(e);
+ if (!revList) buildRevList();
+ var mid = $e.data('id') + '';
+ var list = revList[mid];
+ if (list && list.length > 0) $ct.each(function () {
+ var elem = $(this);
+ var cid = elem.data('id') + '';
+ if (list.indexOf(cid) === -1)
+ elem.addClass('slx-fade');
+ else if (action === 'bold')
+ elem.addClass('slx-bold');
+ }); else $ct.addClass('slx-fade');
+ if (action === 'bold') {
+ boldItem = e;
+ $e.addClass("slx-bold");
+ }
+ }
+
+ function showmod(e, action) {
+ action = showpre(e, action);
+ if (action === 'reset') return;
+ var $e = $(e);
+ var list = ($e.data('modlist') + '').split(',');
+ $mt.each(function () {
+ var elem = $(this);
+ if (list.indexOf(elem.data('id') + '') === -1)
+ elem.addClass("slx-fade");
+ else if (action === 'bold')
+ elem.addClass("slx-bold");
+ });
+ if (action === 'bold') {
+ boldItem = e;
+ $e.addClass("slx-bold");
+ }
+ }
+})();
// Polling for updated status (outdated, missing, ok)