diff options
author | Simon Rettberg | 2016-06-22 17:56:04 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-06-22 17:56:04 +0200 |
commit | a6a484ea37aeb91f848c11cb818e2d7d4351d391 (patch) | |
tree | 03cc7b9df8dabf61bdb1bc84137601ce187339ef /modules-available/sysconfig/clientscript.js | |
parent | [location] Support passing array of selected locs to getLocations() (diff) | |
download | slx-admin-a6a484ea37aeb91f848c11cb818e2d7d4351d391.tar.gz slx-admin-a6a484ea37aeb91f848c11cb818e2d7d4351d391.tar.xz slx-admin-a6a484ea37aeb91f848c11cb818e2d7d4351d391.zip |
[locations/sysconfig] Implement location specific sysconfig
Diffstat (limited to 'modules-available/sysconfig/clientscript.js')
-rw-r--r-- | modules-available/sysconfig/clientscript.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/modules-available/sysconfig/clientscript.js b/modules-available/sysconfig/clientscript.js index 2a133353..47761ea5 100644 --- a/modules-available/sysconfig/clientscript.js +++ b/modules-available/sysconfig/clientscript.js @@ -1,4 +1,6 @@ +// Ugly hack to get the ellipsisized fields to work + function forceTable(t) { var pwidth = t.parent().innerWidth(); @@ -19,3 +21,63 @@ function forceTable(t) w -= 3; } while (t.width() > pwidth); } + +// Mouseover and clicking + +var boldItem = false; + +function showmod(e, action) { + var list = $(e).attr('data-modlist'); + list = list.split(','); + if (action === 'bold') { + $(boldItem).removeClass("slx-bold"); + if (boldItem === e) { + action = 'fade'; + boldItem = false; + } + } else if (boldItem !== false) { + return; + } + $('.modrow').each(function () { + var elem = $(this); + elem.removeClass("slx-fade slx-bold"); + if (action === 'reset') + return; + if (action === 'bold' && list.indexOf(elem.attr('data-id')) !== -1) + elem.addClass("slx-bold"); + if (list.indexOf(elem.attr('data-id')) === -1) + elem.addClass("slx-fade"); + }); + if (action === 'bold') { + boldItem = e; + $(e).addClass("slx-bold"); + } +} + +// Polling for updated status (outdated, missing, ok) + +var statusChecks = 0; + +function checkBuildStatus() { + var mods = []; + var confs = []; + $(".refmod.btn-primary").each(function (index) { + mods.push($(this).val()); + }); + $(".refconf.btn-primary").each(function (index) { + confs.push($(this).val()); + }); + if (mods.length === 0 && confs.length === 0) return; + if (++statusChecks < 10) setTimeout(checkBuildStatus, 200 + 50 * statusChecks); + $.post('?do=SysConfig', { mods: mods.join(), confs: confs.join(), token: TOKEN, action: 'status' }, function (data) { + if (typeof data === 'undefined') return; + if (typeof data.mods === 'object') updateButtonColor($(".refmod.btn-primary"), data.mods); + if (typeof data.confs === 'object') updateButtonColor($(".refconf.btn-primary"), data.confs); + }, 'json'); +} + +function updateButtonColor(list,ids) { + list.each(function() { + if (ids.indexOf($(this).val()) >= 0) $(this).removeClass('btn-primary').addClass('btn-default'); + }); +} |