From: Wolfram Schneider Date: Thu, 10 Jul 2014 12:02:35 +0000 (+0000) Subject: re-order check for loaded jquery-ui.js lib X-Git-Tag: 1.0.0~388^2~2 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=fbf06416f9b0f1aff49b0beda03237dd3cabedd2 re-order check for loaded jquery-ui.js lib --- diff --git a/src/mkws-popup.js b/src/mkws-popup.js index fd6153a..44736cc 100644 --- a/src/mkws-popup.js +++ b/src/mkws-popup.js @@ -2,31 +2,29 @@ * */ -"use strict"; - +//"use strict"; // $(document).ready(function () { mkws.registerWidgetType('Popup', function() { var $ = mkws.$; var debug = mkws.log; debug("init popup window"); - if (!$.ui) { - alert("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?"); - return; - } - - var popup_window = $(this.node); // mkws.registerWidgetType('Popup',....) + var popup_window = $(this.node); // mkws.registerWidgetType('Popup',....) // var popup_window = $(".mkwsPopup"); // $(document).ready() - if (!popup_window) { - debug("no popup found, skip"); + debug("no popup found, skip..."); return; } else { - debug("found popup windows: " + popup_window.length); + debug("number of popup windows found: " + popup_window.length); + } + + if (!$.ui) { + alert("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?"); + return; } // more than one widget on a page are possible - popup_window.each(function (i) { + popup_window.each(function(i) { var that = $(this); var width = parseInt(that.attr("popup_width") || "800"); @@ -43,17 +41,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 var id_botton = that.attr("popup_button"); if (id_botton) { - $(id_botton).button().click(function () { + $(id_botton).button().click(function() { that.dialog("open"); }); }