]> git.sesse.net Git - pr0n/blobdiff - pr0n-fullscreen.js
Add Escape as a shortcut for closing fullscreen.
[pr0n] / pr0n-fullscreen.js
index 31b51ec3d4470b4ff3c9ed5ff16fbd4290016ff4..468f249c0c6c780b30c87eed132d5923f8ec8968 100644 (file)
@@ -98,6 +98,7 @@ function relayout()
 
        set_opacity("previous", can_go_previous() ? 0.7 : 0.1);
        set_opacity("next", can_go_next() ? 0.7 : 0.1);
 
        set_opacity("previous", can_go_previous() ? 0.7 : 0.1);
        set_opacity("next", can_go_next() ? 0.7 : 0.1);
+       set_opacity("close", 0.7);
 }
 
 function set_opacity(id, amount)
 }
 
 function set_opacity(id, amount)
@@ -187,6 +188,8 @@ function key_down(which)
                if (can_go_previous()) {
                        set_opacity("previous", 0.99);
                }
                if (can_go_previous()) {
                        set_opacity("previous", 0.99);
                }
+       } else if (which == 27) {   // escape
+               set_opacity("close", 0.99);
        }
 }
 
        }
 }
 
@@ -201,9 +204,17 @@ function key_up(which) {
                        set_opacity("previous", 0.7);
                        go_previous();
                }
                        set_opacity("previous", 0.7);
                        go_previous();
                }
+       } else if (which == 27) {   // escape
+               set_opacity("close", 0.7);
+               do_close();
        }
 }
 
        }
 }
 
+function do_close()
+{
+       window.location = global_return_url;
+}
+
 // enable the horrible horrible IE PNG hack
 function ie_png_hack()
 {
 // enable the horrible horrible IE PNG hack
 function ie_png_hack()
 {