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)
}
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);
{
x = Math.max(x, -window.innerWidth);
x = Math.min(x, window.innerWidth);
+ if (!can_go_previous()) {
+ x = Math.min(x, window.innerWidth / 8);
+ }
+ if (!can_go_next()) {
+ x = Math.max(x, -window.innerWidth / 8);
+ }
var dpr = find_dpr();
var main = document.getElementById("main");
{
if (swiping) {
var new_x = (e.changedTouches[0].pageX - swipe_start_x);
- if (new_x < -window.innerWidth / 4) {
+ if (new_x < -window.innerWidth / 4 && can_go_next()) {
set_swipe_pos(-window.innerWidth, "transform 0.1s ease-out");
setTimeout(function() { go_next(); }, 100);
- } else if (new_x > window.innerWidth / 4) {
+ } else if (new_x > window.innerWidth / 4 && can_go_previous()) {
set_swipe_pos(window.innerWidth, "transform 0.1s ease-out");
setTimeout(function() { go_previous(); }, 100);
} else {
var new_x = (e.changedTouches[0].pageX - swipe_start_x);
set_swipe_pos(new_x, null);
}
- e.preventDefault();
}
window.onload = function() {