X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-popup.js;h=54ef15218537a620fd6830941e852e390e41ce4b;hp=fd6153a66f0f8aeb22ea4667ba434709b26e99f0;hb=058ce4a204a9ce4d63b2d319037f60cd9f94ff1b;hpb=2b99f60d1c292b415ab8f3185540116cfe062cb7 diff --git a/src/mkws-popup.js b/src/mkws-popup.js index fd6153a..54ef152 100644 --- a/src/mkws-popup.js +++ b/src/mkws-popup.js @@ -2,33 +2,32 @@ * */ -"use strict"; - +//"use strict"; // $(document).ready(function () { -mkws.registerWidgetType('Popup', function() { +mkws.registerWidgetType('popup', function() { var $ = mkws.$; - var debug = mkws.log; + var debug = this.info; debug("init popup window"); - if (!$.ui) { - alert("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?"); + var popup_window = $(this.node); + // var popup_window = $(".mkws-popup mkwsPopup"); // $(document).ready() + if (!popup_window) { + debug("no popup found, skip..."); return; + } else { + debug("number of popup windows found: " + popup_window.length); } - var popup_window = $(this.node); // mkws.registerWidgetType('Popup',....) - // var popup_window = $(".mkwsPopup"); // $(document).ready() - - if (!popup_window) { - debug("no popup found, skip"); + if (!$.ui) { + alert("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?"); return; - } else { - debug("found popup windows: " + popup_window.length); } // more than one widget on a page are possible - popup_window.each(function (i) { + popup_window.each(function(i) { var that = $(this); + // all atributes are strings, convert them to integers here var width = parseInt(that.attr("popup_width") || "800"); var height = parseInt(that.attr("popup_height") || "600"); var autoOpen = parseInt(that.attr("popup_autoOpen") || "0"); @@ -43,17 +42,17 @@ mkws.registerWidgetType('Popup', function() { modal: modal ? true : false, resizable: true, buttons: { - Cancel: function () { + Cancel: function() { that.dialog("close"); } }, - close: function () {} + close: function() {} }); - // open at search query submit + // open at search query submit: "input.mkws-button mkwsButton" var id_botton = that.attr("popup_button"); if (id_botton) { - $(id_botton).button().click(function () { + $(id_botton).button().click(function() { that.dialog("open"); }); }