improve 'run on load' dialog (fixes #810); add close button to preferences dialog

This commit is contained in:
rolux 2012-06-11 07:17:39 +00:00
parent aff1252f3b
commit 876dc8f138
2 changed files with 20 additions and 23 deletions

View file

@ -4,19 +4,19 @@
pandora.ui.onloadDialog = function() { pandora.ui.onloadDialog = function() {
var var dialogHeight = Math.round((window.innerHeight - 48) * 0.75),
dialogHeight = Math.round((window.innerHeight - 48) * 0.9), dialogWidth = Math.round(window.innerWidth * 0.75),
dialogWidth = Math.round(window.innerWidth * 0.9), $input = Ox.Input({
$text = Ox.Input({ height: dialogHeight - 32,
height: dialogHeight - 8,
id: 'onload', id: 'onload',
placeholder: '/*\nAny JavaScript you paste here will run on load.\n' 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*/', + 'If you ever need to manually change or remove it, '
+ 'you can do so by setting localStorage["pandora.onload"] in the console.\n*/',
type: 'textarea', type: 'textarea',
value: localStorage['pandora.onload'] || '', value: localStorage['pandora.onload'] || '',
width: dialogWidth - 8 width: dialogWidth - 32
}), })
.css({margin: '16px'}),
that = Ox.Dialog({ that = Ox.Dialog({
buttons: [ buttons: [
Ox.Button({ Ox.Button({
@ -39,12 +39,11 @@ pandora.ui.onloadDialog = function() {
}) })
], ],
closeButton: true, closeButton: true,
content: $text, content: $input,
height: dialogHeight, height: dialogHeight,
maximizeButton: true, maximizeButton: true,
minHeight: 256, minHeight: 256,
minWidth: 512, minWidth: 512,
padding: 0,
removeOnClose: true, removeOnClose: true,
title: 'Run Script on Load', title: 'Run Script on Load',
width: dialogWidth width: dialogWidth
@ -56,21 +55,20 @@ pandora.ui.onloadDialog = function() {
function resize(data) { function resize(data) {
dialogHeight = data.height; dialogHeight = data.height;
dialogWidth = data.width; dialogWidth = data.width;
$text.options({ $input.options({
height: dialogHeight - 8, height: dialogHeight - 32,
width: dialogWidth - 8 width: dialogWidth - 32
}); });
} }
function clear() { function clear() {
delete localStorage['pandora.onload']; delete localStorage['pandora.onload'];
$text.options({value: ''}); $input.options({value: ''});
} }
that.superClose = that.close; that.superClose = that.close;
that.close = function() { that.close = function() {
var value = $text.value(); var value = $input.value();
if (value) { if (value) {
localStorage['pandora.onload'] = value; localStorage['pandora.onload'] = value;
} else { } else {

View file

@ -138,10 +138,9 @@ pandora.ui.preferencesDialog = function() {
} }
}) })
], ],
//closeButton: true, closeButton: true,
content: $tabPanel, content: $tabPanel,
height: 192, height: 192,
//maximizeButton: true,
minHeight: 192, minHeight: 192,
minWidth: 432, minWidth: 432,
title: 'Preferences', title: 'Preferences',