]> git.sesse.net Git - pr0n/blobdiff - files/pr0n-fullscreen.js
Fix centering of text again.
[pr0n] / files / pr0n-fullscreen.js
index ef0fd2aa67c0a6b66596132ad72822a10c329e41..d9d37c6131b8226a952e95677f2991d9e404f2d2 100644 (file)
@@ -381,11 +381,11 @@ function draw_text(msg)
        text.style.font = "24px verdana, arial, sans-serif";
        text.innerHTML = msg;
 
-       var main = document.getElementById("main");
-       main.appendChild(text);
+       document.getElementById("main").appendChild(text);
 
-       text.style.left = (main.clientWidth - text.clientWidth) / 2 + "px";
-       text.style.top = (main.clientHeight - text.clientHeight) / 2 + "px";
+       var screen_size = find_width();
+       text.style.left = (screen_size[0] - text.clientWidth) / 2 + "px";
+       text.style.top = (screen_size[1] - text.clientHeight) / 2 + "px";
 }
 
 function fade_text(opacity)
@@ -414,7 +414,7 @@ function select_image(evt, filename, selected)
        }
        
        var req = new XMLHttpRequest();
-       req.open("POST", window.location.origin + "/select", false);
+       req.open("POST", window.location.origin + "/select", true);
        req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        req.send("event=" + evt + "&filename=" + filename + "&selected=" + selected);