X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-jquery.js;h=41456529842ba32caf58e37e46f3414394e20a5a;hb=8b768a3e2eeddd23932f8a852a24a5bdd3282216;hp=a093bfdcbcb0de7d9d5d7fc71bd0f0ce57ed51d9;hpb=7722615c17cf1b36d1d2f25c6b60eadfc04653ee;p=mkws-moved-to-github.git diff --git a/src/mkws-jquery.js b/src/mkws-jquery.js index a093bfd..4145652 100644 --- a/src/mkws-jquery.js +++ b/src/mkws-jquery.js @@ -9,78 +9,78 @@ /* * implement jQuery plugin $.pazpar2({}) */ -function _mkws_jquery_plugin ($) { - function debug (string) { - mkws.log("jquery.pazpar2: " + string); +function _mkws_jquery_plugin($) { + function debug(string) { + mkws.log("jQuery.pazpar2: " + string); + } + + function init_popup(obj) { + var config = obj ? obj : {}; + + var height = config.height || 760; + var width = config.width || 880; + var id_button = config.id_button || "input.mkwsButton"; + var id_popup = config.id_popup || ".mkwsPopup"; + + debug("popup height: " + height + ", width: " + width); + + // make sure that jquery-ui was loaded afte jQuery core lib, e.g.: + // + if (!$.ui) { + debug("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?"); + return; } - function init_popup(obj) { - var config = obj ? obj : {}; - - var height = config.height || 760; - var width = config.width || 880; - var id_button = config.id_button || "input.mkwsButton"; - var id_popup = config.id_popup || "#mkwsPopup"; - - debug("popup height: " + height + ", width: " + width); - - // make sure that jquery-ui was loaded afte jQuery core lib, e.g.: - // - if (!$.ui) { - debug("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?"); - return; - } - - $(id_popup).dialog({ - closeOnEscape: true, - autoOpen: false, - height: height, - width: width, - modal: true, - resizable: true, - buttons: { - Cancel: function() { - $(this).dialog("close"); - } - }, - close: function() { } - }); - - $(id_button) - .button() - .click(function() { - $(id_popup).dialog("open"); - }); - }; - - $.extend({ - - // service-proxy or pazpar2 - pazpar2: function(config) { - if (config == null || typeof config != 'object') { - config = {}; - } - var id_popup = config.id_popup || "#mkwsPopup"; - id_popup = id_popup.replace(/^#/, ""); - - // simple layout - var div = '\ -
\ -
\ -
\ -
\ -
\ -
'; - - // new table layout - var table = '\ + $(id_popup).dialog({ + closeOnEscape: true, + autoOpen: false, + height: height, + width: width, + modal: true, + resizable: true, + buttons: { + Cancel: function() { + $(this).dialog("close"); + } + }, + close: function() { } + }); + + $(id_button) + .button() + .click(function() { + $(id_popup).dialog("open"); + }); + }; + + $.extend({ + + // service-proxy or pazpar2 + pazpar2: function(config) { + if (config == null || typeof config != 'object') { + config = {}; + } + var id_popup = config.id_popup || ".mkwsPopup"; + id_popup = id_popup.replace(/^[#\.]/, ""); + + // simple layout + var div = '\ +
\ +
\ +
\ +
\ +
\ +
'; + + // new table layout + var table = '\ \ @@ -88,63 +88,62 @@ function _mkws_jquery_plugin ($) { \ \ \ \ \ \ \ \ \ \ \ \ \
\ -
\ -
\ -
\ +
\ +
\ +
\
\
\ -
\ -
\ -
\ -
\ -
\ +
\ +
\ +
\ +
\ +
\
\
\
\ -
\ +
\
\
\ -
\ +
\
'; - var popup = '\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ + var popup = '\ +
\ +
\ +
\ +
\ +
\ +
\ +
\
' - if (config && config.layout == 'div') { - debug("jquery plugin layout: div"); - document.write(div); - } else if (config && config.layout == 'popup') { - debug("jquery plugin layout: popup with id: " + id_popup); - document.write(popup); - $(document).ready(function() { init_popup(config); }); - } else { - debug("jquery plugin layout: table"); - document.write(table); - } - } - }); + if (config && config.layout == 'div') { + debug("jquery plugin layout: div"); + document.write(div); + } else if (config && config.layout == 'popup') { + debug("jquery plugin layout: popup with id: " + id_popup); + document.write(popup); + $(document).ready(function() { init_popup(config); }); + } else { + debug("jquery plugin layout: table"); + document.write(table); + } + } + }); }; -(function (j) { - // enable before page load, so we could call it before mkws() runs - _mkws_jquery_plugin(j); -})(jQuery); +// XXX: enable before page load, so we could call it before mkws() runs +_mkws_jquery_plugin(mkws.$); +