1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/* 11* $ lightbox_me 12* By: Buck Wilson 13* Version : 2.3 14* 15* Licensed under the Apache License, Version 2.0 (the "License"); 16* you may not use this file except in compliance with the License. 17* You may obtain a copy of the License at 18* 19* http://www.apache.org/licenses/LICENSE-2.0 20* 21* Unless required by applicable law or agreed to in writing, software 22* distributed under the License is distributed on an "AS IS" BASIS, 23* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24* See the License for the specific language governing permissions and 25* limitations under the License. 26*/ 27 28 29(function($) { 30 31 $.fn.lightbox_me = function(options) { 32 33 return this.each(function() { 34 35 var 36 opts = $.extend({}, $.fn.lightbox_me.defaults, options), 37 $overlay = $(), 38 $self = $(this), 39 $iframe = $('<iframe id="foo" style="z-index: ' + (opts.zIndex + 1) + ';border: none; margin: 0; padding: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0; filter: mask();"/>'), 40 ie6 = ($.browser.msie && $.browser.version < 7); 41 42 if (opts.showOverlay) { 43 //check if there's an existing overlay, if so, make subequent ones clear 44 var $currentOverlays = $(".js_lb_overlay:visible"); 45 if ($currentOverlays.length > 0){ 46 $overlay = $('<div class="lb_overlay_clear js_lb_overlay"/>'); 47 } else { 48 $overlay = $('<div class="' + opts.classPrefix + '_overlay js_lb_overlay"/>'); 49 } 50 } 51 52 /*---------------------------------------------------- 53 DOM Building 54 ---------------------------------------------------- */ 55 if (ie6) { 56 var src = /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'; 57 $iframe.attr('src', src); 58 $('body').append($iframe); 59 } // iframe shim for ie6, to hide select elements 60 $('body').append($self.hide()).append($overlay); 61 62 63 /*---------------------------------------------------- 64 Overlay CSS stuffs 65 ---------------------------------------------------- */ 66 67 // set css of the overlay 68 if (opts.showOverlay) { 69 setOverlayHeight(); // pulled this into a function because it is called on window resize. 70 $overlay.css({ position: 'absolute', width: '100%', top: 0, left: 0, right: 0, bottom: 0, zIndex: (opts.zIndex + 2), display: 'none' }); 71 if (!$overlay.hasClass('lb_overlay_clear')){ 72 $overlay.css(opts.overlayCSS); 73 } 74 } 75 76 /*---------------------------------------------------- 77 Animate it in. 78 ---------------------------------------------------- */ 79 // 80 if (opts.showOverlay) { 81 $overlay.fadeIn(opts.overlaySpeed, function() { 82 setSelfPosition(); 83 $self[opts.appearEffect](opts.lightboxSpeed, function() { setOverlayHeight(); setSelfPosition(); opts.onLoad()}); 84 }); 85 } else { 86 setSelfPosition(); 87 $self[opts.appearEffect](opts.lightboxSpeed, function() { opts.onLoad()}); 88 } 89 90 /*---------------------------------------------------- 91 Hide parent if parent specified (parentLightbox should be jquery reference to any parent lightbox) 92 ---------------------------------------------------- */ 93 if (opts.parentLightbox) { 94 opts.parentLightbox.fadeOut(200); 95 } 96 97 98 /*---------------------------------------------------- 99 Bind Events 100 ---------------------------------------------------- */ 101 102 $(window).resize(setOverlayHeight) 103 .resize(setSelfPosition) 104 .scroll(setSelfPosition) 105 .keyup(observeKeyPress); 106 //$overlay.click(function(e) { closeLightbox(); e.preventDefault; }); 107 $self.delegate(opts.closeSelector, "click", function(e) { 108 closeLightbox(); e.preventDefault(); 109 }); 110 $self.bind('close', closeLightbox); 111 $self.bind('reposition', setSelfPosition); 112 113 114 115 /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 116 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ 117 118 119 /*---------------------------------------------------- 120 Private Functions 121 ---------------------------------------------------- */ 122 123 /* Remove or hide all elements */ 124 function closeLightbox() { 125 var s = $self[0].style; 126 if (opts.destroyOnClose) { 127 $self.add($overlay).remove(); 128 } else { 129 $self.add($overlay).hide(); 130 } 131 132 //show the hidden parent lightbox 133 if (opts.parentLightbox) { 134 opts.parentLightbox.fadeIn(200); 135 } 136 137 $iframe.remove(); 138 139 // clean up events. 140 $self.undelegate(opts.closeSelector, "click"); 141 142 $(window).unbind('reposition', setOverlayHeight); 143 $(window).unbind('reposition', setSelfPosition); 144 $(window).unbind('scroll', setSelfPosition); 145 $(window).unbind('keypress', observeKeyPress); 146 if (ie6) 147 s.removeExpression('top'); 148 opts.onClose(); 149 } 150 151 152 /* Function to bind to the window to observe the escape/enter key press */ 153 function observeKeyPress(e) {
154 if((e.keyCode == 27 || (e.DOM_VK_ESCAPE == 27 && e.which==0)) && opts.closeEsc) closeLightbox(); 155 } 156 157 158 /* Set the height of the overlay 159 : if the document height is taller than the window, then set the overlay height to the document height. 160 : otherwise, just set overlay height: 100% 161 */ 162 function setOverlayHeight() { 163 if ($(window).height() < $(document).height()) { 164 $overlay.css({height: $(document).height() + 'px'}); 165 $iframe.css({height: $(document).height() + 'px'}); 166 } else { 167 $overlay.css({height: '100%'}); 168 if (ie6) { 169 $('html,body').css('height','100%'); 170 $iframe.css('height', '100%'); 171 } // ie6 hack for height: 100%; TODO: handle this in IE7 172 } 173 } 174 175 176 /* Set the position of the modal'd window ($self) 177 : if $self is taller than the window, then make it absolutely positioned 178 : otherwise fixed 179 */ 180 function setSelfPosition() { 181 var s = $self[0].style; 182 183 // reset CSS so width is re-calculated for margin-left CSS 184 $self.css({left: '50%', marginLeft: ($self.outerWidth() / 2) * -1, zIndex: (opts.zIndex + 3) }); 185 186 187 /* we have to get a little fancy when dealing with height, because lightbox_me 188 is just so fancy. 189 */ 190 191 // if the height of $self is bigger than the window and self isn't already position absolute 192 if (($self.height() + 80 >= $(window).height()) && ($self.css('position') != 'absolute' || ie6)) { 193 194 // we are going to make it positioned where the user can see it, but they can still scroll 195 // so the top offset is based on the user's scroll position. 196 var topOffset = $(document).scrollTop() + 40; 197 $self.css({position: 'absolute', top: topOffset + 'px', marginTop: 0}) 198 if (ie6) { 199 s.removeExpression('top'); 200 } 201 } else if ($self.height()+ 80 < $(window).height()) { 202 //if the height is less than the window height, then we're gonna make this thing position: fixed. 203 // in ie6 we're gonna fake it. 204 if (ie6) { 205 s.position = 'absolute'; 206 if (opts.centered) { 207 s.setExpression('top', '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"') 208 s.marginTop = 0; 209 } else { 210 var top = (opts.modalCSS && opts.modalCSS.top) ? parseInt(opts.modalCSS.top) : 0; 211 s.setExpression('top', '((blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"') 212 } 213 } else { 214 if (opts.centered) { 215 $self.css({ position: 'fixed', top: '50%', marginTop: ($self.outerHeight() / 2) * -1}) 216 } else { 217 $self.css({ position: 'fixed'}).css(opts.modalCSS); 218 } 219 220 } 221 } 222 } 223 224 }); 225 226 227 228 }; 229 230 $.fn.lightbox_me.defaults = { 231 232 // animation 233 appearEffect: "fadeIn", 234 appearEase: "", 235 overlaySpeed: 250, 236 lightboxSpeed: 300, 237 238 // close 239 closeSelector: ".close", 240 closeClick: true, 241 closeEsc: true, 242 243 // behavior 244 destroyOnClose: false, 245 showOverlay: true, 246 parentLightbox: false, 247 248 // callbacks 249 onLoad: function() {}, 250 onClose: function() {}, 251 252 // style 253 classPrefix: 'lb', 254 zIndex: 999, 255 centered: false, 256 modalCSS: {top: '40px'}, 257 overlayCSS: {background: 'black', opacity: .3} 258 } 259})(jQuery); 260}
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.