store on-load script on server (ui.onload), fixes #1850
This commit is contained in:
parent
19a887ebec
commit
614e7f0d09
7 changed files with 20 additions and 13 deletions
|
@ -822,6 +822,7 @@
|
||||||
"locale": "en",
|
"locale": "en",
|
||||||
"mapFind": "",
|
"mapFind": "",
|
||||||
"mapSelection": "",
|
"mapSelection": "",
|
||||||
|
"onload": "",
|
||||||
"page": "",
|
"page": "",
|
||||||
"part": {
|
"part": {
|
||||||
"api": "",
|
"api": "",
|
||||||
|
|
|
@ -835,6 +835,7 @@
|
||||||
"locale": "en",
|
"locale": "en",
|
||||||
"mapFind": "",
|
"mapFind": "",
|
||||||
"mapSelection": "",
|
"mapSelection": "",
|
||||||
|
"onload": "",
|
||||||
"page": "",
|
"page": "",
|
||||||
"part": {
|
"part": {
|
||||||
"api": "",
|
"api": "",
|
||||||
|
|
|
@ -708,6 +708,7 @@
|
||||||
"locale": "en",
|
"locale": "en",
|
||||||
"mapFind": "",
|
"mapFind": "",
|
||||||
"mapSelection": "",
|
"mapSelection": "",
|
||||||
|
"onload": "",
|
||||||
"page": "",
|
"page": "",
|
||||||
"part": {
|
"part": {
|
||||||
"api": "",
|
"api": "",
|
||||||
|
|
|
@ -627,6 +627,7 @@
|
||||||
"locale": "en",
|
"locale": "en",
|
||||||
"mapFind": "",
|
"mapFind": "",
|
||||||
"mapSelection": "",
|
"mapSelection": "",
|
||||||
|
"onload": "",
|
||||||
"page": "",
|
"page": "",
|
||||||
"part": {
|
"part": {
|
||||||
"api": "",
|
"api": "",
|
||||||
|
|
|
@ -11,9 +11,9 @@ pandora.ui.onloadDialog = function() {
|
||||||
id: 'onload',
|
id: 'onload',
|
||||||
placeholder: Ox._('/*\nAny JavaScript you paste here will run on load.\n'
|
placeholder: Ox._('/*\nAny JavaScript you paste here will run on load.\n'
|
||||||
+ 'If you ever need to manually change or remove it, '
|
+ 'If you ever need to manually change or remove it, '
|
||||||
+ 'you can do so by setting localStorage["pandora.onload"] in the console.\n*/'),
|
+ 'you can do so by pandora.UI.set({onload: ""}) in the console.\n*/'),
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
value: localStorage['pandora.onload'] || '',
|
value: pandora.user.ui.onload || '',
|
||||||
width: dialogWidth - 32
|
width: dialogWidth - 32
|
||||||
})
|
})
|
||||||
.css({margin: '16px'}),
|
.css({margin: '16px'}),
|
||||||
|
@ -62,18 +62,14 @@ pandora.ui.onloadDialog = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
delete localStorage['pandora.onload'];
|
pandora.UI.set({onload: ''});
|
||||||
$input.options({value: ''});
|
$input.options({value: ''});
|
||||||
}
|
}
|
||||||
|
|
||||||
that.superClose = that.close;
|
that.superClose = that.close;
|
||||||
that.close = function() {
|
that.close = function() {
|
||||||
var value = $input.value();
|
var value = $input.value();
|
||||||
if (value) {
|
pandora.UI.set({onload: value || ''});
|
||||||
localStorage['pandora.onload'] = value;
|
|
||||||
} else {
|
|
||||||
delete localStorage['pandora.onload'];
|
|
||||||
}
|
|
||||||
that.superClose();
|
that.superClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -426,11 +426,7 @@ 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;
|
||||||
if (getLocalStorage('pandora.onload')) {
|
pandora.loadUserScript();
|
||||||
try {
|
|
||||||
eval(localStorage['pandora.onload'])
|
|
||||||
} catch(e) {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadBrowserMessage() {
|
function loadBrowserMessage() {
|
||||||
|
|
|
@ -1906,6 +1906,16 @@ pandora.isVideoView = function(view, item) {
|
||||||
).indexOf(view) > -1;
|
).indexOf(view) > -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pandora.loadUserScript = function() {
|
||||||
|
if (pandora.user.ui.onload) {
|
||||||
|
try {
|
||||||
|
eval(pandora.user.ui.onload);
|
||||||
|
} catch(e) {
|
||||||
|
Ox.print('user onload script error', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
pandora.logEvent = function(data, event, element) {
|
pandora.logEvent = function(data, event, element) {
|
||||||
var element = this,
|
var element = this,
|
||||||
handlers = self.eventHandlers ? self.eventHandlers[event] : [];
|
handlers = self.eventHandlers ? self.eventHandlers[event] : [];
|
||||||
|
@ -1959,6 +1969,7 @@ pandora.signin = function(data) {
|
||||||
pandora.URL.update();
|
pandora.URL.update();
|
||||||
Ox.Theme(pandora.user.ui.theme);
|
Ox.Theme(pandora.user.ui.theme);
|
||||||
pandora.$ui.appPanel.reload();
|
pandora.$ui.appPanel.reload();
|
||||||
|
pandora.loadUserScript();
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.signout = function(data) {
|
pandora.signout = function(data) {
|
||||||
|
|
Loading…
Reference in a new issue