From 2a49e9fdab4bd4ec3a613c854cec755580d67a5b Mon Sep 17 00:00:00 2001 From: Piotr Przybylski Date: Tue, 11 Oct 2011 22:12:05 +0200 Subject: [PATCH 1/2] bugfix for Create table dialog (IE6-8, possibly fixes JS error in FF on demo server) --- js/functions.js | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/js/functions.js b/js/functions.js index ce2dac63bb..0ea0155887 100644 --- a/js/functions.js +++ b/js/functions.js @@ -29,6 +29,20 @@ var codemirror_editor = false; */ var chart_activeTimeouts = new Object(); +/** + * Returns browser's viewport size, without accounting for scrollbars + * + * @param window wnd + */ +function getWindowSize(wnd) { + var vp = wnd || window; + return { + // most browsers || IE6-8 strict || failsafe + width: vp.innerWidth || (vp.documentElement !== undefined ? vp.documentElement.clientWidth : false) || $(vp).width(), + height: vp.innerHeight || (vp.documentElement !== undefined ? vp.documentElement.clientHeight : false) || $(vp).height() + }; +} + /** * Add a hidden field to the form to indicate that this will be an * Ajax request (only if this hidden field does not exist) @@ -1509,6 +1523,7 @@ function PMA_createTableDialog( div, url , target) //remove the redundant [Back] link in the error message. .find('fieldset').remove(); } else { + var size = getWindowSize(); var timeout; div .append(data) @@ -1519,16 +1534,17 @@ function PMA_createTableDialog( div, url , target) modal: true, stack: false, position: ['left','top'], - width: window.innerWidth-10, - height: window.innerHeight-10, + width: size.width-10, + height: size.height-10, open: function() { - var $dialog = $(this); + var dialog_id = $(this).attr('id'); $(window).bind('resize.dialog-resizer', function() { clearTimeout(timeout); timeout = setTimeout(function() { - $dialog.dialog('option', { - width: window.innerWidth-10, - height: window.innerHeight-10 + var size = getWindowSize(); + $('#'+dialog_id).dialog('option', { + width: size.width-10, + height: size.height-10 }); }, 50); }); @@ -1536,13 +1552,12 @@ function PMA_createTableDialog( div, url , target) var $wrapper = $('
', {'id': 'content-hide'}).hide(); $('body > *:not(.ui-dialog)').wrapAll($wrapper); - $(this).closest('.ui-dialog').css({ - left: 0, - top: 0 - }); - - // for Chrome - $(this).scrollTop(0); + $(this) + .scrollTop(0) // for Chrome + .closest('.ui-dialog').css({ + left: 0, + top: 0 + }); PMA_verifyTypeOfAllColumns(); }, From b0cbd4c59a302838fff47491f14fc0855287c2be Mon Sep 17 00:00:00 2001 From: Piotr Przybylski Date: Tue, 11 Oct 2011 22:13:31 +0200 Subject: [PATCH 2/2] get_image.js - fix for IE --- js/get_image.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/get_image.js.php b/js/get_image.js.php index 40609d8d93..6064731d07 100644 --- a/js/get_image.js.php +++ b/js/get_image.js.php @@ -68,7 +68,7 @@ function PMA_getImage(image, alternate, attributes) { // this is private alt: '', title: '', - src: 'themes/dot.gif', + src: 'themes/dot.gif' }, isSprite: true, attr: function (name, value) {