From: Wolfram Schneider Date: Wed, 10 Jul 2013 14:55:10 +0000 (+0000) Subject: configurable popup window (width, height, submit button id, popup id) X-Git-Tag: 0.9.1~279 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=db04b1fad38881b8a042c392f9bbd0227b75a18d;p=mkws-moved-to-github.git configurable popup window (width, height, submit button id, popup id) --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 4eb2f20..32b295b 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -919,11 +919,19 @@ jQuery.extend({ }); function init_popup(config) { - $("#mkwsPopup").dialog({ + if (!config) + config = {}; + + var height = config.height || 760; + var width = config.width || 880; + var id_button = config.button || "input#mkwsButton"; + var id_popup = config.popup || "#mkwsPopup"; + + $(id_popup).dialog({ closeOnEscape: true, autoOpen: false, - height: 760, - width: 880, + height: height, + width: width, modal: true, resizable: true, buttons: { @@ -931,15 +939,13 @@ function init_popup(config) { $(this).dialog("close"); } }, - close: function() { - // allFields.val( "" ).removeClass( "ui-state-error" ); - } + close: function() { } }); - $("input#mkwsButton") + $(id_button) .button() .click(function() { - $("#mkwsPopup").dialog("open"); + $(id_popup).dialog("open"); }); };