From 586c4942e18f042cfef7bee1bf5fa62cae9f33fb Mon Sep 17 00:00:00 2001 From: Eric Hill Date: Tue, 14 Apr 2015 15:57:35 -0700 Subject: [PATCH 01/14] Tighten up example/index.html GitHub seemed to have some trouble with the comments, which made the file hard to read. Cleaned up some indenting to make things more consistent. --- examples/index.html | 91 +++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 62 deletions(-) diff --git a/examples/index.html b/examples/index.html index ee07f0f..239d2f3 100644 --- a/examples/index.html +++ b/examples/index.html @@ -20,11 +20,7 @@ - - - +
1. Defaults -- show dialog
Out-of-box behavior. The window and its @@ -38,22 +34,17 @@ http:// and not file://).
-
3. Manual trigger, extend options -- show dialog
Demonstrates a manual trigger of `jqmShow` as well as updating the options object.
-
4. Manual trigger, modal:true dialog -- show modal:true dialog
Demonstrates a manual trigger of `jqmShow` as well as updating the options object.
- - +
Close @@ -67,18 +58,14 @@
Close -
-
- - - + + + }); + - \ No newline at end of file + From aedc06311a6133d693cd382cdf462382cc9c23de Mon Sep 17 00:00:00 2001 From: paladox Date: Sat, 6 Jun 2015 23:51:09 +0100 Subject: [PATCH 02/14] Fix js hint --- jqModal.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/jqModal.js b/jqModal.js index 7fe4262..a82fa60 100644 --- a/jqModal.js +++ b/jqModal.js @@ -47,7 +47,7 @@ $.fn.jqmAddTrigger=function(trigger){ return this.each(function(){ if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") + err("jqmAddTrigger must be called on initialized modals"); }); }; @@ -62,7 +62,7 @@ $.fn.jqmAddClose=function(trigger){ return this.each(function(){ if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") + err("jqmAddClose must be called on initialized modals"); }); }; @@ -206,7 +206,6 @@ // register trigger click event for this modal $(this).click(function(){ - var trigger = this; e[key](this); @@ -217,7 +216,7 @@ }); - }, open = function(h){ + }, function(h){ // open: executes the onOpen callback + performs common tasks if successful // transform legacy hash into new var shortcuts @@ -258,7 +257,7 @@ } - }, close = function(h){ + }, function(h){ // close: executes the onHide callback + performs common tasks if successful // transform legacy hash into new var shortcuts @@ -362,4 +361,4 @@ } }; -})( jQuery ); \ No newline at end of file +})( jQuery ); From 3b343dc43bb46793186777c998c868a446415313 Mon Sep 17 00:00:00 2001 From: paladox Date: Sun, 7 Jun 2015 11:33:29 +0100 Subject: [PATCH 03/14] Update jqModal.js --- jqModal.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jqModal.js b/jqModal.js index a82fa60..de2156a 100644 --- a/jqModal.js +++ b/jqModal.js @@ -116,8 +116,8 @@ var target = o.target || e, url = o.ajax; - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); + target = (typeof target === 'string') ? $(target,e) : $(target); + if(url.substr(0,1) === '@') url = $(t).attr(url.substring(1)); // load remote contents target.load(url,function(){ @@ -294,7 +294,7 @@ var activeModal = ActiveModals[ActiveModals.length-1]; // allow bubbling if event target is within active modal dialog - return (targetModal && targetModal.ID == activeModal._jqmID) ? + return (targetModal && targetModal.ID === activeModal._jqmID) ? true : $.jqm.focusFunc(activeModal,e); }, @@ -354,7 +354,7 @@ // closeOnEscFunc is attached to modals where closeOnEsc param true. closeOnEscFunc: function(event){ - if (event.keyCode == 27) { + if (event.keyCode === 27) { $(this).jqmHide(); return false; } From d0f6bf1ba2ba64c3f700cc9c25eaa812d7641e32 Mon Sep 17 00:00:00 2001 From: paladox Date: Sun, 7 Jun 2015 11:43:33 +0100 Subject: [PATCH 04/14] Update jqModal.js --- jqModal.js | 168 +++++++++++++++++++++++++---------------------------- 1 file changed, 78 insertions(+), 90 deletions(-) diff --git a/jqModal.js b/jqModal.js index de2156a..91d5e58 100644 --- a/jqModal.js +++ b/jqModal.js @@ -11,36 +11,35 @@ */ (function($) { - + /** * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * + * notices, modal windows, &c. + * * @name jqm * @param options user defined options, augments defaults. * @type jQuery * @cat Plugins/jqModal */ - + $.fn.jqm=function(options){ return this.each(function(){ var e = $(this), jqm = e.data('jqm') || $.extend({ID: I++}, $.jqm.params), o = $.extend(jqm,options); - + // add/extend options to modal and mark as initialized e.data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; - + // ... Attach events to trigger showing of this modal o.trigger && e.jqmAddTrigger(o.trigger); }); }; - - + /** * Matching modals will have their jqmShow() method fired by attaching a * onClick event to elements matching `trigger`. - * + * * @name jqmAddTrigger * @param trigger a selector String, jQuery collection of elements, or a DOM element. */ @@ -50,8 +49,7 @@ err("jqmAddTrigger must be called on initialized modals"); }); }; - - + /** * Matching modals will have their jqmHide() method fired by attaching an * onClick event to elements matching `trigger`. @@ -65,70 +63,67 @@ err("jqmAddClose must be called on initialized modals"); }); }; - - + /** * Open matching modals (if not shown) */ $.fn.jqmShow=function(trigger){ return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); }; - + /** * Close matching modals */ $.fn.jqmHide=function(trigger){ return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); }; - - + // utility functions - + var err = function(msg){ if(window.console && window.console.error) window.console.error(msg); - - + }, show = function(e, t){ - + /** * e = modal element (as jQuery object) * t = triggering element - * + * * o = options * z = z-index of modal * v = overlay element (as jQuery object) * h = hash (for jqModal <= r15 compatibility) */ - + var o = e.data('jqm'), t = t || window.event, z = (parseInt(e.css('z-index'))), z = (z > 0) ? z : 3000, v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), - + // maintain legacy "hash" construct h = {w: e, c: o, o: v, t: t}; - + e.css('z-index',z); if(o.ajax){ var target = o.target || e, url = o.ajax; - + target = (typeof target === 'string') ? $(target,e) : $(target); if(url.substr(0,1) === '@') url = $(t).attr(url.substring(1)); - + // load remote contents target.load(url,function(){ o.onLoad && o.onLoad.call(this,h); }); - + // show modal if(o.ajaxText) { - target.html(o.ajaxText); - } - open(h); + target.html(o.ajaxText); + } + open(h); } else { open(h); } @@ -136,86 +131,84 @@ /** * e = modal element (as jQuery object) * t = triggering element - * + * * o = options * h = hash (for jqModal <= r15 compatibility) */ - + var o = e.data('jqm'), t = t || window.event, - + // maintain legacy "hash" construct h = {w: e, c: o, o: e.data('jqmv'), t: t}; - + close(h); - + }, onShow = function(hash){ // onShow callback. Responsible for showing a modal and overlay. // return false to stop opening modal. - + // hash object; // w: (jQuery object) The modal element // c: (object) The modal's options object // o: (jQuery object) The overlay element // t: (DOM object) The triggering element - + // display the overlay (prepend to body) if not disabled if(hash.c.overlay > 0) hash.o.prependTo('body'); - + // make modal visible hash.w.show(); - + // call focusFunc (attempts to focus on first input in modal) $.jqm.focusFunc(hash.w,true); - + return true; - - + }, onHide = function(hash){ // onHide callback. Responsible for hiding a modal and overlay. // return false to stop closing modal. - + // hash object; // w: (jQuery object) The modal element // c: (object) The modal's options object // o: (jQuery object) The overlay element // t: (DOM object) The triggering element - + // hide modal and if overlay, remove overlay. hash.w.hide() && hash.o && hash.o.remove(); - + return true; - - + }, addTrigger = function(e, key, trigger){ // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (e) // to all elements that match trigger string (trigger) - + var jqm = e.data('jqm'); - + // return false if e is not an initialized modal element if(!e.data('jqm')) return false; - + return $(trigger).each(function(){ this[key] = this[key] || []; - + // register this modal with this trigger only once if($.inArray(jqm.ID,this[key]) < 0) { this[key].push(jqm.ID); - + // register trigger click event for this modal $(this).click(function(){ - + e[key](this); - + // stop trigger click event from bubbling return false; }); } - + }); - + }, function(h){ // open: executes the onOpen callback + performs common tasks if successful @@ -223,29 +216,28 @@ var e = h.w, v = h.o, o = h.c; - // execute onShow callback if(o.onShow(h) !== false){ // mark modal as shown e[0]._jqmShown = true; - - // if modal dialog + + // if modal dialog // // Bind the Keep Focus Function [F] if no other Modals are open (!ActiveModals[0]) + - // + // // else, close dialog when overlay is clicked if(o.modal){ !ActiveModals[0]&&F('bind'); ActiveModals.push(e[0]); } else e.jqmAddClose(v); - + // Attach closing events to elements inside the modal matching closingClass o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - + // IF toTop is true and overlay exists; // Add placeholder element before modal to // remember it's position in the DOM and move it to a child of the body tag (after overlay) o.toTop&&v&&e.before('').insertAfter(v); - + // remember overlay (for closing function) e.data('jqmv',v); @@ -255,12 +247,11 @@ e.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); } } - - + }, function(h){ // close: executes the onHide callback + performs common tasks if successful - // transform legacy hash into new var shortcuts + // transform legacy hash into new var shortcuts var e = h.w, v = h.o, o = h.c; @@ -269,39 +260,36 @@ if(o.onHide(h) !== false){ // mark modal as !shown e[0]._jqmShown = false; - + // If modal, remove from modal stack. // If no modals in modal stack, unbind the Keep Focus Function if(o.modal){ActiveModals.pop();!ActiveModals[0]&&F('unbind');} - + // IF toTop was passed and an overlay exists; // Move modal back to its "remembered" position. o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); } - - + }, F = function(t){ // F: The Keep Focus Function (for modal: true dialos) // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - + $(document)[t]("keypress keydown mousedown",X); - - + }, X = function(e){ // X: The Focus Examination Function (for modal: true dialogs) var targetModal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'); var activeModal = ActiveModals[ActiveModals.length-1]; - + // allow bubbling if event target is within active modal dialog - return (targetModal && targetModal.ID === activeModal._jqmID) ? + return (targetModal && targetModal.ID === activeModal._jqmID) ? true : $.jqm.focusFunc(activeModal,e); - }, - - I = 0, // modal ID increment (for nested modals) + }, + + I = 0, // modal ID increment (for nested modals) ActiveModals = []; // array of active modals (used to lock interactivity to appropriate modal) - - + // $.jqm, overridable defaults $.jqm = { /** @@ -336,22 +324,22 @@ onHide: onHide, onLoad: false }, - + // focusFunc is fired: - // a) when a modal:true dialog is shown, + // a) when a modal:true dialog is shown, // b) when an event occurs outside an active modal:true dialog - // It is passed the active modal:true dialog as well as event - focusFunc: function(activeModal, event) { - + // It is passed the active modal:true dialog as well as event + focusFunc: function(activeModal, event) { + // if the event occurs outside the activeModal, focus on first element - if(event) { + if(event) { $(':input:visible:first',activeModal).focus(); - } - + } + // lock interactions to the activeModal return false; }, - + // closeOnEscFunc is attached to modals where closeOnEsc param true. closeOnEscFunc: function(event){ if (event.keyCode === 27) { @@ -360,5 +348,5 @@ } } }; - + })( jQuery ); From 637d6a54796a7844edd387e31b933678fba353db Mon Sep 17 00:00:00 2001 From: paladox Date: Sun, 7 Jun 2015 11:44:44 +0100 Subject: [PATCH 05/14] Update jqModal.js --- jqModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jqModal.js b/jqModal.js index 91d5e58..328459f 100644 --- a/jqModal.js +++ b/jqModal.js @@ -248,7 +248,7 @@ } } - }, function(h){ + }, close = function(h){ // close: executes the onHide callback + performs common tasks if successful // transform legacy hash into new var shortcuts From 7b01108b374c869d961a274ebe13e457e3d4c1c4 Mon Sep 17 00:00:00 2001 From: paladox Date: Sun, 7 Jun 2015 11:45:25 +0100 Subject: [PATCH 06/14] Update jqModal.js --- jqModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jqModal.js b/jqModal.js index 328459f..0a63109 100644 --- a/jqModal.js +++ b/jqModal.js @@ -209,7 +209,7 @@ }); - }, function(h){ + }, open = function(h){ // open: executes the onOpen callback + performs common tasks if successful // transform legacy hash into new var shortcuts From 78150d9c5a08c10ddb5f8fa458bfb9a5bd5a8413 Mon Sep 17 00:00:00 2001 From: paladox Date: Mon, 8 Jun 2015 16:31:19 +0100 Subject: [PATCH 07/14] Create .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..587bd3e --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +language: node_js From e870b80f97b219f9e3a0aac2c4424e0a5200835e Mon Sep 17 00:00:00 2001 From: Ayyash Date: Sat, 4 Jul 2015 13:30:44 +0300 Subject: [PATCH 08/14] Allow click cancelation If an earlier click handler occurs, and it prevents default, the jqm click handler is cancelled. This is to prevent ajax loading of dialogs if user wants to cancel event. --- jqModal.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jqModal.js b/jqModal.js index 0a63109..557cfc1 100644 --- a/jqModal.js +++ b/jqModal.js @@ -198,8 +198,10 @@ this[key].push(jqm.ID); // register trigger click event for this modal - $(this).click(function(){ - + $(this).click(function(f){ + // allow cancelation of event + if (f.isDefaultPrevented()) return false; + e[key](this); // stop trigger click event from bubbling From 35f8343aaec69b0c6a6da6bfa83d5b2c294ce0ae Mon Sep 17 00:00:00 2001 From: Brice Burgess Date: Sun, 16 Aug 2015 12:50:28 -0500 Subject: [PATCH 09/14] new convention: use 'e' for event, 'm' for modal element, 80 cols max. --- jqModal.js | 166 ++++++++++++++++++++++++++--------------------------- 1 file changed, 82 insertions(+), 84 deletions(-) diff --git a/jqModal.js b/jqModal.js index 557cfc1..5955e3c 100644 --- a/jqModal.js +++ b/jqModal.js @@ -13,7 +13,7 @@ (function($) { /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, + * Initialize elements as "modals". Modals typically are popup dialogs, * notices, modal windows, &c. * * @name jqm @@ -24,15 +24,14 @@ $.fn.jqm=function(options){ return this.each(function(){ - var e = $(this), - jqm = e.data('jqm') || $.extend({ID: I++}, $.jqm.params), - o = $.extend(jqm,options); + var jqm = $(this).data('jqm') || $.extend({ID: I++}, $.jqm.params), + o = $.extend(jqm,options); // add/extend options to modal and mark as initialized - e.data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; + $(this).data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; // ... Attach events to trigger showing of this modal - o.trigger && e.jqmAddTrigger(o.trigger); + $(this).jqmAddTrigger(o.trigger); }); }; @@ -41,13 +40,15 @@ * onClick event to elements matching `trigger`. * * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. + * @param trigger a a string selector, jQuery collection, or DOM element. */ $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals"); - }); + if(trigger){ + return this.each(function(){ + addTrigger($(this), 'jqmShow', trigger) || err( + "jqmAddTrigger must be called on initialized modals"); + }); + } }; /** @@ -55,13 +56,15 @@ * onClick event to elements matching `trigger`. * * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. + * @param trigger a string selector, jQuery collection, or DOM element. */ $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals"); - }); + if(trigger){ + return this.each(function(){ + addTrigger($(this), 'jqmHide', trigger) || err ( + "jqmAddClose must be called on initialized modals"); + }); + } }; /** @@ -84,10 +87,10 @@ err = function(msg){ if(window.console && window.console.error) window.console.error(msg); - }, show = function(e, t){ + }, show = function(m, t){ /** - * e = modal element (as jQuery object) + * m = modal element (as jQuery object) * t = triggering element * * o = options @@ -96,22 +99,30 @@ * h = hash (for jqModal <= r15 compatibility) */ - var o = e.data('jqm'), + var o = m.data('jqm'), t = t || window.event, - z = (parseInt(e.css('z-index'))), + z = (parseInt(m.css('z-index'))), z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), + v = $('
').addClass(o.overlayClass).css({ + height:'100%', + width:'100%', + position:'fixed', + left:0, + top:0, + 'z-index':z-1, + opacity:o.overlay/100 + }), // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; + h = {w: m, c: o, o: v, t: t}; - e.css('z-index',z); + m.css('z-index',z); if(o.ajax){ - var target = o.target || e, + var target = o.target || m, url = o.ajax; - target = (typeof target === 'string') ? $(target,e) : $(target); + target = (typeof target === 'string') ? $(target,m) : $(target); if(url.substr(0,1) === '@') url = $(t).attr(url.substring(1)); // load remote contents @@ -120,27 +131,25 @@ }); // show modal - if(o.ajaxText) { - target.html(o.ajaxText); - } - open(h); + o.ajaxText && target.html(o.ajaxText); + open(h); } else { open(h); } - }, hide = function(e, t){ + }, hide = function(m, t){ /** - * e = modal element (as jQuery object) + * m = modal element (as jQuery object) * t = triggering element * * o = options * h = hash (for jqModal <= r15 compatibility) */ - var o = e.data('jqm'), + var o = m.data('jqm'), t = t || window.event, // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; + h = {w: m, c: o, o: m.data('jqmv'), t: t}; close(h); @@ -154,9 +163,8 @@ // o: (jQuery object) The overlay element // t: (DOM object) The triggering element - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); + // if overlay not disabled, prepend to body + (hash.c.overlay > 0) && hash.o.prependTo('body'); // make modal visible hash.w.show(); @@ -181,16 +189,12 @@ return true; - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (e) + }, addTrigger = function(m, key, trigger){ + // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (m) // to all elements that match trigger string (trigger) - var jqm = e.data('jqm'); - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ + var jqm = m.data('jqm'); + if(jqm) return $(trigger).each(function(){ this[key] = this[key] || []; // register this modal with this trigger only once @@ -198,13 +202,8 @@ this[key].push(jqm.ID); // register trigger click event for this modal - $(this).click(function(f){ - // allow cancelation of event - if (f.isDefaultPrevented()) return false; - - e[key](this); - - // stop trigger click event from bubbling + $(this).click(function(e){ + !e.isDefaultPrevented() && m[key](this); return false; }); } @@ -215,38 +214,38 @@ // open: executes the onOpen callback + performs common tasks if successful // transform legacy hash into new var shortcuts - var e = h.w, + var m = h.w, v = h.o, o = h.c; // execute onShow callback if(o.onShow(h) !== false){ // mark modal as shown - e[0]._jqmShown = true; + m[0]._jqmShown = true; - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!ActiveModals[0]) + - // - // else, close dialog when overlay is clicked - if(o.modal){ !ActiveModals[0]&&F('bind'); ActiveModals.push(e[0]); } - else e.jqmAddClose(v); + // if modal:true dialog + // Bind the Keep Focus Function [F] if no other Modals are active + // else, + // trigger closing of dialog when overlay is clicked + if(o.modal){ !ActiveModals[0]&&F('bind'); ActiveModals.push(m[0]); } + else m.jqmAddClose(v); - // Attach closing events to elements inside the modal matching closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); + // Attach events to elements inside the modal matching closingClass + o.closeClass && m.jqmAddClose($('.' + o.closeClass,m)); - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); + // if toTop is true and overlay exists; + // remember modal DOM position with placeholder element, and move + // the modal to a direct child of the body tag (after overlyay) + (o.toTop && v ) && + m.before('').insertAfter(v); // remember overlay (for closing function) - e.data('jqmv',v); + m.data('jqmv',v); // close modal if the esc key is pressed and closeOnEsc is set to true - e.unbind("keydown",$.jqm.closeOnEscFunc); + m.unbind("keydown",$.jqm.closeOnEscFunc); if(o.closeOnEsc) { - e.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); + m.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); } } @@ -254,43 +253,44 @@ // close: executes the onHide callback + performs common tasks if successful // transform legacy hash into new var shortcuts - var e = h.w, + var m = h.w, v = h.o, o = h.c; - // execute onShow callback + // execute onHide callback if(o.onHide(h) !== false){ // mark modal as !shown - e[0]._jqmShown = false; + m[0]._jqmShown = false; // If modal, remove from modal stack. // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){ActiveModals.pop();!ActiveModals[0]&&F('unbind');} + if(o.modal){ ActiveModals.pop(); !ActiveModals[0] && F('unbind'); } // IF toTop was passed and an overlay exists; // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); + (o.toTop && v) && $('#jqmP'+o.ID).after(m).remove(); } }, F = function(t){ // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks + // Binds or Unbinds (t) the Focus Examination Function (X) $(document)[t]("keypress keydown mousedown",X); }, X = function(e){ // X: The Focus Examination Function (for modal: true dialogs) - var targetModal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'); + var targetModal = $(e.target).data('jqm') || + $(e.target).parents('.jqm-init:first').data('jqm'); var activeModal = ActiveModals[ActiveModals.length-1]; // allow bubbling if event target is within active modal dialog return (targetModal && targetModal.ID === activeModal._jqmID) ? - true : $.jqm.focusFunc(activeModal,e); + true : $.jqm.focusFunc(activeModal,e); }, I = 0, // modal ID increment (for nested modals) - ActiveModals = []; // array of active modals (used to lock interactivity to appropriate modal) + ActiveModals = []; // array of active modals // $.jqm, overridable defaults $.jqm = { @@ -331,20 +331,18 @@ // a) when a modal:true dialog is shown, // b) when an event occurs outside an active modal:true dialog // It is passed the active modal:true dialog as well as event - focusFunc: function(activeModal, event) { + focusFunc: function(activeModal, e) { // if the event occurs outside the activeModal, focus on first element - if(event) { - $(':input:visible:first',activeModal).focus(); - } + e && $(':input:visible:first',activeModal).focus(); // lock interactions to the activeModal return false; }, // closeOnEscFunc is attached to modals where closeOnEsc param true. - closeOnEscFunc: function(event){ - if (event.keyCode === 27) { + closeOnEscFunc: function(e){ + if (e.keyCode === 27) { $(this).jqmHide(); return false; } From 5000aa5fd32b5ef0665cc9e6fd4efe8aa13bfbf7 Mon Sep 17 00:00:00 2001 From: Brice Burgess Date: Sun, 16 Aug 2015 13:49:46 -0500 Subject: [PATCH 10/14] staging r25 release --- CHANGELOG.md | 7 + jqModal.jquery.json | 2 +- jqModal.js | 3 +- jqModal.min.js | 4 +- releases/jqModal-r25.js | 353 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 365 insertions(+), 4 deletions(-) create mode 100644 releases/jqModal-r25.js diff --git a/CHANGELOG.md b/CHANGELOG.md index e999cd1..45ab06b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ jqModal Changes By Release ========================== +## 1.4.0 (2015.08.16 +r25) + +* new convention: use 'e' for event, 'm' for modal element, 80 cols max. +* preventDefault to cancel click behavior in trigger functions, thanks @ayyash +* strict javascript linting, thanks @paladox + * add travis-ci integration + ## 1.3.0 (2015.04.15 +r24) * immediately show ajax modals diff --git a/jqModal.jquery.json b/jqModal.jquery.json index 3680427..f97c85a 100644 --- a/jqModal.jquery.json +++ b/jqModal.jquery.json @@ -12,7 +12,7 @@ "video", "page cover" ], - "version": "1.3.0", + "version": "1.4.0", "author": { "name": "Brice Burgess" }, diff --git a/jqModal.js b/jqModal.js index 5955e3c..1f8b59b 100644 --- a/jqModal.js +++ b/jqModal.js @@ -6,7 +6,7 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * $Version: 1.3.0 (2015.04.15 +r24) + * $Version: 1.4.0 (2015.08.16 +r25) * Requires: jQuery 1.2.3+ */ @@ -202,6 +202,7 @@ this[key].push(jqm.ID); // register trigger click event for this modal + // allows cancellation of show/hide event from $(this).click(function(e){ !e.isDefaultPrevented() && m[key](this); return false; diff --git a/jqModal.min.js b/jqModal.min.js index d1b3b27..971bf63 100644 --- a/jqModal.min.js +++ b/jqModal.min.js @@ -6,8 +6,8 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * $Version: 1.3.0 (2015.04.15 +r24) + * $Version: 1.4.0 (2015.08.16 +r25) * Requires: jQuery 1.2.3+ */ -!function(n){n.fn.jqm=function(t){return this.each(function(){var o=n(this),e=o.data("jqm")||n.extend({ID:m++},n.jqm.params),i=n.extend(e,t);o.data("jqm",i).addClass("jqm-init")[0]._jqmID=i.ID,i.trigger&&o.jqmAddTrigger(i.trigger)})},n.fn.jqmAddTrigger=function(o){return this.each(function(){s(n(this),"jqmShow",o)||t("jqmAddTrigger must be called on initialized modals")})},n.fn.jqmAddClose=function(o){return this.each(function(){s(n(this),"jqmHide",o)||t("jqmAddClose must be called on initialized modals")})},n.fn.jqmShow=function(t){return this.each(function(){!this._jqmShown&&o(n(this),t)})},n.fn.jqmHide=function(t){return this.each(function(){this._jqmShown&&e(n(this),t)})};var t=function(n){window.console&&window.console.error&&window.console.error(n)},o=function(t,o){var e=t.data("jqm"),o=o||window.event,i=parseInt(t.css("z-index")),i=i>0?i:3e3,a=n("
").addClass(e.overlayClass).css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":i-1,opacity:e.overlay/100}),s={w:t,c:e,o:a,t:o};if(t.css("z-index",i),e.ajax){var d=e.target||t,c=e.ajax;d="string"==typeof d?n(d,t):n(d),"@"==c.substr(0,1)&&(c=n(o).attr(c.substring(1))),d.load(c,function(){e.onLoad&&e.onLoad.call(this,s)}),e.ajaxText&&d.html(e.ajaxText),r(s)}else r(s)},e=function(n,t){var o=n.data("jqm"),t=t||window.event,e={w:n,c:o,o:n.data("jqmv"),t:t};d(e)},i=function(t){return t.c.overlay>0&&t.o.prependTo("body"),t.w.show(),n.jqm.focusFunc(t.w,!0),!0},a=function(n){return n.w.hide()&&n.o&&n.o.remove(),!0},s=function(t,o,e){var i=t.data("jqm");return t.data("jqm")?n(e).each(function(){this[o]=this[o]||[],n.inArray(i.ID,this[o])<0&&(this[o].push(i.ID),n(this).click(function(){return t[o](this),!1}))}):!1},r=function(t){var o=t.w,e=t.o,i=t.c;i.onShow(t)!==!1&&(o[0]._jqmShown=!0,i.modal?(!l[0]&&c("bind"),l.push(o[0])):o.jqmAddClose(e),i.closeClass&&o.jqmAddClose(n("."+i.closeClass,o)),i.toTop&&e&&o.before('').insertAfter(e),o.data("jqmv",e),o.unbind("keydown",n.jqm.closeOnEscFunc),i.closeOnEsc&&o.attr("tabindex",0).bind("keydown",n.jqm.closeOnEscFunc).focus())},d=function(t){var o=t.w,e=t.o,i=t.c;i.onHide(t)!==!1&&(o[0]._jqmShown=!1,i.modal&&(l.pop(),!l[0]&&c("unbind")),i.toTop&&e&&n("#jqmP"+i.ID).after(o).remove())},c=function(t){n(document)[t]("keypress keydown mousedown",u)},u=function(t){var o=n(t.target).data("jqm")||n(t.target).parents(".jqm-init:first").data("jqm"),e=l[l.length-1];return o&&o.ID==e._jqmID?!0:n.jqm.focusFunc(e,t)},m=0,l=[];n.jqm={params:{overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",closeOnEsc:!1,trigger:".jqModal",ajax:!1,target:!1,ajaxText:"",modal:!1,toTop:!1,onShow:i,onHide:a,onLoad:!1},focusFunc:function(t,o){return o&&n(":input:visible:first",t).focus(),!1},closeOnEscFunc:function(t){return 27==t.keyCode?(n(this).jqmHide(),!1):void 0}}}(jQuery); \ No newline at end of file +!function(n){n.fn.jqm=function(o){return this.each(function(){var t=n(this).data("jqm")||n.extend({ID:m++},n.jqm.params),e=n.extend(t,o);n(this).data("jqm",e).addClass("jqm-init")[0]._jqmID=e.ID,n(this).jqmAddTrigger(e.trigger)})},n.fn.jqmAddTrigger=function(t){return t?this.each(function(){a(n(this),"jqmShow",t)||o("jqmAddTrigger must be called on initialized modals")}):void 0},n.fn.jqmAddClose=function(t){return t?this.each(function(){a(n(this),"jqmHide",t)||o("jqmAddClose must be called on initialized modals")}):void 0},n.fn.jqmShow=function(o){return this.each(function(){!this._jqmShown&&t(n(this),o)})},n.fn.jqmHide=function(o){return this.each(function(){this._jqmShown&&e(n(this),o)})};var o=function(n){window.console&&window.console.error&&window.console.error(n)},t=function(o,t){var e=o.data("jqm"),t=t||window.event,i=parseInt(o.css("z-index")),i=i>0?i:3e3,s=n("
").addClass(e.overlayClass).css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":i-1,opacity:e.overlay/100}),a={w:o,c:e,o:s,t:t};if(o.css("z-index",i),e.ajax){var d=e.target||o,c=e.ajax;d="string"==typeof d?n(d,o):n(d),"@"===c.substr(0,1)&&(c=n(t).attr(c.substring(1))),d.load(c,function(){e.onLoad&&e.onLoad.call(this,a)}),e.ajaxText&&d.html(e.ajaxText),r(a)}else r(a)},e=function(n,o){var t=n.data("jqm"),o=o||window.event,e={w:n,c:t,o:n.data("jqmv"),t:o};d(e)},i=function(o){return o.c.overlay>0&&o.o.prependTo("body"),o.w.show(),n.jqm.focusFunc(o.w,!0),!0},s=function(n){return n.w.hide()&&n.o&&n.o.remove(),!0},a=function(o,t,e){var i=o.data("jqm");return i?n(e).each(function(){this[t]=this[t]||[],n.inArray(i.ID,this[t])<0&&(this[t].push(i.ID),n(this).click(function(n){return!n.isDefaultPrevented()&&o[t](this),!1}))}):void 0},r=function(o){var t=o.w,e=o.o,i=o.c;i.onShow(o)!==!1&&(t[0]._jqmShown=!0,i.modal?(!l[0]&&c("bind"),l.push(t[0])):t.jqmAddClose(e),i.closeClass&&t.jqmAddClose(n("."+i.closeClass,t)),i.toTop&&e&&t.before('').insertAfter(e),t.data("jqmv",e),t.unbind("keydown",n.jqm.closeOnEscFunc),i.closeOnEsc&&t.attr("tabindex",0).bind("keydown",n.jqm.closeOnEscFunc).focus())},d=function(o){var t=o.w,e=o.o,i=o.c;i.onHide(o)!==!1&&(t[0]._jqmShown=!1,i.modal&&(l.pop(),!l[0]&&c("unbind")),i.toTop&&e&&n("#jqmP"+i.ID).after(t).remove())},c=function(o){n(document)[o]("keypress keydown mousedown",u)},u=function(o){var t=n(o.target).data("jqm")||n(o.target).parents(".jqm-init:first").data("jqm"),e=l[l.length-1];return t&&t.ID===e._jqmID?!0:n.jqm.focusFunc(e,o)},m=0,l=[];n.jqm={params:{overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",closeOnEsc:!1,trigger:".jqModal",ajax:!1,target:!1,ajaxText:"",modal:!1,toTop:!1,onShow:i,onHide:s,onLoad:!1},focusFunc:function(o,t){return t&&n(":input:visible:first",o).focus(),!1},closeOnEscFunc:function(o){return 27===o.keyCode?(n(this).jqmHide(),!1):void 0}}}(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r25.js b/releases/jqModal-r25.js new file mode 100644 index 0000000..1f8b59b --- /dev/null +++ b/releases/jqModal-r25.js @@ -0,0 +1,353 @@ +/* + * jqModal - Minimalist Modaling with jQuery + * + * Copyright (c) 2007-2015 Brice Burgess @IceburgBrice + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * $Version: 1.4.0 (2015.08.16 +r25) + * Requires: jQuery 1.2.3+ + */ + +(function($) { + + /** + * Initialize elements as "modals". Modals typically are popup dialogs, + * notices, modal windows, &c. + * + * @name jqm + * @param options user defined options, augments defaults. + * @type jQuery + * @cat Plugins/jqModal + */ + + $.fn.jqm=function(options){ + return this.each(function(){ + var jqm = $(this).data('jqm') || $.extend({ID: I++}, $.jqm.params), + o = $.extend(jqm,options); + + // add/extend options to modal and mark as initialized + $(this).data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; + + // ... Attach events to trigger showing of this modal + $(this).jqmAddTrigger(o.trigger); + }); + }; + + /** + * Matching modals will have their jqmShow() method fired by attaching a + * onClick event to elements matching `trigger`. + * + * @name jqmAddTrigger + * @param trigger a a string selector, jQuery collection, or DOM element. + */ + $.fn.jqmAddTrigger=function(trigger){ + if(trigger){ + return this.each(function(){ + addTrigger($(this), 'jqmShow', trigger) || err( + "jqmAddTrigger must be called on initialized modals"); + }); + } + }; + + /** + * Matching modals will have their jqmHide() method fired by attaching an + * onClick event to elements matching `trigger`. + * + * @name jqmAddClose + * @param trigger a string selector, jQuery collection, or DOM element. + */ + $.fn.jqmAddClose=function(trigger){ + if(trigger){ + return this.each(function(){ + addTrigger($(this), 'jqmHide', trigger) || err ( + "jqmAddClose must be called on initialized modals"); + }); + } + }; + + /** + * Open matching modals (if not shown) + */ + $.fn.jqmShow=function(trigger){ + return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); + }; + + /** + * Close matching modals + */ + $.fn.jqmHide=function(trigger){ + return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); + }; + + // utility functions + + var + err = function(msg){ + if(window.console && window.console.error) window.console.error(msg); + + }, show = function(m, t){ + + /** + * m = modal element (as jQuery object) + * t = triggering element + * + * o = options + * z = z-index of modal + * v = overlay element (as jQuery object) + * h = hash (for jqModal <= r15 compatibility) + */ + + var o = m.data('jqm'), + t = t || window.event, + z = (parseInt(m.css('z-index'))), + z = (z > 0) ? z : 3000, + v = $('
').addClass(o.overlayClass).css({ + height:'100%', + width:'100%', + position:'fixed', + left:0, + top:0, + 'z-index':z-1, + opacity:o.overlay/100 + }), + + // maintain legacy "hash" construct + h = {w: m, c: o, o: v, t: t}; + + m.css('z-index',z); + + if(o.ajax){ + var target = o.target || m, + url = o.ajax; + + target = (typeof target === 'string') ? $(target,m) : $(target); + if(url.substr(0,1) === '@') url = $(t).attr(url.substring(1)); + + // load remote contents + target.load(url,function(){ + o.onLoad && o.onLoad.call(this,h); + }); + + // show modal + o.ajaxText && target.html(o.ajaxText); + open(h); + } + else { open(h); } + + }, hide = function(m, t){ + /** + * m = modal element (as jQuery object) + * t = triggering element + * + * o = options + * h = hash (for jqModal <= r15 compatibility) + */ + + var o = m.data('jqm'), + t = t || window.event, + + // maintain legacy "hash" construct + h = {w: m, c: o, o: m.data('jqmv'), t: t}; + + close(h); + + }, onShow = function(hash){ + // onShow callback. Responsible for showing a modal and overlay. + // return false to stop opening modal. + + // hash object; + // w: (jQuery object) The modal element + // c: (object) The modal's options object + // o: (jQuery object) The overlay element + // t: (DOM object) The triggering element + + // if overlay not disabled, prepend to body + (hash.c.overlay > 0) && hash.o.prependTo('body'); + + // make modal visible + hash.w.show(); + + // call focusFunc (attempts to focus on first input in modal) + $.jqm.focusFunc(hash.w,true); + + return true; + + }, onHide = function(hash){ + // onHide callback. Responsible for hiding a modal and overlay. + // return false to stop closing modal. + + // hash object; + // w: (jQuery object) The modal element + // c: (object) The modal's options object + // o: (jQuery object) The overlay element + // t: (DOM object) The triggering element + + // hide modal and if overlay, remove overlay. + hash.w.hide() && hash.o && hash.o.remove(); + + return true; + + }, addTrigger = function(m, key, trigger){ + // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (m) + // to all elements that match trigger string (trigger) + + var jqm = m.data('jqm'); + if(jqm) return $(trigger).each(function(){ + this[key] = this[key] || []; + + // register this modal with this trigger only once + if($.inArray(jqm.ID,this[key]) < 0) { + this[key].push(jqm.ID); + + // register trigger click event for this modal + // allows cancellation of show/hide event from + $(this).click(function(e){ + !e.isDefaultPrevented() && m[key](this); + return false; + }); + } + + }); + + }, open = function(h){ + // open: executes the onOpen callback + performs common tasks if successful + + // transform legacy hash into new var shortcuts + var m = h.w, + v = h.o, + o = h.c; + + // execute onShow callback + if(o.onShow(h) !== false){ + // mark modal as shown + m[0]._jqmShown = true; + + // if modal:true dialog + // Bind the Keep Focus Function [F] if no other Modals are active + // else, + // trigger closing of dialog when overlay is clicked + if(o.modal){ !ActiveModals[0]&&F('bind'); ActiveModals.push(m[0]); } + else m.jqmAddClose(v); + + // Attach events to elements inside the modal matching closingClass + o.closeClass && m.jqmAddClose($('.' + o.closeClass,m)); + + // if toTop is true and overlay exists; + // remember modal DOM position with placeholder element, and move + // the modal to a direct child of the body tag (after overlyay) + (o.toTop && v ) && + m.before('').insertAfter(v); + + // remember overlay (for closing function) + m.data('jqmv',v); + + // close modal if the esc key is pressed and closeOnEsc is set to true + m.unbind("keydown",$.jqm.closeOnEscFunc); + if(o.closeOnEsc) { + m.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); + } + } + + }, close = function(h){ + // close: executes the onHide callback + performs common tasks if successful + + // transform legacy hash into new var shortcuts + var m = h.w, + v = h.o, + o = h.c; + + // execute onHide callback + if(o.onHide(h) !== false){ + // mark modal as !shown + m[0]._jqmShown = false; + + // If modal, remove from modal stack. + // If no modals in modal stack, unbind the Keep Focus Function + if(o.modal){ ActiveModals.pop(); !ActiveModals[0] && F('unbind'); } + + // IF toTop was passed and an overlay exists; + // Move modal back to its "remembered" position. + (o.toTop && v) && $('#jqmP'+o.ID).after(m).remove(); + } + + }, F = function(t){ + // F: The Keep Focus Function (for modal: true dialos) + // Binds or Unbinds (t) the Focus Examination Function (X) + + $(document)[t]("keypress keydown mousedown",X); + + }, X = function(e){ + // X: The Focus Examination Function (for modal: true dialogs) + + var targetModal = $(e.target).data('jqm') || + $(e.target).parents('.jqm-init:first').data('jqm'); + var activeModal = ActiveModals[ActiveModals.length-1]; + + // allow bubbling if event target is within active modal dialog + return (targetModal && targetModal.ID === activeModal._jqmID) ? + true : $.jqm.focusFunc(activeModal,e); + }, + + I = 0, // modal ID increment (for nested modals) + ActiveModals = []; // array of active modals + + // $.jqm, overridable defaults + $.jqm = { + /** + * default options + * + * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. + * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. + * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). + * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. + * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; ...) + * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. + * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. + * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. + * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. + * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. + * (Function) onShow - User defined callback function fired when modal opened. + * (Function) onHide - User defined callback function fired when modal closed. + * (Function) onLoad - User defined callback function fired when ajax content loads. + */ + params: { + overlay: 50, + overlayClass: 'jqmOverlay', + closeClass: 'jqmClose', + closeOnEsc: false, + trigger: '.jqModal', + ajax: false, + target: false, + ajaxText: '', + modal: false, + toTop: false, + onShow: onShow, + onHide: onHide, + onLoad: false + }, + + // focusFunc is fired: + // a) when a modal:true dialog is shown, + // b) when an event occurs outside an active modal:true dialog + // It is passed the active modal:true dialog as well as event + focusFunc: function(activeModal, e) { + + // if the event occurs outside the activeModal, focus on first element + e && $(':input:visible:first',activeModal).focus(); + + // lock interactions to the activeModal + return false; + }, + + // closeOnEscFunc is attached to modals where closeOnEsc param true. + closeOnEscFunc: function(e){ + if (e.keyCode === 27) { + $(this).jqmHide(); + return false; + } + } + }; + +})( jQuery ); From 47f1a60b559bd395ed1d3d23999c3966aaa4ee20 Mon Sep 17 00:00:00 2001 From: Brice Burgess Date: Sun, 16 Aug 2015 22:08:31 -0500 Subject: [PATCH 11/14] add package.json for travis-ci tests --- package.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..382eaa8 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "jqmodal", + "devDependencies": { + "jshint": "latest" + }, + "scripts": { + "lint": "jshint *.js", + "test": "jshint *.js" + } +} \ No newline at end of file From 614fed82be54ff74cf33b7b5ab10627ac3bd0174 Mon Sep 17 00:00:00 2001 From: Brice Burgess Date: Sun, 16 Aug 2015 22:25:06 -0500 Subject: [PATCH 12/14] lint fixes --- jqModal.js | 53 ++-- jqModal.min.js | 2 +- package.json | 1 - releases/jqModal-r25.js | 677 ++++++++++++++++++++-------------------- 4 files changed, 371 insertions(+), 362 deletions(-) diff --git a/jqModal.js b/jqModal.js index 1f8b59b..f4f2c99 100644 --- a/jqModal.js +++ b/jqModal.js @@ -45,8 +45,8 @@ $.fn.jqmAddTrigger=function(trigger){ if(trigger){ return this.each(function(){ - addTrigger($(this), 'jqmShow', trigger) || err( - "jqmAddTrigger must be called on initialized modals"); + if (!addTrigger($(this), 'jqmShow', trigger)) + err("jqmAddTrigger must be called on initialized modals"); }); } }; @@ -61,8 +61,8 @@ $.fn.jqmAddClose=function(trigger){ if(trigger){ return this.each(function(){ - addTrigger($(this), 'jqmHide', trigger) || err ( - "jqmAddClose must be called on initialized modals"); + if(!addTrigger($(this), 'jqmHide', trigger)) + err ("jqmAddClose must be called on initialized modals"); }); } }; @@ -71,14 +71,14 @@ * Open matching modals (if not shown) */ $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); + return this.each(function(){ if(!this._jqmShown) show($(this), trigger); }); }; /** * Close matching modals */ $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); + return this.each(function(){ if(this._jqmShown) hide($(this), trigger); }); }; // utility functions @@ -98,11 +98,11 @@ * v = overlay element (as jQuery object) * h = hash (for jqModal <= r15 compatibility) */ + + t = t || window.event; var o = m.data('jqm'), - t = t || window.event, - z = (parseInt(m.css('z-index'))), - z = (z > 0) ? z : 3000, + z = (parseInt(m.css('z-index'))) || 3000, v = $('
').addClass(o.overlayClass).css({ height:'100%', width:'100%', @@ -127,11 +127,11 @@ // load remote contents target.load(url,function(){ - o.onLoad && o.onLoad.call(this,h); + if(o.onLoad) o.onLoad.call(this,h); }); // show modal - o.ajaxText && target.html(o.ajaxText); + if(o.ajaxText) target.html(o.ajaxText); open(h); } else { open(h); } @@ -145,11 +145,10 @@ * h = hash (for jqModal <= r15 compatibility) */ + t = t || window.event; var o = m.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: m, c: o, o: m.data('jqmv'), t: t}; + // maintain legacy "hash" construct + h = {w: m, c: o, o: m.data('jqmv'), t: t}; close(h); @@ -164,7 +163,7 @@ // t: (DOM object) The triggering element // if overlay not disabled, prepend to body - (hash.c.overlay > 0) && hash.o.prependTo('body'); + if(hash.c.overlay > 0) hash.o.prependTo('body'); // make modal visible hash.w.show(); @@ -185,7 +184,7 @@ // t: (DOM object) The triggering element // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); + if(hash.w.hide() && hash.o) hash.o.remove(); return true; @@ -204,7 +203,7 @@ // register trigger click event for this modal // allows cancellation of show/hide event from $(this).click(function(e){ - !e.isDefaultPrevented() && m[key](this); + if(!e.isDefaultPrevented()) m[key](this); return false; }); } @@ -228,16 +227,19 @@ // Bind the Keep Focus Function [F] if no other Modals are active // else, // trigger closing of dialog when overlay is clicked - if(o.modal){ !ActiveModals[0]&&F('bind'); ActiveModals.push(m[0]); } + if(o.modal){ + if(!ActiveModals[0]){ F('bind'); } + ActiveModals.push(m[0]); + } else m.jqmAddClose(v); // Attach events to elements inside the modal matching closingClass - o.closeClass && m.jqmAddClose($('.' + o.closeClass,m)); + if(o.closeClass) m.jqmAddClose($('.' + o.closeClass,m)); // if toTop is true and overlay exists; // remember modal DOM position with placeholder element, and move // the modal to a direct child of the body tag (after overlyay) - (o.toTop && v ) && + if(o.toTop && v) m.before('').insertAfter(v); // remember overlay (for closing function) @@ -265,11 +267,14 @@ // If modal, remove from modal stack. // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){ ActiveModals.pop(); !ActiveModals[0] && F('unbind'); } + if(o.modal){ + ActiveModals.pop(); + if(!ActiveModals[0]) F('unbind'); + } // IF toTop was passed and an overlay exists; // Move modal back to its "remembered" position. - (o.toTop && v) && $('#jqmP'+o.ID).after(m).remove(); + if(o.toTop && v) $('#jqmP'+o.ID).after(m).remove(); } }, F = function(t){ @@ -335,7 +340,7 @@ focusFunc: function(activeModal, e) { // if the event occurs outside the activeModal, focus on first element - e && $(':input:visible:first',activeModal).focus(); + if(e) $(':input:visible:first',activeModal).focus(); // lock interactions to the activeModal return false; diff --git a/jqModal.min.js b/jqModal.min.js index 971bf63..849e80f 100644 --- a/jqModal.min.js +++ b/jqModal.min.js @@ -10,4 +10,4 @@ * Requires: jQuery 1.2.3+ */ -!function(n){n.fn.jqm=function(o){return this.each(function(){var t=n(this).data("jqm")||n.extend({ID:m++},n.jqm.params),e=n.extend(t,o);n(this).data("jqm",e).addClass("jqm-init")[0]._jqmID=e.ID,n(this).jqmAddTrigger(e.trigger)})},n.fn.jqmAddTrigger=function(t){return t?this.each(function(){a(n(this),"jqmShow",t)||o("jqmAddTrigger must be called on initialized modals")}):void 0},n.fn.jqmAddClose=function(t){return t?this.each(function(){a(n(this),"jqmHide",t)||o("jqmAddClose must be called on initialized modals")}):void 0},n.fn.jqmShow=function(o){return this.each(function(){!this._jqmShown&&t(n(this),o)})},n.fn.jqmHide=function(o){return this.each(function(){this._jqmShown&&e(n(this),o)})};var o=function(n){window.console&&window.console.error&&window.console.error(n)},t=function(o,t){var e=o.data("jqm"),t=t||window.event,i=parseInt(o.css("z-index")),i=i>0?i:3e3,s=n("
").addClass(e.overlayClass).css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":i-1,opacity:e.overlay/100}),a={w:o,c:e,o:s,t:t};if(o.css("z-index",i),e.ajax){var d=e.target||o,c=e.ajax;d="string"==typeof d?n(d,o):n(d),"@"===c.substr(0,1)&&(c=n(t).attr(c.substring(1))),d.load(c,function(){e.onLoad&&e.onLoad.call(this,a)}),e.ajaxText&&d.html(e.ajaxText),r(a)}else r(a)},e=function(n,o){var t=n.data("jqm"),o=o||window.event,e={w:n,c:t,o:n.data("jqmv"),t:o};d(e)},i=function(o){return o.c.overlay>0&&o.o.prependTo("body"),o.w.show(),n.jqm.focusFunc(o.w,!0),!0},s=function(n){return n.w.hide()&&n.o&&n.o.remove(),!0},a=function(o,t,e){var i=o.data("jqm");return i?n(e).each(function(){this[t]=this[t]||[],n.inArray(i.ID,this[t])<0&&(this[t].push(i.ID),n(this).click(function(n){return!n.isDefaultPrevented()&&o[t](this),!1}))}):void 0},r=function(o){var t=o.w,e=o.o,i=o.c;i.onShow(o)!==!1&&(t[0]._jqmShown=!0,i.modal?(!l[0]&&c("bind"),l.push(t[0])):t.jqmAddClose(e),i.closeClass&&t.jqmAddClose(n("."+i.closeClass,t)),i.toTop&&e&&t.before('').insertAfter(e),t.data("jqmv",e),t.unbind("keydown",n.jqm.closeOnEscFunc),i.closeOnEsc&&t.attr("tabindex",0).bind("keydown",n.jqm.closeOnEscFunc).focus())},d=function(o){var t=o.w,e=o.o,i=o.c;i.onHide(o)!==!1&&(t[0]._jqmShown=!1,i.modal&&(l.pop(),!l[0]&&c("unbind")),i.toTop&&e&&n("#jqmP"+i.ID).after(t).remove())},c=function(o){n(document)[o]("keypress keydown mousedown",u)},u=function(o){var t=n(o.target).data("jqm")||n(o.target).parents(".jqm-init:first").data("jqm"),e=l[l.length-1];return t&&t.ID===e._jqmID?!0:n.jqm.focusFunc(e,o)},m=0,l=[];n.jqm={params:{overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",closeOnEsc:!1,trigger:".jqModal",ajax:!1,target:!1,ajaxText:"",modal:!1,toTop:!1,onShow:i,onHide:s,onLoad:!1},focusFunc:function(o,t){return t&&n(":input:visible:first",o).focus(),!1},closeOnEscFunc:function(o){return 27===o.keyCode?(n(this).jqmHide(),!1):void 0}}}(jQuery); \ No newline at end of file +!function(n){n.fn.jqm=function(o){return this.each(function(){var t=n(this).data("jqm")||n.extend({ID:m++},n.jqm.params),e=n.extend(t,o);n(this).data("jqm",e).addClass("jqm-init")[0]._jqmID=e.ID,n(this).jqmAddTrigger(e.trigger)})},n.fn.jqmAddTrigger=function(t){return t?this.each(function(){a(n(this),"jqmShow",t)||o("jqmAddTrigger must be called on initialized modals")}):void 0},n.fn.jqmAddClose=function(t){return t?this.each(function(){a(n(this),"jqmHide",t)||o("jqmAddClose must be called on initialized modals")}):void 0},n.fn.jqmShow=function(o){return this.each(function(){this._jqmShown||t(n(this),o)})},n.fn.jqmHide=function(o){return this.each(function(){this._jqmShown&&e(n(this),o)})};var o=function(n){window.console&&window.console.error&&window.console.error(n)},t=function(o,t){t=t||window.event;var e=o.data("jqm"),i=parseInt(o.css("z-index"))||3e3,s=n("
").addClass(e.overlayClass).css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":i-1,opacity:e.overlay/100}),a={w:o,c:e,o:s,t:t};if(o.css("z-index",i),e.ajax){var d=e.target||o,c=e.ajax;d="string"==typeof d?n(d,o):n(d),"@"===c.substr(0,1)&&(c=n(t).attr(c.substring(1))),d.load(c,function(){e.onLoad&&e.onLoad.call(this,a)}),e.ajaxText&&d.html(e.ajaxText),r(a)}else r(a)},e=function(n,o){o=o||window.event;var t=n.data("jqm"),e={w:n,c:t,o:n.data("jqmv"),t:o};d(e)},i=function(o){return o.c.overlay>0&&o.o.prependTo("body"),o.w.show(),n.jqm.focusFunc(o.w,!0),!0},s=function(n){return n.w.hide()&&n.o&&n.o.remove(),!0},a=function(o,t,e){var i=o.data("jqm");return i?n(e).each(function(){this[t]=this[t]||[],n.inArray(i.ID,this[t])<0&&(this[t].push(i.ID),n(this).click(function(n){return n.isDefaultPrevented()||o[t](this),!1}))}):void 0},r=function(o){var t=o.w,e=o.o,i=o.c;i.onShow(o)!==!1&&(t[0]._jqmShown=!0,i.modal?(l[0]||c("bind"),l.push(t[0])):t.jqmAddClose(e),i.closeClass&&t.jqmAddClose(n("."+i.closeClass,t)),i.toTop&&e&&t.before('').insertAfter(e),t.data("jqmv",e),t.unbind("keydown",n.jqm.closeOnEscFunc),i.closeOnEsc&&t.attr("tabindex",0).bind("keydown",n.jqm.closeOnEscFunc).focus())},d=function(o){var t=o.w,e=o.o,i=o.c;i.onHide(o)!==!1&&(t[0]._jqmShown=!1,i.modal&&(l.pop(),l[0]||c("unbind")),i.toTop&&e&&n("#jqmP"+i.ID).after(t).remove())},c=function(o){n(document)[o]("keypress keydown mousedown",u)},u=function(o){var t=n(o.target).data("jqm")||n(o.target).parents(".jqm-init:first").data("jqm"),e=l[l.length-1];return t&&t.ID===e._jqmID?!0:n.jqm.focusFunc(e,o)},m=0,l=[];n.jqm={params:{overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",closeOnEsc:!1,trigger:".jqModal",ajax:!1,target:!1,ajaxText:"",modal:!1,toTop:!1,onShow:i,onHide:s,onLoad:!1},focusFunc:function(o,t){return t&&n(":input:visible:first",o).focus(),!1},closeOnEscFunc:function(o){return 27===o.keyCode?(n(this).jqmHide(),!1):void 0}}}(jQuery); \ No newline at end of file diff --git a/package.json b/package.json index 382eaa8..bbec9c6 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "jshint": "latest" }, "scripts": { - "lint": "jshint *.js", "test": "jshint *.js" } } \ No newline at end of file diff --git a/releases/jqModal-r25.js b/releases/jqModal-r25.js index 1f8b59b..efdc909 100644 --- a/releases/jqModal-r25.js +++ b/releases/jqModal-r25.js @@ -12,342 +12,347 @@ (function($) { - /** - * Initialize elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - return this.each(function(){ - var jqm = $(this).data('jqm') || $.extend({ID: I++}, $.jqm.params), - o = $.extend(jqm,options); - - // add/extend options to modal and mark as initialized - $(this).data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; - - // ... Attach events to trigger showing of this modal - $(this).jqmAddTrigger(o.trigger); - }); - }; - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a a string selector, jQuery collection, or DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - if(trigger){ - return this.each(function(){ - addTrigger($(this), 'jqmShow', trigger) || err( - "jqmAddTrigger must be called on initialized modals"); - }); - } - }; - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a string selector, jQuery collection, or DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - if(trigger){ - return this.each(function(){ - addTrigger($(this), 'jqmHide', trigger) || err ( - "jqmAddClose must be called on initialized modals"); - }); - } - }; - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - }, show = function(m, t){ - - /** - * m = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = m.data('jqm'), - t = t || window.event, - z = (parseInt(m.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({ - height:'100%', - width:'100%', - position:'fixed', - left:0, - top:0, - 'z-index':z-1, - opacity:o.overlay/100 - }), - - // maintain legacy "hash" construct - h = {w: m, c: o, o: v, t: t}; - - m.css('z-index',z); - - if(o.ajax){ - var target = o.target || m, - url = o.ajax; - - target = (typeof target === 'string') ? $(target,m) : $(target); - if(url.substr(0,1) === '@') url = $(t).attr(url.substring(1)); - - // load remote contents - target.load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - }); - - // show modal - o.ajaxText && target.html(o.ajaxText); + /** + * Initialize elements as "modals". Modals typically are popup dialogs, + * notices, modal windows, &c. + * + * @name jqm + * @param options user defined options, augments defaults. + * @type jQuery + * @cat Plugins/jqModal + */ + + $.fn.jqm=function(options){ + return this.each(function(){ + var jqm = $(this).data('jqm') || $.extend({ID: I++}, $.jqm.params), + o = $.extend(jqm,options); + + // add/extend options to modal and mark as initialized + $(this).data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; + + // ... Attach events to trigger showing of this modal + $(this).jqmAddTrigger(o.trigger); + }); + }; + + /** + * Matching modals will have their jqmShow() method fired by attaching a + * onClick event to elements matching `trigger`. + * + * @name jqmAddTrigger + * @param trigger a a string selector, jQuery collection, or DOM element. + */ + $.fn.jqmAddTrigger=function(trigger){ + if(trigger){ + return this.each(function(){ + if (!addTrigger($(this), 'jqmShow', trigger)) + err("jqmAddTrigger must be called on initialized modals"); + }); + } + }; + + /** + * Matching modals will have their jqmHide() method fired by attaching an + * onClick event to elements matching `trigger`. + * + * @name jqmAddClose + * @param trigger a string selector, jQuery collection, or DOM element. + */ + $.fn.jqmAddClose=function(trigger){ + if(trigger){ + return this.each(function(){ + if(!addTrigger($(this), 'jqmHide', trigger)) + err ("jqmAddClose must be called on initialized modals"); + }); + } + }; + + /** + * Open matching modals (if not shown) + */ + $.fn.jqmShow=function(trigger){ + return this.each(function(){ if(!this._jqmShown) show($(this), trigger); }); + }; + + /** + * Close matching modals + */ + $.fn.jqmHide=function(trigger){ + return this.each(function(){ if(this._jqmShown) hide($(this), trigger); }); + }; + + // utility functions + + var + err = function(msg){ + if(window.console && window.console.error) window.console.error(msg); + + }, show = function(m, t){ + + /** + * m = modal element (as jQuery object) + * t = triggering element + * + * o = options + * z = z-index of modal + * v = overlay element (as jQuery object) + * h = hash (for jqModal <= r15 compatibility) + */ + + t = t || window.event; + + var o = m.data('jqm'), + z = (parseInt(m.css('z-index'))) || 3000, + v = $('
').addClass(o.overlayClass).css({ + height:'100%', + width:'100%', + position:'fixed', + left:0, + top:0, + 'z-index':z-1, + opacity:o.overlay/100 + }), + + // maintain legacy "hash" construct + h = {w: m, c: o, o: v, t: t}; + + m.css('z-index',z); + + if(o.ajax){ + var target = o.target || m, + url = o.ajax; + + target = (typeof target === 'string') ? $(target,m) : $(target); + if(url.substr(0,1) === '@') url = $(t).attr(url.substring(1)); + + // load remote contents + target.load(url,function(){ + if(o.onLoad) o.onLoad.call(this,h); + }); + + // show modal + if(o.ajaxText) target.html(o.ajaxText); open(h); - } - else { open(h); } - - }, hide = function(m, t){ - /** - * m = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = m.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: m, c: o, o: m.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // if overlay not disabled, prepend to body - (hash.c.overlay > 0) && hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w,true); - - return true; - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - }, addTrigger = function(m, key, trigger){ - // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (m) - // to all elements that match trigger string (trigger) - - var jqm = m.data('jqm'); - if(jqm) return $(trigger).each(function(){ - this[key] = this[key] || []; - - // register this modal with this trigger only once - if($.inArray(jqm.ID,this[key]) < 0) { - this[key].push(jqm.ID); - - // register trigger click event for this modal - // allows cancellation of show/hide event from - $(this).click(function(e){ - !e.isDefaultPrevented() && m[key](this); - return false; - }); - } - - }); - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var m = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - m[0]._jqmShown = true; - - // if modal:true dialog - // Bind the Keep Focus Function [F] if no other Modals are active - // else, - // trigger closing of dialog when overlay is clicked - if(o.modal){ !ActiveModals[0]&&F('bind'); ActiveModals.push(m[0]); } - else m.jqmAddClose(v); - - // Attach events to elements inside the modal matching closingClass - o.closeClass && m.jqmAddClose($('.' + o.closeClass,m)); - - // if toTop is true and overlay exists; - // remember modal DOM position with placeholder element, and move - // the modal to a direct child of the body tag (after overlyay) - (o.toTop && v ) && - m.before('').insertAfter(v); - - // remember overlay (for closing function) - m.data('jqmv',v); - - // close modal if the esc key is pressed and closeOnEsc is set to true - m.unbind("keydown",$.jqm.closeOnEscFunc); - if(o.closeOnEsc) { - m.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); - } - } - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var m = h.w, - v = h.o, - o = h.c; - - // execute onHide callback - if(o.onHide(h) !== false){ - // mark modal as !shown - m[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){ ActiveModals.pop(); !ActiveModals[0] && F('unbind'); } - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - (o.toTop && v) && $('#jqmP'+o.ID).after(m).remove(); - } - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) - - $(document)[t]("keypress keydown mousedown",X); - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var targetModal = $(e.target).data('jqm') || - $(e.target).parents('.jqm-init:first').data('jqm'); - var activeModal = ActiveModals[ActiveModals.length-1]; - - // allow bubbling if event target is within active modal dialog - return (targetModal && targetModal.ID === activeModal._jqmID) ? - true : $.jqm.focusFunc(activeModal,e); - }, - - I = 0, // modal ID increment (for nested modals) - ActiveModals = []; // array of active modals - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - closeOnEsc: false, - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired: - // a) when a modal:true dialog is shown, - // b) when an event occurs outside an active modal:true dialog - // It is passed the active modal:true dialog as well as event - focusFunc: function(activeModal, e) { - - // if the event occurs outside the activeModal, focus on first element - e && $(':input:visible:first',activeModal).focus(); - - // lock interactions to the activeModal - return false; - }, - - // closeOnEscFunc is attached to modals where closeOnEsc param true. - closeOnEscFunc: function(e){ - if (e.keyCode === 27) { - $(this).jqmHide(); - return false; - } - } - }; + } + else { open(h); } + + }, hide = function(m, t){ + /** + * m = modal element (as jQuery object) + * t = triggering element + * + * o = options + * h = hash (for jqModal <= r15 compatibility) + */ + + t = t || window.event; + var o = m.data('jqm'), + // maintain legacy "hash" construct + h = {w: m, c: o, o: m.data('jqmv'), t: t}; + + close(h); + + }, onShow = function(hash){ + // onShow callback. Responsible for showing a modal and overlay. + // return false to stop opening modal. + + // hash object; + // w: (jQuery object) The modal element + // c: (object) The modal's options object + // o: (jQuery object) The overlay element + // t: (DOM object) The triggering element + + // if overlay not disabled, prepend to body + if(hash.c.overlay > 0) hash.o.prependTo('body'); + + // make modal visible + hash.w.show(); + + // call focusFunc (attempts to focus on first input in modal) + $.jqm.focusFunc(hash.w,true); + + return true; + + }, onHide = function(hash){ + // onHide callback. Responsible for hiding a modal and overlay. + // return false to stop closing modal. + + // hash object; + // w: (jQuery object) The modal element + // c: (object) The modal's options object + // o: (jQuery object) The overlay element + // t: (DOM object) The triggering element + + // hide modal and if overlay, remove overlay. + if(hash.w.hide() && hash.o) hash.o.remove(); + + return true; + + }, addTrigger = function(m, key, trigger){ + // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (m) + // to all elements that match trigger string (trigger) + + var jqm = m.data('jqm'); + if(jqm) return $(trigger).each(function(){ + this[key] = this[key] || []; + + // register this modal with this trigger only once + if($.inArray(jqm.ID,this[key]) < 0) { + this[key].push(jqm.ID); + + // register trigger click event for this modal + // allows cancellation of show/hide event from + $(this).click(function(e){ + if(!e.isDefaultPrevented()) m[key](this); + return false; + }); + } + + }); + + }, open = function(h){ + // open: executes the onOpen callback + performs common tasks if successful + + // transform legacy hash into new var shortcuts + var m = h.w, + v = h.o, + o = h.c; + + // execute onShow callback + if(o.onShow(h) !== false){ + // mark modal as shown + m[0]._jqmShown = true; + + // if modal:true dialog + // Bind the Keep Focus Function [F] if no other Modals are active + // else, + // trigger closing of dialog when overlay is clicked + if(o.modal){ + if(!ActiveModals[0]){ F('bind'); } + ActiveModals.push(m[0]); + } + else m.jqmAddClose(v); + + // Attach events to elements inside the modal matching closingClass + if(o.closeClass) m.jqmAddClose($('.' + o.closeClass,m)); + + // if toTop is true and overlay exists; + // remember modal DOM position with placeholder element, and move + // the modal to a direct child of the body tag (after overlyay) + if(o.toTop && v) + m.before('').insertAfter(v); + + // remember overlay (for closing function) + m.data('jqmv',v); + + // close modal if the esc key is pressed and closeOnEsc is set to true + m.unbind("keydown",$.jqm.closeOnEscFunc); + if(o.closeOnEsc) { + m.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); + } + } + + }, close = function(h){ + // close: executes the onHide callback + performs common tasks if successful + + // transform legacy hash into new var shortcuts + var m = h.w, + v = h.o, + o = h.c; + + // execute onHide callback + if(o.onHide(h) !== false){ + // mark modal as !shown + m[0]._jqmShown = false; + + // If modal, remove from modal stack. + // If no modals in modal stack, unbind the Keep Focus Function + if(o.modal){ + ActiveModals.pop(); + if(!ActiveModals[0]) F('unbind'); + } + + // IF toTop was passed and an overlay exists; + // Move modal back to its "remembered" position. + if(o.toTop && v) $('#jqmP'+o.ID).after(m).remove(); + } + + }, F = function(t){ + // F: The Keep Focus Function (for modal: true dialos) + // Binds or Unbinds (t) the Focus Examination Function (X) + + $(document)[t]("keypress keydown mousedown",X); + + }, X = function(e){ + // X: The Focus Examination Function (for modal: true dialogs) + + var targetModal = $(e.target).data('jqm') || + $(e.target).parents('.jqm-init:first').data('jqm'); + var activeModal = ActiveModals[ActiveModals.length-1]; + + // allow bubbling if event target is within active modal dialog + return (targetModal && targetModal.ID === activeModal._jqmID) ? + true : $.jqm.focusFunc(activeModal,e); + }, + + I = 0, // modal ID increment (for nested modals) + ActiveModals = []; // array of active modals + + // $.jqm, overridable defaults + $.jqm = { + /** + * default options + * + * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. + * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. + * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). + * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. + * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; ...) + * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. + * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. + * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. + * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. + * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. + * (Function) onShow - User defined callback function fired when modal opened. + * (Function) onHide - User defined callback function fired when modal closed. + * (Function) onLoad - User defined callback function fired when ajax content loads. + */ + params: { + overlay: 50, + overlayClass: 'jqmOverlay', + closeClass: 'jqmClose', + closeOnEsc: false, + trigger: '.jqModal', + ajax: false, + target: false, + ajaxText: '', + modal: false, + toTop: false, + onShow: onShow, + onHide: onHide, + onLoad: false + }, + + // focusFunc is fired: + // a) when a modal:true dialog is shown, + // b) when an event occurs outside an active modal:true dialog + // It is passed the active modal:true dialog as well as event + focusFunc: function(activeModal, e) { + + // if the event occurs outside the activeModal, focus on first element + if(e) $(':input:visible:first',activeModal).focus(); + + // lock interactions to the activeModal + return false; + }, + + // closeOnEscFunc is attached to modals where closeOnEsc param true. + closeOnEscFunc: function(e){ + if (e.keyCode === 27) { + $(this).jqmHide(); + return false; + } + } + }; })( jQuery ); From d7ef769ec12183ac5983838e178088602284cf29 Mon Sep 17 00:00:00 2001 From: Brice Burgess Date: Sun, 16 Aug 2015 22:30:56 -0500 Subject: [PATCH 13/14] ignore hinting uglified JS --- .gitignore | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bc42ae5..88694d4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ #### LANG /.lein-repl-history /repl +/node_modules #### IDE /.project diff --git a/package.json b/package.json index bbec9c6..f3686fa 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,6 @@ "jshint": "latest" }, "scripts": { - "test": "jshint *.js" + "test": "jshint jqModal.js" } } \ No newline at end of file From 9c99e4ee4c4a1d67b08e9747c2d98eae0fd85048 Mon Sep 17 00:00:00 2001 From: Brice Burgess Date: Sun, 16 Aug 2015 22:35:07 -0500 Subject: [PATCH 14/14] remove releases/ [use git] --- README.md | 3 - releases/jqModal-r1.js | 118 ------------- releases/jqModal-r10.js | 64 ------- releases/jqModal-r11.js | 67 -------- releases/jqModal-r12.js | 69 -------- releases/jqModal-r13.js | 69 -------- releases/jqModal-r14.js | 69 -------- releases/jqModal-r15.js | 186 -------------------- releases/jqModal-r16.js | 332 ------------------------------------ releases/jqModal-r17.js | 339 ------------------------------------- releases/jqModal-r18.js | 339 ------------------------------------- releases/jqModal-r19.js | 339 ------------------------------------- releases/jqModal-r2.js | 113 ------------- releases/jqModal-r20.js | 339 ------------------------------------- releases/jqModal-r21.js | 339 ------------------------------------- releases/jqModal-r22.js | 366 ---------------------------------------- releases/jqModal-r23.js | 363 --------------------------------------- releases/jqModal-r24.js | 365 --------------------------------------- releases/jqModal-r25.js | 358 --------------------------------------- releases/jqModal-r3.js | 113 ------------- releases/jqModal-r4.js | 90 ---------- releases/jqModal-r5.js | 80 --------- releases/jqModal-r6.js | 80 --------- releases/jqModal-r7.js | 70 -------- releases/jqModal-r8.js | 64 ------- releases/jqModal-r9.js | 63 ------- 26 files changed, 4797 deletions(-) delete mode 100755 releases/jqModal-r1.js delete mode 100755 releases/jqModal-r10.js delete mode 100755 releases/jqModal-r11.js delete mode 100755 releases/jqModal-r12.js delete mode 100755 releases/jqModal-r13.js delete mode 100644 releases/jqModal-r14.js delete mode 100644 releases/jqModal-r15.js delete mode 100644 releases/jqModal-r16.js delete mode 100644 releases/jqModal-r17.js delete mode 100644 releases/jqModal-r18.js delete mode 100644 releases/jqModal-r19.js delete mode 100755 releases/jqModal-r2.js delete mode 100644 releases/jqModal-r20.js delete mode 100644 releases/jqModal-r21.js delete mode 100644 releases/jqModal-r22.js delete mode 100644 releases/jqModal-r23.js delete mode 100644 releases/jqModal-r24.js delete mode 100644 releases/jqModal-r25.js delete mode 100755 releases/jqModal-r3.js delete mode 100755 releases/jqModal-r4.js delete mode 100755 releases/jqModal-r5.js delete mode 100755 releases/jqModal-r6.js delete mode 100755 releases/jqModal-r7.js delete mode 100755 releases/jqModal-r8.js delete mode 100755 releases/jqModal-r9.js diff --git a/README.md b/README.md index 70ff671..c89616c 100644 --- a/README.md +++ b/README.md @@ -98,13 +98,10 @@ The [CHANGELOG.md](https://github.com/briceburg/jqModal/blob/master/CHANGELOG.md * Minify jqModal.js -> jqModal.min.js * Update jqModal.jquery.json, bumping version * Ensure changelog is up to date -* Copy jqModal.js to `releases/jqModal-r.js` * Merge -master with -release -* Ensure `releases/` is absent from -release branch * Tag -release with : `git tag && git push origin --tags` to publish. - Get Involved ============ diff --git a/releases/jqModal-r1.js b/releases/jqModal-r1.js deleted file mode 100755 index 03d90f2..0000000 --- a/releases/jqModal-r1.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.01.26 (alpha) - */ -(function($) { - - $.fn.jqm = function(settings) { - - var DEFAULTS = { - cssHeader: 'jqmHeader', - cssWindow: 'jqmWindow', - cssOverlay: 'jqmOverlay', - cssContainer: 'jqmContainer', - header: 'Close', - inline: '#jqModal', - ajax: false, // set to URL to pull content via AJAX - loading: 'loading...', // displayed while a page loads - zIndex: false, // (int) override stylesheet z-index settings - overlay: true - }; - - $.jqm.serial++; - $.jqm.hash[$.jqm.serial] = { }; - $.jqm.hash[$.jqm.serial]['settings'] = $.extend(DEFAULTS, settings); - $.jqm.hash[$.jqm.serial]['active'] = false; - - this.bind("click", {serial: $.jqm.serial}, function(event) { - if(!$.jqm.hash[event.data.serial]['active']) - return $.jqm.open(event.data.serial) - return false; - }); - - if($.jqm.hash[$.jqm.serial]['settings'].autofire) - this.click(); - - return this; - } - $.jqm = { - open: function(serial) { - h = $.jqm.hash[serial]; - h['active'] = true; - settings = h['settings']; - if (settings.overlay) { - $('body') - .prepend('
') - .children(':first-child') - .jqmAddHash('overlay', serial) - .css({height: $.jqm.pageHeight(), display: 'block', opacity: 0.5}) - .one('click', {serial: serial}, $.jqm.close); // attach close event - } - else { h['overlay'] = false; } - - if (settings.ajax) - $('body') - .prepend('
') - .children(':first-child') - .addClass('jqmAjaxDestroy') - .html(settings.loading) - .load(settings.ajax, function() { - $(this).jqmPrepare(settings, serial); - }); - else - $(settings.inline).jqmPrepare(settings, serial); - - if(settings.zIndex) { - h['window'].parent().css('z-index',settings.zIndex).end(); - if(h['settings'].overlay) - h['overlay'].css('z-index',settings.zIndex-1); - } - return false; - }, - close: function(event) { - h = $.jqm.hash[event.data.serial]; - p = h['window'].parent(); - - h['window'] - .hide() - .find('.jqmDestroy').remove().end() // .remove('expr') doesn't work - .insertBefore(p); - p.remove(); - - if(h['settings'].overlay) - h['overlay'].hide().remove(); - - h['active'] = false; - return false; - }, - pageHeight: function() { - // document height - var h = Math.max( document.body.scrollHeight, document.body.offsetHeight ); - return h+100+'px'; - }, - hash: {}, - serial: 0 - }; - - $.fn.jqmPrepare = function(settings, serial) { - this - .jqmAddHash('window', serial) - .wrap('
') - .prepend('
'+settings.header+'
') - .addClass(settings.cssWindow) - .show() - .find('.jqmClose') // attach close events - .one('click', {serial: serial}, $.jqm.close); - return this; - } - - $.fn.jqmAddHash = function(type, serial) { - $.jqm.hash[serial][type] = this; - return this; - } -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r10.js b/releases/jqModal-r10.js deleted file mode 100755 index a8a703f..0000000 --- a/releases/jqModal-r10.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.07.30 +r10 - */ -(function($) { -$.fn.jqm=function(o){ -var _o = { -zIndex: 3000, -overlay: 50, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: false, -target: false, -modal: false, -onShow: false, -onHide: false, -onLoad: false -}; -return this.each(function(){if(this._jqm)return; s++; this._jqm=s; -H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s}; -if(_o.trigger)$(this).jqmAddTrigger(_o.trigger); -});}; - -$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;}; -$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;}; -$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});}; -$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});}; - -$.jqm = { -hash:{}, -open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('
').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z); - if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');} - else if(c.overlay > 0)h.w.jqmAddClose(o); - else o=false; - - h.o=(o)?o.addClass(c.overlayClass).appendTo('body'):false; - if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} - - if(c.ajax) {var r=c.target,u=c.ajax; - r=(r)?(typeof r == 'string')?$(r,h.w):$(r):h.w; u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; - r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} - else if(cc)h.w.jqmAddClose($(cc,h.w)); - - (c.onShow)?c.onShow(h):h.w.show();e(h);return false; -}, -close:function(s){var h=H[s];h.a=false; - if(A[0]){A.pop();if(!A[0])F('unbind');} - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false; -}}; -var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"), -i=$('').css({opacity:0}), -e=function(h){if(ie6)if(h.o)h.o.html('

').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, -f=function(h){h.f=$(':input:visible:first',h.w)[0];if(h.f)h.f.focus();}, -F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, -m=function(e) {var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, -hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)}); - $(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});}; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r11.js b/releases/jqModal-r11.js deleted file mode 100755 index 4257d81..0000000 --- a/releases/jqModal-r11.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.08.17 +r11 - * - */ -(function($) { -$.fn.jqm=function(o){ -var _o = { -zIndex: 3000, -overlay: 50, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: false, -target: false, -modal: false, -toTop: false, -onShow: false, -onHide: false, -onLoad: false -}; -return this.each(function(){if(this._jqm)return; s++; this._jqm=s; -H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s}; -if(_o.trigger)$(this).jqmAddTrigger(_o.trigger); -});}; - -$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;}; -$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;}; -$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});}; -$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});}; - -$.jqm = { -hash:{}, -open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('

').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z); - if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');} - else if(c.overlay > 0)h.w.jqmAddClose(o); - else o=false; - - h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false; - if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} - - if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; - r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} - else if(cc)h.w.jqmAddClose($(cc,h.w)); - - if(c.toTop&&h.o)h.w.before('').insertAfter(h.o); - (c.onShow)?c.onShow(h):h.w.show();e(h);return false; -}, -close:function(s){var h=H[s];h.a=false; - if(A[0]){A.pop();if(!A[0])F('unbind');} - if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false; -}}; -var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"), -i=$('').css({opacity:0}), -e=function(h){if(ie6)if(h.o)h.o.html('

').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, -f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}}, -F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, -m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, -hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)}); - $(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});}; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r12.js b/releases/jqModal-r12.js deleted file mode 100755 index f6c5c7c..0000000 --- a/releases/jqModal-r12.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * (http://dev.iceburg.net/jquery/jqmodal/) - * - * Copyright (c) 2007,2008 Brice Burgess - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 06/22/2008 +r12 - * - */ -(function($) { -$.fn.jqm=function(o){ -var _o = { -overlay: 50, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: false, -ajaxText: '', -target: false, -modal: false, -toTop: false, -onShow: false, -onHide: false, -onLoad: false -}; -return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o); s++; this._jqm=s; -H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s}; -if(_o.trigger)$(this).jqmAddTrigger(_o.trigger); -});}; - -$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;}; -$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;}; -$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});}; -$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});}; - -$.jqm = { -hash:{}, -open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('

').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z); - if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');} - else if(c.overlay > 0)h.w.jqmAddClose(o); - else o=false; - - h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false; - if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} - - if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; - r.html(c.waitText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} - else if(cc)h.w.jqmAddClose($(cc,h.w)); - - if(c.toTop&&h.o)h.w.before('').insertAfter(h.o); - (c.onShow)?c.onShow(h):h.w.show();e(h);return false; -}, -close:function(s){var h=H[s];h.a=false; - if(A[0]){A.pop();if(!A[0])F('unbind');} - if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false; -}}; -var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"), -i=$('').css({opacity:0}), -e=function(h){if(ie6)if(h.o)h.o.html('

').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, -f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}}, -F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, -m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, -hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)}); - $(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});}; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r13.js b/releases/jqModal-r13.js deleted file mode 100755 index f3665cc..0000000 --- a/releases/jqModal-r13.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * (http://dev.iceburg.net/jquery/jqmodal/) - * - * Copyright (c) 2007,2008 Brice Burgess - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 07/06/2008 +r13 - */ -(function($) { -$.fn.jqm=function(o){ -var p={ -overlay: 50, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: F, -ajaxText: '', -target: F, -modal: F, -toTop: F, -onShow: F, -onHide: F, -onLoad: F -}; -return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; -H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; -if(p.trigger)$(this).jqmAddTrigger(p.trigger); -});}; - -$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; -$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; -$.fn.jqmShow=function(t){return this.each(function(){$.jqm.open(this._jqm,t);});}; -$.fn.jqmHide=function(t){return this.each(function(){$.jqm.close(this._jqm,t)});}; - -$.jqm = { -hash:{}, -open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('

').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); - if(c.modal) {if(!A[0])L('bind');A.push(s);} - else if(c.overlay > 0)h.w.jqmAddClose(o); - else o=F; - - h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; - if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} - - if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; - r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} - else if(cc)h.w.jqmAddClose($(cc,h.w)); - - if(c.toTop&&h.o)h.w.before('').insertAfter(h.o); - (c.onShow)?c.onShow(h):h.w.show();e(h);return F; -}, -close:function(s){var h=H[s];if(!h.a)return F;h.a=F; - if(A[0]){A.pop();if(!A[0])L('unbind');} - if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; -}, -params:{}}; -var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false, -i=$('').css({opacity:0}), -e=function(h){if(ie6)if(h.o)h.o.html('

').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, -f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, -L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, -m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, -hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { - if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r14.js b/releases/jqModal-r14.js deleted file mode 100644 index 3aac816..0000000 --- a/releases/jqModal-r14.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * (http://dev.iceburg.net/jquery/jqModal/) - * - * Copyright (c) 2007,2008 Brice Burgess - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 03/01/2009 +r14 - */ -(function($) { -$.fn.jqm=function(o){ -var p={ -overlay: 50, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: F, -ajaxText: '', -target: F, -modal: F, -toTop: F, -onShow: F, -onHide: F, -onLoad: F -}; -return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; -H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; -if(p.trigger)$(this).jqmAddTrigger(p.trigger); -});}; - -$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; -$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; -$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});}; -$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});}; - -$.jqm = { -hash:{}, -open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('

').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); - if(c.modal) {if(!A[0])L('bind');A.push(s);} - else if(c.overlay > 0)h.w.jqmAddClose(o); - else o=F; - - h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; - if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} - - if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; - r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} - else if(cc)h.w.jqmAddClose($(cc,h.w)); - - if(c.toTop&&h.o)h.w.before('').insertAfter(h.o); - (c.onShow)?c.onShow(h):h.w.show();e(h);return F; -}, -close:function(s){var h=H[s];if(!h.a)return F;h.a=F; - if(A[0]){A.pop();if(!A[0])L('unbind');} - if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; -}, -params:{}}; -var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false, -i=$('').css({opacity:0}), -e=function(h){if(ie6)if(h.o)h.o.html('

').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, -f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, -L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, -m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, -hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { - if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r15.js b/releases/jqModal-r15.js deleted file mode 100644 index 8f4852c..0000000 --- a/releases/jqModal-r15.js +++ /dev/null @@ -1,186 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * (http://dev.iceburg.net/jquery/jqModal/) - * - * Copyright (c) 2007,2008 Brice Burgess - * Code updated by Yoosuf Muhammad - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 08/04/2013 +r15 - */ -(function($) { - $.fn.jqm = function(o) { - var p = { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - trigger: '.jqModal', - ajax: F, - ajaxText: '', - target: F, - modal: F, - toTop: F, - onShow: F, - onHide: F, - onLoad: F - }; - return this.each(function() { - if (this._jqm) return H[this._jqm].c = $.extend({}, H[this._jqm].c, o); - s++; - this._jqm = s; - H[s] = { - c: $.extend(p, $.jqm.params, o), - a: F, - w: $(this).addClass('jqmID' + s), - s: s - }; - if (p.trigger) $(this).jqmAddTrigger(p.trigger); - }); - }; - - $.fn.jqmAddClose = function(e) { - return hs(this, e, 'jqmHide'); - }; - $.fn.jqmAddTrigger = function(e) { - return hs(this, e, 'jqmShow'); - }; - $.fn.jqmShow = function(t) { - return this.each(function() { - t = t || window.event; - $.jqm.open(this._jqm, t); - }); - }; - $.fn.jqmHide = function(t) { - return this.each(function() { - t = t || window.event; - $.jqm.close(this._jqm, t) - }); - }; - - $.jqm = { - hash: {}, - open: function(s, t) { - var h = H[s], - c = h.c, - cc = '.' + c.closeClass, - z = (parseInt(h.w.css('z-index'))), - z = (z > 0) ? z : 3000, - o = $('

').css({ - height: '100%', - width: '100%', - position: 'fixed', - left: 0, - top: 0, - 'z-index': z - 1, - opacity: c.overlay / 100 - }); - if (h.a) return F; - h.t = t; - h.a = true; - h.w.css('z-index', z); - if (c.modal) { - if (!A[0]) L('bind'); - A.push(s); - } else if (c.overlay > 0) h.w.jqmAddClose(o); - else o = F; - - h.o = (o) ? o.addClass(c.overlayClass).prependTo('body') : F; - if (ie6) { - $('html,body').css({ - height: '100%', - width: '100%' - }); - if (o) { - o = o.css({ - position: 'absolute' - })[0]; - for (var y in { - Top: 1, - Left: 1 - }) o.style.setExpression(y.toLowerCase(), "(_=(document.documentElement.scroll" + y + " || document.body.scroll" + y + "))+'px'"); - } - } - - if (c.ajax) { - var r = c.target || h.w, - u = c.ajax, - r = (typeof r == 'string') ? $(r, h.w) : $(r), - u = (u.substr(0, 1) == '@') ? $(t).attr(u.substring(1)) : u; - r.html(c.ajaxText).load(u, function() { - if (c.onLoad) c.onLoad.call(this, h); - if (cc) h.w.jqmAddClose($(cc, h.w)); - e(h); - }); - } else if (cc) h.w.jqmAddClose($(cc, h.w)); - - if (c.toTop && h.o) h.w.before('').insertAfter(h.o); - (c.onShow) ? c.onShow(h) : h.w.show(); - e(h); - return F; - }, - close: function(s) { - var h = H[s]; - if (!h.a) return F; - h.a = F; - if (A[0]) { - A.pop(); - if (!A[0]) L('unbind'); - } - if (h.c.toTop && h.o) $('#jqmP' + h.w[0]._jqm).after(h.w).remove(); - if (h.c.onHide) h.c.onHide(h); - else { - h.w.hide(); - if (h.o) h.o.remove(); - } - return F; - }, - params: {} - }; - var s = 0, - H = $.jqm.hash, - A = [], - ie6 = (navigator.userAgent.match(/msie 6/i)), //&& navigator.userAgent.match(/6/)), - F = false, - i = $('').css({ - opacity: 0 - }), - e = function(h) { - if (ie6) if (h.o) h.o.html('

').prepend(i); - else if (!$('iframe.jqm', h.w)[0]) h.w.prepend(i); - f(h); - }, - f = function(h) { - try { - $(':input:visible', h.w)[0].focus(); - } catch (_) {} - }, - L = function(t) { - $()[t]("keypress", m)[t]("keydown", m)[t]("mousedown", m); - }, - m = function(e) { - var h = H[A[A.length - 1]], - r = (!$(e.target).parents('.jqmID' + h.s)[0]); - if (r) f(h); - return !r; - }, - hs = function(w, t, c) { - return w.each(function() { - var s = this._jqm; - $(t).each(function() { - if (!this[c]) { - this[c] = []; - $(this).click(function() { - for (var i in { - jqmShow: 1, - jqmHide: 1 - }) for (var s in this[i]) if (H[this[i][s]]) H[this[i][s]].w[i](this); - return F; - }); - } - this[c].push(s); - }); - }); - }; -})(jQuery); diff --git a/releases/jqModal-r16.js b/releases/jqModal-r16.js deleted file mode 100644 index c9949b0..0000000 --- a/releases/jqModal-r16.js +++ /dev/null @@ -1,332 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2014 Brice Burgess @iceburg_net - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 2014.01.28 +r16 - * Requires: jQuery 1.2.3+ - */ - -(function(jQuery, window, undefined) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - - /** - * default options - * - * (Integer) zIndex - Desired z-Index of modal element. Will not override existing z-index styles (set inline or via CSS). - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; ...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - var o = { - zIndex: 3000, - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - trigger: '.jqModal', - ajax: false, - target: false, - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }; - - $.extend(o,options); - - return this.each(function(){ - var e = $(this), - jqm = $(this).data('jqm'); - - if(!jqm) jqm = {ID: I++}; - - // add/extend options to modal and mark as initialized - e.data('jqm',$.extend(o,jqm)).addClass('jqm-init'); - - // ... Attach events to trigger showing of this modal - o.trigger&&$(this).jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - z = /^\d+$/.test(e.css('z-index'))&&e.css('z-index')||o.zIndex, - v = $('

').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}); - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // Load the Ajax Content (and once loaded); - // Fire the onLoad callback (if exists), - // Attach closing events to elements inside the modal that match the closingClass, - // and Execute the jqModal default Open Callback - target.load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - open(h); - }); - - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop showing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.addClass(hash.c.overlayClass).prependTo('body'); - - // make modal visible - hash.w.show(); - - // attempt to focus on first input in modal - $(':input:visible:first',hash.w).focus(); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e) - // all elements that match trigger string (trigger)\ - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - // register modal to trigger elements - this[key] = this[key] || []; - this[key].push(e); - - }).click(function(){ - - var trigger = this; - - // foreadh modal registered to this trigger, call jqmShow || - // jqmHide (key) on modal passing trigger element (e) - $.each(this[key], function(i, e){ e[key](trigger); }); - - // stop trigger click event from bubbling - return false; - }); - - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) + - // Add this modal to the opened modals stack (A) for nested modal support + - // Mark overlay to show wait cursor when mouse hovers over it. - // - // else, close dialog when overlay is clicked - if(o.modal){ !A[0]&&F('bind'); A.push(e); v.css('cursor','wait'); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal that match the closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){A.pop();!A[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'), - activeModal = A[A.length-1].data('jqm'); - - // allow bubbling if event target is within active modal dialog - if(modal && modal.ID == activeModal.ID) return true; - - // else, try to focus on first input element and halt bubbling - $(':input:visible:first',activeModal).focus(); - return false; - - }, - - I = 0, // modal ID increment (for nested modals) - A = []; // array of active modals (used to lock interactivity to appropriate modal) - -})( jQuery, window ); \ No newline at end of file diff --git a/releases/jqModal-r17.js b/releases/jqModal-r17.js deleted file mode 100644 index 5402f79..0000000 --- a/releases/jqModal-r17.js +++ /dev/null @@ -1,339 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2014 Brice Burgess @iceburg_net - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 2014.01.30 +r17 (aka 1.0.0) - * Requires: jQuery 1.2.3+ - */ - -(function(jQuery, window, undefined) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - - var o = $.extend({}, $.jqm.params, options); - - return this.each(function(){ - var e = $(this), - jqm = $(this).data('jqm'); - - if(!jqm) jqm = {ID: I++}; - - // add/extend options to modal and mark as initialized - e.data('jqm',$.extend(o,jqm)).addClass('jqm-init'); - - // ... Attach events to trigger showing of this modal - o.trigger&&$(this).jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - z = (parseInt(e.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}); - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // Load the Ajax Content (and once loaded); - // Fire the onLoad callback (if exists), - // Attach closing events to elements inside the modal that match the closingClass, - // and Execute the jqModal default Open Callback - target.html(o.ajaxText).load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - open(h); - }); - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e) - // all elements that match trigger string (trigger)\ - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - // register modal to trigger elements - this[key] = this[key] || []; - this[key].push(e); - - }).click(function(){ - - var trigger = this; - - // foreadh modal registered to this trigger, call jqmShow || - // jqmHide (key) on modal passing trigger element (e) - $.each(this[key], function(i, e){ e[key](trigger); }); - - // stop trigger click event from bubbling - return false; - }); - - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) + - // Add this modal to the opened modals stack (A) for nested modal support - // - // else, close dialog when overlay is clicked - if(o.modal){ !A[0]&&F('bind'); A.push(e); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal that match the closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){A.pop();!A[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'), - activeModal = A[A.length-1].data('jqm'); - - // allow bubbling if event target is within active modal dialog - if(modal && modal.ID == activeModal.ID) return true; - - // else, trigger focusFunc (focus on first input element and halt bubbling) - return $.jqm.focusFunc(activeModal); - }, - - I = 0, // modal ID increment (for nested modals) - A = []; // array of active modals (used to lock interactivity to appropriate modal) - - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired when a modal is shown, or when interaction occurs outside - // a modal enabled dialog. Passed the modal element. - focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; } - }; - -})( jQuery, window ); \ No newline at end of file diff --git a/releases/jqModal-r18.js b/releases/jqModal-r18.js deleted file mode 100644 index c702124..0000000 --- a/releases/jqModal-r18.js +++ /dev/null @@ -1,339 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2014 Brice Burgess @iceburg_net - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 2014.03.27 +r18 - * Requires: jQuery 1.2.3+ - */ - -(function(jQuery, window, undefined) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - - var o = $.extend({}, $.jqm.params, options); - - return this.each(function(){ - var e = $(this), - jqm = $(this).data('jqm'); - - if(!jqm) jqm = {ID: I++}; - - // add/extend options to modal and mark as initialized - e.data('jqm',$.extend(o,jqm)).addClass('jqm-init'); - - // ... Attach events to trigger showing of this modal - o.trigger&&$(this).jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - z = (parseInt(e.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // Load the Ajax Content (and once loaded); - // Fire the onLoad callback (if exists), - // Attach closing events to elements inside the modal that match the closingClass, - // and Execute the jqModal default Open Callback - target.html(o.ajaxText).load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - open(h); - }); - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e) - // all elements that match trigger string (trigger)\ - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - // register modal to trigger elements - this[key] = this[key] || []; - this[key].push(e); - - }).click(function(){ - - var trigger = this; - - // foreadh modal registered to this trigger, call jqmShow || - // jqmHide (key) on modal passing trigger element (e) - $.each(this[key], function(i, e){ e[key](trigger); }); - - // stop trigger click event from bubbling - return false; - }); - - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) + - // Add this modal to the opened modals stack (A) for nested modal support - // - // else, close dialog when overlay is clicked - if(o.modal){ !A[0]&&F('bind'); A.push(e); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal that match the closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){A.pop();!A[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'), - activeModal = A[A.length-1].data('jqm'); - - // allow bubbling if event target is within active modal dialog - if(modal && modal.ID == activeModal.ID) return true; - - // else, trigger focusFunc (focus on first input element and halt bubbling) - return $.jqm.focusFunc(activeModal); - }, - - I = 0, // modal ID increment (for nested modals) - A = []; // array of active modals (used to lock interactivity to appropriate modal) - - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired when a modal is shown, or when interaction occurs outside - // a modal enabled dialog. Passed the modal element. - focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; } - }; - -})( jQuery, window ); \ No newline at end of file diff --git a/releases/jqModal-r19.js b/releases/jqModal-r19.js deleted file mode 100644 index 825e7f8..0000000 --- a/releases/jqModal-r19.js +++ /dev/null @@ -1,339 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2014 Brice Burgess @iceburg_net - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 1.0.2 (2014.04.10 +r19) - * Requires: jQuery 1.2.3+ - */ - -(function($) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - - var o = $.extend({}, $.jqm.params, options); - - return this.each(function(){ - var e = $(this), - jqm = $(this).data('jqm'); - - if(!jqm) jqm = {ID: I++}; - - // add/extend options to modal and mark as initialized - e.data('jqm',$.extend(o,jqm)).addClass('jqm-init'); - - // ... Attach events to trigger showing of this modal - o.trigger&&$(this).jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - z = (parseInt(e.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // Load the Ajax Content (and once loaded); - // Fire the onLoad callback (if exists), - // Attach closing events to elements inside the modal that match the closingClass, - // and Execute the jqModal default Open Callback - target.html(o.ajaxText).load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - open(h); - }); - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e) - // all elements that match trigger string (trigger)\ - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - // register modal to trigger elements - this[key] = this[key] || []; - this[key].push(e); - - }).click(function(){ - - var trigger = this; - - // foreadh modal registered to this trigger, call jqmShow || - // jqmHide (key) on modal passing trigger element (e) - $.each(this[key], function(i, e){ e[key](trigger); }); - - // stop trigger click event from bubbling - return false; - }); - - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) + - // Add this modal to the opened modals stack (A) for nested modal support - // - // else, close dialog when overlay is clicked - if(o.modal){ !A[0]&&F('bind'); A.push(e); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal that match the closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){A.pop();!A[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'), - activeModal = A[A.length-1].data('jqm'); - - // allow bubbling if event target is within active modal dialog - if(modal && modal.ID == activeModal.ID) return true; - - // else, trigger focusFunc (focus on first input element and halt bubbling) - return $.jqm.focusFunc(activeModal); - }, - - I = 0, // modal ID increment (for nested modals) - A = []; // array of active modals (used to lock interactivity to appropriate modal) - - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired when a modal is shown, or when interaction occurs outside - // a modal enabled dialog. Passed the modal element. - focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; } - }; - -})( jQuery ); \ No newline at end of file diff --git a/releases/jqModal-r2.js b/releases/jqModal-r2.js deleted file mode 100755 index 3f271c0..0000000 --- a/releases/jqModal-r2.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.01.27 +r2 - */ -(function($) { - $.fn.jqm = function(settings) { - - var DEFAULTS = { - cssHeader: 'jqmHeader', - cssWindow: 'jqmWindow', - cssOverlay: 'jqmOverlay', - cssContainer: 'jqmContainer', - header: 'Close', - inline: '#jqModal', - ajax: false, // set to URL to pull content via AJAX - loading: 'loading...', // HTML displayed while a page loads - zIndex: 3000, - autofire: false, - overlay: true - }; - $.jqm.serial++; s = $.jqm.serial; - $.jqm.hash[s] = { - settings: $.extend(DEFAULTS, settings), active: false, overlay: false }; - - this.bind("click", {serial: s}, function(event) { - if(!$.jqm.hash[event.data.serial]['active']) - return $.jqm.open(event.data.serial) - return false; - }); - - if($.jqm.hash[s]['settings'].autofire) - this.click(); - - return this; - } - $.jqm = { - open: function(serial) { - h = $.jqm.hash[serial]; - h['active'] = true; - settings = h['settings']; - - if (settings.overlay) { - z = settings.zIndex - 2; - var f = $(''); - var o = $('
') - .css({opacity: 0.5, 'z-index': z+1}) - .one('click', {serial: serial}, $.jqm.close) - .add(f[0]) - .css({height: $.jqm.pageHeight(), width: '100%', position: 'absolute', left: 0, top: 0}) - .jqmAddHash('overlay', serial) - .appendTo('body') - } - - if (settings.ajax) - $('
') - .html(settings.loading) - .load(settings.ajax, function() { - $(this).jqmPrepare(settings, serial); - }) - .appendTo('body'); - else - $(settings.inline).jqmPrepare(settings, serial); - - return false; - }, - close: function(event) { - h = $.jqm.hash[event.data.serial]; - p = h['window'].parent(); - - h['window'] - .hide() - .find('.jqmDestroy').remove().end() // .remove('expr') doesn't work??? - .insertBefore(p); - p.remove(); - - if(h['settings'].overlay) - h['overlay'].hide().remove(); - - h['active'] = false; - return false; - }, - pageHeight: function() { // returns full document height despite body being set to 100% - h = (window.innerHeight && window.scrollMaxY) ? - window.innerHeight + window.scrollMaxY : - (document.body.scrollHeight > document.body.offsetHeight) ? - document.body.scrollHeight : - document.body.offsetHeight; - return h+'px'; - }, - hash: {}, - serial: 0 - }; - - $.fn.jqmPrepare = function(settings, serial) { - return this - .jqmAddHash('window', serial) - .addClass(settings.cssWindow) - .wrap('
') - .prepend('
'+settings.header+'
') - .show() - .find('.jqmClose') // attach close events - .one('click', {serial: serial}, $.jqm.close); - } - - $.fn.jqmAddHash = function(type, serial) { - $.jqm.hash[serial][type] = this; return this; - } -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r20.js b/releases/jqModal-r20.js deleted file mode 100644 index 872f0b3..0000000 --- a/releases/jqModal-r20.js +++ /dev/null @@ -1,339 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2014 Brice Burgess @IceburgBrice - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 1.0.3 (2014.07.02 +r20) - * Requires: jQuery 1.2.3+ - */ - -(function($) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - - var o = $.extend({}, $.jqm.params, options); - - return this.each(function(){ - var e = $(this), - jqm = e.data('jqm'); - - if(!jqm) jqm = {ID: I++}; - - // add/extend options to modal and mark as initialized - e.data('jqm',$.extend(jqm,o)).addClass('jqm-init'); - - // ... Attach events to trigger showing of this modal - o.trigger&&$(this).jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - z = (parseInt(e.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // Load the Ajax Content (and once loaded); - // Fire the onLoad callback (if exists), - // Attach closing events to elements inside the modal that match the closingClass, - // and Execute the jqModal default Open Callback - target.html(o.ajaxText).load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - open(h); - }); - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e) - // all elements that match trigger string (trigger)\ - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - // register modal to trigger elements - this[key] = this[key] || []; - this[key].push(e); - - }).click(function(){ - - var trigger = this; - - // foreadh modal registered to this trigger, call jqmShow || - // jqmHide (key) on modal passing trigger element (e) - $.each(this[key], function(i, e){ e[key](trigger); }); - - // stop trigger click event from bubbling - return false; - }); - - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) + - // Add this modal to the opened modals stack (A) for nested modal support - // - // else, close dialog when overlay is clicked - if(o.modal){ !A[0]&&F('bind'); A.push(e); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal that match the closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){A.pop();!A[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'), - activeModal = A[A.length-1].data('jqm'); - - // allow bubbling if event target is within active modal dialog - if(modal && modal.ID == activeModal.ID) return true; - - // else, trigger focusFunc (focus on first input element and halt bubbling) - return $.jqm.focusFunc(activeModal); - }, - - I = 0, // modal ID increment (for nested modals) - A = []; // array of active modals (used to lock interactivity to appropriate modal) - - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; ...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired when a modal is shown, or when interaction occurs outside - // a modal enabled dialog. Passed the modal element. - focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; } - }; - -})( jQuery ); \ No newline at end of file diff --git a/releases/jqModal-r21.js b/releases/jqModal-r21.js deleted file mode 100644 index d89cd11..0000000 --- a/releases/jqModal-r21.js +++ /dev/null @@ -1,339 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2014 Brice Burgess @IceburgBrice - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 1.1.0 (2014.07.03 +r21) - * Requires: jQuery 1.2.3+ - */ - -(function($) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - return this.each(function(){ - var e = $(this), - jqm = e.data('jqm') || $.extend({ID: I++}, $.jqm.params), - o = $.extend(jqm,options); - - // add/extend options to modal and mark as initialized - e.data('jqm',o).addClass('jqm-init'); - - // ... Attach events to trigger showing of this modal - o.trigger && e.jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - z = (parseInt(e.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // Load the Ajax Content (and once loaded); - // Fire the onLoad callback (if exists), - // Attach closing events to elements inside the modal that match the closingClass, - // and Execute the jqModal default Open Callback - target.html(o.ajaxText).load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - open(h); - }); - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (e) - // to all elements that match trigger string (trigger) - - var jqm = e.data('jqm'); - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - this[key] = this[key] || []; - - // register this modal with this trigger only once - if($.inArray(jqm.ID,this[key]) < 0) { - this[key].push(jqm.ID); - - // register trigger click event for this modal - $(this).click(function(){ - var trigger = this; - - e[key](this); - - // stop trigger click event from bubbling - return false; - }); - } - - }); - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) + - // Add this modal to the opened modals stack (A) for nested modal support - // - // else, close dialog when overlay is clicked - if(o.modal){ !A[0]&&F('bind'); A.push(e); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal that match the closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){A.pop();!A[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'), - activeModal = A[A.length-1].data('jqm'); - - // allow bubbling if event target is within active modal dialog - if(modal && modal.ID == activeModal.ID) return true; - - // else, trigger focusFunc (focus on first input element and halt bubbling) - return $.jqm.focusFunc(activeModal); - }, - - I = 0, // modal ID increment (for nested modals) - A = []; // array of active modals (used to lock interactivity to appropriate modal) - - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired when a modal is shown, or when interaction occurs outside - // a modal enabled dialog. Passed the modal element. - focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; } - }; - -})( jQuery ); \ No newline at end of file diff --git a/releases/jqModal-r22.js b/releases/jqModal-r22.js deleted file mode 100644 index ba8a645..0000000 --- a/releases/jqModal-r22.js +++ /dev/null @@ -1,366 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2015 Brice Burgess @IceburgBrice - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 1.2.0 (2015.02.26 +r22) - * Requires: jQuery 1.2.3+ - */ - -(function($) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - return this.each(function(){ - var e = $(this), - jqm = e.data('jqm') || $.extend({ID: I++}, $.jqm.params), - o = $.extend(jqm,options); - - // add/extend options to modal and mark as initialized - e.data('jqm',o).addClass('jqm-init'); - - // ... Attach events to trigger showing of this modal - o.trigger && e.jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - z = (parseInt(e.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // Load the Ajax Content (and once loaded); - // Fire the onLoad callback (if exists), - // Attach closing events to elements inside the modal that match the closingClass, - // and Execute the jqModal default Open Callback - target.html(o.ajaxText).load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - open(h); - }); - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w,null); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (e) - // to all elements that match trigger string (trigger) - - var jqm = e.data('jqm'); - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - this[key] = this[key] || []; - - // register this modal with this trigger only once - if($.inArray(jqm.ID,this[key]) < 0) { - this[key].push(jqm.ID); - - // register trigger click event for this modal - $(this).click(function(){ - var trigger = this; - - e[key](this); - - // stop trigger click event from bubbling - return false; - }); - } - - }); - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) + - // Add this modal to the opened modals stack (A) for nested modal support - // - // else, close dialog when overlay is clicked - if(o.modal){ !A[0]&&F('bind'); A.push(e); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal matching closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - - // close modal if the esc key is pressed and closeOnEsc is set to true - e.unbind("keydown",$.jqm.closeOnEscFunc); - if(o.closeOnEsc) { - e.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); - } - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){A.pop();!A[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'), - activeModal = A[A.length-1]; - - // allow bubbling if event target is within active modal dialog - if(modal && modal.ID == activeModal.ID) return true; - - // else, trigger focusFunc (focus on first input element and halt bubbling) - return $.jqm.focusFunc(activeModal,e); - }, - - I = 0, // modal ID increment (for nested modals) - A = []; // array of active modals (used to lock interactivity to appropriate modal) - - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - closeOnEsc: false, - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired: - // a) when a modal:true dialog is shown, - // b) when an event occurs outside an active modal:true dialog - // It is passed the active modal:true dialog as well as event - focusFunc: function(activeModal, event) { - - // if the event occurs outside the activeModal, focus on first element - if(event) { - $(':input:visible:first',activeModal).focus(); - } - - // lock interactions to the activeModal - return false; - }, - - // closeOnEscFunc is attached to modals where closeOnEsc param true. - closeOnEscFunc: function(event){ - if (event.keyCode == 27) { - $(this).jqmHide(); - return false; - } - } - }; - -})( jQuery ); \ No newline at end of file diff --git a/releases/jqModal-r23.js b/releases/jqModal-r23.js deleted file mode 100644 index 8211ca7..0000000 --- a/releases/jqModal-r23.js +++ /dev/null @@ -1,363 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2015 Brice Burgess @IceburgBrice - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 1.2.0 (2015.04.01 +r23) - * Requires: jQuery 1.2.3+ - */ - -(function($) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - return this.each(function(){ - var e = $(this), - jqm = e.data('jqm') || $.extend({ID: I++}, $.jqm.params), - o = $.extend(jqm,options); - - // add/extend options to modal and mark as initialized - e.data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; - - // ... Attach events to trigger showing of this modal - o.trigger && e.jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - z = (parseInt(e.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // Load the Ajax Content (and once loaded); - // Fire the onLoad callback (if exists), - // Attach closing events to elements inside the modal that match the closingClass, - // and Execute the jqModal default Open Callback - target.html(o.ajaxText).load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - open(h); - }); - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w,true); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (e) - // to all elements that match trigger string (trigger) - - var jqm = e.data('jqm'); - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - this[key] = this[key] || []; - - // register this modal with this trigger only once - if($.inArray(jqm.ID,this[key]) < 0) { - this[key].push(jqm.ID); - - // register trigger click event for this modal - $(this).click(function(){ - var trigger = this; - - e[key](this); - - // stop trigger click event from bubbling - return false; - }); - } - - }); - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!ActiveModals[0]) + - // - // else, close dialog when overlay is clicked - if(o.modal){ !ActiveModals[0]&&F('bind'); ActiveModals.push(e[0]); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal matching closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - - // close modal if the esc key is pressed and closeOnEsc is set to true - e.unbind("keydown",$.jqm.closeOnEscFunc); - if(o.closeOnEsc) { - e.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); - } - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){ActiveModals.pop();!ActiveModals[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var targetModal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'); - var activeModal = ActiveModals[ActiveModals.length-1]; - - // allow bubbling if event target is within active modal dialog - return (targetModal && targetModal.ID == activeModal._jqmID) ? - true : $.jqm.focusFunc(activeModal,e); - }, - - I = 0, // modal ID increment (for nested modals) - ActiveModals = []; // array of active modals (used to lock interactivity to appropriate modal) - - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - closeOnEsc: false, - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired: - // a) when a modal:true dialog is shown, - // b) when an event occurs outside an active modal:true dialog - // It is passed the active modal:true dialog as well as event - focusFunc: function(activeModal, event) { - - // if the event occurs outside the activeModal, focus on first element - if(event) { - $(':input:visible:first',activeModal).focus(); - } - - // lock interactions to the activeModal - return false; - }, - - // closeOnEscFunc is attached to modals where closeOnEsc param true. - closeOnEscFunc: function(event){ - if (event.keyCode == 27) { - $(this).jqmHide(); - return false; - } - } - }; - -})( jQuery ); \ No newline at end of file diff --git a/releases/jqModal-r24.js b/releases/jqModal-r24.js deleted file mode 100644 index 7fe4262..0000000 --- a/releases/jqModal-r24.js +++ /dev/null @@ -1,365 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2015 Brice Burgess @IceburgBrice - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 1.3.0 (2015.04.15 +r24) - * Requires: jQuery 1.2.3+ - */ - -(function($) { - - /** - * Initialize a set of elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - return this.each(function(){ - var e = $(this), - jqm = e.data('jqm') || $.extend({ID: I++}, $.jqm.params), - o = $.extend(jqm,options); - - // add/extend options to modal and mark as initialized - e.data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; - - // ... Attach events to trigger showing of this modal - o.trigger && e.jqmAddTrigger(o.trigger); - }); - }; - - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals") - }); - }; - - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a selector String, jQuery collection of elements, or a DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err("jqmAddClose must be called on initialized modals") - }); - }; - - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ !this._jqmShown&&show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ this._jqmShown&&hide($(this), trigger); }); - }; - - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - - }, show = function(e, t){ - - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - z = (parseInt(e.css('z-index'))), - z = (z > 0) ? z : 3000, - v = $('
').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}), - - // maintain legacy "hash" construct - h = {w: e, c: o, o: v, t: t}; - - e.css('z-index',z); - - if(o.ajax){ - var target = o.target || e, - url = o.ajax; - - target = (typeof target == 'string') ? $(target,e) : $(target); - if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1)); - - // load remote contents - target.load(url,function(){ - o.onLoad && o.onLoad.call(this,h); - }); - - // show modal - if(o.ajaxText) { - target.html(o.ajaxText); - } - open(h); - } - else { open(h); } - - }, hide = function(e, t){ - /** - * e = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - var o = e.data('jqm'), - t = t || window.event, - - // maintain legacy "hash" construct - h = {w: e, c: o, o: e.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // display the overlay (prepend to body) if not disabled - if(hash.c.overlay > 0) - hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w,true); - - return true; - - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - hash.w.hide() && hash.o && hash.o.remove(); - - return true; - - - }, addTrigger = function(e, key, trigger){ - // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (e) - // to all elements that match trigger string (trigger) - - var jqm = e.data('jqm'); - - // return false if e is not an initialized modal element - if(!e.data('jqm')) return false; - - return $(trigger).each(function(){ - this[key] = this[key] || []; - - // register this modal with this trigger only once - if($.inArray(jqm.ID,this[key]) < 0) { - this[key].push(jqm.ID); - - // register trigger click event for this modal - $(this).click(function(){ - var trigger = this; - - e[key](this); - - // stop trigger click event from bubbling - return false; - }); - } - - }); - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - e[0]._jqmShown = true; - - // if modal dialog - // - // Bind the Keep Focus Function [F] if no other Modals are open (!ActiveModals[0]) + - // - // else, close dialog when overlay is clicked - if(o.modal){ !ActiveModals[0]&&F('bind'); ActiveModals.push(e[0]); } - else e.jqmAddClose(v); - - // Attach closing events to elements inside the modal matching closingClass - o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e)); - - // IF toTop is true and overlay exists; - // Add placeholder element before modal to - // remember it's position in the DOM and move it to a child of the body tag (after overlay) - o.toTop&&v&&e.before('').insertAfter(v); - - // remember overlay (for closing function) - e.data('jqmv',v); - - // close modal if the esc key is pressed and closeOnEsc is set to true - e.unbind("keydown",$.jqm.closeOnEscFunc); - if(o.closeOnEsc) { - e.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); - } - } - - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var e = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onHide(h) !== false){ - // mark modal as !shown - e[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){ActiveModals.pop();!ActiveModals[0]&&F('unbind');} - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove(); - } - - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks - - $(document)[t]("keypress keydown mousedown",X); - - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var targetModal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'); - var activeModal = ActiveModals[ActiveModals.length-1]; - - // allow bubbling if event target is within active modal dialog - return (targetModal && targetModal.ID == activeModal._jqmID) ? - true : $.jqm.focusFunc(activeModal,e); - }, - - I = 0, // modal ID increment (for nested modals) - ActiveModals = []; // array of active modals (used to lock interactivity to appropriate modal) - - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - closeOnEsc: false, - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired: - // a) when a modal:true dialog is shown, - // b) when an event occurs outside an active modal:true dialog - // It is passed the active modal:true dialog as well as event - focusFunc: function(activeModal, event) { - - // if the event occurs outside the activeModal, focus on first element - if(event) { - $(':input:visible:first',activeModal).focus(); - } - - // lock interactions to the activeModal - return false; - }, - - // closeOnEscFunc is attached to modals where closeOnEsc param true. - closeOnEscFunc: function(event){ - if (event.keyCode == 27) { - $(this).jqmHide(); - return false; - } - } - }; - -})( jQuery ); \ No newline at end of file diff --git a/releases/jqModal-r25.js b/releases/jqModal-r25.js deleted file mode 100644 index efdc909..0000000 --- a/releases/jqModal-r25.js +++ /dev/null @@ -1,358 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007-2015 Brice Burgess @IceburgBrice - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Version: 1.4.0 (2015.08.16 +r25) - * Requires: jQuery 1.2.3+ - */ - -(function($) { - - /** - * Initialize elements as "modals". Modals typically are popup dialogs, - * notices, modal windows, &c. - * - * @name jqm - * @param options user defined options, augments defaults. - * @type jQuery - * @cat Plugins/jqModal - */ - - $.fn.jqm=function(options){ - return this.each(function(){ - var jqm = $(this).data('jqm') || $.extend({ID: I++}, $.jqm.params), - o = $.extend(jqm,options); - - // add/extend options to modal and mark as initialized - $(this).data('jqm',o).addClass('jqm-init')[0]._jqmID = o.ID; - - // ... Attach events to trigger showing of this modal - $(this).jqmAddTrigger(o.trigger); - }); - }; - - /** - * Matching modals will have their jqmShow() method fired by attaching a - * onClick event to elements matching `trigger`. - * - * @name jqmAddTrigger - * @param trigger a a string selector, jQuery collection, or DOM element. - */ - $.fn.jqmAddTrigger=function(trigger){ - if(trigger){ - return this.each(function(){ - if (!addTrigger($(this), 'jqmShow', trigger)) - err("jqmAddTrigger must be called on initialized modals"); - }); - } - }; - - /** - * Matching modals will have their jqmHide() method fired by attaching an - * onClick event to elements matching `trigger`. - * - * @name jqmAddClose - * @param trigger a string selector, jQuery collection, or DOM element. - */ - $.fn.jqmAddClose=function(trigger){ - if(trigger){ - return this.each(function(){ - if(!addTrigger($(this), 'jqmHide', trigger)) - err ("jqmAddClose must be called on initialized modals"); - }); - } - }; - - /** - * Open matching modals (if not shown) - */ - $.fn.jqmShow=function(trigger){ - return this.each(function(){ if(!this._jqmShown) show($(this), trigger); }); - }; - - /** - * Close matching modals - */ - $.fn.jqmHide=function(trigger){ - return this.each(function(){ if(this._jqmShown) hide($(this), trigger); }); - }; - - // utility functions - - var - err = function(msg){ - if(window.console && window.console.error) window.console.error(msg); - - }, show = function(m, t){ - - /** - * m = modal element (as jQuery object) - * t = triggering element - * - * o = options - * z = z-index of modal - * v = overlay element (as jQuery object) - * h = hash (for jqModal <= r15 compatibility) - */ - - t = t || window.event; - - var o = m.data('jqm'), - z = (parseInt(m.css('z-index'))) || 3000, - v = $('
').addClass(o.overlayClass).css({ - height:'100%', - width:'100%', - position:'fixed', - left:0, - top:0, - 'z-index':z-1, - opacity:o.overlay/100 - }), - - // maintain legacy "hash" construct - h = {w: m, c: o, o: v, t: t}; - - m.css('z-index',z); - - if(o.ajax){ - var target = o.target || m, - url = o.ajax; - - target = (typeof target === 'string') ? $(target,m) : $(target); - if(url.substr(0,1) === '@') url = $(t).attr(url.substring(1)); - - // load remote contents - target.load(url,function(){ - if(o.onLoad) o.onLoad.call(this,h); - }); - - // show modal - if(o.ajaxText) target.html(o.ajaxText); - open(h); - } - else { open(h); } - - }, hide = function(m, t){ - /** - * m = modal element (as jQuery object) - * t = triggering element - * - * o = options - * h = hash (for jqModal <= r15 compatibility) - */ - - t = t || window.event; - var o = m.data('jqm'), - // maintain legacy "hash" construct - h = {w: m, c: o, o: m.data('jqmv'), t: t}; - - close(h); - - }, onShow = function(hash){ - // onShow callback. Responsible for showing a modal and overlay. - // return false to stop opening modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // if overlay not disabled, prepend to body - if(hash.c.overlay > 0) hash.o.prependTo('body'); - - // make modal visible - hash.w.show(); - - // call focusFunc (attempts to focus on first input in modal) - $.jqm.focusFunc(hash.w,true); - - return true; - - }, onHide = function(hash){ - // onHide callback. Responsible for hiding a modal and overlay. - // return false to stop closing modal. - - // hash object; - // w: (jQuery object) The modal element - // c: (object) The modal's options object - // o: (jQuery object) The overlay element - // t: (DOM object) The triggering element - - // hide modal and if overlay, remove overlay. - if(hash.w.hide() && hash.o) hash.o.remove(); - - return true; - - }, addTrigger = function(m, key, trigger){ - // addTrigger: Adds a jqmShow/jqmHide (key) event click on modal (m) - // to all elements that match trigger string (trigger) - - var jqm = m.data('jqm'); - if(jqm) return $(trigger).each(function(){ - this[key] = this[key] || []; - - // register this modal with this trigger only once - if($.inArray(jqm.ID,this[key]) < 0) { - this[key].push(jqm.ID); - - // register trigger click event for this modal - // allows cancellation of show/hide event from - $(this).click(function(e){ - if(!e.isDefaultPrevented()) m[key](this); - return false; - }); - } - - }); - - }, open = function(h){ - // open: executes the onOpen callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var m = h.w, - v = h.o, - o = h.c; - - // execute onShow callback - if(o.onShow(h) !== false){ - // mark modal as shown - m[0]._jqmShown = true; - - // if modal:true dialog - // Bind the Keep Focus Function [F] if no other Modals are active - // else, - // trigger closing of dialog when overlay is clicked - if(o.modal){ - if(!ActiveModals[0]){ F('bind'); } - ActiveModals.push(m[0]); - } - else m.jqmAddClose(v); - - // Attach events to elements inside the modal matching closingClass - if(o.closeClass) m.jqmAddClose($('.' + o.closeClass,m)); - - // if toTop is true and overlay exists; - // remember modal DOM position with placeholder element, and move - // the modal to a direct child of the body tag (after overlyay) - if(o.toTop && v) - m.before('').insertAfter(v); - - // remember overlay (for closing function) - m.data('jqmv',v); - - // close modal if the esc key is pressed and closeOnEsc is set to true - m.unbind("keydown",$.jqm.closeOnEscFunc); - if(o.closeOnEsc) { - m.attr("tabindex", 0).bind("keydown",$.jqm.closeOnEscFunc).focus(); - } - } - - }, close = function(h){ - // close: executes the onHide callback + performs common tasks if successful - - // transform legacy hash into new var shortcuts - var m = h.w, - v = h.o, - o = h.c; - - // execute onHide callback - if(o.onHide(h) !== false){ - // mark modal as !shown - m[0]._jqmShown = false; - - // If modal, remove from modal stack. - // If no modals in modal stack, unbind the Keep Focus Function - if(o.modal){ - ActiveModals.pop(); - if(!ActiveModals[0]) F('unbind'); - } - - // IF toTop was passed and an overlay exists; - // Move modal back to its "remembered" position. - if(o.toTop && v) $('#jqmP'+o.ID).after(m).remove(); - } - - }, F = function(t){ - // F: The Keep Focus Function (for modal: true dialos) - // Binds or Unbinds (t) the Focus Examination Function (X) - - $(document)[t]("keypress keydown mousedown",X); - - }, X = function(e){ - // X: The Focus Examination Function (for modal: true dialogs) - - var targetModal = $(e.target).data('jqm') || - $(e.target).parents('.jqm-init:first').data('jqm'); - var activeModal = ActiveModals[ActiveModals.length-1]; - - // allow bubbling if event target is within active modal dialog - return (targetModal && targetModal.ID === activeModal._jqmID) ? - true : $.jqm.focusFunc(activeModal,e); - }, - - I = 0, // modal ID increment (for nested modals) - ActiveModals = []; // array of active modals - - // $.jqm, overridable defaults - $.jqm = { - /** - * default options - * - * (Integer) overlay - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay. - * (String) overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS. - * (String) closeClass - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal). - * (Mixed) trigger - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. - * (String) ajax - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for;
...) - * (Mixed) target - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. - * Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element. - * (String) ajaxText - Text shown while waiting for ajax return. Replaces HTML content of `target` element. - * (Boolean) modal - If true, user interactivity will be locked to the modal window until closed. - * (Boolean) toTop - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues. - * (Function) onShow - User defined callback function fired when modal opened. - * (Function) onHide - User defined callback function fired when modal closed. - * (Function) onLoad - User defined callback function fired when ajax content loads. - */ - params: { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - closeOnEsc: false, - trigger: '.jqModal', - ajax: false, - target: false, - ajaxText: '', - modal: false, - toTop: false, - onShow: onShow, - onHide: onHide, - onLoad: false - }, - - // focusFunc is fired: - // a) when a modal:true dialog is shown, - // b) when an event occurs outside an active modal:true dialog - // It is passed the active modal:true dialog as well as event - focusFunc: function(activeModal, e) { - - // if the event occurs outside the activeModal, focus on first element - if(e) $(':input:visible:first',activeModal).focus(); - - // lock interactions to the activeModal - return false; - }, - - // closeOnEscFunc is attached to modals where closeOnEsc param true. - closeOnEscFunc: function(e){ - if (e.keyCode === 27) { - $(this).jqmHide(); - return false; - } - } - }; - -})( jQuery ); diff --git a/releases/jqModal-r3.js b/releases/jqModal-r3.js deleted file mode 100755 index e1ab5aa..0000000 --- a/releases/jqModal-r3.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.01.28 +r3 - */ -(function($) { - $.fn.jqm = function(settings) { - - var DEFAULTS = { - cssHeader: 'jqmHeader', - cssWindow: 'jqmWindow', - cssOverlay: 'jqmOverlay', - cssContainer: 'jqmContainer', - header: 'Close', - inline: '#jqModal', - ajax: false, // set to URL to pull content via AJAX - loading: 'loading...', // HTML displayed while a page loads - zIndex: 3000, - autofire: false, - overlay: true - }; - $.jqm.serial++; s = $.jqm.serial; - $.jqm.hash[s] = { - settings: $.extend(DEFAULTS, settings), active: false, overlay: false }; - - this.bind("click", {serial: s}, function(event) { - if(!$.jqm.hash[event.data.serial]['active']) - return $.jqm.open(event.data.serial) - return false; - }); - - if($.jqm.hash[s]['settings'].autofire) - this.click(); - - return this; - } - $.jqm = { - open: function(serial) { - h = $.jqm.hash[serial]; - h['active'] = true; - settings = h['settings']; - - z = settings.zIndex - 2; - var f = $('') - .css({'z-index':z,border:'none',opacity:0}); - if (settings.overlay) - f = $('
') - .css({opacity: 0.5, 'z-index': z+1}) - .one('click', {serial: serial}, $.jqm.close) - .add(f[0]); - f - .css({height: $.jqm.pageHeight(), width: '100%', position: 'absolute', left: 0, top: 0}) - .jqmAddHash('overlay', serial) - .appendTo('body'); - - if (settings.ajax) - $('
') - .html(settings.loading) - .appendTo('body') - .load(settings.ajax, function() { - $(this).jqmPrepare(settings, serial); - }); - else - $(settings.inline).jqmPrepare(settings, serial); - - return false; - }, - close: function(event) { - h = $.jqm.hash[event.data.serial]; - p = h['window'].parent(); - - h['window'] - .hide() - .find('.jqmDestroy').remove().end() // .remove('expr') doesn't work??? - .insertBefore(p); - p.remove(); - - h['overlay'].remove(); - - h['active'] = false; - return false; - }, - pageHeight: function() { // returns full document height despite body being set to 100% - h = (window.innerHeight && window.scrollMaxY) ? - window.innerHeight + window.scrollMaxY : - (document.body.scrollHeight > document.body.offsetHeight) ? - document.body.scrollHeight : - document.body.offsetHeight; - return h+'px'; - }, - hash: {}, - serial: 0 - }; - - $.fn.jqmPrepare = function(settings, serial) { - return this - .jqmAddHash('window', serial) - .addClass(settings.cssWindow) - .wrap('
') - .prepend('
'+settings.header+'
') - .show() - .find('.jqmClose') // attach close events - .one('click', {serial: serial}, $.jqm.close); - } - - $.fn.jqmAddHash = function(type, serial) { - $.jqm.hash[serial][type] = this; return this; - } -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r4.js b/releases/jqModal-r4.js deleted file mode 100755 index e2141f4..0000000 --- a/releases/jqModal-r4.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.02.02 +r4 - */ -(function($) { -$.fn.jqm = function(o, f) { - -var _o = { -zIndex: 3000, -overlay: 50, -overlayColor: '#000', -wrapClass: 'jqmWrap', -trigger: '.jqModal', -ajax: false, -target: false, -autofire: false, -focus: false -}; - -$.jqm.serial++; s = $.jqm.serial; -$.jqm.hash[s] = {conf:$.extend(_o, o),active:false,w:this,callback:($.isFunction(f))?f:false}; - -$(_o.trigger).bind("click",{serial: s},function(e) { - return (!$.jqm.hash[e.data.serial]['active'])?$.jqm.open(e.data.serial):false; -}); - -if(_o.autofire) $(_o.trigger).click(); -return this; -} - -$.jqm = { -open: function(s) { - var h=$.jqm.hash[s]; - var c=h['conf']; - var z=c.zIndex; if (c.focus) z+=10; if (c.overlay == 0) z-=5; - h['active']=true; - if(!$.isFunction(h.c)) h.c=function(){return $.jqm.close(s)}; - - var f=$('').css({'z-index':z-2,opacity:0}); - var o=$('
').css({'z-index':z-1,opacity:c.overlay/100,'background-color':c.overlayColor}); - $([f[0],o[0]]).css({height:$.jqm.pageHeight(),width:'100%',position:'absolute',left:0,top:0}); - - if (c.focus) { if($.jqm.c.length == 0) $.jqm.ffunc('bind'); $.jqm.c.push(s); - o=f.add(o[0]).css('cursor','wait'); } - else { o.bind('click', h.c); - o=(c.overlay == 0)?$('
'):($.jqm.ie6)?f.add(o[0]):o; } - h['o']=o.appendTo('body'); - - h.w.show().wrap('
'); - h.d=false; if ($('input,select,button',h.w)[0]) { h.d=$('input,select,button',h.w)[0]; h.d.focus(); } - if (c.ajax) { var t = (c.target) ? - (typeof(c.target) == 'string')?$(c.target,h.w):$(c.target):h.w; - t.load(c.ajax, function() {$('.jqmClose',h.w).bind('click',h.c);}); } - else h.w.find('.jqmClose').bind('click',h.c); - - if(h.callback) h.callback(h.w[0],s); - return false; -}, -close: function(s) { - var h=$.jqm.hash[s]; - var p=$(h.w).parent(); - $('.jqmClose',p).unbind('click',h.c); - h.w.hide().insertBefore(p); - p.remove(); h['o'].remove(); - h['active'] = false; - var c=$.jqm.c; if(c.length != 0) { c.pop(); - if (c.length == 0) $.jqm.ffunc('unbind'); } - return false; -}, -pageHeight: function() { var d=document.body; var w=window; - return (w.innerHeight && w.scrollMaxY) ? w.innerHeight+w.scrollMaxY+'px' : - (d.scrollHeight > d.offsetHeight) ? d.scrollHeight+'px' :d.offsetHeight+'px'; -}, -hash: {}, -serial: 0, -c: [], -f: function(e) { var s=$.jqm.c[$.jqm.c.length-1]; - if($(e.target).parents('#jqmID'+s).length == 0) { - if($.jqm.hash[s].d) $.jqm.hash[s].d.focus(); - return false;} return true; -}, -ffunc: function(t) {$()[t]("keypress",$.jqm.f)[t]("keydown",$.jqm.f)[t]("mousedown",$.jqm.f);}, -ie6: $.browser.msie && typeof XMLHttpRequest == 'function' -}; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r5.js b/releases/jqModal-r5.js deleted file mode 100755 index b3923df..0000000 --- a/releases/jqModal-r5.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.02.07 +r5 - */ -(function($) { -$.fn.jqm=function(o,x,y){ -var _o = { -zIndex: 3000, -overlay: 50, -overlayClass: 'jqmOverlay', -wrapClass: 'jqmWrap', -trigger: '.jqModal', -ajax: false, -target: false, -autofire: false, -focus: false -}; -$.jqm.serial++; s = $.jqm.serial; -hash[s] = {c:$.extend(_o, o),active:false,w:this,o:false,u:$('input,select,button',this)[0],cb:[($.isFunction(x))?x:false,($.isFunction(y))?y:false]}; -$(_o.trigger).bind("click",{'s':s},function(e) { hash[e.data.s]['t']=this; - return (!hash[e.data.s]['active'])?$.jqm.open(e.data.s):false;}); -if(_o.autofire) $(_o.trigger).click(); -return this; -} -$.fn.jqmClose=function(){var p=this.parent(); - this.hide().insertBefore(p); p.remove(); return this;} -$.jqm = { -open:function(s){ - var h=hash[s]; - var c=h.c; - var z=c.zIndex; if (c.focus) z+=10; if (c.overlay == 0) z-=5; - if(!$.isFunction(h.q)) h.q=function(){return $.jqm.close(s)}; - h['active']=true; - - var f=$('').css({'z-index':z-2,opacity:0}); - var o=$('
').css({'z-index':z-1,opacity:c.overlay/100}).addClass(c.overlayClass); - $([f[0],o[0]]).css({height:$.jqm.pageHeight(),width:'100%',position:'absolute',left:0,top:0}); - - if (c.focus) { if($.jqm.x.length == 0) $.jqm.ffunc('bind'); $.jqm.x.push(s); - o=f.add(o[0]).css('cursor','wait');} - else if (c.overlay > 0){o.bind('click', h.q); o=($.jqm.ie6)?f.add(o[0]):o;} - else o=(true)?f.css('height','100%').prependTo(h.w):false; - if (o) h.o=o.appendTo('body'); - - h.w.wrap('
'); - if (c.ajax) { var t = (c.target) ? - (typeof(c.target) == 'string')?$(c.target,h.w):$(c.target):h.w; - c.ajax=(c.ajax.substr(0,1) == '@')?$(h.t).attr(c.ajax.substring(1)):c.ajax; - t.load(c.ajax, function() {$('.jqmClose',h.w).bind('click',h.q);}); } - else h.w.find('.jqmClose').bind('click',h.q); - - (h.cb[0])?h.cb[0](h):h.w.show(); h.u.focus(); - return false; -}, -close:function(s){var h=hash[s]; h['active'] = false; - $('.jqmClose',h.w[0]).unbind('click',h.q); - var x=$.jqm.x; if(x.length != 0) { x.pop(); - if (x.length == 0) $.jqm.ffunc('unbind'); } - (h.cb[1])?h.cb[1](h):h.w.jqmClose(); if(h.o) h.o.remove(); - return false; -}, -pageHeight:function(){var d=document.documentElement; - return Math.max(document.body.scrollHeight,d.offsetHeight,d.clientHeight || 0,window.innerHeight || 0); -}, -hash: {}, -serial: 0, -x: [], -f:function(e) { var s=$.jqm.x[$.jqm.x.length-1]; - if($(e.target).parents('#jqmID'+s).length == 0) { hash[s].u.focus(); return false;} return true; -}, -ffunc:function(t) {$()[t]("keypress",$.jqm.f)[t]("keydown",$.jqm.f)[t]("mousedown",$.jqm.f);}, -ie6:$.browser.msie && typeof XMLHttpRequest == 'function' -}; -var hash=$.jqm.hash; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r6.js b/releases/jqModal-r6.js deleted file mode 100755 index 28666d9..0000000 --- a/releases/jqModal-r6.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.02.14 +r6 - */ -(function($) { -$.fn.jqm=function(o,x,y){ -var _o = { -zIndex: 3000, -overlay: 50, -overlayClass: 'jqmOverlay', -wrapClass: 'jqmWrap', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: false, -target: false, -autofire: false, -focus: false -}; -$.jqm.serial++; s = $.jqm.serial; -hash[s] = {c:$.extend(_o, o),active:false,w:this,o:false,u:$('input,select,button',this)[0]||this[0],cb:[($.isFunction(x))?x:false,($.isFunction(y))?y:false]}; -$(_o.trigger).bind("click",{'s':s},function(e) { - return (!hash[e.data.s]['active'])?$.jqm.open(e.data.s,this):false;}); -if(_o.autofire) $(_o.trigger).click(); -return this; -} -$.fn.jqmClose=function(){var p=this.parent(); - this.hide().insertBefore(p); p.remove(); return this;} -$.jqm = { -open:function(s,t){ - var h=hash[s]; h.t=t; - var c=h.c; h.cc='.'+c.closeClass; - var z=c.zIndex; if (c.focus) z+=10; if (c.overlay == 0) z-=5; - if(!$.isFunction(h.q)) h.q=function(){return $.jqm.close(s)}; - h['active']=true; - - var f=$('').css({'z-index':z-2,opacity:0}); - var o=$('
').css({'z-index':z-1,opacity:c.overlay/100}).addClass(c.overlayClass); - $([f[0],o[0]]).css({height:$.jqm.pageHeight(),width:'100%',position:'absolute',left:0,top:0}); - - if (c.focus) { if($.jqm.x.length == 0) $.jqm.ffunc('bind'); $.jqm.x.push(s); - o=f.add(o[0]).css('cursor','wait');} - else if (c.overlay > 0){o.bind('click', h.q); o=($.jqm.ie6)?f.add(o[0]):o;} - else o=($.jqm.ie6)?f.css('height','100%').prependTo(h.w):false; - if (o) h.o=o.appendTo('body'); - - h.w.wrap('
'); - if (c.ajax) { var r=c.target; r=(r)?(typeof r == 'string')?$(r,h.w):$(r):h.w; - var url=c.ajax; url=(url.substr(0,1) == '@')?$(t).attr(url.substring(1)):url; - r.load(url, function() {$(h.cc,h.w).bind('click',h.q);}); } - else h.w.find(h.cc).bind('click',h.q); - - (h.cb[0])?h.cb[0](h):h.w.show(); h.u.focus(); - return false; -}, -close:function(s){var h=hash[s]; h['active'] = false; - $(h.cc,h.w[0]).unbind('click',h.q); - var x=$.jqm.x; if(x.length != 0) { x.pop(); - if (x.length == 0) $.jqm.ffunc('unbind'); } - (h.cb[1])?h.cb[1](h):h.w.jqmClose(); if(h.o) h.o.remove(); - return false; -}, -pageHeight:function(){var d=document.documentElement; - return Math.max(document.body.scrollHeight,d.offsetHeight,d.clientHeight || 0,window.innerHeight || 0); -}, -hash: {}, -serial: 0, -x: [], -f:function(e) { var s=$.jqm.x[$.jqm.x.length-1]; - if($(e.target).parents('#jqmID'+s).length == 0) { hash[s].u.focus(); return false;} return true; -}, -ffunc:function(t) {$()[t]("keypress",$.jqm.f)[t]("keydown",$.jqm.f)[t]("mousedown",$.jqm.f);}, -ie6:$.browser.msie && typeof XMLHttpRequest == 'function' -}; -var hash=$.jqm.hash; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r7.js b/releases/jqModal-r7.js deleted file mode 100755 index 0412781..0000000 --- a/releases/jqModal-r7.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.02.23 +r7 - */ -(function($) { -$.fn.jqm=function(o){ -var _o = { -zIndex: 3000, -overlay: 50, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: false, -target: false, -modal: false, -onShow: false, -onHide: false, -onLoad: false -}; -return this.each(function(){if(this._jqm)return; s++; this._jqm=s; -hash[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s}; -if(_o.trigger)$(this).jqmAddTrigger(_o.trigger); -});} - -$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;} -$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;} -$.fn.jqmShow=function(t){return this.each(function(){if(!hash[this._jqm].a)$.jqm.open(this._jqm,t)});} -$.fn.jqmHide=function(t){return this.each(function(){if(hash[this._jqm].a)$.jqm.close(this._jqm,t)});} - -$.jqm = { -open:function(s,t){var h=hash[s];h.t=t;var c=h.c;var cc='.'+c.closeClass;h.a=true; - var z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex;if(z<3)z=5;h.w.css('z-index',z); - var i=$('').css({'z-index':z-2,opacity:0}); - var o=$('
').css({'z-index':z-1,opacity:c.overlay/100}).addClass(c.overlayClass); - $([i[0],o[0]]).css({height:'100%',width:'100%',position:'fixed',left:0,top:0}); - - if(c.modal) {if(ma.length == 0)mf('bind');ma.push(s);o.css('cursor','wait');} - else if(c.overlay > 0)h.w.jqmAddClose(o); - else o=(ie6)?$():false; - - if(ie6){$('html,body').css('height','100%');o.add(i[0]).css({position:'absolute'}).each(function(){for(y in {Top:1,Left:1})this.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");});} - if(o)h.o=o.appendTo('body'); - - if(c.ajax) {var r=c.target;r=(r)?(typeof r == 'string')?$(r,h.w):$(r):h.w; - var u=c.ajax;u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; - r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));f(h);});} - else if(cc)h.w.jqmAddClose($(cc,h.w)); - - (c.onShow)?c.onShow(h):h.w.show();f(h);return false; -}, -close:function(s){var h=hash[s];h.a=false; - if(ma.length != 0){ma.pop();if(ma.length == 0)mf('unbind');} - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false; -}}; -var s=0; -var hash={}; -var ie6=$.browser.msie && typeof XMLHttpRequest == 'function'; -var f=function(h){h.f=$(':input:visible',h.w)[0]||h.w[0];h.f.focus();} -var ma=[]; -var mf=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}; -var m=function(e) {var h=hash[ma[ma.length-1]];var r=(!$(e.target).parents('.jqmID'+h.s).length == 0);if(!r)h.f.focus();return r;}; -var hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)}); - $(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s; $(this).click(function() { - for(i in {jqmShow:1,jqmHide:1})for(s in this[i])hash[this[i][s]].w[i](this);return false;});}});}; -})(jQuery); diff --git a/releases/jqModal-r8.js b/releases/jqModal-r8.js deleted file mode 100755 index 2a06a46..0000000 --- a/releases/jqModal-r8.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.02.24 +r8 - */ -(function($) { -$.fn.jqm=function(o){ -var _o = { -zIndex: 3000, -overlay: 50, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: false, -target: false, -modal: false, -onShow: false, -onHide: false, -onLoad: false -}; -return this.each(function(){if(this._jqm)return; s++; this._jqm=s; -hash[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s}; -if(_o.trigger)$(this).jqmAddTrigger(_o.trigger); -});} - -$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;} -$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;} -$.fn.jqmShow=function(t){return this.each(function(){if(!hash[this._jqm].a)$.jqm.open(this._jqm,t)});} -$.fn.jqmHide=function(t){return this.each(function(){if(hash[this._jqm].a)$.jqm.close(this._jqm,t)});} - -$.jqm = { -open:function(s,t){var h=hash[s], c=h.c,cc='.'+c.closeClass, z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex;h.t=t;h.a=true;if(z<3)z=5;h.w.css('z-index',z); - var o=$('
').css({'z-index':z-1,opacity:c.overlay/100,height:'100%',width:'100%',position:'fixed',left:0,top:0}).addClass(c.overlayClass); - - if(c.modal) {if(ma.length == 0)mf('bind');ma.push(s);o.css('cursor','wait');} - else if(c.overlay > 0)h.w.jqmAddClose(o); - else o=false; - - if(ie6){$('html,body').css('height','100%');if(o)o=o.css({position:'absolute'}).each(function(){for(y in {Top:1,Left:1})this.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");});} - if(o)h.o=o.appendTo('body'); - - if(c.ajax) {var r=c.target,u=c.ajax; - r=(r)?(typeof r == 'string')?$(r,h.w):$(r):h.w; u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; - r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));f(h);});} - else if(cc)h.w.jqmAddClose($(cc,h.w)); - - (c.onShow)?c.onShow(h):h.w.show();f(h);return false; -}, -close:function(s){var h=hash[s];h.a=false; - if(ma.length != 0){ma.pop();if(ma.length == 0)mf('unbind');} - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false; -}}; -var s=0,hash={},ma=[],ie6=$.browser.msie && typeof XMLHttpRequest == 'function', -f=function(h){if(ie6)if($('iframe.jqmIF',h.w).length == 0)$('').css({'z-index':-1,opacity:0,position:'absolute',left:0,top:0}).prependTo(h.w); - h.f=$(':input:visible',h.w)[0]||h.w[0];h.f.focus();}, -mf=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, -m=function(e) {var h=hash[ma[ma.length-1]], r=(!$(e.target).parents('.jqmID'+h.s).length == 0);if(!r)h.f.focus();return r;}, -hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)}); - $(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(i in {jqmShow:1,jqmHide:1})for(s in this[i]){if(s == 'indexOf')continue;hash[this[i][s]].w[i](this)};return false;});}});}; -})(jQuery); \ No newline at end of file diff --git a/releases/jqModal-r9.js b/releases/jqModal-r9.js deleted file mode 100755 index 68e299c..0000000 --- a/releases/jqModal-r9.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * jqModal - Minimalist Modaling with jQuery - * - * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - * $Version: 2007.02.25 +r9 - */ -(function($) { -$.fn.jqm=function(o){ -var _o = { -zIndex: 3000, -overlay: 50, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: false, -target: false, -modal: false, -onShow: false, -onHide: false, -onLoad: false -}; -return this.each(function(){if(this._jqm)return; s++; this._jqm=s; -hash[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s}; -if(_o.trigger)$(this).jqmAddTrigger(_o.trigger); -});} - -$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;} -$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;} -$.fn.jqmShow=function(t){return this.each(function(){if(!hash[this._jqm].a)$.jqm.open(this._jqm,t)});} -$.fn.jqmHide=function(t){return this.each(function(){if(hash[this._jqm].a)$.jqm.close(this._jqm,t)});} - -$.jqm = { -open:function(s,t){var h=hash[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('
').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z); - if(c.modal) {if(ma.length == 0)mf('bind');ma.push(s);o.css('cursor','wait');} - else if(c.overlay > 0)h.w.jqmAddClose(o); - else o=false; - - h.o=(o)?o.addClass(c.overlayClass).appendTo('body'):false; - if(ie6){$('html,body').css('height','100%');if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} - - if(c.ajax) {var r=c.target,u=c.ajax; - r=(r)?(typeof r == 'string')?$(r,h.w):$(r):h.w; u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; - r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));f(h);});} - else if(cc)h.w.jqmAddClose($(cc,h.w)); - - (c.onShow)?c.onShow(h):h.w.show();f(h);return false; -}, -close:function(s){var h=hash[s];h.a=false; - if(ma.length != 0){ma.pop();if(ma.length == 0)mf('unbind');} - if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false; -}}; -var s=0,hash={},ma=[],ie6=$.browser.msie && typeof XMLHttpRequest == 'function', -i=$('').css({opacity:0}), -f=function(h){if(ie6)if(h.o)h.o.html('

').prepend(i);else if($('iframe.jqm',h.w).length == 0)h.w.prepend(i); - h.f=$(':input:visible',h.w)[0]||h.w[0];h.f.focus();}, -mf=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, -m=function(e) {var h=hash[ma[ma.length-1]], r=(!$(e.target).parents('.jqmID'+h.s).length == 0);if(!r)h.f.focus();return r;}, -hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)}); - $(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(hash[this[i][s]])hash[this[i][s]].w[i](this);return false;});}});}; -})(jQuery); \ No newline at end of file