: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
http://www.jacklmoore.com/colorbox
(function ($, document, window) {
// Default settings object.
// See http://jacklmoore.com/colorbox for details.
// behavior and appearance
slideshowStart: "start slideshow",
slideshowStop: "stop slideshow",
photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
// alternate image paths for high-res displays
current: "image {current} of {total}",
xhrError: "This content failed to load.",
imgError: "This image failed to load.",
// using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container')
return $(this).attr('href');
var attrs = $(this).data('cbox-img-attrs');
if (typeof attrs === 'object') {
$.each(attrs, function(key, val){
createIframe: function() {
var iframe = document.createElement('iframe');
var attrs = $(this).data('cbox-iframe-attrs');
if (typeof attrs === 'object') {
$.each(attrs, function(key, val){
if ('frameBorder' in iframe) {
if ('allowTransparency' in iframe) {
iframe.allowTransparency = "true";
iframe.name = (new Date()).getTime(); // give the iframe a unique name to prevent caching
iframe.allowFullscreen = true;
// Abstracting the HTML and event identifiers for easy rebranding
colorbox = 'wflscolorbox',
boxElement = prefix + 'Element',
event_open = prefix + '_open',
event_load = prefix + '_load',
event_complete = prefix + '_complete',
event_cleanup = prefix + '_cleanup',
event_closed = prefix + '_closed',
event_purge = prefix + '_purge',
// Cached jQuery Object Variables
$events = $('<a/>'), // $({}) would be preferred, but there is an issue with jQuery 1.4.2
// Variables for cached values or use across multiple functions
// Convenience function for creating new jQuery objects
function $tag(tag, id, css) {
var element = document.createElement(tag);
element.id = prefix + id;
element.style.cssText = css;
// Get the window height using innerHeight when available to avoid an issue with iOS
// http://bugs.jquery.com/ticket/6724
return window.innerHeight ? window.innerHeight : $(window).height();
function Settings(element, options) {
if (options !== Object(options)) {
this.value = function(key) {
if (this.cache[key] === undefined) {
dataAttr = $(this.el).attr('data-cbox-'+key);
if (dataAttr !== undefined) {
this.cache[key] = dataAttr;
} else if (options[key] !== undefined) {
this.cache[key] = options[key];
} else if (defaults[key] !== undefined) {
this.cache[key] = defaults[key];
this.get = function(key) {
var value = this.value(key);
return $.isFunction(value) ? value.call(this.el, this) : value;
// Determine the next and previous members in a group.
function getIndex(increment) {
newIndex = (index + increment) % max;
return (newIndex < 0) ? max + newIndex : newIndex;
// Convert '%' and 'px' values to integers
function setSize(size, dimension) {
return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
// Checks an href to see if it is a photo.
// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
function isImage(settings, url) {
return settings.get('photo') || settings.get('photoRegex').test(url);
function retinaUrl(settings, url) {
return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
if (setClass.str !== str) {
$box.add($overlay).removeClass(setClass.str).addClass(str);
function getRelated(rel) {
if (rel && rel !== false && rel !== 'nofollow') {
$related = $('.' + boxElement).filter(function () {
var options = $.data(this, colorbox);
var settings = new Settings(this, options);
return (settings.get('rel') === rel);
index = $related.index(settings.el);
// Check direct calls to Colorbox.
$related = $related.add(settings.el);
index = $related.length - 1;
$related = $(settings.el);
function trigger(event) {
$(document).trigger(event);
$events.triggerHandler(event);
var slideshow = (function(){
className = prefix + "Slideshow_",
click = "click." + prefix,
if (settings.get('loop') || $related[index + 1]) {
timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
.html(settings.get('slideshowStop'))
.bind(event_complete, set)
.bind(event_load, clear);
$box.removeClass(className + "off").addClass(className + "on");
.unbind(event_complete, set)
.unbind(event_load, clear);
.html(settings.get('slideshowStart'))
.one(click, function () {
$box.removeClass(className + "on").addClass(className + "off");
.unbind(event_complete, set)
.unbind(event_load, clear);
$box.removeClass(className + "off " + className + "on");
if (!settings.get('slideshow')) {
$events.unbind(event_cleanup, reset);
if (settings.get('slideshow') && $related[1]) {
$events.one(event_cleanup, reset);
if (settings.get('slideshowAuto')) {
function launch(element) {
options = $(element).data(colorbox);
settings = new Settings(element, options);
getRelated(settings.get('rel'));
open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
setClass(settings.get('className'));
// Show colorbox so the sizes can be calculated in older versions of jQuery
$box.css({visibility:'hidden', display:'block', opacity:''});
$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
$content.css({width:'', height:''}).append($loaded);
// Cache values needed for size calculations
interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
loadedHeight = $loaded.outerHeight(true);
loadedWidth = $loaded.outerWidth(true);
// Opens inital empty Colorbox prior to content being loaded.
var initialWidth = setSize(settings.get('initialWidth'), 'x');
var initialHeight = setSize(settings.get('initialHeight'), 'y');
var maxWidth = settings.get('maxWidth');
var maxHeight = settings.get('maxHeight');
settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0);
settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0);
$loaded.css({width:'', height:settings.h});
$groupControls.add($title).hide();
if (settings.get('trapFocus')) {
// Confine focus to the modal
// Uses event capturing that is not supported in IE8-
if (document.addEventListener) {
document.addEventListener('focus', trapFocus, true);
$events.one(event_closed, function () {
document.removeEventListener('focus', trapFocus, true);
// Return focus on closing
if (settings.get('returnFocus')) {
$events.one(event_closed, function () {
var opacity = parseFloat(settings.get('opacity'));
opacity: opacity === opacity ? opacity : '',
cursor: settings.get('overlayClose') ? 'pointer' : '',
if (settings.get('closeButton')) {
$close.html(settings.get('close')).appendTo($content);
$close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
// Colorbox's markup needs to be added to the DOM prior to being called
// so that the browser will go ahead and load the CSS background images.
'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
$overlay = $tag(div, "Overlay").hide();
$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
$wrap = $tag(div, "Wrapper");
$content = $tag(div, "Content").append(
$title = $tag(div, "Title"),
$current = $tag(div, "Current"),
$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
$slideshow = $('<button type="button"/>').attr({id:prefix+'Slideshow'}),
$close = $('<button type="button"/>').attr({id:prefix+'Close'});
$wrap.append( // The 3x3 Grid that makes up Colorbox
$topBorder = $tag(div, "TopCenter"),
$tag(div, false, 'clear:left').append(
$leftBorder = $tag(div, "MiddleLeft"),