diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2016-05-14 14:15:10 +0200 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-05-14 14:15:10 +0200 |
commit | 36ba81c8b4ce3bced4898d45853d2b736ef9b2b4 (patch) | |
tree | 892d968432b0899582e37235c8da7b946e33f598 /web/js | |
parent | 55f2f43db3b82cacaf459a374176a8ddd56c1b73 (diff) |
Add tabs for admin/map
The admin-tab is currently empty. That is besides the point.
Closes #18
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/nms-ui.js | 23 | ||||
-rw-r--r-- | web/js/nms.js | 19 |
2 files changed, 42 insertions, 0 deletions
diff --git a/web/js/nms-ui.js b/web/js/nms-ui.js new file mode 100644 index 0000000..411ed2f --- /dev/null +++ b/web/js/nms-ui.js @@ -0,0 +1,23 @@ +"use strict"; + + +/* + * The idea is to gradually move pure UI stuff into nmsUi. + */ +var nmsUi = nmsUi || { + _active: "map" +}; + +nmsUi.setActive = function(pane) { + var old = document.getElementById(nmsUi._active); + var newp = document.getElementById(pane); + old.style.display = "none"; + newp.style.display = "block"; + + var oldlink = document.getElementById(nmsUi._active + "-link"); + var newlink = document.getElementById(pane + "-link"); + oldlink.classList.remove("active"); + newlink.classList.add("active"); + + nmsUi._active = pane; +} diff --git a/web/js/nms.js b/web/js/nms.js index cd60633..1f7398b 100644 --- a/web/js/nms.js +++ b/web/js/nms.js @@ -1,4 +1,21 @@ "use strict"; + +/* + * This is the original nms.js and it's a bit of a mess as much has been + * moved into separate js-files and cleaned up. + * + * Gradual refactoring has begun. + * + * On the TODO list: + * + * - Move all pure UI stuff into nmsUi: nightMode, vertical mode, + * menushowing, + * - Get rid of "tvmode". As in: complete the merge + * - Move all time-travel related code out into a separate entity. + * - Remove nms.now: it belongs in nmsData. + * - nms.timers probably also deserves to die. It used to do a lot more, + * now it's just leftovers. + */ var nms = { stats:{}, // Various internal stats get nightMode() { return this._nightMode; }, @@ -495,6 +512,8 @@ function isIn(box, x, y) /* * Return the name of the switch found at coordinates (x,y), or 'undefined' * if none is found. + * + * FIXME: this belongs in nmsMap. */ function findSwitch(x,y) { x = parseInt(parseInt(x) / nmsMap.scale); |