From fb6422388df840ca68af00c51e7a378decb4d4d5 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 28 May 2012 21:04:27 +0000 Subject: [PATCH] move run script on load to user->preferences->advanced --- static/js/pandora/menu.js | 5 +---- static/js/pandora/onloadDialog.js | 5 +++-- static/js/pandora/preferencesDialog.js | 14 +++++++++++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/static/js/pandora/menu.js b/static/js/pandora/menu.js index 0797e24d..12ca17c2 100644 --- a/static/js/pandora/menu.js +++ b/static/js/pandora/menu.js @@ -154,8 +154,7 @@ pandora.ui.mainMenu = function() { { id: 'reloadapplication', title: 'Reload Application'}, { id: 'resetui', title: 'Reset UI Settings'}, { id: 'debug', title: (pandora.localStorage('debug')?'Disable':'Enable')+' Debug Mode'}, - { id: 'triggererror', title: 'Trigger JavaScript Error'}, - { id: 'onload', title: 'Edit onload script...'} + { id: 'triggererror', title: 'Trigger JavaScript Error'} ] } ] : [] @@ -320,8 +319,6 @@ pandora.ui.mainMenu = function() { filters: pandora.site.user.ui.filters }); pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser()); - } else if (data.id == 'onload') { - pandora.$ui.onloadDialog = pandora.ui.onloadDialog().open(); } else if (data.id == 'logs') { pandora.$ui.logsDialog = pandora.ui.logsDialog().open(); } else if (data.id == 'clearcache') { diff --git a/static/js/pandora/onloadDialog.js b/static/js/pandora/onloadDialog.js index dda54651..7f64e660 100644 --- a/static/js/pandora/onloadDialog.js +++ b/static/js/pandora/onloadDialog.js @@ -10,7 +10,8 @@ pandora.ui.onloadDialog = function() { $text = Ox.Input({ height: dialogHeight - 8, id: 'onload', - placeholder: 'Paste onload code here', + placeholder: '/*\nAny JavaScript you paste here will run on load.\n' + +'You can also manually change or remove it by setting localStorage["pandora.onload"] in the console.\n*/', type: 'textarea', value: localStorage['pandora.onload'] || '', width: dialogWidth - 8 @@ -45,7 +46,7 @@ pandora.ui.onloadDialog = function() { minWidth: 512, padding: 0, removeOnClose: true, - title: 'Manage on load hook', + title: 'Run Script on Load', width: dialogWidth }) .bindEvent({ diff --git a/static/js/pandora/preferencesDialog.js b/static/js/pandora/preferencesDialog.js index 123fff9b..0ae406bb 100644 --- a/static/js/pandora/preferencesDialog.js +++ b/static/js/pandora/preferencesDialog.js @@ -100,7 +100,7 @@ pandora.ui.preferencesDialog = function() { $content.append( Ox.Button({ title: 'Reset UI Settings', - width: 120 + width: 128 }) .bindEvent({ click: function() { @@ -110,6 +110,18 @@ pandora.ui.preferencesDialog = function() { }) .css({position: 'absolute', left: '96px', top: '16px'}) ); + $content.append( + Ox.Button({ + title: 'Run Script on Load', + width: 128 + }) + .bindEvent({ + click: function() { + pandora.$ui.onloadDialog = pandora.ui.onloadDialog().open(); + } + }) + .css({position: 'absolute', left: '96px', top: '40px'}) + ); } return $content; },