aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/nms.gathering.org/ping.html12
-rw-r--r--web/nms.gathering.org/ping.js14
2 files changed, 22 insertions, 4 deletions
diff --git a/web/nms.gathering.org/ping.html b/web/nms.gathering.org/ping.html
index 423c73e..1b4e728 100644
--- a/web/nms.gathering.org/ping.html
+++ b/web/nms.gathering.org/ping.html
@@ -1,5 +1,17 @@
<html>
<body>
+ <style>
+.switchname {
+ -webkit-transform: rotate(-90deg);
+ -webkit-transform-origin: 0% 0%;
+ transform: rotate(-90deg);
+ transform-origin: 0% 0%;
+ position: absolute;
+ bottom: -14px;
+ font-family: sans-serif;
+ font-size: small;
+}
+</style>
<p id="playground"><img src="tg14-salkart.png" alt="" id="map" /></p>
<script type="text/javascript" src="ping.js"></script>
</body>
diff --git a/web/nms.gathering.org/ping.js b/web/nms.gathering.org/ping.js
index c0f6b46..1299567 100644
--- a/web/nms.gathering.org/ping.js
+++ b/web/nms.gathering.org/ping.js
@@ -82,12 +82,18 @@ function create_switch(switchnum, sysname, x, y, width, height) {
s.style.height = height + 'px';
s.style.backgroundColor = '#0000ff';
s.style.border = '1px solid black';
+ s.style.padding = "0";
switches[switchnum] = s;
+ var span = document.createElement("div");
+ span.className = "switchname";
+ span.style.border = "0";
+ span.style.padding = "0";
+ s.appendChild(span);
+
var text = document.createTextNode(sysname);
- s.appendChild(text);
+ span.appendChild(text);
- //var attr = document.createAttribute("data-switchnum", switchnum);
s.setAttribute("data-switchnum", switchnum);
document.body.appendChild(s);
@@ -118,8 +124,8 @@ document.onmouseup = function(e) {
if (dragging_switch === null) {
return;
}
- var x = e.clientX + delta_x;
- var y = e.clientY + delta_y;
+ var x = e.clientX + delta_x - map.getBoundingClientRect().top;
+ var y = e.clientY + delta_y - map.getBoundingClientRect().left;
var request = new XMLHttpRequest();
request.open('POST', '/change-switch-pos.pl', true);