PageSourceSearch

https://kasouken-movie.com/wordpress/wp-content/themes/schneid/common/js/colorbox.js?ver=1.2

js kasouken-movie.com collected 2026-10-02 18:38:27 UTC 29,675 bytes, 1,122 lines download raw bytes

1// colorbox
2$(document).ready(function(){
3"use strict";
4// 開いている時にbody側はスクロールできないようにする処理
5    var current_scrollY;
6    $(".ajax, .__trailer").colorbox({
7      iframe:true, width:"100%", height:"100%", scrolling:true,
8      onOpen:function(){ current_scrollY = $( window ).scrollTop();
9
10      $( '#container' ).css( {
11        position: 'fixed',
12        width: '100%',
13        top: -1 * current_scrollY
14      } ); },
15      onClosed:function(){ $( '#container' ).attr( { style: '' } );$( 'html, body' ).prop( { scrollTop: current_scrollY } ); }
16    });
17  });
18
19/*!
20	Colorbox 1.6.3
21	license: MIT
22*/
23(function ($, document, window) {
24	var
25	// Default settings object.
26	defaults = {
27		// data sources
28		html: false,
29		photo: false,
30		iframe: false,
31		inline: false,
32
33		// behavior and appearance
34		transition: "elastic",
35		speed: 0,
36		fadeOut: 300,
37		width: false,
38		initialWidth: "600",
39		innerWidth: false,
40		maxWidth: false,
41		height: false,
42		initialHeight: "450",
43		innerHeight: false,
44		maxHeight: false,
45		scalePhotos: true,
46		scrolling: false,
47		opacity: .96,
48		preloading: true,
49		className: true,
50		overlayClose: true,
51		escKey: true,
52		arrowKey: true,
53		top: false,
54		bottom: false,
55		left: false,
56		right: false,
57		fixed: true,
58		data: undefined,
59		closeButton: true,
60		fastIframe: true,
61		open: false,
62		reposition: true,
63		loop: true,
64		slideshow: false,
65		slideshowAuto: true,
66		slideshowSpeed: 2500,
67		slideshowStart: "start slideshow",
68		slideshowStop: "stop slideshow",
69		photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
70
71		// alternate image paths for high-res displays
72		retinaImage: false,
73		retinaUrl: false,
74		retinaSuffix: '@2x.$1',
75
76		// internationalization
77		current: "image {current} of {total}",
78		previous: "previous",
79		next: "next",
80		close: "close",
81		xhrError: "This content failed to load.",
82		imgError: "This image failed to load.",
83
84		// accessbility
85		returnFocus: true,
86		trapFocus: true,
87
88		// callbacks
89		onOpen: true,
90		onLoad: true,
91		onComplete: true,
92		onCleanup: true,
93		onClosed: true,
94
95		rel: function() {
96			return this.rel;
97		},
98		href: function() {
99			// using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container')
100			return $(this).attr('href');
101		},
102		title: function() {
103			return this.title;
104		},
105		createImg: function() {
106			var img = new Image();
107			var attrs = $(this).data('cbox-img-attrs');
108
109			if (typeof attrs === 'object') {
110				$.each(attrs, function(key, val){
111					img[key] = val;
112				});
113			}
114
115			return img;
116		},
117		createIframe: function() {
118			var iframe = document.createElement('iframe');
119			var attrs = $(this).data('cbox-iframe-attrs');
120
121			if (typeof attrs === 'object') {
122				$.each(attrs, function(key, val){
123					iframe[key] = val;
124				});
125			}
126
127			if ('frameBorder' in iframe) {
128				iframe.frameBorder = 0;
129			}
130			if ('allowTransparency' in iframe) {
131				iframe.allowTransparency = "true";
132			}
133			iframe.name = (new Date()).getTime(); // give the iframe a unique name to prevent caching
134			iframe.allowFullscreen = true;
135
136			return iframe;
137		}
138	},
139
140	// Abstracting the HTML and event identifiers for easy rebranding
141	colorbox = 'colorbox',
142	prefix = 'cbox',
143	boxElement = prefix + 'Element',
144
145	// Events
146	event_open = prefix + '_open',
147	event_load = prefix + '_load',
148	event_complete = prefix + '_complete',
149	event_cleanup = prefix + '_cleanup',
150	event_closed = prefix + '_closed',
151	event_purge = prefix + '_purge',
152
153	// Cached jQuery Object Variables
154	$overlay,
155	$box,
156	$wrap,
157	$content,
158	$topBorder,
159	$leftBorder,
160	$rightBorder,
161	$bottomBorder,
162	$related,
163	$window,
164	$loaded,
165	$loadingBay,
166	$loadingOverlay,
167	$title,
168	$current,
169	$slideshow,
170	$next,
171	$prev,
172	$close,
173	$groupControls,
174	$events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2
175
176	// Variables for cached values or use across multiple functions
177	settings,
178	interfaceHeight,
179	interfaceWidth,
180	loadedHeight,
181	loadedWidth,
182	index,
183	photo,
184	open,
185	active,
186	closing,
187	loadingTimer,
188	publicMethod,
189	div = "div",
190	requests = 0,
191	previousCSS = {},
192	init;
193
194	// ****************
195	// HELPER FUNCTIONS
196	// ****************
197
198	// Convenience function for creating new jQuery objects
199	function $tag(tag, id, css) {
200		var element = document.createElement(tag);
201
202		if (id) {
vendor: 9,840 bytes, lines 203-560
203			element.id = prefix + id;
204		}
205
206		if (css) {
207			element.style.cssText = css;
208		}
209
210		return $(element);
211	}
212
213	// Get the window height using innerHeight when available to avoid an issue with iOS
214	// http://bugs.jquery.com/ticket/6724
215	function winheight() {
216		return window.innerHeight ? window.innerHeight : $(window).height();
217	}
218
219	function Settings(element, options) {
220		if (options !== Object(options)) {
221			options = {};
222		}
223
224		this.cache = {};
225		this.el = element;
226
227		this.value = function(key) {
228			var dataAttr;
229
230			if (this.cache[key] === undefined) {
231				dataAttr = $(this.el).attr('data-cbox-'+key);
232
233				if (dataAttr !== undefined) {
234					this.cache[key] = dataAttr;
235				} else if (options[key] !== undefined) {
236					this.cache[key] = options[key];
237				} else if (defaults[key] !== undefined) {
238					this.cache[key] = defaults[key];
239				}
240			}
241
242			return this.cache[key];
243		};
244
245		this.get = function(key) {
246			var value = this.value(key);
247			return $.isFunction(value) ? value.call(this.el, this) : value;
248		};
249	}
250
251	// Determine the next and previous members in a group.
252	function getIndex(increment) {
253		var
254		max = $related.length,
255		newIndex = (index + increment) % max;
256
257		return (newIndex < 0) ? max + newIndex : newIndex;
258	}
259
260	// Convert '%' and 'px' values to integers
261	function setSize(size, dimension) {
262		return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
263	}
264
265	// Checks an href to see if it is a photo.
266	// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
267	function isImage(settings, url) {
268		return settings.get('photo') || settings.get('photoRegex').test(url);
269	}
270
271	function retinaUrl(settings, url) {
272		return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
273	}
274
275	function trapFocus(e) {
276		if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
277			e.stopPropagation();
278			$box.focus();
279		}
280	}
281
282	function setClass(str) {
283		if (setClass.str !== str) {
284			$box.add($overlay).removeClass(setClass.str).addClass(str);
285			setClass.str = str;
286		}
287	}
288
289	function getRelated(rel) {
290		index = 0;
291
292		if (rel && rel !== false && rel !== 'nofollow') {
293			$related = $('.' + boxElement).filter(function () {
294				var options = $.data(this, colorbox);
295				var settings = new Settings(this, options);
296				return (settings.get('rel') === rel);
297			});
298			index = $related.index(settings.el);
299
300			// Check direct calls to Colorbox.
301			if (index === -1) {
302				$related = $related.add(settings.el);
303				index = $related.length - 1;
304			}
305		} else {
306			$related = $(settings.el);
307		}
308	}
309
310	function trigger(event) {
311		// for external use
312		$(document).trigger(event);
313		// for internal use
314		$events.triggerHandler(event);
315	}
316
317	var slideshow = (function(){
318		var active,
319			className = prefix + "Slideshow_",
320			click = "click." + prefix,
321			timeOut;
322
323		function clear () {
324			clearTimeout(timeOut);
325		}
326
327		function set() {
328			if (settings.get('loop') || $related[index + 1]) {
329				clear();
330				timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
331			}
332		}
333
334		function start() {
335			$slideshow
336				.html(settings.get('slideshowStop'))
337				.unbind(click)
338				.one(click, stop);
339
340			$events
341				.bind(event_complete, set)
342				.bind(event_load, clear);
343
344			$box.removeClass(className + "off").addClass(className + "on");
345		}
346
347		function stop() {
348			clear();
349
350			$events
351				.unbind(event_complete, set)
352				.unbind(event_load, clear);
353
354			$slideshow
355				.html(settings.get('slideshowStart'))
356				.unbind(click)
357				.one(click, function () {
358					publicMethod.next();
359					start();
360				});
361
362			$box.removeClass(className + "on").addClass(className + "off");
363		}
364
365		function reset() {
366			active = false;
367			$slideshow.hide();
368			clear();
369			$events
370				.unbind(event_complete, set)
371				.unbind(event_load, clear);
372			$box.removeClass(className + "off " + className + "on");
373		}
374
375		return function(){
376			if (active) {
377				if (!settings.get('slideshow')) {
378					$events.unbind(event_cleanup, reset);
379					reset();
380				}
381			} else {
382				if (settings.get('slideshow') && $related[1]) {
383					active = true;
384					$events.one(event_cleanup, reset);
385					if (settings.get('slideshowAuto')) {
386						start();
387					} else {
388						stop();
389					}
390					$slideshow.show();
391				}
392			}
393		};
394
395	}());
396
397
398	function launch(element) {
399		var options;
400
401		if (!closing) {
402
403			options = $(element).data(colorbox);
404
405			settings = new Settings(element, options);
406
407			getRelated(settings.get('rel'));
408
409			if (!open) {
410				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
411
412				setClass(settings.get('className'));
413
414				// Show colorbox so the sizes can be calculated in older versions of jQuery
415				$box.css({visibility:'hidden', display:'block', opacity:''});
416
417				$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
418				$content.css({width:'', height:''}).append($loaded);
419
420				// Cache values needed for size calculations
421				interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
422				interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
423				loadedHeight = $loaded.outerHeight(true);
424				loadedWidth = $loaded.outerWidth(true);
425
426				// Opens inital empty Colorbox prior to content being loaded.
427				var initialWidth = setSize(settings.get('initialWidth'), 'x');
428				var initialHeight = setSize(settings.get('initialHeight'), 'y');
429				var maxWidth = settings.get('maxWidth');
430				var maxHeight = settings.get('maxHeight');
431
432				settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0);
433				settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0);
434
435				$loaded.css({width:'', height:settings.h});
436				publicMethod.position();
437
438				trigger(event_open);
439				settings.get('onOpen');
440
441				$groupControls.add($title).hide();
442
443				$box.focus();
444
445				if (settings.get('trapFocus')) {
446					// Confine focus to the modal
447					// Uses event capturing that is not supported in IE8-
448					if (document.addEventListener) {
449
450						document.addEventListener('focus', trapFocus, true);
451
452						$events.one(event_closed, function () {
453							document.removeEventListener('focus', trapFocus, true);
454						});
455					}
456				}
457
458				// Return focus on closing
459				if (settings.get('returnFocus')) {
460					$events.one(event_closed, function () {
461						$(settings.el).focus();
462					});
463				}
464			}
465
466			var opacity = parseFloat(settings.get('opacity'));
467			$overlay.css({
468				opacity: opacity === opacity ? opacity : '',
469				cursor: settings.get('overlayClose') ? 'pointer' : '',
470				visibility: 'visible'
471			}).show();
472
473			if (settings.get('closeButton')) {
474				$close.html(settings.get('close')).appendTo($content);
475			} else {
476				$close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
477			}
478
479			load();
480		}
481	}
482
483	// Colorbox's markup needs to be added to the DOM prior to being called
484	// so that the browser will go ahead and load the CSS background images.
485	function appendHTML() {
486		if (!$box) {
487			init = false;
488			$window = $(window);
489			$box = $tag(div).attr({
490				id: colorbox,
491				'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
492				role: 'dialog',
493				tabindex: '-1'
494			}).hide();
495			$overlay = $tag(div, "Overlay").hide();
496			$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
497			$wrap = $tag(div, "Wrapper");
498			$content = $tag(div, "Content").append(
499				$title = $tag(div, "Title"),
500				$current = $tag(div, "Current"),
501				$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
502				$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
503				$slideshow = $tag('button', "Slideshow"),
504				$loadingOverlay
505			);
506
507			$close = $('<button type="button"/>').attr({id:prefix+'Close'});
508
509			$wrap.append( // The 3x3 Grid that makes up Colorbox
510				$tag(div).append(
511					$tag(div, "TopLeft"),
512					$topBorder = $tag(div, "TopCenter"),
513					$tag(div, "TopRight")
514				),
515				$tag(div, false, 'clear:left').append(
516					$leftBorder = $tag(div, "MiddleLeft"),
517					$content,
518					$rightBorder = $tag(div, "MiddleRight")
519				),
520				$tag(div, false, 'clear:left').append(
521					$tag(div, "BottomLeft"),
522					$bottomBorder = $tag(div, "BottomCenter"),
523					$tag(div, "BottomRight")
524				)
525			).find('div div').css({'float': 'left'});
526
527			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
528
529			$groupControls = $next.add($prev).add($current).add($slideshow);
530		}
531		if (document.body && !$box.parent().length) {
532			$(document.body).append($overlay, $box.append($wrap, $loadingBay));
533		}
534	}
535
536	// Add Colorbox's event bindings
537	function addBindings() {
538		function clickHandler(e) {
539			// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
540			// See: http://jacklmoore.com/notes/click-events/
541			if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
542				e.preventDefault();
543				launch(this);
544			}
545		}
546
547		if ($box) {
548			if (!init) {
549				init = true;
550
551				// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
552				$next.click(function () {
553					publicMethod.next();
554				});
555				$prev.click(function () {
556					publicMethod.prev();
557				});
558				$close.click(function () {
559					publicMethod.close();
560					$('body').css('overflow',''
vendor: 11,250 bytes, lines 560-970
560);
561				});
562				$overlay.click(function () {
563					if (settings.get('overlayClose')) {
564						publicMethod.close();
565					}
566				});
567
568				// Key Bindings
569				$(document).bind('keydown.' + prefix, function (e) {
570					var key = e.keyCode;
571					if (open && settings.get('escKey') && key === 27) {
572						e.preventDefault();
573						publicMethod.close();
574					}
575					if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
576						if (key === 37) {
577							e.preventDefault();
578							$prev.click();
579						} else if (key === 39) {
580							e.preventDefault();
581							$next.click();
582						}
583					}
584				});
585
586				if ($.isFunction($.fn.on)) {
587					// For jQuery 1.7+
588					$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
589				} else {
590					// For jQuery 1.3.x -> 1.6.x
591					// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
592					// This is not here for jQuery 1.9, it's here for legacy users.
593					$('.'+boxElement).live('click.'+prefix, clickHandler);
594				}
595			}
596			return true;
597		}
598		return false;
599	}
600
601	// Don't do anything if Colorbox already exists.
602	if ($[colorbox]) {
603		return;
604	}
605
606	// Append the HTML when the DOM loads
607	$(appendHTML);
608
609
610	// ****************
611	// PUBLIC FUNCTIONS
612	// Usage format: $.colorbox.close();
613	// Usage from within an iframe: parent.jQuery.colorbox.close();
614	// ****************
615
616	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
617		var settings;
618		var $obj = this;
619
620		options = options || {};
621
622		if ($.isFunction($obj)) { // assume a call to $.colorbox
623			$obj = $('<a/>');
624			options.open = true;
625		}
626
627		if (!$obj[0]) { // colorbox being applied to empty collection
628			return $obj;
629		}
630
631		appendHTML();
632
633		if (addBindings()) {
634
635			if (callback) {
636				options.onComplete = callback;
637			}
638
639			$obj.each(function () {
640				var old = $.data(this, colorbox) || {};
641				$.data(this, colorbox, $.extend(old, options));
642			}).addClass(boxElement);
643
644			settings = new Settings($obj[0], options);
645
646			if (settings.get('open')) {
647				launch($obj[0]);
648			}
649		}
650
651		return $obj;
652	};
653
654	publicMethod.position = function (speed, loadedCallback) {
655		var
656		css,
657		top = 0,
658		left = 0,
659		offset = $box.offset(),
660		scrollTop,
661		scrollLeft;
662
663		$window.unbind('resize.' + prefix);
664
665		// remove the modal so that it doesn't influence the document width/height
666		$box.css({top: -9e4, left: -9e4});
667
668		scrollTop = $window.scrollTop();
669		scrollLeft = $window.scrollLeft();
670
671		if (settings.get('fixed')) {
672			offset.top -= scrollTop;
673			offset.left -= scrollLeft;
674			$box.css({position: 'fixed'});
675		} else {
676			top = scrollTop;
677			left = scrollLeft;
678			$box.css({position: 'absolute'});
679		}
680
681		// keeps the top and left positions within the browser's viewport.
682		if (settings.get('right') !== false) {
683			left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
684		} else if (settings.get('left') !== false) {
685			left += setSize(settings.get('left'), 'x');
686		} else {
687			left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
688		}
689
690		if (settings.get('bottom') !== false) {
691			top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
692		} else if (settings.get('top') !== false) {
693			top += setSize(settings.get('top'), 'y');
694		} else {
695			top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
696		}
697
698		$box.css({top: offset.top, left: offset.left, visibility:'visible'});
699
700		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
701		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
702		// it can invoke an obscure IE bug when using iframes.
703		$wrap[0].style.width = $wrap[0].style.height = "9999px";
704
705		function modalDimensions() {
706			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
707			$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
708		}
709
710		css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
711
712		// setting the speed to 0 if the content hasn't changed size or position
713		if (speed) {
714			var tempSpeed = 0;
715			$.each(css, function(i){
716				if (css[i] !== previousCSS[i]) {
717					tempSpeed = speed;
718					return;
719				}
720			});
721			speed = tempSpeed;
722		}
723
724		previousCSS = css;
725
726		if (!speed) {
727			$box.css(css);
728		}
729
730		$box.dequeue().animate(css, {
731			duration: speed || 0,
732			complete: function () {
733				modalDimensions();
734
735				active = false;
736
737				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
738				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
739				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
740
741				if (settings.get('reposition')) {
742					setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
743						$window.bind('resize.' + prefix, publicMethod.position);
744					}, 1);
745				}
746
747				if ($.isFunction(loadedCallback)) {
748					loadedCallback();
749				}
750			},
751			step: modalDimensions
752		});
753	};
754
755	publicMethod.resize = function (options) {
756		var scrolltop;
757
758		if (open) {
759			options = options || {};
760
761			if (options.width) {
762				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
763			}
764
765			if (options.innerWidth) {
766				settings.w = setSize(options.innerWidth, 'x');
767			}
768
769			$loaded.css({width: settings.w});
770
771			if (options.height) {
772				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
773			}
774
775			if (options.innerHeight) {
776				settings.h = setSize(options.innerHeight, 'y');
777			}
778
779			if (!options.innerHeight && !options.height) {
780				scrolltop = $loaded.scrollTop();
781				$loaded.css({height: "auto"});
782				settings.h = $loaded.height();
783			}
784
785			$loaded.css({height: settings.h});
786
787			if(scrolltop) {
788				$loaded.scrollTop(scrolltop);
789			}
790
791			publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
792		}
793	};
794
795	publicMethod.prep = function (object) {
796		if (!open) {
797			return;
798		}
799
800		var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
801
802		$loaded.remove();
803
804		$loaded = $tag(div, 'LoadedContent').append(object);
805
806		function getWidth() {
807			settings.w = settings.w || $loaded.width();
808			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
809			return settings.w;
810		}
811		function getHeight() {
812			settings.h = settings.h || $loaded.height();
813			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
814			return settings.h;
815		}
816
817		$loaded.hide()
818		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
819		.css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
820		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
821		.prependTo($content);
822
823		$loadingBay.hide();
824
825		// 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.
826
827		$(photo).css({'float': 'none'});
828
829		setClass(settings.get('className'));
830
831		callback = function () {
832			var total = $related.length,
833				iframe,
834				complete;
835
836			if (!open) {
837				return;
838			}
839
840			function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
841				if ($.support.opacity === false) {
842					$box[0].style.removeAttribute('filter');
843				}
844			}
845
846			complete = function () {
847				clearTimeout(loadingTimer);
848				$loadingOverlay.hide();
849				trigger(event_complete);
850				settings.get('onComplete');
851			};
852
853
854			$title.html(settings.get('title')).show();
855			$loaded.show();
856
857			if (total > 1) { // handle grouping
858				if (typeof settings.get('current') === "string") {
859					$current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
860				}
861
862				$next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
863				$prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
864
865				slideshow();
866
867				// Preloads images within a rel group
868				if (settings.get('preloading')) {
869					$.each([getIndex(-1), getIndex(1)], function(){
870						var img,
871							i = $related[this],
872							settings = new Settings(i, $.data(i, colorbox)),
873							src = settings.get('href');
874
875						if (src && isImage(settings, src)) {
876							src = retinaUrl(settings, src);
877							img = document.createElement('img');
878							img.src = src;
879						}
880					});
881				}
882			} else {
883				$groupControls.hide();
884			}
885
886			if (settings.get('iframe')) {
887
888				iframe = settings.get('createIframe');
889
890				if (!settings.get('scrolling')) {
891					iframe.scrolling = "no";
892				}
893
894				$(iframe)
895					.attr({
896						src: settings.get('href'),
897						'class': prefix + 'Iframe'
898					})
899					.one('load', complete)
900					.appendTo($loaded);
901
902				$events.one(event_purge, function () {
903					iframe.src = "//about:blank";
904				});
905
906				if (settings.get('fastIframe')) {
907					$(iframe).trigger('load');
908				}
909			} else {
910				complete();
911			}
912
913			if (settings.get('transition') === 'fade') {
914				$box.fadeTo(speed, 1, removeFilter);
915			} else {
916				removeFilter();
917			}
918		};
919
920		if (settings.get('transition') === 'fade') {
921			$box.fadeTo(speed, 0, function () {
922				publicMethod.position(0, callback);
923			});
924		} else {
925			publicMethod.position(speed, callback);
926		}
927	};
928
929	function load () {
930		var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
931
932		active = true;
933
934		photo = false;
935
936		trigger(event_purge);
937		trigger(event_load);
938		settings.get('onLoad');
939
940		settings.h = settings.get('height') ?
941				setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
942				settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
943
944		settings.w = settings.get('width') ?
945				setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
946				settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
947
948		// Sets the minimum dimensions for use in image scaling
949		settings.mw = settings.w;
950		settings.mh = settings.h;
951
952		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
953		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
954		if (settings.get('maxWidth')) {
955			settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
956			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
957		}
958		if (settings.get('maxHeight')) {
959			settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
960			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
961		}
962
963		href = settings.get('href');
964
965		loadingTimer = setTimeout(function () {
966			$loadingOverlay.show();
967		}, 100);
968
969		if (settings.get('inline')) {
970			var $target = $(href)
vendor: 4,231 bytes, lines 970-1122
970;
971			// Inserts an empty placeholder where inline content is being pulled from.
972			// An event is bound to put inline content back when Colorbox closes or loads new content.
973			$inline = $('<div>').hide().insertBefore($target);
974
975			$events.one(event_purge, function () {
976				$inline.replaceWith($target);
977			});
978
979			prep($target);
980		} else if (settings.get('iframe')) {
981			// IFrame element won't be added to the DOM until it is ready to be displayed,
982			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
983			prep(" ");
984		} else if (settings.get('html')) {
985			prep(settings.get('html'));
986		} else if (isImage(settings, href)) {
987
988			href = retinaUrl(settings, href);
989
990			photo = settings.get('createImg');
991
992			$(photo)
993			.addClass(prefix + 'Photo')
994			.bind('error.'+prefix,function () {
995				prep($tag(div, 'Error').html(settings.get('imgError')));
996			})
997			.one('load', function () {
998				if (request !== requests) {
999					return;
1000				}
1001
1002				// A small pause because some browsers will occassionaly report a
1003				// img.width and img.height of zero immediately after the img.onload fires
1004				setTimeout(function(){
1005					var percent;
1006
1007					if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
1008						photo.height = photo.height / window.devicePixelRatio;
1009						photo.width = photo.width / window.devicePixelRatio;
1010					}
1011
1012					if (settings.get('scalePhotos')) {
1013						setResize = function () {
1014							photo.height -= photo.height * percent;
1015							photo.width -= photo.width * percent;
1016						};
1017						if (settings.mw && photo.width > settings.mw) {
1018							percent = (photo.width - settings.mw) / photo.width;
1019							setResize();
1020						}
1021						if (settings.mh && photo.height > settings.mh) {
1022							percent = (photo.height - settings.mh) / photo.height;
1023							setResize();
1024						}
1025					}
1026
1027					if (settings.h) {
1028						photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
1029					}
1030
1031					if ($related[1] && (settings.get('loop') || $related[index + 1])) {
1032						photo.style.cursor = 'pointer';
1033
1034						$(photo).bind('click.'+prefix, function () {
1035							publicMethod.next();
1036						});
1037					}
1038
1039					photo.style.width = photo.width + 'px';
1040					photo.style.height = photo.height + 'px';
1041					prep(photo);
1042				}, 1);
1043			});
1044
1045			photo.src = href;
1046
1047		} else if (href) {
1048			$loadingBay.load(href, settings.get('data'), function (data, status) {
1049				if (request === requests) {
1050					prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
1051				}
1052			});
1053		}
1054	}
1055
1056	// Navigates to the next page/image in a set.
1057	publicMethod.next = function () {
1058		if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
1059			index = getIndex(1);
1060			launch($related[index]);
1061		}
1062	};
1063
1064	publicMethod.prev = function () {
1065		if (!active && $related[1] && (settings.get('loop') || index)) {
1066			index = getIndex(-1);
1067			launch($related[index]);
1068		}
1069	};
1070
1071	// Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
1072	publicMethod.close = function () {
1073		if (open && !closing) {
1074
1075			closing = true;
1076			open = false;
1077			trigger(event_cleanup);
1078			settings.get('onCleanup');
1079			$window.unbind('.' + prefix);
1080			$overlay.fadeTo(settings.get('fadeOut') || 0, 0);
1081
1082			$box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
1083				$box.hide();
1084				$overlay.hide();
1085				trigger(event_purge);
1086				$loaded.remove();
1087
1088				setTimeout(function () {
1089					closing = false;
1090					trigger(event_closed);
1091					settings.get('onClosed');
1092				}, 1);
1093			});
1094		}
1095	};
1096
1097	// Removes changes Colorbox made to the document, but does not remove the plugin.
1098	publicMethod.remove = function () {
1099		if (!$box) { return; }
1100
1101		$box.stop();
1102		$[colorbox].close();
1103		$box.stop(false, true).remove();
1104		$overlay.remove();
1105		closing = false;
1106		$box = null;
1107		$('.' + boxElement)
1108			.removeData(colorbox)
1109			.removeClass(boxElement);
1110
1111		$(document).unbind('click.'+prefix).unbind('keydown.'+prefix);
1112	};
1113
1114	// A method for fetching the current element Colorbox is referencing.
1115	// returns a jQuery object.
1116	publicMethod.element = function () {
1117		return $(settings.el);
1118	};
1119
1120	publicMethod.settings = defaults;
1121
1122}(jQuery, document, window));

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.