PageSourceSearch

https://moapp.kr/jquery/jquery.colorbox.js?1789361064

js moapp.kr collected 2026-10-02 00:02:44 UTC 34,385 bytes, 1,042 lines download raw bytes

1// ColorBox v1.3.18 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
2// Copyright (c) 2011 Jack Moore - [email protected]
3// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
5(function ($, document, window) {
6    var
7    // Default settings object.	
8    // See http://jacklmoore.com/colorbox for details.
9    defaults = {
10        transition: "elastic",
11        speed: 300,
12        width: false,
13        initialWidth: "430",
14        innerWidth: false,
15        maxWidth: false,
16        height: false,
17        initialHeight: "450",
18        innerHeight: false,
19        maxHeight: false,
20        scalePhotos: true,
21        scrolling: true,
22        inline: false,
23        html: false,
24        iframe: false,
25        fastIframe: true,
26        photo: false,
27        href: false,
28        title: false,
29        rel: false,
30        opacity: 0.9,
31        preloading: true,
32        current: "image {current} of {total}",
33        previous: "previous",
34        next: "next",
35        close: "close",
36        open: false,
37        returnFocus: true,
38        loop: true,
39        slideshow: false,
40        slideshowAuto: true,
41        slideshowSpeed: 2500,
42        slideshowStart: "start slideshow",
43        slideshowStop: "stop slideshow",
44        onOpen: false,
45        onLoad: false,
46        onComplete: false,
47        onCleanup: false,
48        onClosed: false,
49        overlayClose: true,		
50        escKey: true,
51        arrowKey: true,
52        top: false,
53        bottom: false,
54        left: false,
55        right: false,
56        fixed: false,
57        data: undefined,
58		design: true,//2011/11/09 추가
59		view_point_start: 0//2011/11/09 추가
60    },
61    // Abstracting the HTML and event identifiers for easy rebranding
62    colorbox = 'colorbox',
63    prefix = 'cbox',
64    boxElement = prefix + 'Element',
65    // Events	
66    event_open = prefix + '_open',
67    event_load = prefix + '_load',
68    event_complete = prefix + '_complete',
69    event_cleanup = prefix + '_cleanup',
70    event_closed = prefix + '_closed',
71    event_purge = prefix + '_purge',
72    
73    // Special Handling for IE
74    isIE = navigator.appVersion.indexOf('MSIE')>-1 && !$.support.opacity, // Detects IE6,7,8.  IE9 supports opacity.  Feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome, hence the user-agent test.
75    isIE6 = isIE && navigator.appVersion.indexOf('MSIE 6.0')>-1,
76    event_ie6 = prefix + '_IE6',
77    
78    // Cached jQuery Object Variables
79    $overlay,
80    $box,
81    $wrap,
82    $content,
83    $topBorder,
84    $leftBorder,
85    $rightBorder,
86    $bottomBorder,
87    $related,
88    $window,
89    $loaded,
90    $loadingBay,
91    $loadingOverlay,
92    $title,
93    $current,
94    $slideshow,
95    $next,
96    $prev,
97    $close,
98    $groupControls,
99	$test_n = 0,
100    
101    // Variables for cached values or use across multiple functions
102    settings,
103    interfaceHeight,
104    interfaceWidth,
105	contents_interfaceWidth,
106    loadedHeight,
107    loadedWidth,
108    element,
109    index,
110    photo,
111    open,
112    active,
113    closing,
114    loadingTimer,
115    publicMethod,
116    div = "div";
117	// ****************
118	// HELPER FUNCTIONS
119	// ****************
120    
121	// Convience function for creating new jQuery objects
122    function $tag(tag, id, css) {
123        var element = document.createElement(tag);
124        
125        if (id) {
126            element.id = prefix + id;
127        }
128        
129        if (css) {
130            element.style.cssText = css;
131        }
132        
133        return $(element);
134    }
135
136	// Determine the next and previous members in a group.
137	function getIndex(increment) {
138		var 
139		max = $related.length, 
140		newIndex = (index + increment) % max;
141		
142		return (newIndex < 0) ? max + newIndex : newIndex;
143	}
144
145	// Convert '%' and 'px' values to integers
146	function setSize(size, dimension) {
147		return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : $window.height()) / 100) : 1) * parseInt(size, 10));
148	}
149	
150	// Checks an href to see if it is a photo.
151	// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
152	function isImage(url) {
153		return settings.photo || /\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(url);
154	}
155	
156	// Assigns function results to their respective properties
157	function makeSettings() {
158        var i;
159        settings = $.extend({}, $.data(element, colorbox));
160
161		for (i in settings) {
162			if ($.isFunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
163			    settings[i] = settings[i].call(element);
164			}
165		}
166        
167		settings.rel = settings.rel || element.rel || 'nofollow';
168		settings.href = settings.href || $(element).attr('href');
169		settings.title = settings.title || element.title;
170        if (typeof settings.href === "string") {
171            settings.href = $.trim(settings.href);
172        }
173
174	}
175
176	function trigger(event, callback) {
177		$.event.trigger(event);
178		if (callback) {
179			callback.call(element);
180		}
181	}
182
183	// Slideshow functionality
184	function slideshow() {
185		var
186		timeOut,
187		className = prefix + "Slideshow_",
188		click = "click." + prefix,
189		start,
190		stop,
191		clear;
192		if(typeof settings === 'undefined') return;
193		if (settings['slideshow'] && $related[1]) {
194			start = function () {
195				$slideshow
196					.text(settings.slideshowStop)
197					.unbind(click)
198					.bind(event_complete, function () {
199						if (index < $related.length - 1 || settings.loop) {
200							timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
201						}
202					})
203					.bind(event_load, function () {
204						clearTimeout(timeOut);
205					})
206					.one(click + ' ' + event_cleanup, stop);
207				$box.removeClass(className + "off").addClass(className + "on");
208				timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
209			};
210			
211			stop = function () {
212				clearTimeout(timeOut);
213				$slideshow
214					.text(settings.slideshowStart)
215					.unbind([event_complete, event_load, event_cleanup, click].join(' '))
216					.one(click, function () {
217						publicMethod.next();
218						start();
219					});
220				$box.removeClass(className + "on").addClass(className + "off");
221			};
222			
223			if (settings.slideshowAuto) {
224				start();
225			} else {
226				stop();
227			}
228		} else {
229            $box.removeClass(className + "off " + className + "on");
230        }
231	}
232
233	function launch(target) {
234		if (!closing) {
235			
236			element = target;
237			
238			makeSettings();
239			
240			$related = $(element);
241			
242			index = 0;
243			
244			if (settings.rel !== 'nofollow') {
245				$related = $('.' + boxElement).filter(function () {
246					var relRelated = $.data(this, colorbox).rel || this.rel;
247					return (relRelated === settings.rel);
248				});
249				index = $related.index(element);
250				
251				// Check direct calls to ColorBox.
252				if (index === -1) {
253					$related = $related.add(element);
254					index = $related.length - 1;
255				}
256			}
257			
258			if (!open) {
259				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
260				
261				//design 제거 추가 2011/11/09
262				if(settings.design == false){
263					$box.removeClass('design_false');
264					$box.removeClass('design_custom');
265					$box.addClass('design_false');
266				}else if(settings.design == 'custom'){
267					$box.removeClass('design_false');
268					$box.removeClass('design_custom');
269					$box.addClass('design_custom');
270				}else{
271					$box.removeClass('design_false');
272					$box.removeClass('design_custom');
273				}
274				//여기까지
275				$box.show();
276				
277				if (settings.returnFocus) {
278					try {
279						element.blur();
280						$(element).one(event_closed, function () {
281							try {
282								this.focus();
283							} catch (e) {
284								// do nothing
285							}
286						});
287					} catch (e) {
288						// do nothing
289					}
290				}
291				
292				// +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
293				$overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
294				
295				// Opens inital empty ColorBox prior to content being loaded.
296				settings.w = setSize(settings.initialWidth, 'x');
297				settings.h = setSize(settings.initialHeight, 'y');
298				
299				publicMethod.position();
300				
301				if (isIE6) {
302					$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
303						$overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
304					}).trigger('resize.' + event_ie6);
305				}
306				
307				trigger(event_open, settings.onOpen);
308				
309				$groupControls.add($title).hide();
310				
311				$close.html(settings.close).show();
312			}else{
313				$box.hide();
314				//design 제거 추가 2011/11/09
315				if(settings.design == false){
316					$box.removeClass('design_false');
317					$box.removeClass('design_custom');
318					$box.addClass('design_false');
319				}else if(settings.design == 'custom'){
320					$box.removeClass('design_false');
321					$box.removeClass('design_custom');
322					$box.addClass('design_custom');
323				}else{
324					$box.removeClass('design_false');
325					$box.removeClass('design_custom');
326				}
327				
328				$box.show();
329				$overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
330			}
331			
332			publicMethod.load(true);
333		}
334	}
335
336	// ****************
337	// PUBLIC FUNCTIONS
338	// Usage format: $.fn.colorbox.close();
339	// Usage from within an iframe: parent.$.fn.colorbox.close();
340	// ****************
341	
342	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
343		var $this = this;
344		
345        options = options || {};
346        
347		publicMethod.init();
348		
349		if (!$this[0]) {
350			if ($this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
351                return $this;
352            }
353            // if no selector was given (ie. $.colorbox()), create a temporary element to work with
354			$this = $('<a/>');
355			options.open = true; // assume an immediate open
356		}
357		
358		if (callback) {
359			options.onComplete = callback;
360		}
361		
362		$this.each(function () {
363			$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
364			$(this).addClass(boxElement);
365		});
366
367        if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
368			launch($this[0]);
369		}
370        
371		return $this;
372	};
373
374	// Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
375	// This preps ColorBox for a speedy open when clicked, and minimizes the burdon on the browser by only
376	// having to run once, instead of each time colorbox is opened.
377	publicMethod.init = function () {
378		if (!$box) {
379
380			// If the body is not present yet, wait for DOM ready
381			if (!$('body')[0]) {
382				$(publicMethod.init);
383				return;
384			}
385			
386			// Create the markup and append to BODY
387			$window = $(window);
388			$box = $tag(div).attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''});
389			$overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide();
390			$wrap = $tag(div, "Wrapper");
391			$content = $tag(div, "Content","z-index:4; position:relative;overflow:visible").append(
392				$loaded = $tag(div, "LoadedContent", 'width:0; height:0; position:relative; z-index:5;'),
393				$loadingOverlay = $tag('span', "LoadingOverlay").add($tag('span', "LoadingGraphic")),
394				$title = $tag(div, "Title"),
395				$current = $tag(div, "Current"),
396				$next = $tag(div, "Next"),
397				$prev = $tag(div, "Previous"),
398				$slideshow = $tag(div, "Slideshow").bind(event_open, slideshow),
399				$close = $tag(div, "Close")
400			);
401			/*if(settings.design == false){
402				var bmi_top = '0px';
403			}else if(settings.design == 'custom'){
404				var bmi_top = '37px';
405			}else{
406				var bmi_top = '25px';
407			}*/
408			$wrap.append( // The 3x3 Grid that makes up ColorBox
409				$tag(div,'cbox_top_wrap').append(
410					$t_leftBorder = $tag(div, "TopLeft"),
411					$topBorder = $tag(div, "TopCenter"),
412					$t_rightBorder = $tag(div, "TopRight")
413				),
414				$tag(div, 'cbox_mid_wrap').append(
415					$leftBorder = $tag(div, "MiddleLeft"),
416					$content,
417					$rightBorder = $tag(div, "MiddleRight")
418				),
419				$cbox_bottom = $tag(div, 'cbox_foot_wrap').append(
420					$b_leftBorder = $tag(div, "BottomLeft"),
421					$bottomBorder = $tag(div, "BottomCenter"),
422					$b_rightBorder = $tag(div, "BottomRight")
423				)
424			).find('div div').css({'float': 'left'});
425			
426			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
427			
428			$('body').prepend($overlay, $box.append($wrap, $loadingBay));
429
430			// Cache values needed for size calculations
431			interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
432			contents_interfaceWidth = $t_leftBorder.width() + $t_rightBorder.width() + $content.outerWidth(true) - $content.width()+30;
433			interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
434			loadedHeight = $loaded.outerHeight(true);
435			loadedWidth = $loaded.outerWidth(true);
436			
437			// Setting padding to remove the need to do size conversions during the animation step.
438			$box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
439			
440			// Setup button events.
441			// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
442			$next.click(function () {
443				publicMethod.next();
444			});
445			$prev.click(function () {
446				publicMethod.prev();
447			});
448			$close.click(function () {
449				publicMethod.close();
450			});
451			
452			$groupControls = $next.add($prev).add($current).add($slideshow);
453			
454			$overlay.click(function () {
455				if (settings.overlayClose) {
456					publicMethod.close();
457				}
458			});
459			
460			// Set Navigation Key Bindings
461			$(document).bind('keydown.' + prefix, function (e) {
462				var key = e.keyCode;
463				if (open && settings.escKey && key === 27) {
464					e.preventDefault();
465					publicMethod.close();
466				}
467				if (open && settings.arrowKey && $related[1]) {
468					if (key === 37) {
469						e.preventDefault();
470						$prev.click();
471					} else if (key === 39) {
472						e.preventDefault();
473						$next.click();
474					}
475				}
476			});
477		}
478	};
479	
480	publicMethod.remove = function () {
481		//$box.add($overlay).remove();
482		$box.remove();
483		$overlay.remove();
484		$box = null;
485		$('.' + boxElement).removeData(colorbox).removeClass(boxElement);
486	};
487
488	publicMethod.position = function (speed, loadedCallback) {
489			var top = 0, left = 0, offset = $box.offset();
490			
491			$window.unbind('resize.' + prefix);
492	
493			// remove the modal so that it doesn't influence the document width/height        
494			$box.css({top: -99999, left: -99999});
495	
496			if (settings.fixed && !isIE6) {
497				$box.css({position: 'fixed'});
498			} else {
499				top = $window.scrollTop();
500				left = $window.scrollLeft();
501				$box.css({position: 'absolute'});
502			}
503	
504			// keeps the top and left positions within the browser's viewport.
505			if (settings.right !== false) {
506				left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(sett
506ings.right, 'x'), 0);
507			} else if (settings.left !== false) {
508				left += setSize(settings.left, 'x');
509			} else {
510				left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
511			}
512			
513			if (settings.bottom !== false) {
514				top += Math.max($window.height() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
515			} else if (settings.top !== false) {
516				top += setSize(settings.top, 'y');
517			} else {
518				top += Math.round(Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
519			}
520			
521        if(settings.transition != 'slide'){
522			$box.css({top: offset.top, left: offset.left});
523		}else{
524			$pop_login_window_h = $(window).height();
525			$pop_d_h =(settings.h + loadedHeight + interfaceHeight);
526			$view_height = $pop_d_h - settings.view_point_start;
527			$box_t_top = ($pop_login_window_h/2)-settings.view_point_start;
528			$box_t_top = $box_t_top-($view_height/2);
529			$box_t_top>=0 ? $box_t_top =0 : $box_t_top=$box_t_top;
530			$box.css({left:left, top:$box_t_top});
531		}
532		
533		
534		
535        
536		// setting the speed to 0 to reduce the delay between same-sized content.
537		speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0;
538        
539		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
540		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
541		// it can invoke an obscure IE bug when using iframes.
542		$wrap[0].style.width = $wrap[0].style.height = "9999px";
543		
544		function modalDimensions(that) {
545			// loading overlay height has to be explicitly set for IE6.
546			$content[0].style.width = that.style.width;
547			$topBorder[0].style.width = $bottomBorder[0].style.width = that.style.width;
548			if(settings.design==true){var cobox_midlle_con_wid = 0; var cobox_midlle_con_hei = 0;}else{cobox_midlle_con_wid = 21; var cobox_midlle_con_hei = 20;}
549			$topBorder.width($topBorder.width()-cobox_midlle_con_wid);
550			$bottomBorder.width($bottomBorder.width()-cobox_midlle_con_wid);
551			$loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
552			$content.height($content.height()-cobox_midlle_con_hei);
553			$leftBorder.height($leftBorder.height()-cobox_midlle_con_hei);
554			$rightBorder.height($rightBorder.height()-cobox_midlle_con_hei);
555			$loadingOverlay.height($loadingOverlay.height()-cobox_midlle_con_hei);
556			$cbox_bottom.css('top',$topBorder.height()+$content.height());
557		}
558		
559		if(settings.design==true){var cobox_midlle_con_wid = 0; var cobox_midlle_con_hei = 0;}else{cobox_midlle_con_wid = 21; var cobox_midlle_con_hei = 20;}
560		if(settings.transition == 'none'){
561			$box.css({'width':settings.w + loadedWidth,'height':settings.h + loadedHeight,'top':top,'left':left});
562			$content.width(settings.w + loadedWidth);
563			$topBorder.width(settings.w + loadedWidth);
564			$bottomBorder.width(settings.w + loadedWidth);
565			$topBorder.width($topBorder.width()-cobox_midlle_con_wid);
566			$bottomBorder.width($bottomBorder.width()-cobox_midlle_con_wid);
567			$loadingOverlay[0].style.height = (settings.h + loadedHeight)+"px";
568			$loadingOverlay[1].style.height = (settings.h + loadedHeight)+"px";
569			$content.height(settings.h + loadedHeight);
570			$leftBorder.height(settings.h + loadedHeight);
571			$rightBorder.height(settings.h + loadedHeight);
572			$content.height($content.height()-cobox_midlle_con_hei);
573			$leftBorder.height($leftBorder.height()-cobox_midlle_con_hei);
574			$rightBorder.height($rightBorder.height()-cobox_midlle_con_hei);
575			$loadingOverlay.height($loadingOverlay.height()-cobox_midlle_con_hei);
576			$cbox_bottom.css('top',$topBorder.height()+$content.height());
577			active = false;
578			// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
579			$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
580			$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
581			if (loadedCallback) {
582				loadedCallback();
583			}
584			
585			setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
586				$window.bind('resize.' + prefix, publicMethod.resize_windows);
587			}, 1);
588		}else if(settings.transition == 'slide'){
589			$(document).scrollTop(0);
590			$pop_login_window_h = $(window).height();
591			$pop_d_h =(settings.h + loadedHeight + interfaceHeight);
592			$view_height = $pop_d_h - settings.view_point_start;
593			$box[0].style.width =$wrap[0].style.width =$content[0].style.width= (settings.w + loadedWidth + interfaceWidth) + "px";
594			$box[0].style.height =$wrap[0].style.height =$content[0].style.height= $pop_d_h + "px";
595			$box_t_top = ($pop_login_window_h/2)-settings.view_point_start;
596			$box_t_top = $box_t_top-($view_height/2);
597			$box_t_top>=-40 ? $box_t_top =-40 : $box_t_top=$box_t_top;
598			$box[0].style.top = "-"+$pop_d_h+ "px";
599			$loaded.show();
600			$box.dequeue().animate({top: $box_t_top}, {
601				duration: 300,
602				complete: function () {
603					active = false;
604					if (loadedCallback) {
605						loadedCallback();
606					}
607					setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
608						$window.bind('resize.' + prefix, publicMethod.resize_windows);
609					}, 1);
610				}
611			});
612		}else{
613			$box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left}, {
614				duration: 300,
615				complete: function () {
616					modalDimensions(this);
617					
618					active = false;
619					
620					// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
621					$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
622					$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
623					if (loadedCallback) {
624						loadedCallback();
625					}
626					
627					setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
628						$window.bind('resize.' + prefix, publicMethod.resize_windows);
629					}, 1);
630				},
631				step: function () {
632					modalDimensions(this);
633				}
634			});
635		}
636	};
637	publicMethod.resize_windows = function(){
638		var top = 0, left = 0, offset = $box.offset();
639	
640			// remove the modal so that it doesn't influence the document width/height        
641			$box.css({top: -99999, left: -99999});
642	
643			if (settings.fixed && !isIE6) {
644				$box.css({position: 'fixed'});
645			} else {
646				top = $window.scrollTop();
647				left = $window.scrollLeft();
648				$box.css({position: 'absolute'});
649			}
650	
651			// keeps the top and left positions within the browser's viewport.
652			if (settings.right !== false) {
653				left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
654			} else if (settings.left !== false) {
655				left += setSize(settings.left, 'x');
656			} else {
657				left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
658			}
659			
660			if (settings.bottom !== false) {
661				top += Math.max($window.height() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
662			} else if (settings.top !== false) {
663				top += setSize(settings.top, 'y');
664			} else {
665				top += Math.round(Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
666			}
667			
668        if(settings.transition != 'slide'){
669			$box.css({top: top, left: left});
670		}else{
671			$pop_login_window_h = $(window).height();
672			$pop_d_h =(settings.h + loadedHeight + interfaceHeight);
673			$view_height = $pop_d_h - settings.view_point_start;
674			$box_t_top = ($pop_login_window_h/2)-settings.view_point_start;
675			$box_t_top = $box_t_top-($view_height/2);
676			$box_t_top>=-40 ? $box_t_top =-40 : $box_t_top=$box_t_top;
677			$box.css({left:left, top:$box_t_top});
678		}
679	}
680	publicMethod.resize = function (options) {
681		if (open) {
682			options = options || {};
683			
684			if (options.width) {
685				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
686			}
687			if (options.innerWidth) {
688				settings.w = setSize(options.innerWidth, 'x');
689			}
690			$loaded.css({width: settings.w});
691			
692			if (options.height) {
693				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
694			}
695			if (options.innerHeight) {
696				settings.h = setSize(options.innerHeight, 'y');
697			}
698			if (!options.innerHeight && !options.height) {
699				$loaded.css({height: "auto"});
700				settings.h = $loaded.height();
701			}
702			$loaded.css({height: settings.h});
703			
704			publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
705		}
706	};
707
708	publicMethod.prep = function (object) {
709		if (!open) {
710			return;
711		}
712		
713		var callback, speed = settings.transition === "none" ? 0 : settings.speed;
714		
715		$loaded.remove();
716		$loaded = $tag(div, 'LoadedContent').append(object);
717		
718		function getWidth() {
719			settings.w = settings.w || $loaded.width();
720			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
721			return settings.w;
722		}
723		function getHeight() {
724			settings.h = settings.h || $loaded.height();
725			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
726			return settings.h;
727		}
728		
729		$loaded.hide()
730		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
731		.css({width: getWidth()})
732		.css({height: getHeight(),
733			'z-index': 5,
734			'position': 'relative',
735			'overflow':'visible'
736		})// sets the height independently from the width in case the new width influences the value of height.
737		.prependTo($content);
738		
739		$loadingBay.hide();
740		
741		// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
742		//$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
743		
744        $(photo).css({'float': 'none'});
745        
746		// Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
747		if (isIE6) {
748			$('select').not($box.find('select')).filter(function () {
749				return this.style.visibility !== 'hidden';
750			}).css({'visibility': 'hidden'}).one(event_cleanup, function () {
751				this.style.visibility = 'inherit';
752			});
753		}
754		
755		callback = function () {
756            var preload, i, total = $related.length, iframe, frameBorder = 'frameBorder', allowTransparency = 'allowTransparency', complete, src, img;
757            
758            if (!open) {
759                return;
760            }
761            
762            function removeFilter() {
763                if (isIE) {
764                    $box[0].style.removeAttribute('filter');
765                }
766            }
767            
768            complete = function () {
769                clearTimeout(loadingTimer);
770                $loadingOverlay.hide();
771                trigger(event_complete, settings.onComplete);
772            };
773            
774            if (isIE) {
775                //This fadeIn helps the bicubic resampling to kick-in.
776                if (photo) {
777                    $loaded.fadeIn(100);
778                }
779            }
780            
781            $title.html(settings.title).add($loaded).show();
782            
783            if (total > 1) { // handle grouping
784                if (typeof settings.current === "string") {
785                    $current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
786                }
787                
788                $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(sett
788ings.next);
789                $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
790				
791                if (settings.slideshow) {
792                    $slideshow.show();
793                }
794				
795                // Preloads images within a rel group
796                if (settings.preloading) {
797					preload = [
798						getIndex(-1),
799						getIndex(1)
800					];
801					while ((i = $related[preload.pop()])) {
802						src = $.data(i, colorbox).href || i.href;
803						if ($.isFunction(src)) {
804							src = src.call(i);
805						}
806						if (isImage(src)) {
807							img = new Image();
808							img.src = src;
809						}
810					}
811                }
812            } else {
813                $groupControls.hide();
814            }
815            
816            if (settings.iframe) {
817                iframe = $tag('iframe')[0];
818                
819                if (frameBorder in iframe) {
820                    iframe[frameBorder] = 0;
821                }
822                if (allowTransparency in iframe) {
823                    iframe[allowTransparency] = "true";
824                }
825                // give the iframe a unique name to prevent caching
826                iframe.name = prefix + (+new Date());
827                if (settings.fastIframe) {
828                    complete();
829                } else {
830                    $(iframe).one('load', complete);
831                }
832                iframe.src = settings.href;
833                if (!settings.scrolling) {
834                    iframe.scrolling = "no";
835                }
836                $(iframe).addClass(prefix + 'Iframe').appendTo($loaded).one(event_purge, function () {
837                    iframe.src = "//about:blank";
838                });
839            } else {
840                complete();
841            }
842            
843            if (settings.transition === 'fade') {
844                $box.fadeTo(speed, 1, removeFilter);
845            } else {
846                removeFilter();
847            }
848		};
849		
850		if (settings.transition === 'fade') {
851			$box.fadeTo(speed, 0, function () {
852				publicMethod.position(0, callback);
853			});
854		} else {
855			publicMethod.position(speed, callback);
856		}
857	};
858
859	publicMethod.load = function (launched) {
860		var href, setResize, prep = publicMethod.prep;
861		
862		active = true;
863		
864		photo = false;
865		
866		element = $related[index];
867		
868		if (!launched) {
869			makeSettings();
870		}
871		
872		trigger(event_purge);
873		
874		trigger(event_load, settings.onLoad);
875		
876		settings.h = settings.height ?
877				setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
878				settings.innerHeight && setSize(settings.innerHeight, 'y');
879		
880		settings.w = settings.width ?
881				setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
882				settings.innerWidth && setSize(settings.innerWidth, 'x');
883		
884		// Sets the minimum dimensions for use in image scaling
885		settings.mw = settings.w;
886		settings.mh = settings.h;
887		
888		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
889		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
890		if (settings.maxWidth) {
891			settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
892			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
893		}
894		if (settings.maxHeight) {
895			settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
896			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
897		}
898		
899		href = settings.href;
900		
901        loadingTimer = setTimeout(function () {
902            $loadingOverlay.show();
903        }, 100);
904        
905		if (settings.inline) {
906			// Inserts an empty placeholder where inline content is being pulled from.
907			// An event is bound to put inline content back when ColorBox closes or loads new content.
908			$tag(div).hide().insertBefore($(href)[0]).one(event_purge, function () {
909				$(this).replaceWith($loaded.children());
910			});
911			prep($(href));
912		} else if (settings.iframe) {
913			// IFrame element won't be added to the DOM until it is ready to be displayed,
914			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
915			prep(" ");
916		} else if (settings.html) {
917			prep(settings.html);
918		} else if (isImage(href)) {
919			$(photo = new Image())
920			.addClass(prefix + 'Photo')
921			.error(function () {
922				settings.title = false;
923				prep($tag(div, 'Error').text('This image could not be loaded'));
924			})
925			.load(function () {
926				var percent;
927				photo.onload = null; //stops animated gifs from firing the onload repeatedly.
928				
929				if (settings.scalePhotos) {
930					setResize = function () {
931						photo.height -= photo.height * percent;
932						photo.width -= photo.width * percent;	
933					};
934					if (settings.mw && photo.width > settings.mw) {
935						percent = (photo.width - settings.mw) / photo.width;
936						setResize();
937					}
938					if (settings.mh && photo.height > settings.mh) {
939						percent = (photo.height - settings.mh) / photo.height;
940						setResize();
941					}
942				}
943				
944				if (settings.h) {
945					photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
946				}
947				
948				if ($related[1] && (index < $related.length - 1 || settings.loop)) {
949					photo.style.cursor = 'pointer';
950					photo.onclick = function () {
951                        publicMethod.next();
952                    };
953				}
954				
955				if (isIE) {
956					photo.style.msInterpolationMode = 'bicubic';
957				}
958				
959				setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
960					prep(photo);
961				}, 1);
962			});
963			
964			setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
965				photo.src = href;
966			}, 1);
967		} else if (href) {
968			$loadingBay.load(href, settings.data, function (data, status, xhr) {
969				prep(status === 'error' ? $tag(div, 'Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents());
970			});
971		}
972	};
973        
974	// Navigates to the next page/image in a set.
975	publicMethod.next = function () {
976		if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) {
977			index = getIndex(1);
978			publicMethod.load();
979		}
980	};
981	
982	publicMethod.prev = function () {
983		if (!active && $related[1] && (index || settings.loop)) {
984			index = getIndex(-1);
985			publicMethod.load();
986		}
987	};
988
989	// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
990	publicMethod.close = function () {
991		if (open && !closing) {
992			
993			closing = true;
994			
995			open = false;
996			
997			trigger(event_cleanup, settings.onCleanup);
998			
999			$window.unbind('.' + prefix + ' .' + event_ie6);
1000			
1001			$overlay.hide();//fadeTo(200, 0);
1002			
1003			$window.unbind('resize.' + prefix);
1004			
1005			//$box.stop().fadeTo(300, 0, function () {
1006                 
1007				$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
1008				
1009				trigger(event_purge);
1010				
1011				$loaded.remove();
1012				
1013				setTimeout(function () {
1014					closing = false;
1015					trigger(event_closed, settings.onClosed);
1016				}, 1);
1017			//});
1018		}
1019	};
1020
1021	// A method for fetching the current element ColorBox is referencing.
1022	// returns a jQuery object.
1023	publicMethod.element = function () {
1024		return $(element);
1025	};
1026
1027	publicMethod.settings = defaults;
1028    
1029	// Bind the live event before DOM-ready for maximum performance in IE6 & 7.
1030	$('.' + boxElement, document).on('click', function (e) {
1031        // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
1032        // See: http://jacklmoore.com/notes/click-events/
1033        if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) {
1034            e.preventDefault();
1035            launch(this);
1036        }
1037    });
1038
1039	// Setup ColorBox
1040	publicMethod.init();
1041
1042}(jQuery, document, this));

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.