1/* 2* jQuery modalPopLite 3* Copyright (c) 2012 Simon Hibbard 4* 5* Permission is hereby granted, free of charge, to any person 6* obtaining a copy of this software and associated documentation 7* files (the "Software"), to deal in the Software without 8* restriction, including without limitation the rights to use, 9* copy, modify, merge, publish, distribute, sublicense, and/or sell 10* copies of the Software, and to permit persons to whom the 11* Software is furnished to do so, subject to the following 12* conditions: 13 14* The above copyright notice and this permission notice shall be 15* included in all copies or substantial portions of the Software. 16* 17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24* OTHER DEALINGS IN THE SOFTWARE. 25*/ 26 27/* 28* Version: V1.3.1 29* Release: 19-07-2012 30* Based on jQuery 1.7.2 31*/ 32 33(function ($) { 34 var popID = 0; 35 $.fn.modalPopLite = function (options) { 36 var options = $.extend({}, { openButton: "modalPopLite-open-btn", closeButton: "modalPopLite-close-btn", isModal: false, callBack: null }, options); 37 38 return this.each(function () { 39 popID++; 40 var thisPopID = popID; 41 var isOpen = false; 42 43 obj = $(this); 44 triggerObj = options.openButton; 45 closeObj = options.closeButton; 46 isReallyModel = options.isModal; 47 48 //alert("winH: " + winH + "top: " + top + "objH: " + objH); 49 obj.before('<div id="modalPopLite-mask' + thisPopID + '" style="width:100%" class="modalPopLite-mask" />'); 50 obj.wrap('<div id="modalPopLite-wrapper' + thisPopID + '" style="left: -10000px;" class="modalPopLite-wrapper" />'); 51 obj.addClass('modalPopLite-child-' + thisPopID); 52 53 $(triggerObj).live("click", function (e) { 54 e.preventDefault(); 55 var winW = $(window).width(); 56 var winH = $(window).height(); 57 var objW = $('.modalPopLite-child-' + thisPopID).outerWidth(); 58 var objH = $('.modalPopLite-child-' + thisPopID).outerHeight(); 59 var left = (winW / 2) - (objW / 2); 60 var top = (winH / 2) - (objH / 2); 61 62 $('#modalPopLite-mask' + thisPopID).css('height', winH + "px"); 63 $('#modalPopLite-mask' + thisPopID).fadeTo('slow', 0.6); 64 //$('#modalPopLite-wrapper' + thisPopID).hide(); 65 $('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top }); 66 $('#modalPopLite-wrapper' + thisPopID).fadeIn('slow'); 67 isOpen = true; 68 }); 69 70 $(closeObj).live("click", function (e) { 71 e.preventDefault(); 72 $('#modalPopLite-mask' + thisPopID).hide(); 73 //$('#modalPopLite-wrapper' + thisPopID).hide(); 74 $('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px"); 75 isOpen = false; 76 if (options.callBack != null) { 77 options.callBack.call(this); 78 } 79 }); 80 81 //if mask is clicked 82 if (!isReallyModel) { 83 $('#modalPopLite-mask' + thisPopID).click(function (e) { 84 e.preventDefault(); 85 $(this).hide(); 86 //$('#modalPopLite-wrapper' + thisPopID).hide(); 87 $('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px"); 88 isOpen = false; 89 if (options.callBack != null) { 90 options.callBack.call(this); 91 } 92 }); 93 } 94 $(window).resize(function () { 95 if (isOpen) { 96 var winW = $(window).width(); 97 var winH = $(window).height(); 98 var objW = $('.modalPopLite-child-' + thisPopID).outerWidth(); 99 var objH = $('.modalPopLite-child-' + thisPopID).outerHeight(); 100 var left = (winW / 2) - (objW / 2); 101 var top = (winH / 2) - (objH / 2); 102 $('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top }); 103 } 104 }); 105 }); 106 107 }; 108 109 $.fn.modalPopLite.Close = function (id) { 110 $('#modalPopLite-mask' + id).hide(); 111 //$('#modalPopLite-wrapper' + id).hide(); 112 $('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px"); 113 if (options.callBack != null) { 114 options.callBack.call(this); 115 } 116 }; 117 118 $.fn.modalPopLite.ShowProgress = function () { 119 $('<div class="popBox-ajax-progress"></div>').appendTo("body") 120 }; 121 122 $.fn.modalPopLite.HideProgress = function () { 123 $('.popBox-ajax-progress').remove(); 124 }; 125 126})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.