X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/362ea2e7f8ac4254398791139cc060090199f400..06954b630bc0f09afd4e7e1e9cd04a53ff6347b4:/wolnelektury/static/js/jquery.jqmodal.js?ds=inline diff --git a/wolnelektury/static/js/jquery.jqmodal.js b/wolnelektury/static/js/jquery.jqmodal.js index 966336ac1..248bb1931 100644 --- a/wolnelektury/static/js/jquery.jqmodal.js +++ b/wolnelektury/static/js/jquery.jqmodal.js @@ -4,7 +4,7 @@ * Copyright (c) 2007 Brice Burgess , http://www.iceburg.net * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php - * + * * $Version: 2007.??.?? +r12 beta * Requires: jQuery 1.1.3+ */ @@ -14,11 +14,11 @@ * notices, modal windows, and image containers. An expando ("_jqm") containing * the UUID or "serial" of the modal is added to each element. This expando helps * reference the modal's settings in the jqModal Hash Object (jQuery.jqm.hash) - * + * * Accepts a parameter object with the following modal settings; - * - * (Integer) zIndex - Desired z-Index of the modal. This setting does not override (has no effect on) preexisting z-Index styling (set via CSS or inline style). - * (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. + * + * (Integer) zIndex - Desired z-Index of the modal. This setting does not override (has no effect on) preexisting z-Index styling (set via CSS or inline style). + * (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 - This class is applied to the body covering overlay. Allows CSS control of the overlay look (tint, background image, etc.). * (String) closeClass - A close trigger is added to all elements matching this class within the modal. * (Mixed) trigger - An open trigger is added to all matching elements within the DOM. Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean. @@ -59,7 +59,7 @@ onLoad: false // *AND*... return this.each(function(){if(this._jqm)return;s++;this._jqm=s; -// ... Add this element's serial to the jqModal Hash Object +// ... Add this element's serial to the jqModal Hash Object // Hash is globally accessible via jQuery.jqm.hash. It consists of; // c: {obj} config/options // a: {bool} active state (true: active/visible, false: inactive/hidden) @@ -74,7 +74,7 @@ o.trigger&&$(this).jqmAddTrigger(o.trigger); });}; // Adds behavior to triggering elements via the hide-show (HS) function. -// +// $.fn.jqmAddClose=function(e){return HS(this,e,'jqmHide');}; $.fn.jqmAddTrigger=function(e){return HS(this,e,'jqmShow');}; @@ -98,23 +98,23 @@ hash:{}, // mark this modal as active (h.a === true) // set the triggering object (h.t) and the modal's z-Index. 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 the modal argument was passed as true; // Bind the Keep Focus Function if no other Modals are open (!A[0]), // Add this modal to the opened modals stack (A) for nested modal support, // and Mark overlay to show wait cursor when mouse hovers over it. if(c.modal) {!A[0]&&F('bind');A.push(s);o.css('cursor','wait');} - + // ELSE IF an overlay was requested (translucency set greater than 0); // Attach a Close event to overlay to hide modal when overlay is clicked. else if(c.overlay > 0)h.w.jqmAddClose(o); - + // ELSE disable the overlay else o=false; // Add the Overlay to BODY if not disabled. h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false; - + // IF IE6; // Set the Overlay to 100% height/width, and fix-position it via JS workaround if(ie6&&$('html,body').css({height:'100%',width:'100%'})&&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'");} @@ -123,13 +123,13 @@ open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=/^\d+$/.test(h.w.css(' // determine the target element {JQ} to recieve content (r), // determine the URL {STR} to load content from (u) 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; - + // Load the 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 r.load(u,function(){c.onLoad&&c.onLoad.call(this,h);cc&&h.w.jqmAddClose($(cc,h.w));O(h);});} - + // ELSE the modal content is NOT to be loaded via ajax; // Attach closing events to elements inside the modal that match the closingClass else cc&&h.w.jqmAddClose($(cc,h.w)); @@ -137,13 +137,13 @@ open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=/^\d+$/.test(h.w.css(' // IF toTop was passed and an overlay exists; // Remember the DOM posistion of the modal by inserting a tagged (matching serial) before the modal // Move the Modal from its current position to a first child of the body tag (after the overlay) - c.toTop&&h.o&&h.w.before('').insertAfter(h.o); - + c.toTop&&h.o&&h.w.before('').insertAfter(h.o); + // Execute user defined onShow callback, or else show (make visible) the modal. // Execute the jqModal default Open Callback. // Return false to prevent trigger click from being followed. (c.onShow)?c.onShow(h):h.w.show();O(h);return false; - + }, // Function is executed by $.jqmHide to hide a modal @@ -152,11 +152,11 @@ close:function(s){var h=H[s];h.a=false; // If modal, remove from modal stack. // If no modals in modal stack, unbind the Keep Focus Function if(h.c.modal){A.pop();!A[0]&&F('unbind');} - + // IF toTop was passed and an overlay exists; // Move modal back to its previous ("remembered") position. h.c.toTop&&h.o&&$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); - + // Execute user defined onHide callback, or else hide (make invisible) the modal and remove the overlay. if(h.c.onHide)h.c.onHide(h);else{h.w.hide()&&h.o&&h.o.remove()}return false; }}; @@ -191,10 +191,10 @@ F=function(t){$()[t]("keypress",x)[t]("keydown",x)[t]("mousedown",x);}, // ELSE if so (r===false); follow event (return true [!false]) x=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);r&&f(h);return !r;}, -// hide-show function; assigns click events to trigger elements that +// hide-show function; assigns click events to trigger elements that // hide, show, or hide AND show modals. -// Expandos (jqmShow and/or jqmHide) are added to all trigger elements. +// Expandos (jqmShow and/or jqmHide) are added to all trigger elements. // These Expandos hold an array of modal serials {INT} to show or hide. // w: {DOM Element} The modal element (window/dialog/notice/etc. container) @@ -207,7 +207,7 @@ HS=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)}); // for each triggering element attach the jqmHide or jqmShow expando (y) // or else expand the expando with the current serial array $(e).each(function(){if(this[y])$.extend(this[y],s); - + // Assign a click event on the trigger element which examines the element's // jqmHide/Show expandos and attempts to execute $.jqmHide/Show on matching modals 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;});}});return w;};