forked from 0x2620/pandora
allow for aborting user script by pressing escape on page load
This commit is contained in:
parent
df7c6c6de3
commit
fa376dd188
1 changed files with 11 additions and 1 deletions
|
@ -52,6 +52,7 @@ appPanel
|
||||||
&& !(Math.round(navigator.userAgent.match(/MSIE (\d+)/)[1]) >= 10),
|
&& !(Math.round(navigator.userAgent.match(/MSIE (\d+)/)[1]) >= 10),
|
||||||
isPrint = /^#print(\?.*?)?$/.test(document.location.hash),
|
isPrint = /^#print(\?.*?)?$/.test(document.location.hash),
|
||||||
legacyThemes = {classic: 'oxlight', modern: 'oxdark'},
|
legacyThemes = {classic: 'oxlight', modern: 'oxdark'},
|
||||||
|
loadUserScript = true,
|
||||||
logoHeight,
|
logoHeight,
|
||||||
logoWidth,
|
logoWidth,
|
||||||
theme = getLocalStorage('Ox.theme')
|
theme = getLocalStorage('Ox.theme')
|
||||||
|
@ -59,6 +60,8 @@ appPanel
|
||||||
|
|
||||||
theme = legacyThemes[theme] || theme;
|
theme = legacyThemes[theme] || theme;
|
||||||
|
|
||||||
|
document.addEventListener('keydown', onKeydown);
|
||||||
|
|
||||||
loadImages(function(images) {
|
loadImages(function(images) {
|
||||||
loadScreen(images);
|
loadScreen(images);
|
||||||
loadOxJS(function() {
|
loadOxJS(function() {
|
||||||
|
@ -429,7 +432,8 @@ appPanel
|
||||||
});
|
});
|
||||||
Ox.Fullscreen.bind('exit', pandora.UI.set);
|
Ox.Fullscreen.bind('exit', pandora.UI.set);
|
||||||
pandora.site.sectionButtonsWidth = pandora.$ui.sectionButtons.width() + 8;
|
pandora.site.sectionButtonsWidth = pandora.$ui.sectionButtons.width() + 8;
|
||||||
pandora.loadUserScript();
|
loadUserScript && pandora.loadUserScript();
|
||||||
|
document.removeEventListener('keydown', onKeydown);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadBrowserMessage() {
|
function loadBrowserMessage() {
|
||||||
|
@ -513,6 +517,12 @@ appPanel
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onKeydown(e) {
|
||||||
|
if (e.keyCode == 27) {
|
||||||
|
loadUserScript = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function startAnimation() {
|
function startAnimation() {
|
||||||
var css, deg = 0, loadingIcon = document.getElementById('loadingIcon'),
|
var css, deg = 0, loadingIcon = document.getElementById('loadingIcon'),
|
||||||
previousTime = +new Date();
|
previousTime = +new Date();
|
||||||
|
|
Loading…
Reference in a new issue