store on-load script on server (ui.onload), fixes #1850

This commit is contained in:
j 2014-04-09 15:44:28 +00:00
parent 19a887ebec
commit 614e7f0d09
7 changed files with 20 additions and 13 deletions

View file

@ -822,6 +822,7 @@
"locale": "en",
"mapFind": "",
"mapSelection": "",
"onload": "",
"page": "",
"part": {
"api": "",

View file

@ -835,6 +835,7 @@
"locale": "en",
"mapFind": "",
"mapSelection": "",
"onload": "",
"page": "",
"part": {
"api": "",

View file

@ -708,6 +708,7 @@
"locale": "en",
"mapFind": "",
"mapSelection": "",
"onload": "",
"page": "",
"part": {
"api": "",

View file

@ -627,6 +627,7 @@
"locale": "en",
"mapFind": "",
"mapSelection": "",
"onload": "",
"page": "",
"part": {
"api": "",

View file

@ -11,9 +11,9 @@ pandora.ui.onloadDialog = function() {
id: 'onload',
placeholder: Ox._('/*\nAny JavaScript you paste here will run on load.\n'
+ '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',
value: localStorage['pandora.onload'] || '',
value: pandora.user.ui.onload || '',
width: dialogWidth - 32
})
.css({margin: '16px'}),
@ -62,18 +62,14 @@ pandora.ui.onloadDialog = function() {
}
function clear() {
delete localStorage['pandora.onload'];
pandora.UI.set({onload: ''});
$input.options({value: ''});
}
that.superClose = that.close;
that.close = function() {
var value = $input.value();
if (value) {
localStorage['pandora.onload'] = value;
} else {
delete localStorage['pandora.onload'];
}
pandora.UI.set({onload: value || ''});
that.superClose();
};

View file

@ -426,11 +426,7 @@ appPanel
});
Ox.Fullscreen.bind('exit', pandora.UI.set);
pandora.site.sectionButtonsWidth = pandora.$ui.sectionButtons.width() + 8;
if (getLocalStorage('pandora.onload')) {
try {
eval(localStorage['pandora.onload'])
} catch(e) {}
}
pandora.loadUserScript();
}
function loadBrowserMessage() {

View file

@ -1906,6 +1906,16 @@ pandora.isVideoView = function(view, item) {
).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) {
var element = this,
handlers = self.eventHandlers ? self.eventHandlers[event] : [];
@ -1959,6 +1969,7 @@ pandora.signin = function(data) {
pandora.URL.update();
Ox.Theme(pandora.user.ui.theme);
pandora.$ui.appPanel.reload();
pandora.loadUserScript();
};
pandora.signout = function(data) {