/* Minification failed. Returning unminified contents. (6517,547-554): run-time error JS1019: Can't have 'break' outside of loop: break a (6039,472-479): run-time error JS1019: Can't have 'break' outside of loop: break a */ /* Uniform v2.1.2 Copyright � 2009 Josh Pyles / Pixelmatrix Design LLC http://pixelmatrixdesign.com Requires jQuery 1.3 or newer Much thanks to Thomas Reynolds and Buck Wilson for their help and advice on this. Disabling text selection is made possible by Mathias Bynens and his noSelect plugin. , which is embedded. Also, thanks to David Kaneda and Eugene Bond for their contributions to the plugin. Tyler Akins has also rewritten chunks of the plugin, helped close many issues, and ensured version 2 got out the door. License: MIT License - http://www.opensource.org/licenses/mit-license.php Enjoy! */ /*global jQuery, document, navigator*/ (function (wind, $, undef) { "use strict"; /** * Use .prop() if jQuery supports it, otherwise fall back to .attr() * * @param jQuery $el jQuery'd element on which we're calling attr/prop * @param ... All other parameters are passed to jQuery's function * @return The result from jQuery */ function attrOrProp($el) { var args = Array.prototype.slice.call(arguments, 1); if ($el.prop) { // jQuery 1.6+ return $el.prop.apply($el, args); } // jQuery 1.5 and below return $el.attr.apply($el, args); } /** * For backwards compatibility with older jQuery libraries, only bind * one thing at a time. Also, this function adds our namespace to * events in one consistent location, shrinking the minified code. * * The properties on the events object are the names of the events * that we are supposed to add to. It can be a space separated list. * The namespace will be added automatically. * * @param jQuery $el * @param Object options Uniform options for this element * @param Object events Events to bind, properties are event names */ function bindMany($el, options, events) { var name, namespaced; for (name in events) { if (events.hasOwnProperty(name)) { namespaced = name.replace(/ |$/g, options.eventNamespace); $el.bind(namespaced, events[name]); } } } /** * Bind the hover, active, focus, and blur UI updates * * @param jQuery $el Original element * @param jQuery $target Target for the events (our div/span) * @param Object options Uniform options for the element $target */ function bindUi($el, $target, options) { bindMany($el, options, { focus: function () { $target.addClass(options.focusClass); }, blur: function () { $target.removeClass(options.focusClass); $target.removeClass(options.activeClass); }, mouseenter: function () { $target.addClass(options.hoverClass); }, mouseleave: function () { $target.removeClass(options.hoverClass); $target.removeClass(options.activeClass); }, "mousedown touchbegin": function () { if (!$el.is(":disabled")) { $target.addClass(options.activeClass); } }, "mouseup touchend": function () { $target.removeClass(options.activeClass); } }); } /** * Remove the hover, focus, active classes. * * @param jQuery $el Element with classes * @param Object options Uniform options for the element */ function classClearStandard($el, options) { $el.removeClass(options.hoverClass + " " + options.focusClass + " " + options.activeClass); } /** * Add or remove a class, depending on if it's "enabled" * * @param jQuery $el Element that has the class added/removed * @param String className Class or classes to add/remove * @param Boolean enabled True to add the class, false to remove */ function classUpdate($el, className, enabled) { if (enabled) { $el.addClass(className); } else { $el.removeClass(className); } } /** * Updating the "checked" property can be a little tricky. This * changed in jQuery 1.6 and now we can pass booleans to .prop(). * Prior to that, one either adds an attribute ("checked=checked") or * removes the attribute. * * @param jQuery $tag Our Uniform span/div * @param jQuery $el Original form element * @param Object options Uniform options for this element */ function classUpdateChecked($tag, $el, options) { var c = "checked", isChecked = $el.is(":" + c); if ($el.prop) { // jQuery 1.6+ $el.prop(c, isChecked); } else { // jQuery 1.5 and below if (isChecked) { $el.attr(c, c); } else { $el.removeAttr(c); } } classUpdate($tag, options.checkedClass, isChecked); } /** * Set or remove the "disabled" class for disabled elements, based on * if the element is detected to be disabled. * * @param jQuery $tag Our Uniform span/div * @param jQuery $el Original form element * @param Object options Uniform options for this element */ function classUpdateDisabled($tag, $el, options) { classUpdate($tag, options.disabledClass, $el.is(":disabled")); } /** * Wrap an element inside of a container or put the container next * to the element. See the code for examples of the different methods. * * Returns the container that was added to the HTML. * * @param jQuery $el Element to wrap * @param jQuery $container Add this new container around/near $el * @param String method One of "after", "before" or "wrap" * @return $container after it has been cloned for adding to $el */ function divSpanWrap($el, $container, method) { switch (method) { case "after": // Result: $el.after($container); return $el.next(); case "before": // Result: $el.before($container); return $el.prev(); case "wrap": // Result: $el.wrap($container); return $el.parent(); } return null; } /** * Create a div/span combo for uniforming an element * * @param jQuery $el Element to wrap * @param Object options Options for the element, set by the user * @param Object divSpanConfig Options for how we wrap the div/span * @return Object Contains the div and span as properties */ function divSpan($el, options, divSpanConfig) { var $div, $span, id; if (!divSpanConfig) { divSpanConfig = {}; } divSpanConfig = $.extend({ bind: {}, divClass: null, divWrap: "wrap", spanClass: null, spanHtml: null, spanWrap: "wrap" }, divSpanConfig); $div = $('
'); $span = $(''); // Automatically hide this div/span if the element is hidden. // Do not hide if the element is hidden because a parent is hidden. if (options.autoHide && $el.is(':hidden') && $el.css('display') === 'none') { $div.hide(); } if (divSpanConfig.divClass) { $div.addClass(divSpanConfig.divClass); } if (options.wrapperClass) { $div.addClass(options.wrapperClass); } if (divSpanConfig.spanClass) { $span.addClass(divSpanConfig.spanClass); } id = attrOrProp($el, 'id'); if (options.useID && id) { attrOrProp($div, 'id', options.idPrefix + '-' + id); } if (divSpanConfig.spanHtml) { $span.html(divSpanConfig.spanHtml); } $div = divSpanWrap($el, $div, divSpanConfig.divWrap); $span = divSpanWrap($el, $span, divSpanConfig.spanWrap); classUpdateDisabled($div, $el, options); return { div: $div, span: $span }; } /** * Wrap an element with a span to apply a global wrapper class * * @param jQuery $el Element to wrap * @param object options * @return jQuery Wrapper element */ function wrapWithWrapperClass($el, options) { var $span; if (!options.wrapperClass) { return null; } $span = $('').addClass(options.wrapperClass); $span = divSpanWrap($el, $span, "wrap"); return $span; } /** * Test if high contrast mode is enabled. * * In high contrast mode, background images can not be set and * they are always returned as 'none'. * * @return boolean True if in high contrast mode */ function highContrast() { var c, $div, el, rgb; // High contrast mode deals with white and black rgb = 'rgb(120,2,153)'; $div = $('
'); $('body').append($div); el = $div.get(0); // $div.css() will get the style definition, not // the actually displaying style if (wind.getComputedStyle) { c = wind.getComputedStyle(el, '').color; } else { c = (el.currentStyle || el.style || {}).color; } $div.remove(); return c.replace(/ /g, '') !== rgb; } /** * Change text into safe HTML * * @param String text * @return String HTML version */ function htmlify(text) { if (!text) { return ""; } return $('').text(text).html(); } /** * If not MSIE, return false. * If it is, return the version number. * * @return false|number */ function isMsie() { return navigator.cpuClass && !navigator.product; } /** * Return true if this version of IE allows styling * * @return boolean */ function isMsieSevenOrNewer() { if (wind.XMLHttpRequest !== undefined) { return true; } return false; } /** * Test if the element is a multiselect * * @param jQuery $el Element * @return boolean true/false */ function isMultiselect($el) { var elSize; if ($el[0].multiple) { return true; } elSize = attrOrProp($el, "size"); if (!elSize || elSize <= 1) { return false; } return true; } /** * Meaningless utility function. Used mostly for improving minification. * * @return false */ function returnFalse() { return false; } /** * noSelect plugin, very slightly modified * http://mths.be/noselect v1.0.3 * * @param jQuery $elem Element that we don't want to select * @param Object options Uniform options for the element */ function noSelect($elem, options) { var none = 'none'; bindMany($elem, options, { 'selectstart dragstart mousedown': returnFalse }); $elem.css({ MozUserSelect: none, msUserSelect: none, webkitUserSelect: none, userSelect: none }); } /** * Updates the filename tag based on the value of the real input * element. * * @param jQuery $el Actual form element * @param jQuery $filenameTag Span/div to update * @param Object options Uniform options for this element */ function setFilename($el, $filenameTag, options) { var filename = $el.val(); if (filename === "") { filename = options.fileDefaultHtml; } else { filename = filename.split(/[\/\\]+/); filename = filename[(filename.length - 1)]; } $filenameTag.text(filename); } /** * Function from jQuery to swap some CSS values, run a callback, * then restore the CSS. Modified to pass JSLint and handle undefined * values with 'use strict'. * * @param jQuery $el Element * @param object newCss CSS values to swap out * @param Function callback Function to run */ function swap($elements, newCss, callback) { var restore, item; restore = []; $elements.each(function () { var name; for (name in newCss) { if (Object.prototype.hasOwnProperty.call(newCss, name)) { restore.push({ el: this, name: name, old: this.style[name] }); this.style[name] = newCss[name]; } } }); callback(); while (restore.length) { item = restore.pop(); item.el.style[item.name] = item.old; } } /** * The browser doesn't provide sizes of elements that are not visible. * This will clone an element and add it to the DOM for calculations. * * @param jQuery $el * @param String method */ function sizingInvisible($el, callback) { var targets; // We wish to target ourselves and any parents as long as // they are not visible targets = $el.parents(); targets.push($el[0]); targets = targets.not(':visible'); swap(targets, { visibility: "hidden", display: "block", position: "absolute" }, callback); } /** * Standard way to unwrap the div/span combination from an element * * @param jQuery $el Element that we wish to preserve * @param Object options Uniform options for the element * @return Function This generated function will perform the given work */ function unwrapUnwrapUnbindFunction($el, options) { return function () { $el.unwrap().unwrap().unbind(options.eventNamespace); }; } var allowStyling = true, // False if IE6 or other unsupported browsers highContrastTest = false, // Was the high contrast test ran? uniformHandlers = [ // Objects that take care of "unification" { // Buttons match: function ($el) { return $el.is("a, button, :submit, :reset, input[type='button']"); }, apply: function ($el, options) { var $div, defaultSpanHtml, ds, getHtml, doingClickEvent; defaultSpanHtml = options.submitDefaultHtml; if ($el.is(":reset")) { defaultSpanHtml = options.resetDefaultHtml; } if ($el.is("a, button")) { // Use the HTML inside the tag getHtml = function () { return $el.html() || defaultSpanHtml; }; } else { // Use the value property of the element getHtml = function () { return htmlify(attrOrProp($el, "value")) || defaultSpanHtml; }; } ds = divSpan($el, options, { divClass: options.buttonClass, spanHtml: getHtml() }); $div = ds.div; bindUi($el, $div, options); doingClickEvent = false; bindMany($div, options, { "click touchend": function () { var ev, res, target, href; if (doingClickEvent) { return; } if ($el.is(':disabled')) { return; } doingClickEvent = true; if ($el[0].dispatchEvent) { ev = document.createEvent("MouseEvents"); ev.initEvent("click", true, true); res = $el[0].dispatchEvent(ev); if ($el.is('a') && res) { target = attrOrProp($el, 'target'); href = attrOrProp($el, 'href'); if (!target || target === '_self') { document.location.href = href; } else { wind.open(href, target); } } } else { $el.click(); } doingClickEvent = false; } }); noSelect($div, options); return { remove: function () { // Move $el out $div.after($el); // Remove div and span $div.remove(); // Unbind events $el.unbind(options.eventNamespace); return $el; }, update: function () { classClearStandard($div, options); classUpdateDisabled($div, $el, options); $el.detach(); ds.span.html(getHtml()).append($el); } }; } }, { // Checkboxes match: function ($el) { return $el.is(":checkbox"); }, apply: function ($el, options) { var ds, $div, $span; ds = divSpan($el, options, { divClass: options.checkboxClass }); $div = ds.div; $span = ds.span; // Add focus classes, toggling, active, etc. bindUi($el, $div, options); bindMany($el, options, { "click touchend": function () { classUpdateChecked($span, $el, options); } }); classUpdateChecked($span, $el, options); return { remove: unwrapUnwrapUnbindFunction($el, options), update: function () { classClearStandard($div, options); $span.removeClass(options.checkedClass); classUpdateChecked($span, $el, options); classUpdateDisabled($div, $el, options); } }; } }, { // File selection / uploads match: function ($el) { return $el.is(":file"); }, apply: function ($el, options) { var ds, $div, $filename, $button; // The "span" is the button ds = divSpan($el, options, { divClass: options.fileClass, spanClass: options.fileButtonClass, spanHtml: options.fileButtonHtml, spanWrap: "after" }); $div = ds.div; $button = ds.span; $filename = $("").html(options.fileDefaultHtml); $filename.addClass(options.filenameClass); $filename = divSpanWrap($el, $filename, "after"); // Set the size if (!attrOrProp($el, "size")) { attrOrProp($el, "size", $div.width() / 10); } // Actions function filenameUpdate() { setFilename($el, $filename, options); } bindUi($el, $div, options); // Account for input saved across refreshes filenameUpdate(); // IE7 doesn't fire onChange until blur or second fire. if (isMsie()) { // IE considers browser chrome blocking I/O, so it // suspends tiemouts until after the file has // been selected. bindMany($el, options, { click: function () { $el.trigger("change"); setTimeout(filenameUpdate, 0); } }); } else { // All other browsers behave properly bindMany($el, options, { change: filenameUpdate }); } noSelect($filename, options); noSelect($button, options); return { remove: function () { // Remove filename and button $filename.remove(); $button.remove(); // Unwrap parent div, remove events return $el.unwrap().unbind(options.eventNamespace); }, update: function () { classClearStandard($div, options); setFilename($el, $filename, options); classUpdateDisabled($div, $el, options); } }; } }, { // Input fields (text) match: function ($el) { if ($el.is("input")) { var t = (" " + attrOrProp($el, "type") + " ").toLowerCase(), allowed = " color date datetime datetime-local email month number password search tel text time url week "; return allowed.indexOf(t) >= 0; } return false; }, apply: function ($el, options) { var elType, $wrapper; elType = attrOrProp($el, "type"); $el.addClass(options.inputClass); $wrapper = wrapWithWrapperClass($el, options); bindUi($el, $el, options); if (options.inputAddTypeAsClass) { $el.addClass(elType); } return { remove: function () { $el.removeClass(options.inputClass); if (options.inputAddTypeAsClass) { $el.removeClass(elType); } if ($wrapper) { $el.unwrap(); } }, update: returnFalse }; } }, { // Radio buttons match: function ($el) { return $el.is(":radio"); }, apply: function ($el, options) { var ds, $div, $span; ds = divSpan($el, options, { divClass: options.radioClass }); $div = ds.div; $span = ds.span; // Add classes for focus, handle active, checked bindUi($el, $div, options); bindMany($el, options, { "click touchend": function () { // Find all radios with the same name, then update // them with $.uniform.update() so the right // per-element options are used $.uniform.update($(':radio[name="' + attrOrProp($el, "name") + '"]')); } }); classUpdateChecked($span, $el, options); return { remove: unwrapUnwrapUnbindFunction($el, options), update: function () { classClearStandard($div, options); classUpdateChecked($span, $el, options); classUpdateDisabled($div, $el, options); } }; } }, { // Select lists, but do not style multiselects here match: function ($el) { if ($el.is("select") && !isMultiselect($el)) { return true; } return false; }, apply: function ($el, options) { var ds, $div, $span, origElemWidth; if (options.selectAutoWidth) { sizingInvisible($el, function () { origElemWidth = $el.width(); }); } ds = divSpan($el, options, { divClass: options.selectClass, spanHtml: ($el.find(":selected:first") || $el.find("option:first")).html(), spanWrap: "before" }); $div = ds.div; $span = ds.span; if (options.selectAutoWidth) { // Use the width of the select and adjust the // span and div accordingly sizingInvisible($el, function () { // Force "display: block" - related to bug #287 swap($([$span[0], $div[0]]), { display: "block" }, function () { var spanPad; spanPad = $span.outerWidth() - $span.width(); $div.width(origElemWidth + spanPad); $span.width(origElemWidth); }); }); } else { // Force the select to fill the size of the div $div.addClass('fixedWidth'); } // Take care of events bindUi($el, $div, options); bindMany($el, options, { change: function () { $span.html($el.find(":selected").html()); $div.removeClass(options.activeClass); }, "click touchend": function () { // IE7 and IE8 may not update the value right // until after click event - issue #238 var selHtml = $el.find(":selected").html(); if ($span.html() !== selHtml) { // Change was detected // Fire the change event on the select tag $el.trigger('change'); } }, keyup: function () { $span.html($el.find(":selected").html()); } }); noSelect($span, options); return { remove: function () { // Remove sibling span $span.remove(); // Unwrap parent div $el.unwrap().unbind(options.eventNamespace); return $el; }, update: function () { if (options.selectAutoWidth) { // Easier to remove and reapply formatting $.uniform.restore($el); $el.uniform(options); } else { classClearStandard($div, options); // Reset current selected text $span.html($el.find(":selected").html()); classUpdateDisabled($div, $el, options); } } }; } }, { // Select lists - multiselect lists only match: function ($el) { if ($el.is("select") && isMultiselect($el)) { return true; } return false; }, apply: function ($el, options) { var $wrapper; $el.addClass(options.selectMultiClass); $wrapper = wrapWithWrapperClass($el, options); bindUi($el, $el, options); return { remove: function () { $el.removeClass(options.selectMultiClass); if ($wrapper) { $el.unwrap(); } }, update: returnFalse }; } }, { // Textareas match: function ($el) { return $el.is("textarea"); }, apply: function ($el, options) { var $wrapper; $el.addClass(options.textareaClass); $wrapper = wrapWithWrapperClass($el, options); bindUi($el, $el, options); return { remove: function () { $el.removeClass(options.textareaClass); if ($wrapper) { $el.unwrap(); } }, update: returnFalse }; } } ]; // IE6 can't be styled - can't set opacity on select if (isMsie() && !isMsieSevenOrNewer()) { allowStyling = false; } $.uniform = { // Default options that can be overridden globally or when uniformed // globally: $.uniform.defaults.fileButtonHtml = "Pick A File"; // on uniform: $('input').uniform({fileButtonHtml: "Pick a File"}); defaults: { activeClass: "active", autoHide: true, buttonClass: "button", checkboxClass: "checker", checkedClass: "checked", disabledClass: "disabled", eventNamespace: ".uniform", fileButtonClass: "action", fileButtonHtml: "Choose File", fileClass: "uploader", fileDefaultHtml: "No file selected", filenameClass: "filename", focusClass: "focus", hoverClass: "hover", idPrefix: "uniform", inputAddTypeAsClass: true, inputClass: "uniform-input", radioClass: "radio", resetDefaultHtml: "Reset", resetSelector: false, // We'll use our own function when you don't specify one selectAutoWidth: true, selectClass: "selector", selectMultiClass: "uniform-multiselect", submitDefaultHtml: "Submit", // Only text allowed textareaClass: "uniform", useID: true, wrapperClass: null }, // All uniformed elements - DOM objects elements: [] }; $.fn.uniform = function (options) { var el = this; options = $.extend({}, $.uniform.defaults, options); // If we are in high contrast mode, do not allow styling if (!highContrastTest) { highContrastTest = true; if (highContrast()) { allowStyling = false; } } // Only uniform on browsers that work if (!allowStyling) { return this; } // Code for specifying a reset button if (options.resetSelector) { $(options.resetSelector).mouseup(function () { wind.setTimeout(function () { $.uniform.update(el); }, 10); }); } return this.each(function () { var $el = $(this), i, handler, callbacks; // Avoid uniforming elements already uniformed - just update if ($el.data("uniformed")) { $.uniform.update($el); return; } // See if we have any handler for this type of element for (i = 0; i < uniformHandlers.length; i = i + 1) { handler = uniformHandlers[i]; if (handler.match($el, options)) { callbacks = handler.apply($el, options); $el.data("uniformed", callbacks); // Store element in our global array $.uniform.elements.push($el.get(0)); return; } } // Could not style this element }); }; $.uniform.restore = $.fn.uniform.restore = function (elem) { if (elem === undef) { elem = $.uniform.elements; } $(elem).each(function () { var $el = $(this), index, elementData; elementData = $el.data("uniformed"); // Skip elements that are not uniformed if (!elementData) { return; } // Unbind events, remove additional markup that was added elementData.remove(); // Remove item from list of uniformed elements index = $.inArray(this, $.uniform.elements); if (index >= 0) { $.uniform.elements.splice(index, 1); } $el.removeData("uniformed"); }); }; $.uniform.update = $.fn.uniform.update = function (elem) { if (elem === undef) { elem = $.uniform.elements; } $(elem).each(function () { var $el = $(this), elementData; elementData = $el.data("uniformed"); // Skip elements that are not uniformed if (!elementData) { return; } elementData.update($el, elementData.options); }); }; }(this, jQuery));; /*! * fancyBox - jQuery Plugin * version: 2.1.5 (Fri, 14 Jun 2013) * requires jQuery v1.6 or later * * Examples at http://fancyapps.com/fancybox/ * License: www.fancyapps.com/fancybox/#license * * Copyright 2012 Janis Skarnelis - janis@fancyapps.com * */ ; (function (window, document, $, undefined) { "use strict"; var H = $("html"), W = $(window), D = $(document), F = $.fancybox = function () { F.open.apply(this, arguments); }, IE = navigator.userAgent.match(/msie/i), didUpdate = null, isTouch = document.createTouch !== undefined, isQuery = function (obj) { return obj && obj.hasOwnProperty && obj instanceof $; }, isString = function (str) { return str && $.type(str) === "string"; }, isPercentage = function (str) { return isString(str) && str.indexOf('%') > 0; }, isScrollable = function (el) { return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight))); }, getScalar = function (orig, dim) { var value = parseInt(orig, 10) || 0; if (dim && isPercentage(orig)) { value = F.getViewport()[dim] / 100 * value; } return Math.ceil(value); }, getValue = function (value, dim) { return getScalar(value, dim) + 'px'; }; $.extend(F, { // The current version of fancyBox version: '2.1.5', defaults: { padding: 15, margin: 20, width: 800, height: 600, minWidth: 100, minHeight: 100, maxWidth: 9999, maxHeight: 9999, pixelRatio: 1, // Set to 2 for retina display support autoSize: true, autoHeight: false, autoWidth: false, autoResize: true, autoCenter: !isTouch, fitToView: true, aspectRatio: false, topRatio: 0.5, leftRatio: 0.5, scrolling: 'auto', // 'auto', 'yes' or 'no' wrapCSS: '', arrows: true, closeBtn: true, closeClick: false, nextClick: false, mouseWheel: true, autoPlay: false, playSpeed: 3000, preload: 3, modal: false, loop: true, ajax: { dataType: 'html', headers: { 'X-fancyBox': true } }, iframe: { scrolling: 'auto', preload: true }, swf: { wmode: 'transparent', allowfullscreen: 'true', allowscriptaccess: 'always' }, keys: { next: { 13: 'left', // enter 34: 'up', // page down 39: 'left', // right arrow 40: 'up' // down arrow }, prev: { 8: 'right', // backspace 33: 'down', // page up 37: 'right', // left arrow 38: 'down' // up arrow }, close: [27], // escape key play: [32], // space - start/stop slideshow toggle: [70] // letter "f" - toggle fullscreen }, direction: { next: 'left', prev: 'right' }, scrollOutside: true, // Override some properties index: 0, type: null, href: null, content: null, title: null, // HTML templates tpl: { wrap: '
', image: '', iframe: '', error: '

The requested content cannot be loaded.
Please try again later.

', closeBtn: '', next: '', prev: '' }, // Properties for each animation type // Opening fancyBox openEffect: 'fade', // 'elastic', 'fade' or 'none' openSpeed: 250, openEasing: 'swing', openOpacity: true, openMethod: 'zoomIn', // Closing fancyBox closeEffect: 'fade', // 'elastic', 'fade' or 'none' closeSpeed: 250, closeEasing: 'swing', closeOpacity: true, closeMethod: 'zoomOut', // Changing next gallery item nextEffect: 'elastic', // 'elastic', 'fade' or 'none' nextSpeed: 250, nextEasing: 'swing', nextMethod: 'changeIn', // Changing previous gallery item prevEffect: 'elastic', // 'elastic', 'fade' or 'none' prevSpeed: 250, prevEasing: 'swing', prevMethod: 'changeOut', // Enable default helpers helpers: { overlay: true, title: true }, // Callbacks onCancel: $.noop, // If canceling beforeLoad: $.noop, // Before loading afterLoad: $.noop, // After loading beforeShow: $.noop, // Before changing in current item afterShow: $.noop, // After opening beforeChange: $.noop, // Before changing gallery item beforeClose: $.noop, // Before closing afterClose: $.noop // After closing }, //Current state group: {}, // Selected group opts: {}, // Group options previous: null, // Previous element coming: null, // Element being loaded current: null, // Currently loaded element isActive: false, // Is activated isOpen: false, // Is currently open isOpened: false, // Have been fully opened at least once wrap: null, skin: null, outer: null, inner: null, player: { timer: null, isActive: false }, // Loaders ajaxLoad: null, imgPreload: null, // Some collections transitions: {}, helpers: {}, /* * Static methods */ open: function (group, opts) { if (!group) { return; } if (!$.isPlainObject(opts)) { opts = {}; } // Close if already active if (false === F.close(true)) { return; } // Normalize group if (!$.isArray(group)) { group = isQuery(group) ? $(group).get() : [group]; } // Recheck if the type of each element is `object` and set content type (image, ajax, etc) $.each(group, function (i, element) { var obj = {}, href, title, content, type, rez, hrefParts, selector; if ($.type(element) === "object") { // Check if is DOM element if (element.nodeType) { element = $(element); } if (isQuery(element)) { obj = { href: element.data('fancybox-href') || element.attr('href'), title: $('
').text(element.data('fancybox-title') || element.attr('title')).html(), isDom: true, element: element }; if ($.metadata) { $.extend(true, obj, element.metadata()); } } else { obj = element; } } href = opts.href || obj.href || (isString(element) ? element : null); title = opts.title !== undefined ? opts.title : obj.title || ''; content = opts.content || obj.content; type = content ? 'html' : (opts.type || obj.type); if (!type && obj.isDom) { type = element.data('fancybox-type'); if (!type) { rez = element.prop('class').match(/fancybox\.(\w+)/); type = rez ? rez[1] : null; } } if (isString(href)) { // Try to guess the content type if (!type) { if (F.isImage(href)) { type = 'image'; } else if (F.isSWF(href)) { type = 'swf'; } else if (href.charAt(0) === '#') { type = 'inline'; } else if (isString(element)) { type = 'html'; content = element; } } // Split url into two pieces with source url and content selector, e.g, // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id" if (type === 'ajax') { hrefParts = href.split(/\s+/, 2); href = hrefParts.shift(); selector = hrefParts.shift(); } } if (!content) { if (type === 'inline') { if (href) { content = $(isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href); //strip for ie7 } else if (obj.isDom) { content = element; } } else if (type === 'html') { content = href; } else if (!type && !href && obj.isDom) { type = 'inline'; content = element; } } $.extend(obj, { href: href, type: type, content: content, title: title, selector: selector }); group[i] = obj; }); // Extend the defaults F.opts = $.extend(true, {}, F.defaults, opts); // All options are merged recursive except keys if (opts.keys !== undefined) { F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false; } F.group = group; return F._start(F.opts.index); }, // Cancel image loading or abort ajax request cancel: function () { var coming = F.coming; if (coming && false === F.trigger('onCancel')) { return; } F.hideLoading(); if (!coming) { return; } if (F.ajaxLoad) { F.ajaxLoad.abort(); } F.ajaxLoad = null; if (F.imgPreload) { F.imgPreload.onload = F.imgPreload.onerror = null; } if (coming.wrap) { coming.wrap.stop(true, true).trigger('onReset').remove(); } F.coming = null; // If the first item has been canceled, then clear everything if (!F.current) { F._afterZoomOut(coming); } }, // Start closing animation if is open; remove immediately if opening/closing close: function (event) { F.cancel(); if (false === F.trigger('beforeClose')) { return; } F.unbindEvents(); if (!F.isActive) { return; } if (!F.isOpen || event === true) { $('.fancybox-wrap').stop(true).trigger('onReset').remove(); F._afterZoomOut(); } else { F.isOpen = F.isOpened = false; F.isClosing = true; $('.fancybox-item, .fancybox-nav').remove(); F.wrap.stop(true, true).removeClass('fancybox-opened'); F.transitions[F.current.closeMethod](); } }, // Manage slideshow: // $.fancybox.play(); - toggle slideshow // $.fancybox.play( true ); - start // $.fancybox.play( false ); - stop play: function (action) { var clear = function () { clearTimeout(F.player.timer); }, set = function () { clear(); if (F.current && F.player.isActive) { F.player.timer = setTimeout(F.next, F.current.playSpeed); } }, stop = function () { clear(); D.unbind('.player'); F.player.isActive = false; F.trigger('onPlayEnd'); }, start = function () { if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) { F.player.isActive = true; D.bind({ 'onCancel.player beforeClose.player': stop, 'onUpdate.player': set, 'beforeLoad.player': clear }); set(); F.trigger('onPlayStart'); } }; if (action === true || (!F.player.isActive && action !== false)) { start(); } else { stop(); } }, // Navigate to next gallery item next: function (direction) { var current = F.current; if (current) { if (!isString(direction)) { direction = current.direction.next; } F.jumpto(current.index + 1, direction, 'next'); } }, // Navigate to previous gallery item prev: function (direction) { var current = F.current; if (current) { if (!isString(direction)) { direction = current.direction.prev; } F.jumpto(current.index - 1, direction, 'prev'); } }, // Navigate to gallery item by index jumpto: function (index, direction, router) { var current = F.current; if (!current) { return; } index = getScalar(index); F.direction = direction || current.direction[(index >= current.index ? 'next' : 'prev')]; F.router = router || 'jumpto'; if (current.loop) { if (index < 0) { index = current.group.length + (index % current.group.length); } index = index % current.group.length; } if (current.group[index] !== undefined) { F.cancel(); F._start(index); } }, // Center inside viewport and toggle position type to fixed or absolute if needed reposition: function (e, onlyAbsolute) { var current = F.current, wrap = current ? current.wrap : null, pos; if (wrap) { pos = F._getPosition(onlyAbsolute); if (e && e.type === 'scroll') { delete pos.position; wrap.stop(true, true).animate(pos, 200); } else { wrap.css(pos); current.pos = $.extend({}, current.dim, pos); } } }, update: function (e) { var type = (e && e.originalEvent && e.originalEvent.type), anyway = !type || type === 'orientationchange'; if (anyway) { clearTimeout(didUpdate); didUpdate = null; } if (!F.isOpen || didUpdate) { return; } didUpdate = setTimeout(function () { var current = F.current; if (!current || F.isClosing) { return; } F.wrap.removeClass('fancybox-tmp'); if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) { F._setDimension(); } if (!(type === 'scroll' && current.canShrink)) { F.reposition(e); } F.trigger('onUpdate'); didUpdate = null; }, (anyway && !isTouch ? 0 : 300)); }, // Shrink content to fit inside viewport or restore if resized toggle: function (action) { if (F.isOpen) { F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView; // Help browser to restore document dimensions if (isTouch) { F.wrap.removeAttr('style').addClass('fancybox-tmp'); F.trigger('onUpdate'); } F.update(); } }, hideLoading: function () { D.unbind('.loading'); $('#fancybox-loading').remove(); }, showLoading: function () { var el, viewport; F.hideLoading(); el = $('
').click(F.cancel).appendTo('body'); // If user will press the escape-button, the request will be canceled D.bind('keydown.loading', function (e) { if ((e.which || e.keyCode) === 27) { e.preventDefault(); F.cancel(); } }); if (!F.defaults.fixed) { viewport = F.getViewport(); el.css({ position: 'absolute', top: (viewport.h * 0.5) + viewport.y, left: (viewport.w * 0.5) + viewport.x }); } F.trigger('onLoading'); }, getViewport: function () { var locked = (F.current && F.current.locked) || false, rez = { x: W.scrollLeft(), y: W.scrollTop() }; if (locked && locked.length) { rez.w = locked[0].clientWidth; rez.h = locked[0].clientHeight; } else { // See http://bugs.jquery.com/ticket/6724 rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width(); rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height(); } return rez; }, // Unbind the keyboard / clicking actions unbindEvents: function () { if (F.wrap && isQuery(F.wrap)) { F.wrap.unbind('.fb'); } D.unbind('.fb'); W.unbind('.fb'); }, bindEvents: function () { var current = F.current, keys; if (!current) { return; } // Changing document height on iOS devices triggers a 'resize' event, // that can change document height... repeating infinitely W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update); keys = current.keys; if (keys) { D.bind('keydown.fb', function (e) { var code = e.which || e.keyCode, target = e.target || e.srcElement; // Skip esc key if loading, because showLoading will cancel preloading if (code === 27 && F.coming) { return false; } // Ignore key combinations and key events within form elements if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) { $.each(keys, function (i, val) { if (current.group.length > 1 && val[code] !== undefined) { F[i](val[code]); e.preventDefault(); return false; } if ($.inArray(code, val) > -1) { F[i](); e.preventDefault(); return false; } }); } }); } if ($.fn.mousewheel && current.mouseWheel) { F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) { var target = e.target || null, parent = $(target), canScroll = false; while (parent.length) { if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) { break; } canScroll = isScrollable(parent[0]); parent = $(parent).parent(); } if (delta !== 0 && !canScroll) { if (F.group.length > 1 && !current.canShrink) { if (deltaY > 0 || deltaX > 0) { F.prev(deltaY > 0 ? 'down' : 'left'); } else if (deltaY < 0 || deltaX < 0) { F.next(deltaY < 0 ? 'up' : 'right'); } e.preventDefault(); } } }); } }, trigger: function (event, o) { var ret, obj = o || F.coming || F.current; if (obj) { if ($.isFunction(obj[event])) { ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1)); } if (ret === false) { return false; } if (obj.helpers) { $.each(obj.helpers, function (helper, opts) { if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) { F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj); } }); } } D.trigger(event); }, isImage: function (str) { return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i); }, isSWF: function (str) { return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i); }, _start: function (index) { var coming = {}, obj, href, type, margin, padding; index = getScalar(index); obj = F.group[index] || null; if (!obj) { return false; } coming = $.extend(true, {}, F.opts, obj); // Convert margin and padding properties to array - top, right, bottom, left margin = coming.margin; padding = coming.padding; if ($.type(margin) === 'number') { coming.margin = [margin, margin, margin, margin]; } if ($.type(padding) === 'number') { coming.padding = [padding, padding, padding, padding]; } // 'modal' propery is just a shortcut if (coming.modal) { $.extend(true, coming, { closeBtn: false, closeClick: false, nextClick: false, arrows: false, mouseWheel: false, keys: null, helpers: { overlay: { closeClick: false } } }); } // 'autoSize' property is a shortcut, too if (coming.autoSize) { coming.autoWidth = coming.autoHeight = true; } if (coming.width === 'auto') { coming.autoWidth = true; } if (coming.height === 'auto') { coming.autoHeight = true; } /* * Add reference to the group, so it`s possible to access from callbacks, example: * afterLoad : function() { * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); * } */ coming.group = F.group; coming.index = index; // Give a chance for callback or helpers to update coming item (type, title, etc) F.coming = coming; if (false === F.trigger('beforeLoad')) { F.coming = null; return; } type = coming.type; href = coming.href; if (!type) { F.coming = null; //If we can not determine content type then drop silently or display next/prev item if looping through gallery if (F.current && F.router && F.router !== 'jumpto') { F.current.index = index; return F[F.router](F.direction); } return false; } F.isActive = true; if (type === 'image' || type === 'swf') { coming.autoHeight = coming.autoWidth = false; coming.scrolling = 'visible'; } if (type === 'image') { coming.aspectRatio = true; } if (type === 'iframe' && isTouch) { coming.scrolling = 'scroll'; } // Build the neccessary markup coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo(coming.parent || 'body'); $.extend(coming, { skin: $('.fancybox-skin', coming.wrap), outer: $('.fancybox-outer', coming.wrap), inner: $('.fancybox-inner', coming.wrap) }); $.each(["Top", "Right", "Bottom", "Left"], function (i, v) { coming.skin.css('padding' + v, getValue(coming.padding[i])); }); F.trigger('onReady'); // Check before try to load; 'inline' and 'html' types need content, others - href if (type === 'inline' || type === 'html') { if (!coming.content || !coming.content.length) { return F._error('content'); } } else if (!href) { return F._error('href'); } if (type === 'image') { F._loadImage(); } else if (type === 'ajax') { F._loadAjax(); } else if (type === 'iframe') { F._loadIframe(); } else { F._afterLoad(); } }, _error: function (type) { $.extend(F.coming, { type: 'html', autoWidth: true, autoHeight: true, minWidth: 0, minHeight: 0, scrolling: 'no', hasError: type, content: F.coming.tpl.error }); F._afterLoad(); }, _loadImage: function () { // Reset preload image so it is later possible to check "complete" property var img = F.imgPreload = new Image(); img.onload = function () { this.onload = this.onerror = null; F.coming.width = this.width / F.opts.pixelRatio; F.coming.height = this.height / F.opts.pixelRatio; F._afterLoad(); }; img.onerror = function () { this.onload = this.onerror = null; F._error('image'); }; img.src = F.coming.href; if (img.complete !== true) { F.showLoading(); } }, _loadAjax: function () { var coming = F.coming; F.showLoading(); F.ajaxLoad = $.ajax($.extend({}, coming.ajax, { url: coming.href, error: function (jqXHR, textStatus) { if (F.coming && textStatus !== 'abort') { F._error('ajax', jqXHR); } else { F.hideLoading(); } }, success: function (data, textStatus) { if (textStatus === 'success') { coming.content = data; F._afterLoad(); } } })); }, _loadIframe: function () { var coming = F.coming, iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime())) .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling) .attr('src', coming.href); // This helps IE $(coming.wrap).bind('onReset', function () { try { $(this).find('iframe').hide().attr('src', '//about:blank').end().empty(); } catch (e) { } }); if (coming.iframe.preload) { F.showLoading(); iframe.one('load', function () { $(this).data('ready', 1); // iOS will lose scrolling if we resize if (!isTouch) { $(this).bind('load.fb', F.update); } // Without this trick: // - iframe won't scroll on iOS devices // - IE7 sometimes displays empty iframe $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show(); F._afterLoad(); }); } coming.content = iframe.appendTo(coming.inner); if (!coming.iframe.preload) { F._afterLoad(); } }, _preloadImages: function () { var group = F.group, current = F.current, len = group.length, cnt = current.preload ? Math.min(current.preload, len - 1) : 0, item, i; for (i = 1; i <= cnt; i += 1) { item = group[(current.index + i) % len]; if (item.type === 'image' && item.href) { new Image().src = item.href; } } }, _afterLoad: function () { var coming = F.coming, previous = F.current, placeholder = 'fancybox-placeholder', current, content, type, scrolling, href, embed; F.hideLoading(); if (!coming || F.isActive === false) { return; } if (false === F.trigger('afterLoad', coming, previous)) { coming.wrap.stop(true).trigger('onReset').remove(); F.coming = null; return; } if (previous) { F.trigger('beforeChange', previous); previous.wrap.stop(true).removeClass('fancybox-opened') .find('.fancybox-item, .fancybox-nav') .remove(); } F.unbindEvents(); current = coming; content = coming.content; type = coming.type; scrolling = coming.scrolling; $.extend(F, { wrap: current.wrap, skin: current.skin, outer: current.outer, inner: current.inner, current: current, previous: previous }); href = current.href; switch (type) { case 'inline': case 'ajax': case 'html': if (current.selector) { content = $('
').html(content).find(current.selector); } else if (isQuery(content)) { if (!content.data(placeholder)) { content.data(placeholder, $('
').insertAfter(content).hide()); } content = content.show().detach(); current.wrap.bind('onReset', function () { if ($(this).find(content).length) { content.hide().replaceAll(content.data(placeholder)).data(placeholder, false); } }); } break; case 'image': content = current.tpl.image.replace(/\{href\}/g, href); break; case 'swf': content = ''; embed = ''; $.each(current.swf, function (name, val) { content += ''; embed += ' ' + name + '="' + val + '"'; }); content += ''; break; } if (!(isQuery(content) && content.parent().is(current.inner))) { current.inner.append(content); } // Give a chance for helpers or callbacks to update elements F.trigger('beforeShow'); // Set scrolling before calculating dimensions current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling)); // Set initial dimensions and start position F._setDimension(); F.reposition(); F.isOpen = false; F.coming = null; F.bindEvents(); if (!F.isOpened) { $('.fancybox-wrap').not(current.wrap).stop(true).trigger('onReset').remove(); } else if (previous.prevMethod) { F.transitions[previous.prevMethod](); } F.transitions[F.isOpened ? current.nextMethod : current.openMethod](); F._preloadImages(); }, _setDimension: function () { var viewport = F.getViewport(), steps = 0, canShrink = false, canExpand = false, wrap = F.wrap, skin = F.skin, inner = F.inner, current = F.current, width = current.width, height = current.height, minWidth = current.minWidth, minHeight = current.minHeight, maxWidth = current.maxWidth, maxHeight = current.maxHeight, scrolling = current.scrolling, scrollOut = current.scrollOutside ? current.scrollbarWidth : 0, margin = current.margin, wMargin = getScalar(margin[1] + margin[3]), hMargin = getScalar(margin[0] + margin[2]), wPadding, hPadding, wSpace, hSpace, origWidth, origHeight, origMaxWidth, origMaxHeight, ratio, width_, height_, maxWidth_, maxHeight_, iframe, body; // Reset dimensions so we could re-check actual size wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp'); wPadding = getScalar(skin.outerWidth(true) - skin.width()); hPadding = getScalar(skin.outerHeight(true) - skin.height()); // Any space between content and viewport (margin, padding, border, title) wSpace = wMargin + wPadding; hSpace = hMargin + hPadding; origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width; origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height; if (current.type === 'iframe') { iframe = current.content; if (current.autoHeight && iframe.data('ready') === 1) { try { if (iframe[0].contentWindow.document.location) { inner.width(origWidth).height(9999); body = iframe.contents().find('body'); if (scrollOut) { body.css('overflow-x', 'hidden'); } origHeight = body.outerHeight(true); } } catch (e) { } } } else if (current.autoWidth || current.autoHeight) { inner.addClass('fancybox-tmp'); // Set width or height in case we need to calculate only one dimension if (!current.autoWidth) { inner.width(origWidth); } if (!current.autoHeight) { inner.height(origHeight); } if (current.autoWidth) { origWidth = inner.width(); } if (current.autoHeight) { origHeight = inner.height(); } inner.removeClass('fancybox-tmp'); } width = getScalar(origWidth); height = getScalar(origHeight); ratio = origWidth / origHeight; // Calculations for the content minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth); maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth); minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight); maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight); // These will be used to determine if wrap can fit in the viewport origMaxWidth = maxWidth; origMaxHeight = maxHeight; if (current.fitToView) { maxWidth = Math.min(viewport.w - wSpace, maxWidth); maxHeight = Math.min(viewport.h - hSpace, maxHeight); } maxWidth_ = viewport.w - wMargin; maxHeight_ = viewport.h - hMargin; if (current.aspectRatio) { if (width > maxWidth) { width = maxWidth; height = getScalar(width / ratio); } if (height > maxHeight) { height = maxHeight; width = getScalar(height * ratio); } if (width < minWidth) { width = minWidth; height = getScalar(width / ratio); } if (height < minHeight) { height = minHeight; width = getScalar(height * ratio); } } else { width = Math.max(minWidth, Math.min(width, maxWidth)); if (current.autoHeight && current.type !== 'iframe') { inner.width(width); height = inner.height(); } height = Math.max(minHeight, Math.min(height, maxHeight)); } // Try to fit inside viewport (including the title) if (current.fitToView) { inner.width(width).height(height); wrap.width(width + wPadding); // Real wrap dimensions width_ = wrap.width(); height_ = wrap.height(); if (current.aspectRatio) { while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) { if (steps++ > 19) { break; } height = Math.max(minHeight, Math.min(maxHeight, height - 10)); width = getScalar(height * ratio); if (width < minWidth) { width = minWidth; height = getScalar(width / ratio); } if (width > maxWidth) { width = maxWidth; height = getScalar(width / ratio); } inner.width(width).height(height); wrap.width(width + wPadding); width_ = wrap.width(); height_ = wrap.height(); } } else { width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_))); height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_))); } } if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) { width += scrollOut; } inner.width(width).height(height); wrap.width(width + wPadding); width_ = wrap.width(); height_ = wrap.height(); canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight; canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight)); $.extend(current, { dim: { width: getValue(width_), height: getValue(height_) }, origWidth: origWidth, origHeight: origHeight, canShrink: canShrink, canExpand: canExpand, wPadding: wPadding, hPadding: hPadding, wrapSpace: height_ - skin.outerHeight(true), skinSpace: skin.height() - height }); if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) { inner.height('auto'); } }, _getPosition: function (onlyAbsolute) { var current = F.current, viewport = F.getViewport(), margin = current.margin, width = F.wrap.width() + margin[1] + margin[3], height = F.wrap.height() + margin[0] + margin[2], rez = { position: 'absolute', top: margin[0], left: margin[3] }; if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) { rez.position = 'fixed'; } else if (!current.locked) { rez.top += viewport.y; rez.left += viewport.x; } rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio))); rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio))); return rez; }, _afterZoomIn: function () { var current = F.current; if (!current) { return; } F.isOpen = F.isOpened = true; F.wrap.css('overflow', 'visible').addClass('fancybox-opened').hide().show(0); F.update(); // Assign a click event if (current.closeClick || (current.nextClick && F.group.length > 1)) { F.inner.css('cursor', 'pointer').bind('click.fb', function (e) { if (!$(e.target).is('a') && !$(e.target).parent().is('a')) { e.preventDefault(); F[current.closeClick ? 'close' : 'next'](); } }); } // Create a close button if (current.closeBtn) { $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function (e) { e.preventDefault(); F.close(); }); } // Create navigation arrows if (current.arrows && F.group.length > 1) { if (current.loop || current.index > 0) { $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev); } if (current.loop || current.index < F.group.length - 1) { $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next); } } F.trigger('afterShow'); // Stop the slideshow if this is the last item if (!current.loop && current.index === current.group.length - 1) { F.play(false); } else if (F.opts.autoPlay && !F.player.isActive) { F.opts.autoPlay = false; F.play(true); } }, _afterZoomOut: function (obj) { obj = obj || F.current; $('.fancybox-wrap').trigger('onReset').remove(); $.extend(F, { group: {}, opts: {}, router: false, current: null, isActive: false, isOpened: false, isOpen: false, isClosing: false, wrap: null, skin: null, outer: null, inner: null }); F.trigger('afterClose', obj); } }); /* * Default transitions */ F.transitions = { getOrigPosition: function () { var current = F.current, element = current.element, orig = current.orig, pos = {}, width = 50, height = 50, hPadding = current.hPadding, wPadding = current.wPadding, viewport = F.getViewport(); if (!orig && current.isDom && element.is(':visible')) { orig = element.find('img:first'); if (!orig.length) { orig = element; } } if (isQuery(orig)) { pos = orig.offset(); if (orig.is('img')) { width = orig.outerWidth(); height = orig.outerHeight(); } } else { pos.top = viewport.y + (viewport.h - height) * current.topRatio; pos.left = viewport.x + (viewport.w - width) * current.leftRatio; } if (F.wrap.css('position') === 'fixed' || current.locked) { pos.top -= viewport.y; pos.left -= viewport.x; } pos = { top: getValue(pos.top - hPadding * current.topRatio), left: getValue(pos.left - wPadding * current.leftRatio), width: getValue(width + wPadding), height: getValue(height + hPadding) }; return pos; }, step: function (now, fx) { var ratio, padding, value, prop = fx.prop, current = F.current, wrapSpace = current.wrapSpace, skinSpace = current.skinSpace; if (prop === 'width' || prop === 'height') { ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start); if (F.isClosing) { ratio = 1 - ratio; } padding = prop === 'width' ? current.wPadding : current.hPadding; value = now - padding; F.skin[prop](getScalar(prop === 'width' ? value : value - (wrapSpace * ratio))); F.inner[prop](getScalar(prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio))); } }, zoomIn: function () { var current = F.current, startPos = current.pos, effect = current.openEffect, elastic = effect === 'elastic', endPos = $.extend({ opacity: 1 }, startPos); // Remove "position" property that breaks older IE delete endPos.position; if (elastic) { startPos = this.getOrigPosition(); if (current.openOpacity) { startPos.opacity = 0.1; } } else if (effect === 'fade') { startPos.opacity = 0.1; } F.wrap.css(startPos).animate(endPos, { duration: effect === 'none' ? 0 : current.openSpeed, easing: current.openEasing, step: elastic ? this.step : null, complete: F._afterZoomIn }); }, zoomOut: function () { var current = F.current, effect = current.closeEffect, elastic = effect === 'elastic', endPos = { opacity: 0.1 }; if (elastic) { endPos = this.getOrigPosition(); if (current.closeOpacity) { endPos.opacity = 0.1; } } F.wrap.animate(endPos, { duration: effect === 'none' ? 0 : current.closeSpeed, easing: current.closeEasing, step: elastic ? this.step : null, complete: F._afterZoomOut }); }, changeIn: function () { var current = F.current, effect = current.nextEffect, startPos = current.pos, endPos = { opacity: 1 }, direction = F.direction, distance = 200, field; startPos.opacity = 0.1; if (effect === 'elastic') { field = direction === 'down' || direction === 'up' ? 'top' : 'left'; if (direction === 'down' || direction === 'right') { startPos[field] = getValue(getScalar(startPos[field]) - distance); endPos[field] = '+=' + distance + 'px'; } else { startPos[field] = getValue(getScalar(startPos[field]) + distance); endPos[field] = '-=' + distance + 'px'; } } // Workaround for http://bugs.jquery.com/ticket/12273 if (effect === 'none') { F._afterZoomIn(); } else { F.wrap.css(startPos).animate(endPos, { duration: current.nextSpeed, easing: current.nextEasing, complete: F._afterZoomIn }); } }, changeOut: function () { var previous = F.previous, effect = previous.prevEffect, endPos = { opacity: 0.1 }, direction = F.direction, distance = 200; if (effect === 'elastic') { endPos[direction === 'down' || direction === 'up' ? 'top' : 'left'] = (direction === 'up' || direction === 'left' ? '-' : '+') + '=' + distance + 'px'; } previous.wrap.animate(endPos, { duration: effect === 'none' ? 0 : previous.prevSpeed, easing: previous.prevEasing, complete: function () { $(this).trigger('onReset').remove(); } }); } }; /* * Overlay helper */ F.helpers.overlay = { defaults: { closeClick: true, // if true, fancyBox will be closed when user clicks on the overlay speedOut: 200, // duration of fadeOut animation showEarly: true, // indicates if should be opened immediately or wait until the content is ready css: {}, // custom CSS properties locked: !isTouch, // if true, the content will be locked into overlay fixed: true // if false, the overlay CSS position property will not be set to "fixed" }, overlay: null, // current handle fixed: false, // indicates if the overlay has position "fixed" el: $('html'), // element that contains "the lock" // Public methods create: function (opts) { var parent; opts = $.extend({}, this.defaults, opts); if (this.overlay) { this.close(); } parent = F.coming ? F.coming.parent : opts.parent; this.overlay = $('
').appendTo(parent && parent.lenth ? parent : 'body'); this.fixed = false; if (opts.fixed && F.defaults.fixed) { this.overlay.addClass('fancybox-overlay-fixed'); this.fixed = true; } }, open: function (opts) { var that = this; opts = $.extend({}, this.defaults, opts); if (this.overlay) { this.overlay.unbind('.overlay').width('auto').height('auto'); } else { this.create(opts); } if (!this.fixed) { W.bind('resize.overlay', $.proxy(this.update, this)); this.update(); } if (opts.closeClick) { this.overlay.bind('click.overlay', function (e) { if ($(e.target).hasClass('fancybox-overlay')) { if (F.isActive) { F.close(); } else { that.close(); } return false; } }); } this.overlay.css(opts.css).show(); }, close: function () { W.unbind('resize.overlay'); if (this.el.hasClass('fancybox-lock')) { $('.fancybox-margin').removeClass('fancybox-margin'); this.el.removeClass('fancybox-lock'); W.scrollTop(this.scrollV).scrollLeft(this.scrollH); } $('.fancybox-overlay').remove().hide(); $.extend(this, { overlay: null, fixed: false }); }, // Private, callbacks update: function () { var width = '100%', offsetWidth; // Reset width/height so it will not mess this.overlay.width(width).height('100%'); // jQuery does not return reliable result for IE if (IE) { offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); if (D.width() > offsetWidth) { width = D.width(); } } else if (D.width() > W.width()) { width = D.width(); } this.overlay.width(width).height(D.height()); }, // This is where we can manipulate DOM, because later it would cause iframes to reload onReady: function (opts, obj) { var overlay = this.overlay; $('.fancybox-overlay').stop(true, true); if (!overlay) { this.create(opts); } if (opts.locked && this.fixed && obj.fixed) { obj.locked = this.overlay.append(obj.wrap); obj.fixed = false; } if (opts.showEarly === true) { this.beforeShow.apply(this, arguments); } }, beforeShow: function (opts, obj) { if (obj.locked && !this.el.hasClass('fancybox-lock')) { if (this.fixPosition !== false) { $('*').filter(function () { return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap")); }).addClass('fancybox-margin'); } this.el.addClass('fancybox-margin'); this.scrollV = W.scrollTop(); this.scrollH = W.scrollLeft(); this.el.addClass('fancybox-lock'); W.scrollTop(this.scrollV).scrollLeft(this.scrollH); } this.open(opts); }, onUpdate: function () { if (!this.fixed) { this.update(); } }, afterClose: function (opts) { // Remove overlay if exists and fancyBox is not opening // (e.g., it is not being open using afterClose callback) if (this.overlay && !F.coming) { this.overlay.fadeOut(opts.speedOut, $.proxy(this.close, this)); } } }; /* * Title helper */ F.helpers.title = { defaults: { type: 'float', // 'float', 'inside', 'outside' or 'over', position: 'bottom' // 'top' or 'bottom' }, beforeShow: function (opts) { var current = F.current, text = current.title, type = opts.type, title, target; if ($.isFunction(text)) { text = text.call(current.element, current); } if (!isString(text) || $.trim(text) === '') { return; } title = $('
' + text + '
'); switch (type) { case 'inside': target = F.skin; break; case 'outside': target = F.wrap; break; case 'over': target = F.inner; break; default: // 'float' target = F.skin; title.appendTo('body'); if (IE) { title.width(title.width()); } title.wrapInner(''); //Increase bottom margin so this title will also fit into viewport F.current.margin[2] += Math.abs(getScalar(title.css('margin-bottom'))); break; } title[(opts.position === 'top' ? 'prependTo' : 'appendTo')](target); } }; // jQuery plugin initialization $.fn.fancybox = function (options) { var index, that = $(this), selector = this.selector || '', run = function (e) { var what = $(this).blur(), idx = index, relType, relVal; if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) { relType = options.groupAttr || 'data-fancybox-group'; relVal = what.attr(relType); if (!relVal) { relType = 'rel'; relVal = what.get(0)[relType]; } if (relVal && relVal !== '' && relVal !== 'nofollow') { what = selector.length ? $(selector) : that; what = what.filter('[' + relType + '="' + relVal + '"]'); idx = what.index(this); } options.index = idx; // Stop an event from bubbling if everything is fine if (F.open(what, options) !== false) { e.preventDefault(); } } }; options = options || {}; index = options.index || 0; if (!selector || options.live === false) { that.unbind('click.fb-start').bind('click.fb-start', run); } else { D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run); } this.filter('[data-fancybox-start=1]').trigger('click'); return this; }; // Tests that need a body at doc ready D.ready(function () { var w1, w2; if ($.scrollbarWidth === undefined) { // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth $.scrollbarWidth = function () { var parent = $('
').appendTo('body'), child = parent.children(), width = child.innerWidth() - child.height(99).innerWidth(); parent.remove(); return width; }; } if ($.support.fixedPosition === undefined) { $.support.fixedPosition = (function () { var elem = $('
').appendTo('body'), fixed = (elem[0].offsetTop === 20 || elem[0].offsetTop === 15); elem.remove(); return fixed; }()); } $.extend(F.defaults, { scrollbarWidth: $.scrollbarWidth(), fixed: $.support.fixedPosition, parent: $('body') }); //Get real width of page scroll-bar w1 = $(window).width(); H.addClass('fancybox-lock-test'); w2 = $(window).width(); H.removeClass('fancybox-lock-test'); $("").appendTo("head"); }); }(window, document, jQuery));; /*! * Media helper for fancyBox * version: 1.0.6 (Fri, 14 Jun 2013) * @requires fancyBox v2.0 or later * * Usage: * $(".fancybox").fancybox({ * helpers : { * media: true * } * }); * * Set custom URL parameters: * $(".fancybox").fancybox({ * helpers : { * media: { * youtube : { * params : { * autoplay : 0 * } * } * } * } * }); * * Or: * $(".fancybox").fancybox({, * helpers : { * media: true * }, * youtube : { * autoplay: 0 * } * }); * * Supports: * * Youtube * http://www.youtube.com/watch?v=opj24KnzrWo * http://www.youtube.com/embed/opj24KnzrWo * http://youtu.be/opj24KnzrWo * http://www.youtube-nocookie.com/embed/opj24KnzrWo * Vimeo * http://vimeo.com/40648169 * http://vimeo.com/channels/staffpicks/38843628 * http://vimeo.com/groups/surrealism/videos/36516384 * http://player.vimeo.com/video/45074303 * Metacafe * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ * http://www.metacafe.com/watch/7635964/ * Dailymotion * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people * Twitvid * http://twitvid.com/QY7MD * Twitpic * http://twitpic.com/7p93st * Instagram * http://instagr.am/p/IejkuUGxQn/ * http://instagram.com/p/IejkuUGxQn/ * Google maps * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 */ (function ($) { "use strict"; //Shortcut for fancyBox object var F = $.fancybox, format = function( url, rez, params ) { params = params || ''; if ( $.type( params ) === "object" ) { params = $.param(params, true); } $.each(rez, function(key, value) { url = url.replace( '$' + key, value || '' ); }); if (params.length) { url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; } return url; }; //Add helper object F.helpers.media = { defaults : { youtube : { matcher : /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, params : { autoplay : 1, autohide : 1, fs : 1, rel : 0, hd : 1, wmode : 'opaque', enablejsapi : 1 }, type : 'iframe', url : '//www.youtube.com/embed/$3' }, vimeo : { matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, params : { autoplay : 1, hd : 1, show_title : 1, show_byline : 1, show_portrait : 0, fullscreen : 1 }, type : 'iframe', url : '//player.vimeo.com/video/$1' }, metacafe : { matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, params : { autoPlay : 'yes' }, type : 'swf', url : function( rez, params, obj ) { obj.swf.flashVars = 'playerVars=' + $.param( params, true ); return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; } }, dailymotion : { matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, params : { additionalInfos : 0, autoStart : 1 }, type : 'swf', url : '//www.dailymotion.com/swf/video/$1' }, twitvid : { matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, params : { autoplay : 0 }, type : 'iframe', url : '//www.twitvid.com/embed.php?guid=$1' }, twitpic : { matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, type : 'image', url : '//twitpic.com/show/full/$1/' }, instagram : { matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, type : 'image', url : '//$1/p/$2/media/?size=l' }, google_maps : { matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, type : 'iframe', url : function( rez ) { return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); } } }, beforeLoad : function(opts, obj) { var url = obj.href || '', type = false, what, item, rez, params; for (what in opts) { if (opts.hasOwnProperty(what)) { item = opts[ what ]; rez = url.match( item.matcher ); if (rez) { type = item.type; params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); break; } } } if (type) { obj.href = url; obj.type = type; obj.autoHeight = false; } } }; }(jQuery));; /*! AnythingSlider v1.9.4 Original by Chris Coyier: http://css-tricks.com Get the latest version: https://github.com/CSS-Tricks/AnythingSlider To use the navigationFormatter function, you must have a function that accepts two paramaters, and returns a string of HTML text. index = integer index (1 based); panel = jQuery wrapped LI item this tab references @return = Must return a string of HTML/Text navigationFormatter: function(index, panel){ return "Panel #" + index; // This would have each tab with the text 'Panel #X' where X = index } */ /*jshint browser:true, jquery:true, unused:false */ ; (function ($, win, doc) { "use strict"; $.anythingSlider = function (el, options) { var base = this, o, t; // Wraps the ul in the necessary divs and then gives Access to jQuery element base.el = el; base.$el = $(el).addClass('anythingBase').wrap('
'); // Add a reverse reference to the DOM object base.$el.data("AnythingSlider", base); base.init = function () { // Added "o" to be used in the code instead of "base.options" which doesn't get modifed by the compiler - reduces size by ~1k base.options = o = $.extend({}, $.anythingSlider.defaults, options); base.initialized = false; if ($.isFunction(o.onBeforeInitialize)) { base.$el.bind('before_initialize', o.onBeforeInitialize); } base.$el.trigger('before_initialize', base); // Add "as-oldie" class to body for css purposes $('').appendTo('body').remove(); // Cache existing DOM elements for later // base.$el = original ul // for wrap - get parent() then closest in case the ul has "anythingSlider" class base.$wrapper = base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-' + o.theme); base.$outer = base.$wrapper.parent(); base.$window = base.$el.closest('div.anythingWindow'); base.$win = $(win); base.$controls = $('
'); base.$nav = $('
'); base.$startStop = $(''); if (o.buildStartStop || o.buildNavigation) { base.$controls.appendTo((o.appendControlsTo && $(o.appendControlsTo).length) ? $(o.appendControlsTo) : base.$wrapper); } if (o.buildNavigation) { base.$nav.appendTo((o.appendNavigationTo && $(o.appendNavigationTo).length) ? $(o.appendNavigationTo) : base.$controls); } if (o.buildStartStop) { base.$startStop.appendTo((o.appendStartStopTo && $(o.appendStartStopTo).length) ? $(o.appendStartStopTo) : base.$controls); } // Figure out how many sliders are on the page for indexing base.runTimes = $('.anythingBase').length; // hash tag regex - fixes issue #432 base.regex = (o.hashTags) ? new RegExp('panel' + base.runTimes + '-(\\d+)', 'i') : null; if (base.runTimes === 1) { base.makeActive(); } // make the first slider on the page active // Set up a few defaults & get details base.flag = false; // event flag to prevent multiple calls (used in control click/focusin) if (o.autoPlayLocked) { o.autoPlay = true; } // if autoplay is locked, start playing base.playing = o.autoPlay; // slideshow state; removed "startStopped" option base.slideshow = false; // slideshow flag needed to correctly trigger slideshow events base.hovered = false; // actively hovering over the slider base.panelSize = []; // will contain dimensions and left position of each panel base.currentPage = base.targetPage = o.startPanel = parseInt(o.startPanel, 10) || 1; // make sure this isn't a string o.changeBy = parseInt(o.changeBy, 10) || 1; // set slider type, but keep backward compatibility with the vertical option t = (o.mode || 'h').toLowerCase().match(/(h|v|f)/); t = o.vertical ? 'v' : (t || ['h'])[0]; o.mode = t === 'v' ? 'vertical' : t === 'f' ? 'fade' : 'horizontal'; if (t === 'f') { o.showMultiple = 1; // all slides are stacked in fade mode o.infiniteSlides = false; // no cloned slides } base.adj = (o.infiniteSlides) ? 0 : 1; // adjust page limits for infinite or limited modes base.adjustMultiple = 0; if (o.playRtl) { base.$wrapper.addClass('rtl'); } // Build start/stop button if (o.buildStartStop) { base.buildAutoPlay(); } // Build forwards/backwards buttons if (o.buildArrows) { base.buildNextBackButtons(); } base.$lastPage = base.$targetPage = base.$currentPage; // Initialize o.aspectRatio if (o.expand) { if (o.aspectRatio === true) { // if aspectRatio = true calculate it o.aspectRatio = base.$el.width() / base.$el.height(); } else if (typeof o.aspectRatio === 'string' && o.aspectRatio.indexOf(':') !== -1) { // Calculate and set a float from a string e.g. '680:317' var f = o.aspectRatio.split(':'); o.aspectRatio = f[0] / f[1]; } // Adjust the aspectRatio according to showMultiple i.e. the more panels shown the wider the slider gets if (o.aspectRatio > 0 && o.showMultiple > 1) { o.aspectRatio = o.aspectRatio * o.showMultiple; } } base.updateSlider(); // Expand slider to fit parent if (o.expand) { base.$window.css({ width: '100%', height: '100%' }); // needed for Opera base.checkResize(); } // Make sure easing function exists. if (!$.isFunction($.easing[o.easing])) { o.easing = "swing"; } // If pauseOnHover then add hover effects if (o.pauseOnHover) { base.$wrapper.hover(function () { if (base.playing) { base.$el.trigger('slideshow_paused', base); base.clearTimer(true); } }, function () { if (base.playing) { base.$el.trigger('slideshow_unpaused', base); base.startStop(base.playing, true); } }); } // Hide/Show navigation & play/stop controls base.slideControls(false); base.$wrapper.bind('mouseenter mouseleave', function (e) { // add hovered class to outer wrapper $(this)[e.type === 'mouseenter' ? 'addClass' : 'removeClass']('anythingSlider-hovered'); base.hovered = (e.type === 'mouseenter') ? true : false; base.slideControls(base.hovered); }); // Add keyboard navigation $(doc).keyup(function (e) { // Stop arrow keys from working when focused on form items if (o.enableKeyboard && base.$wrapper.hasClass('activeSlider') && !e.target.tagName.match('TEXTAREA|INPUT|SELECT')) { if (o.mode !== 'vertical' && (e.which === 38 || e.which === 40)) { return; } switch (e.which) { case 39: case 40: // right & down arrow base.goForward(); break; case 37: case 38: // left & up arrow base.goBack(); break; } } }); // If a hash can not be used to trigger the plugin, then go to start panel - see issue #432 base.currentPage = ((o.hashTags) ? base.gotoHash() : '') || o.startPanel || 1; base.gotoPage(base.currentPage, false, null, -1); // Binds events var triggers = "slideshow_resized slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" "); $.each("onSliderResize onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function (i, f) { if ($.isFunction(o[f])) { base.$el.bind(triggers[i], o[f]); } }); if ($.isFunction(o.onSlideComplete)) { // Added setTimeout (zero time) to ensure animation is complete... see this bug report: http://bugs.jquery.com/ticket/7157 base.$el.bind('slide_complete', function () { setTimeout(function () { o.onSlideComplete(base); }, 0); return false; }); } base.initialized = true; base.$el.trigger('initialized', base); // trigger the slideshow base.startStop(o.autoPlay); }; // called during initialization & to update the slider if a panel is added or deleted base.updateSlider = function () { // needed for updating the slider base.$el.children('.cloned').remove(); base.navTextVisible = base.$nav.find('span:first').css('visibility') !== 'hidden'; base.$nav.empty(); // set currentPage to 1 in case it was zero - occurs when adding slides after removing them all base.currentPage = base.currentPage || 1; base.$items = base.$el.children(); base.pages = base.$items.length; base.dir = (o.mode === 'vertical') ? 'top' : 'left'; o.showMultiple = parseInt(o.showMultiple, 10) || 1; // only integers allowed o.navigationSize = (o.navigationSize === false) ? 0 : parseInt(o.navigationSize, 10) || 0; // Fix tabbing through the page, but don't change the view if the link is in view (showMultiple = true) base.$items.find('a').unbind('focus.AnythingSlider').bind('focus.AnythingSlider', function (e) { var panel = $(this).closest('.panel'), indx = base.$items.index(panel) + base.adj; // index can be -1 in nested sliders - issue #208 base.$items.find('.focusedLink').removeClass('focusedLink'); $(this).addClass('focusedLink'); base.$window.scrollLeft(0).scrollTop(0); if ((indx !== -1 && (indx >= base.currentPage + o.showMultiple || indx < base.currentPage))) { base.gotoPage(indx); e.preventDefault(); } }); if (o.showMultiple > 1) { if (o.showMultiple > base.pages) { o.showMultiple = base.pages; } base.adjustMultiple = (o.infiniteSlides && base.pages > 1) ? 0 : o.showMultiple - 1; } // Hide navigation & player if there is only one page base.$controls .add(base.$nav) .add(base.$startStop) .add(base.$forward) .add(base.$back)[(base.pages <= 1) ? 'hide' : 'show'](); if (base.pages > 1) { // Build/update navigation tabs base.buildNavigation(); } // Top and tail the list with 'visible' number of items, top has the last section, and tail has the first // This supports the "infinite" scrolling, also ensures any cloned elements don't duplicate an ID // Moved removeAttr before addClass otherwise IE7 ignores the addClass: http://bugs.jquery.com/ticket/9871 if (o.mode !== 'fade' && o.infiniteSlides && base.pages > 1) { base.$el.prepend(base.$items.filter(':last').clone().addClass('cloned')); // Add support for multiple sliders shown at the same time if (o.showMultiple > 1) { base.$el.append(base.$items.filter(':lt(' + o.showMultiple + ')').clone().addClass('cloned multiple')); } else { base.$el.append(base.$items.filter(':first').clone().addClass('cloned')); } base.$el.find('.cloned').each(function () { // disable all focusable elements in cloned panels to prevent shifting the panels by tabbing $(this).find('a,input,textarea,select,button,area,form').attr({ disabled: 'disabled', name: '' }); $(this).find('[id]')[$.fn.addBack ? 'addBack' : 'andSelf']().removeAttr('id'); }); } // We just added two items, time to re-cache the list, then get the dimensions of each panel base.$items = base.$el.addClass(o.mode).children().addClass('panel'); base.setDimensions(); // Set the dimensions of each panel if (o.resizeContents) { base.$items.css('width', base.width); base.$wrapper .css('width', base.getDim(base.currentPage)[0]) .add(base.$items).css('height', base.height); } else { base.$win.load(function () { // set dimensions after all images load base.setDimensions(); // make sure the outer wrapper is set properly t = base.getDim(base.currentPage); base.$wrapper.css({ width: t[0], height: t[1] }); base.setCurrentPage(base.currentPage, false); }); } if (base.currentPage > base.pages) { base.currentPage = base.pages; } base.setCurrentPage(base.currentPage, false); base.$nav.find('a').eq(base.currentPage - 1).addClass('cur'); // update current selection if (o.mode === 'fade') { t = base.$items.eq(base.currentPage - 1); if (o.resumeOnVisible) { // prevent display: none; t.css({ opacity: 1, visibility: 'visible' }) .siblings().css({ opacity: 0, visibility: 'hidden' }); } else { // allow display: none; - resets video base.$items.css('opacity', 1); t.fadeIn(0).siblings().fadeOut(0); } } }; // Creates the numbered navigation links base.buildNavigation = function () { if (o.buildNavigation && (base.pages > 1)) { var a, c, i, t, $li; base.$items.filter(':not(.cloned)').each(function (j) { $li = $('
  • '); i = j + 1; c = (i === 1 ? ' first' : '') + (i === base.pages ? ' last' : ''); a = '@'; // If a formatter function is present, use it if ($.isFunction(o.navigationFormatter)) { t = o.navigationFormatter(i, $(this)); if (typeof (t) === "string") { $li.html(a.replace(/@/g, t)); } else { $li = $('
  • ', t); } } else { $li.html(a.replace(/@/g, i)); } $li .appendTo(base.$nav) .addClass(c) .data('index', i); }); base.$nav.children('li').bind(o.clickControls, function (e) { if (!base.flag && o.enableNavigation) { // prevent running functions twice (once for click, second time for focusin) base.flag = true; setTimeout(function () { base.flag = false; }, 100); base.gotoPage($(this).data('index')); } e.preventDefault(); }); // Add navigation tab scrolling - use !! in case someone sets the size to zero if (!!o.navigationSize && o.navigationSize < base.pages) { if (!base.$controls.find('.anythingNavWindow').length) { base.$nav .before('') .after('') .wrap('
    '); } // include half of the left position to include extra width from themes like tabs-light and tabs-dark (still not perfect) base.navWidths = base.$nav.find('li').map(function () { return $(this).outerWidth(true) + Math.ceil(parseInt($(this).find('span').css('left'), 10) / 2 || 0); }).get(); base.navLeft = base.currentPage; // add 25 pixels (old IE needs more than 5) to make sure the tabs don't wrap to the next line base.$nav.width(base.navWidth(1, base.pages + 1) + 25); base.$controls.find('.anythingNavWindow') .width(base.navWidth(1, o.navigationSize + 1)).end() .find('.prev,.next').bind(o.clickControls, function (e) { if (!base.flag) { base.flag = true; setTimeout(function () { base.flag = false; }, 200); base.navWindow(base.navLeft + o.navigationSize * ($(this).is('.prev') ? -1 : 1)); } e.preventDefault(); }); } } }; base.navWidth = function (x, y) { var i, s = Math.min(x, y), e = Math.max(x, y), w = 0; for (i = s; i < e; i++) { w += base.navWidths[i - 1] || 0; } return w; }; base.navWindow = function (n) { if (!!o.navigationSize && o.navigationSize < base.pages && base.navWidths) { var p = base.pages - o.navigationSize + 1; n = (n <= 1) ? 1 : (n > 1 && n < p) ? n : p; if (n !== base.navLeft) { base.$controls.find('.anythingNavWindow').animate( { scrollLeft: base.navWidth(1, n), width: base.navWidth(n, n + o.navigationSize) }, { queue: false, duration: o.animationTime }); base.navLeft = n; } } }; // Creates the Forward/Backward buttons base.buildNextBackButtons = function () { base.$forward = $('' + o.forwardText + ''); base.$back = $('' + o.backText + ''); // Bind to the forward and back buttons base.$back.bind(o.clickBackArrow, function (e) { // prevent running functions twice (once for click, second time for swipe) if (o.enableArrows && !base.flag) { base.flag = true; setTimeout(function () { base.flag = false; }, 100); base.goBack(); } e.preventDefault(); }); base.$forward.bind(o.clickForwardArrow, function (e) { // prevent running functions twice (once for click, second time for swipe) if (o.enableArrows && !base.flag) { base.flag = true; setTimeout(function () { base.flag = false; }, 100); base.goForward(); } e.preventDefault(); }); // using tab to get to arrow links will show they have focus (outline is disabled in css) base.$back.add(base.$forward).find('a').bind('focusin focusout', function () { $(this).toggleClass('hover'); }); // Append elements to page base.$back.appendTo((o.appendBackTo && $(o.appendBackTo).length) ? $(o.appendBackTo) : base.$wrapper); base.$forward.appendTo((o.appendForwardTo && $(o.appendForwardTo).length) ? $(o.appendForwardTo) : base.$wrapper); base.arrowWidth = base.$forward.width(); // assuming the left & right arrows are the same width - used for toggle base.arrowRight = parseInt(base.$forward.css('right'), 10); base.arrowLeft = parseInt(base.$back.css('left'), 10); }; // Creates the Start/Stop button base.buildAutoPlay = function () { base.$startStop .html('' + (base.playing ? o.stopText : o.startText) + '') .bind(o.clickSlideshow, function (e) { if (o.enableStartStop) { base.startStop(!base.playing); base.makeActive(); if (base.playing && !o.autoPlayDelayed) { base.goForward(true, o.playRtl); } } e.preventDefault(); }) // show button has focus while tabbing .bind('focusin focusout', function () { $(this).toggleClass('hover'); }); }; // Adjust slider dimensions on parent element resize base.checkResize = function (stopTimer) { // checking document visibility var vis = !!(doc.hidden || doc.webkitHidden || doc.mozHidden || doc.msHidden); clearTimeout(base.resizeTimer); base.resizeTimer = setTimeout(function () { var w = base.$outer.width(), h = base.$outer[0].tagName === "BODY" ? base.$win.height() : base.$outer.height(); // base.width = width of one panel, so multiply by # of panels; outerPad is padding added for arrows. // ignore changes if window hidden if (!vis && (base.lastDim[0] !== w || base.lastDim[1] !== h)) { base.setDimensions(); // adjust panel sizes //callback for slider resize base.$el.trigger('slideshow_resized', base); // make sure page is lined up (use -1 animation time, so we can differeniate it from when animationTime = 0) base.gotoPage(base.currentPage, base.playing, null, -1); } if (typeof (stopTimer) === 'undefined') { base.checkResize(); } // increase time if page is hidden; but don't stop it completely }, vis ? 2000 : 500); }; // Set panel dimensions to either resize content or adjust panel to content base.setDimensions = function () { // reset element width & height base.$wrapper.find('.anythingWindow, .anythingBase, .panel')[$.fn.addBack ? 'addBack' : 'andSelf']().css({ width: '', height: '' }); base.width = base.$el.width(); base.height = base.$el.height(); base.outerPad = [base.$wrapper.innerWidth() - base.$wrapper.width(), base.$wrapper.innerHeight() - base.$wrapper.height()]; var w, h, c, t, edge = 0, fullsize = { width: '100%', height: '100%' }, // determine panel width pw = (o.showMultiple > 1 && o.mode === 'horizontal') ? base.width || base.$window.width() / o.showMultiple : base.$window.width(), ph = (o.showMultiple > 1 && o.mode === 'vertical') ? base.height / o.showMultiple || base.$window.height() / o.showMultiple : base.$window.height(); if (o.expand) { base.lastDim = [base.$outer.width(), base.$outer.height()]; w = base.lastDim[0] - base.outerPad[0]; h = base.lastDim[1] - base.outerPad[1]; // Rescale according to the aspectRatio if not null // We have already insured that (in init) o.aspectRatio contains a float. // make sure aspectRatio isn't infinity (divided by zero; so must be less than width, 3 might be a better number) if (o.aspectRatio && o.aspectRatio < base.width) { var arW = h * o.aspectRatio; // Really: only one of these should be adjusted therefor the else ... if if (arW < w) { w = arW; } else { var arH = w / o.aspectRatio; if (arH < h) { h = arH; } } } base.$wrapper.add(base.$window).css({ width: w, height: h }); base.height = h = (o.showMultiple > 1 && o.mode === 'vertical') ? ph : h; base.width = pw = (o.showMultiple > 1 && o.mode === 'horizontal') ? w / o.showMultiple : w; base.$items.css({ width: pw, height: ph }); } base.$items.each(function (i) { t = $(this); c = t.children(); if (o.resizeContents) { // resize panel w = base.width; h = base.height; t.css({ width: w, height: h }); if (c.length) { if (c[0].tagName === "EMBED") { c.attr(fullsize); } // needed for IE7; also c.length > 1 in IE7 if (c[0].tagName === "OBJECT") { c.find('embed').attr(fullsize); } // resize panel contents, if solitary (wrapped content or solitary image) if (c.length === 1) { c.css(fullsize); } } } else { // get panel width & height and save it if (o.mode === 'vertical') { w = t.css('display', 'inline-block').width(); t.css('display', ''); } else { w = t.width() || base.width; // if image hasn't finished loading, width will be zero, so set it to base width instead } if (c.length === 1 && w >= pw) { w = (c.width() >= pw) ? pw : c.width(); // get width of solitary child c.css('max-width', w); // set max width for all children } t.css({ width: w, height: '' }); // set width of panel h = (c.length === 1 ? c.outerHeight(true) : t.height()); // get height after setting width if (h <= base.outerPad[1]) { h = base.height; } // if height less than the outside padding, then set it to the preset height t.css('height', h); } base.panelSize[i] = [w, h, edge]; edge += (o.mode === 'vertical') ? h : w; }); // Set total width of slider base.$el.css((o.mode === 'vertical' ? 'height' : 'width'), o.mode === 'fade' ? base.width : edge); }; // get dimension of multiple panels, as needed base.getDim = function (page) { var t, i, w = base.width, h = base.height; if (base.pages < 1 || isNaN(page)) { return [w, h]; } // prevent errors when base.panelSize is empty page = (o.infiniteSlides && base.pages > 1) ? page : page - 1; i = base.panelSize[page]; if (i) { w = i[0] || w; h = i[1] || h; } if (o.showMultiple > 1) { for (i = 1; i < o.showMultiple; i++) { t = page + i; if (o.mode === 'vertical') { w = Math.max(w, base.panelSize[t][0]); h += base.panelSize[t][1]; } else { w += base.panelSize[t][0]; h = Math.max(h, base.panelSize[t][1]); } } } return [w, h]; }; base.goForward = function (autoplay, rtl) { // targetPage changes before animation so if rapidly changing pages, it will have the correct current page base.gotoPage(base[o.allowRapidChange ? 'targetPage' : 'currentPage'] + o.changeBy * (rtl ? -1 : 1), autoplay); }; base.goBack = function (autoplay) { base.gotoPage(base[o.allowRapidChange ? 'targetPage' : 'currentPage'] - o.changeBy, autoplay); }; base.gotoPage = function (page, autoplay, callback, time) { if (autoplay !== true) { autoplay = false; base.startStop(false); base.makeActive(); } // check if page is an id or class name if (/^[#|.]/.test(page) && $(page).length) { page = $(page).closest('.panel').index() + base.adj; } // rewind effect occurs here when changeBy > 1 if (o.changeBy !== 1) { var adj = base.pages - base.adjustMultiple; if (page < 1) { page = o.stopAtEnd ? 1 : (o.infiniteSlides ? base.pages + page : (o.showMultiple > 1 - page ? 1 : adj)); } if (page > base.pages) { page = o.stopAtEnd ? base.pages : (o.showMultiple > 1 - page ? 1 : page -= adj); } else if (page >= adj) { // show multiple adjustments page = adj; } } if (base.pages <= 1) { return; } // prevents animation base.$lastPage = base.$currentPage; if (typeof (page) !== "number") { page = parseInt(page, 10) || o.startPanel; base.setCurrentPage(page); } // pause YouTube videos before scrolling or prevent change if playing if (autoplay && o.isVideoPlaying(base)) { return; } if (o.stopAtEnd && !o.infiniteSlides && page > base.pages - o.showMultiple) { page = base.pages - o.showMultiple + 1; } // fixes #515 base.exactPage = page; if (page > base.pages + 1 - base.adj) { page = (!o.infiniteSlides && !o.stopAtEnd) ? 1 : base.pages; } if (page < base.adj) { page = (!o.infiniteSlides && !o.stopAtEnd) ? base.pages : 1; } if (!o.infiniteSlides) { base.exactPage = page; } // exact page used by the fx extension base.currentPage = (page > base.pages) ? base.pages : (page < 1) ? 1 : base.currentPage; base.$currentPage = base.$items.eq(base.currentPage - base.adj); base.targetPage = (page === 0) ? base.pages : (page > base.pages) ? 1 : page; base.$targetPage = base.$items.eq(base.targetPage - base.adj); time = typeof time !== 'undefined' ? time : o.animationTime; // don't trigger events when time < 0 - to prevent FX from firing multiple times on page resize if (time >= 0) { base.$el.trigger('slide_init', base); } // toggle arrows/controls only if there is time to see it - fix issue #317 if (time > 0 && o.toggleControls === true) { base.slideControls(true); } // Set visual if (o.buildNavigation) { base.setNavigation(base.targetPage); } // When autoplay isn't passed, we stop the timer if (autoplay !== true) { autoplay = false; } // Stop the slider when we reach the last page, if the option stopAtEnd is set to true if (!autoplay || (o.stopAtEnd && page === base.pages)) { base.startStop(false); } if (time >= 0) { base.$el.trigger('slide_begin', base); } // delay starting slide animation setTimeout(function (d) { var t, p, empty = true; if (o.allowRapidChange) { base.$wrapper.add(base.$el).add(base.$items).stop(true, true); } // resize slider if content size varies if (!o.resizeContents) { // animating the wrapper resize before the window prevents flickering in Firefox // don't animate the dimension if it hasn't changed - fix for issue #264 p = base.getDim(page); d = {}; // prevent animating a dimension to zero if (base.$wrapper.width() !== p[0]) { d.width = p[0] || base.width; empty = false; } if (base.$wrapper.height() !== p[1]) { d.height = p[1] || base.height; empty = false; } if (!empty) { base.$wrapper.filter(':not(:animated)').animate(d, { queue: false, duration: (time < 0 ? 0 : time), easing: o.easing }); } } if (o.mode === 'fade') { if (base.$lastPage[0] !== base.$targetPage[0]) { base.fadeIt(base.$lastPage, 0, time); base.fadeIt(base.$targetPage, 1, time, function () { base.endAnimation(page, callback, time); }); } else { base.endAnimation(page, callback, time); } } else { d = {}; d[base.dir] = -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2]; // resize width of base element (ul) if vertical & width of content varies if (o.mode === 'vertical' && !o.resizeContents) { d.width = p[0]; } // Animate Slider base.$el.filter(':not(:animated)').animate( d, { queue: false, duration: time < 0 ? 0 : time, easing: o.easing, complete: function () { base.endAnimation(page, callback, time); } } ); } }, parseInt(o.delayBeforeAnimate, 10) || 0); }; base.endAnimation = function (page, callback, time) { if (page === 0) { base.$el.css(base.dir, o.mode === 'fade' ? 0 : -base.panelSize[base.pages][2]); page = base.pages; } else if (page > base.pages) { // reset back to start position base.$el.css(base.dir, o.mode === 'fade' ? 0 : -base.panelSize[1][2]); page = 1; } base.exactPage = page; base.setCurrentPage(page, false); if (o.mode === 'fade') { // make sure non current panels are hidden (rapid slide changes) base.fadeIt(base.$items.not(':eq(' + (page - base.adj) + ')'), 0, 0); } if (!base.hovered) { base.slideControls(false); } if (o.hashTags) { base.setHash(page); } if (time >= 0) { base.$el.trigger('slide_complete', base); } // callback from external slide control: $('#slider').anythingSlider(4, function(slider){ }) if (typeof callback === 'function') { callback(base); } // Continue slideshow after a delay if (o.autoPlayLocked && !base.playing) { setTimeout(function () { base.startStop(true); // subtract out slide delay as the slideshow waits that additional time. }, o.resumeDelay - (o.autoPlayDelayed ? o.delay : 0)); } }; base.fadeIt = function (el, toOpacity, time, callback) { var f = el.filter(':not(:animated)'), t = time < 0 ? 0 : time; if (o.resumeOnVisible) { if (toOpacity === 1) { f.css('visibility', 'visible'); } f.fadeTo(t, toOpacity, function () { if (toOpacity === 0) { f.css('visibility', 'hidden'); } if ($.isFunction(callback)) { callback(); } }); } else { f[toOpacity === 0 ? 'fadeOut' : 'fadeIn'](t, callback); } }; base.setCurrentPage = function (page, move) { page = parseInt(page, 10); if (base.pages < 1 || page === 0 || isNaN(page)) { return; } if (page > base.pages + 1 - base.adj) { page = base.pages - base.adj; } if (page < base.adj) { page = 1; } // hide/show arrows based on infinite scroll mode if (o.buildArrows && !o.infiniteSlides && o.stopAtEnd) { base.$forward[page === base.pages - base.adjustMultiple ? 'addClass' : 'removeClass']('disabled'); base.$back[page === 1 ? 'addClass' : 'removeClass']('disabled'); if (page === base.pages && base.playing) { base.startStop(); } } // Only change left if move does not equal false if (!move) { var d = base.getDim(page); base.$wrapper .css({ width: d[0], height: d[1] }) .add(base.$window).scrollLeft(0).scrollTop(0); // reset in case tabbing changed this scrollLeft - probably overly redundant base.$el.css(base.dir, o.mode === 'fade' ? 0 : -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2]); } // Update local variable base.currentPage = page; base.$currentPage = base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage'); if (o.buildNavigation) { base.setNavigation(page); } }; base.setNavigation = function (page) { base.$nav .find('.cur').removeClass('cur').end() .find('a').eq(page - 1).addClass('cur'); }; base.makeActive = function () { // Set current slider as active so keyboard navigation works properly if (!base.$wrapper.hasClass('activeSlider')) { $('.activeSlider').removeClass('activeSlider'); base.$wrapper.addClass('activeSlider'); } }; // This method tries to find a hash that matches an ID and panel-X // If either found, it tries to find a matching item // If that is found as well, then it returns the page number base.gotoHash = function () { var h = win.location.hash, i = h.indexOf('&'), n = h.match(base.regex); // test for "/#/" or "/#!/" used by the jquery address plugin - $('#/') breaks jQuery if (n === null && !/^#&/.test(h) && !/#!?\//.test(h) && !/\=/.test(h)) { // #quote2&panel1-3&panel3-3 h = h.substring(0, (i >= 0 ? i : h.length)); // ensure the element is in the same slider n = ($(h).length && $(h).closest('.anythingBase')[0] === base.el) ? base.$items.index($(h).closest('.panel')) + base.adj : null; } else if (n !== null) { // #&panel1-3&panel3-3 n = (o.hashTags) ? parseInt(n[1], 10) : null; } return n; }; base.setHash = function (n) { var s = 'panel' + base.runTimes + '-', h = win.location.hash; if (typeof h !== 'undefined') { win.location.hash = (h.indexOf(s) > 0) ? h.replace(base.regex, s + n) : h + "&" + s + n; } }; // Slide controls (nav and play/stop button up or down) base.slideControls = function (toggle) { var dir = (toggle) ? 'slideDown' : 'slideUp', t1 = (toggle) ? 0 : o.animationTime, t2 = (toggle) ? o.animationTime : 0, op = (toggle) ? 1 : 0, sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden if (o.toggleControls) { base.$controls.stop(true, true).delay(t1)[dir](o.animationTime / 2).delay(t2); } if (o.buildArrows && o.toggleArrows) { if (!base.hovered && base.playing) { sign = 1; op = 0; } // don't animate arrows during slideshow base.$forward.stop(true, true).delay(t1).animate({ right: base.arrowRight + (sign * base.arrowWidth), opacity: op }, o.animationTime / 2); base.$back.stop(true, true).delay(t1).animate({ left: base.arrowLeft + (sign * base.arrowWidth), opacity: op }, o.animationTime / 2); } }; base.clearTimer = function (paused) { // Clear the timer only if it is set if (base.timer) { win.clearInterval(base.timer); if (!paused && base.slideshow) { base.$el.trigger('slideshow_stop', base); base.slideshow = false; } } }; // Pass startStop(false) to stop and startStop(true) to play base.startStop = function (playing, paused) { if (playing !== true) { playing = false; } // Default if not supplied is false base.playing = playing; if (playing && !paused) { base.$el.trigger('slideshow_start', base); base.slideshow = true; } // Toggle playing and text if (o.buildStartStop) { base.$startStop.toggleClass('playing', playing).find('span').html(playing ? o.stopText : o.startText); // add button text to title attribute if it is hidden by text-indent if (base.$startStop.find('span').css('visibility') === "hidden") { base.$startStop.addClass(o.tooltipClass).attr('title', playing ? o.stopText : o.startText); } } // Pause slideshow while video is playing if (playing) { base.clearTimer(true); // Just in case this was triggered twice in a row base.timer = win.setInterval(function () { if (!!(doc.hidden || doc.webkitHidden || doc.mozHidden || doc.msHidden)) { // stop slideshow if the page isn't visible (issue #463) if (!o.autoPlayLocked) { base.startStop(); } } else if (!o.isVideoPlaying(base)) { // prevent autoplay if video is playing base.goForward(true, o.playRtl); } else if (!o.resumeOnVideoEnd) { // stop slideshow if resume if false base.startStop(); } }, o.delay); } else { base.clearTimer(); } }; // Trigger the initialization base.init(); }; $.anythingSlider.defaults = { // Appearance theme: "default", // Theme name, add the css stylesheet manually mode: "horiz", // Set mode to "horizontal", "vertical" or "fade" (only first letter needed); replaces vertical option expand: false, // If true, the entire slider will expand to fit the parent element resizeContents: true, // If true, solitary images/objects in the panel will expand to fit the viewport // commented out as this will reduce the size of the minified version //aspectRatio : null, // Valid values: null, true, a float e.g. 1.5 (or as 3/2) or a ratio in a string e.g. '3:2' // If true calculate it from original width/height for slider element, if it is a number/ratio use that value showMultiple: false, // Set this value to a number and it will show that many slides at once easing: "swing", // Anything other than "linear" or "swing" requires the easing plugin or jQuery UI buildArrows: true, // If true, builds the forwards and backwards buttons buildNavigation: true, // If true, builds a list of anchor links to link to each panel buildStartStop: true, // ** If true, builds the start/stop button /* // commented out as this will reduce the size of the minified version appendForwardTo : null, // Append forward arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null appendBackTo : null, // Append back arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null appendControlsTo : null, // Append controls (navigation + start-stop) to a HTML element (jQuery Object, selector or HTMLNode), if not null appendNavigationTo : null, // Append navigation buttons to a HTML element (jQuery Object, selector or HTMLNode), if not null appendStartStopTo : null, // Append start-stop button to a HTML element (jQuery Object, selector or HTMLNode), if not null */ toggleArrows: false, // If true, side navigation arrows will slide out on hovering & hide @ other times toggleControls: false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times startText: "Start", // Start button text stopText: "Stop", // Stop button text forwardText: "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) backText: "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image) tooltipClass: "tooltip", // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) // Function enableArrows: true, // if false, arrows will be visible, but not clickable. enableNavigation: true, // if false, navigation links will still be visible, but not clickable. enableStartStop: true, // if false, the play/stop button will still be visible, but not clickable. Previously "enablePlay" enableKeyboard: true, // if false, keyboard arrow keys will not work for this slider. // Navigation startPanel: 1, // This sets the initial panel changeBy: 1, // Amount to go forward or back when changing panels. hashTags: true, // Should links change the hashtag in the URL? infiniteSlides: true, // if false, the slider will not wrap & not clone any panels navigationFormatter: null, // Details at the top of the file on this use (advanced use) navigationSize: false, // Set this to the maximum number of visible navigation tabs; false to disable // Slideshow options autoPlay: false, // If true, the slideshow will start running; replaces "startStopped" option autoPlayLocked: false, // If true, user changing slides will not stop the slideshow autoPlayDelayed: false, // If true, starting a slideshow will delay advancing slides; if false, the slider will immediately advance to the next slide when slideshow starts pauseOnHover: true, // If true & the slideshow is active, the slideshow will pause on hover stopAtEnd: false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false. playRtl: false, // If true, the slideshow will move right-to-left // Times delay: 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) resumeDelay: 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). animationTime: 600, // How long the slideshow transition takes (in milliseconds) delayBeforeAnimate: 0, // How long to pause slide animation before going to the desired slide (used if you want your "out" FX to show). /* // Callbacks - commented out to reduce size of the minified version - they still work onSliderResize : function(e, slider) {}, // Callback when slider resizes onBeforeInitialize : function(e, slider) {}, // Callback before the plugin initializes onInitialized : function(e, slider) {}, // Callback when the plugin finished initializing onShowStart : function(e, slider) {}, // Callback on slideshow start onShowStop : function(e, slider) {}, // Callback after slideshow stops onShowPause : function(e, slider) {}, // Callback when slideshow pauses onShowUnpause : function(e, slider) {}, // Callback when slideshow unpauses - may not trigger properly if user clicks on any controls onSlideInit : function(e, slider) {}, // Callback when slide initiates, before control animation onSlideBegin : function(e, slider) {}, // Callback before slide animates onSlideComplete : function(slider) {}, // Callback when slide completes - no event variable! */ // Interactivity clickForwardArrow: "click", // Event used to activate forward arrow functionality (e.g. add jQuery mobile's "swiperight") clickBackArrow: "click", // Event used to activate back arrow functionality (e.g. add jQuery mobile's "swipeleft") clickControls: "click focusin", // Events used to activate navigation control functionality clickSlideshow: "click", // Event used to activate slideshow play/stop button allowRapidChange: false, // If true, allow rapid changing of the active pane, instead of ignoring activity during animation // Video resumeOnVideoEnd: true, // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete resumeOnVisible: true, // If true the video will resume playing, if previously paused; if false, the video remains paused. isVideoPlaying: function (base) { return false; } // return true if video is playing or false if not - used by video extension // deprecated - use the video extension wmode option now // addWmodeToObject : "opaque" // If your slider has a video supported by the extension, the script will automatically add a wmode parameter with this setting }; $.fn.anythingSlider = function (options, callback) { return this.each(function () { var page, anySlide = $(this).data('AnythingSlider'); // initialize the slider but prevent multiple initializations if ((typeof (options)).match('object|undefined')) { if (!anySlide) { (new $.anythingSlider(this, options)); } else { anySlide.updateSlider(); } // If options is a number, process as an external link to page #: $(element).anythingSlider(#) } else if (/\d/.test(options) && !isNaN(options) && anySlide) { page = (typeof (options) === "number") ? options : parseInt($.trim(options), 10); // accepts " 2 " // ignore out of bound pages if (page >= 1 && page <= anySlide.pages) { anySlide.gotoPage(page, false, callback); // page #, autoplay, one time callback } // Accept id or class name } else if (/^[#|.]/.test(options) && $(options).length) { anySlide.gotoPage(options, false, callback); } }); }; })(jQuery, window, document);; /*! * jQuery Cookie Plugin v1.4.0 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD define(['jquery'], factory); } else if (typeof exports === 'object') { // CommonJS factory(require('jquery')); } else { // Browser globals factory(jQuery); } }(function ($) { var pluses = /\+/g; function encode(s) { return config.raw ? s : encodeURIComponent(s); } function decode(s) { return config.raw ? s : decodeURIComponent(s); } function stringifyCookieValue(value) { return encode(config.json ? JSON.stringify(value) : String(value)); } function parseCookieValue(s) { if (s.indexOf('"') === 0) { // This is a quoted cookie as according to RFC2068, unescape... s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { // Replace server-side written pluses with spaces. // If we can't decode the cookie, ignore it, it's unusable. // If we can't parse the cookie, ignore it, it's unusable. s = decodeURIComponent(s.replace(pluses, ' ')); return config.json ? JSON.parse(s) : s; } catch (e) { } } function read(s, converter) { var value = config.raw ? s : parseCookieValue(s); return $.isFunction(converter) ? converter(value) : value; } var config = $.cookie = function (key, value, options) { // Write if (value !== undefined && !$.isFunction(value)) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setTime(+t + days * 864e+5); } return (document.cookie = [ encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // Read var result = key ? undefined : {}; // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. Also prevents odd result when // calling $.cookie(). var cookies = document.cookie ? document.cookie.split('; ') : []; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = parts.join('='); if (key && key === name) { // If second argument (value) is a function it's a converter... result = read(cookie, value); break; } // Prevent storing a cookie that we couldn't decode. if (!key && (cookie = read(cookie)) !== undefined) { result[name] = cookie; } } return result; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) === undefined) { return false; } // Must not alter options, thus extending a fresh object... $.cookie(key, '', $.extend({}, options, { expires: -1 })); return !$.cookie(key); }; }));; (function ($) { if ($.shopten === undefined) $.shopten = {}; $.shopten.autocomplete = function () { }; /* * Public, $. methods */ $.extend($.shopten.autocomplete, { settings: { type: "GET", actionName: null, controllerName: null, splitIndex: -1, splitSeperator: ",", debug: false, onChoosen: function (text, value) { } }, loading: function () { init(); // do some checks otherwise the autocomplete will not work if ($.shopten.autocomplete.settings.debug && $.shopten.autocomplete.settings.actionName === "" && console) { console.log("$.shopten.autocomplete: Please add the action name to the settings"); return; } if ($.shopten.autocomplete.settings.debug && $.shopten.autocomplete.settings.controllerName === "" && console) { console.log("$.shopten.autocomplete: Please add the controller name to the settings"); return; } } }); /* * Public, $.fn methods */ $.fn.aComplete = function (settings) { this.each(function () { var $input = $(this), $hidden = $input.parent().find("input:hidden"); if ($input.length == 0) return false; init(settings); if ($hidden[0]) $.shopten.autocomplete.settings.$hidden = $hidden; $.shopten.autocomplete.loading($input); bindAutocomplete($input); }); return; }; /* * Private methods */ function init(settings) { if ($.shopten.autocomplete.settings.inited) return true; else $.shopten.autocomplete.settings.inited = true; if (settings) $.extend($.shopten.autocomplete.settings, settings); }; function bindAutocomplete($element) { $element.autocomplete({ source: function (req, add) { var searchTerm = req.term; if (searchTerm.length > 1) { $element.addClass("loading"); callAction(searchTerm, function (items) { add(items); $element.removeClass("loading"); }); } }, select: function (e, ui) { var value = ($.shopten.autocomplete.settings.splitIndex >= 0) && (ui.item.Value.indexOf($.shopten.autocomplete.settings.splitSeperator) > 0) ? $.trim(ui.item.Value.split($.shopten.autocomplete.settings.splitSeperator)[$.shopten.autocomplete.settings.splitIndex]) : $.trim(ui.item.Value); if ($.shopten.autocomplete.settings.$hidden) $.shopten.autocomplete.settings.$hidden.val(ui.item.Key); this.value = value; $.shopten.autocomplete.settings.onChoosen(value, ui.item.Key); return false; } }); // get the API var autocomplete = $element.data("ui-autocomplete"); // override the render item autocomplete._renderItem = function (ul, item) { var $li = $("
  • "), $a = $("", { href: "javascript:", text: item.Value }), $hidden = $("", { type: "hidden", value: item.Key }); var keywords = autocomplete.term.split(" ").join("|"); $a.html($a.text().replace(new RegExp("(" + keywords + ")", "gi"), "$1")); $li.data("item.autocomplete", item); return $li.append($a.append($hidden)).appendTo(ul); }; }; function callAction(searchTerm, success) { $.ajax({ type: $.shopten.autocomplete.settings.type, url: "/" + $.shopten.autocomplete.settings.controllerName + "/" + $.shopten.autocomplete.settings.actionName, data: { searchTerm: searchTerm }, contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: true, success: function (json) { var obj = [], count = 0; for (i in json) { obj[count] = { Key: i, Value: json[i] }; count++; } success(obj); }, error: function (request, code, error) { if ($.shopten.autocomplete.settings.debug && console) console.log("$.shopten.autocomplete: Error occured in callAction() \n\nFull Error: " + request.responseText); }, failure: function () { if ($.shopten.autocomplete.settings.debug && console) console.log("$.shopten.autocomplete: Failure occured in callAction()"); } }); } /* * Bindings */ $(document).on("keydown.auratel.autocomplete", "input[type='text'].ui-autocomplete-input", function (e) { var keyCode = e.keyCode || e.which; // get the first item when the user pressed enter if (keyCode === 13) { var element = $("ul.ui-autocomplete:visible li a")[0]; if (element) { var $input = $(this), $element = $(element), value = $element.text(), key = Number($element.find("input[type='hidden']").val()); if ($.shopten.autocomplete.settings.$hidden) $.shopten.autocomplete.settings.$hidden.val(key); $input.val(value); $.shopten.autocomplete.settings.onChoosen(value, key); $("ul.ui-autocomplete.ui-menu.ui-widget").hide(); return false; } } }); })(jQuery);; /** * @name Elastic * @descripton Elastic is jQuery plugin that grow and shrink your textareas automatically * @version 1.6.11 * @requires jQuery 1.2.6+ * * @author Jan Jarfalk * @author-email jan.jarfalk@unwrongest.com * @author-website http://www.unwrongest.com * * @licence MIT License - http://www.opensource.org/licenses/mit-license.php */ (function($){ jQuery.fn.extend({ elastic: function() { // We will create a div clone of the textarea // by copying these attributes from the textarea to the div. var mimics = [ 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'fontSize', 'lineHeight', 'fontFamily', 'width', 'fontWeight', 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', 'borderTopStyle', 'borderTopColor', 'borderRightStyle', 'borderRightColor', 'borderBottomStyle', 'borderBottomColor', 'borderLeftStyle', 'borderLeftColor' ]; return this.each( function() { // Elastic only works on textareas if ( this.type !== 'textarea' ) { return false; } var $textarea = jQuery(this), $twin = jQuery('
    ').css({ 'position' : 'absolute', 'display' : 'none', 'word-wrap' : 'break-word', 'white-space' :'pre-wrap' }), lineHeight = parseInt($textarea.css('line-height'),10) || parseInt($textarea.css('font-size'),'10'), minheight = parseInt($textarea.css('height'),10) || lineHeight*3, maxheight = parseInt($textarea.css('max-height'),10) || Number.MAX_VALUE, goalheight = 0; // Opera returns max-height of -1 if not set if (maxheight < 0) { maxheight = Number.MAX_VALUE; } // Append the twin to the DOM // We are going to meassure the height of this, not the textarea. $twin.appendTo($textarea.parent()); // Copy the essential styles (mimics) from the textarea to the twin var i = mimics.length; while(i--){ $twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString())); } // Updates the width of the twin. (solution for textareas with widths in percent) function setTwinWidth(){ var curatedWidth = Math.floor(parseInt($textarea.width(),10)); if($twin.width() !== curatedWidth){ $twin.css({'width': curatedWidth + 'px'}); // Update height of textarea update(true); } } // Sets a given height and overflow state on the textarea function setHeightAndOverflow(height, overflow){ var curratedHeight = Math.floor(parseInt(height,10)); if($textarea.height() !== curratedHeight){ $textarea.css({'height': curratedHeight + 'px','overflow':overflow}); } } // This function will update the height of the textarea if necessary function update(forced) { // Get curated content from the textarea. var textareaContent = $textarea.val().replace(/&/g,'&').replace(/ {2}/g, ' ').replace(/<|>/g, '>').replace(/\n/g, '
    '); // Compare curated content with curated twin. var twinContent = $twin.html().replace(/
    /ig,'
    '); if(forced || textareaContent+' ' !== twinContent){ // Add an extra white space so new rows are added when you are at the end of a row. $twin.html(textareaContent+' '); // Change textarea height if twin plus the height of one line differs more than 3 pixel from textarea height if(Math.abs($twin.height() + lineHeight - $textarea.height()) > 3){ var goalheight = $twin.height()+lineHeight; if(goalheight >= maxheight) { setHeightAndOverflow(maxheight,'auto'); } else if(goalheight <= minheight) { setHeightAndOverflow(minheight,'hidden'); } else { setHeightAndOverflow(goalheight,'hidden'); } } } } // Hide scrollbars $textarea.css({'overflow':'hidden'}); // Update textarea size on keyup, change, cut and paste $textarea.bind('keyup change cut paste', function(){ update(); }); // Update width of twin if browser or textarea is resized (solution for textareas with widths in percent) $(window).bind('resize', setTwinWidth); $textarea.bind('resize', setTwinWidth); $textarea.bind('update', update); // Compact textarea on blur $textarea.bind('blur',function(){ if($twin.height() < maxheight){ if($twin.height() > minheight) { $textarea.height($twin.height()); } else { $textarea.height(minheight); } } }); // And this line is to catch the browser paste event $textarea.bind('input paste',function(e){ setTimeout( update, 250); }); // Run update once when elastic is initialized update(); }); } }); })(jQuery);; (function (c) { var b = { init: function (e) { var f = { set_width: false, set_height: false, horizontalScroll: false, scrollInertia: 950, mouseWheel: true, mouseWheelPixels: "auto", autoDraggerLength: true, autoHideScrollbar: false, snapAmount: null, snapOffset: 0, scrollButtons: { enable: false, scrollType: "continuous", scrollSpeed: "auto", scrollAmount: 40 }, advanced: { updateOnBrowserResize: true, updateOnContentResize: false, autoExpandHorizontalScroll: false, autoScrollOnFocus: true, normalizeMouseWheelDelta: false }, contentTouchScroll: true, callbacks: { onScrollStart: function () { }, onScroll: function () { }, onTotalScroll: function () { }, onTotalScrollBack: function () { }, onTotalScrollOffset: 0, onTotalScrollBackOffset: 0, whileScrolling: function () { } }, theme: "light" }, e = c.extend(true, f, e); return this.each(function () { var m = c(this); if (e.set_width) { m.css("width", e.set_width) } if (e.set_height) { m.css("height", e.set_height) } if (!c(document).data("scrollbar-index")) { c(document).data("scrollbar-index", "1") } else { var t = parseInt(c(document).data("scrollbar-index")); c(document).data("scrollbar-index", t + 1) } m.wrapInner("
    ").addClass("scrollbar _mCS_" + c(document).data("scrollbar-index")); var g = m.children(".mCustomScrollBox"); if (e.horizontalScroll) { g.addClass("mCSB_horizontal").wrapInner("
    "); var k = g.children(".mCSB_h_wrapper"); k.wrapInner("
    ").children(".mCSB_container").css({ width: k.children().outerWidth(), position: "relative" }).unwrap() } else { g.wrapInner("
    ") } var o = g.children(".mCSB_container"); if (c.support.touch) { o.addClass("mCS_touch") } o.after("
    "); var l = g.children(".mCSB_scrollTools"), h = l.children(".mCSB_draggerContainer"), q = h.children(".mCSB_dragger"); if (e.horizontalScroll) { q.data("minDraggerWidth", q.width()) } else { q.data("minDraggerHeight", q.height()) } if (e.scrollButtons.enable) { if (e.horizontalScroll) { l.prepend("").append("") } else { l.prepend("").append("") } } g.bind("scroll", function () { if (!m.is(".mCS_disabled")) { g.scrollTop(0).scrollLeft(0) } }); m.data({ mCS_Init: true, scrollbarIndex: c(document).data("scrollbar-index"), horizontalScroll: e.horizontalScroll, scrollInertia: e.scrollInertia, scrollEasing: "mcsEaseOut", mouseWheel: e.mouseWheel, mouseWheelPixels: e.mouseWheelPixels, autoDraggerLength: e.autoDraggerLength, autoHideScrollbar: e.autoHideScrollbar, snapAmount: e.snapAmount, snapOffset: e.snapOffset, scrollButtons_enable: e.scrollButtons.enable, scrollButtons_scrollType: e.scrollButtons.scrollType, scrollButtons_scrollSpeed: e.scrollButtons.scrollSpeed, scrollButtons_scrollAmount: e.scrollButtons.scrollAmount, autoExpandHorizontalScroll: e.advanced.autoExpandHorizontalScroll, autoScrollOnFocus: e.advanced.autoScrollOnFocus, normalizeMouseWheelDelta: e.advanced.normalizeMouseWheelDelta, contentTouchScroll: e.contentTouchScroll, onScrollStart_Callback: e.callbacks.onScrollStart, onScroll_Callback: e.callbacks.onScroll, onTotalScroll_Callback: e.callbacks.onTotalScroll, onTotalScrollBack_Callback: e.callbacks.onTotalScrollBack, onTotalScroll_Offset: e.callbacks.onTotalScrollOffset, onTotalScrollBack_Offset: e.callbacks.onTotalScrollBackOffset, whileScrolling_Callback: e.callbacks.whileScrolling, bindEvent_scrollbar_drag: false, bindEvent_content_touch: false, bindEvent_scrollbar_click: false, bindEvent_mousewheel: false, bindEvent_buttonsContinuous_y: false, bindEvent_buttonsContinuous_x: false, bindEvent_buttonsPixels_y: false, bindEvent_buttonsPixels_x: false, bindEvent_focusin: false, bindEvent_autoHideScrollbar: false, mCSB_buttonScrollRight: false, mCSB_buttonScrollLeft: false, mCSB_buttonScrollDown: false, mCSB_buttonScrollUp: false }); if (e.horizontalScroll) { if (m.css("max-width") !== "none") { if (!e.advanced.updateOnContentResize) { e.advanced.updateOnContentResize = true } } } else { if (m.css("max-height") !== "none") { var s = false, r = parseInt(m.css("max-height")); if (m.css("max-height").indexOf("%") >= 0) { s = r, r = m.parent().height() * s / 100 } m.css("overflow", "hidden"); g.css("max-height", r) } } m.scrollbar("update"); if (e.advanced.updateOnBrowserResize) { var i, j = c(window).width(), u = c(window).height(); c(window).bind("resize." + m.data("scrollbarIndex"), function () { if (i) { clearTimeout(i) } i = setTimeout(function () { if (!m.is(".mCS_disabled") && !m.is(".mCS_destroyed")) { var w = c(window).width(), v = c(window).height(); if (j !== w || u !== v) { if (m.css("max-height") !== "none" && s) { g.css("max-height", m.parent().height() * s / 100) } m.scrollbar("update"); j = w; u = v } } }, 150) }) } if (e.advanced.updateOnContentResize) { var p; if (e.horizontalScroll) { var n = o.outerWidth() } else { var n = o.outerHeight() } p = setInterval(function () { if (e.horizontalScroll) { if (e.advanced.autoExpandHorizontalScroll) { o.css({ position: "absolute", width: "auto" }).wrap("
    ").css({ width: o.outerWidth(), position: "relative" }).unwrap() } var v = o.outerWidth() } else { var v = o.outerHeight() } if (v != n) { m.scrollbar("update"); n = v } }, 300) } }) }, update: function () { var n = c(this), k = n.children(".mCustomScrollBox"), q = k.children(".mCSB_container"); q.removeClass("mCS_no_scrollbar"); n.removeClass("mCS_disabled mCS_destroyed"); k.scrollTop(0).scrollLeft(0); var y = k.children(".mCSB_scrollTools"), o = y.children(".mCSB_draggerContainer"), m = o.children(".mCSB_dragger"); if (n.data("horizontalScroll")) { var A = y.children(".mCSB_buttonLeft"), t = y.children(".mCSB_buttonRight"), f = k.width(); if (n.data("autoExpandHorizontalScroll")) { q.css({ position: "absolute", width: "auto" }).wrap("
    ").css({ width: q.outerWidth(), position: "relative" }).unwrap() } var z = q.outerWidth() } else { var w = y.children(".mCSB_buttonUp"), g = y.children(".mCSB_buttonDown"), r = k.height(), i = q.outerHeight() } if (i > r && !n.data("horizontalScroll")) { y.css("display", "block"); var s = o.height(); if (n.data("autoDraggerLength")) { var u = Math.round(r / i * s), l = m.data("minDraggerHeight"); if (u <= l) { m.css({ height: l }) } else { if (u >= s - 10) { var p = s - 10; m.css({ height: p }) } else { m.css({ height: u }) } } m.children(".mCSB_dragger_bar").css({ "line-height": m.height() + "px" }) } var B = m.height(), x = (i - r) / (s - B); n.data("scrollAmount", x).scrollbar("scrolling", k, q, o, m, w, g, A, t); var D = Math.abs(q.position().top); n.scrollbar("scrollTo", D, { scrollInertia: 0, trigger: "internal" }) } else { if (z > f && n.data("horizontalScroll")) { y.css("display", "block"); var h = o.width(); if (n.data("autoDraggerLength")) { var j = Math.round(f / z * h), C = m.data("minDraggerWidth"); if (j <= C) { m.css({ width: C }) } else { if (j >= h - 10) { var e = h - 10; m.css({ width: e }) } else { m.css({ width: j }) } } } var v = m.width(), x = (z - f) / (h - v); n.data("scrollAmount", x).scrollbar("scrolling", k, q, o, m, w, g, A, t); var D = Math.abs(q.position().left); n.scrollbar("scrollTo", D, { scrollInertia: 0, trigger: "internal" }) } else { k.unbind("mousewheel focusin"); if (n.data("horizontalScroll")) { m.add(q).css("left", 0) } else { m.add(q).css("top", 0) } y.css("display", "none"); q.addClass("mCS_no_scrollbar"); n.data({ bindEvent_mousewheel: false, bindEvent_focusin: false }) } } }, scrolling: function (h, p, m, j, w, e, A, v) { var k = c(this); if (!k.data("bindEvent_scrollbar_drag")) { var n, o; if (c.support.msPointer) { j.bind("MSPointerDown", function (H) { H.preventDefault(); k.data({ on_drag: true }); j.addClass("mCSB_dragger_onDrag"); var G = c(this), J = G.offset(), F = H.originalEvent.pageX - J.left, I = H.originalEvent.pageY - J.top; if (F < G.width() && F > 0 && I < G.height() && I > 0) { n = I; o = F } }); c(document).bind("MSPointerMove." + k.data("scrollbarIndex"), function (H) { H.preventDefault(); if (k.data("on_drag")) { var G = j, J = G.offset(), F = H.originalEvent.pageX - J.left, I = H.originalEvent.pageY - J.top; D(n, o, I, F) } }).bind("MSPointerUp." + k.data("scrollbarIndex"), function (x) { k.data({ on_drag: false }); j.removeClass("mCSB_dragger_onDrag") }) } else { j.bind("mousedown touchstart", function (H) { H.preventDefault(); H.stopImmediatePropagation(); var G = c(this), K = G.offset(), F, J; if (H.type === "touchstart") { var I = H.originalEvent.touches[0] || H.originalEvent.changedTouches[0]; F = I.pageX - K.left; J = I.pageY - K.top } else { k.data({ on_drag: true }); j.addClass("mCSB_dragger_onDrag"); F = H.pageX - K.left; J = H.pageY - K.top } if (F < G.width() && F > 0 && J < G.height() && J > 0) { n = J; o = F } }).bind("touchmove", function (H) { H.preventDefault(); H.stopImmediatePropagation(); var K = H.originalEvent.touches[0] || H.originalEvent.changedTouches[0], G = c(this), J = G.offset(), F = K.pageX - J.left, I = K.pageY - J.top; D(n, o, I, F) }); c(document).bind("mousemove." + k.data("scrollbarIndex"), function (H) { if (k.data("on_drag")) { var G = j, J = G.offset(), F = H.pageX - J.left, I = H.pageY - J.top; D(n, o, I, F) } }).bind("mouseup." + k.data("scrollbarIndex"), function (x) { k.data({ on_drag: false }); j.removeClass("mCSB_dragger_onDrag") }) } k.data({ bindEvent_scrollbar_drag: true }) } function D(G, H, I, F) { if (k.data("horizontalScroll")) { k.scrollbar("scrollTo", (j.position().left - (H)) + F, { moveDragger: true, trigger: "internal" }) } else { k.scrollbar("scrollTo", (j.position().top - (G)) + I, { moveDragger: true, trigger: "internal" }) } } if (c.support.touch && k.data("contentTouchScroll")) { if (!k.data("bindEvent_content_touch")) { var l, B, r, s, u, C, E; p.bind("touchstart", function (x) { x.stopImmediatePropagation(); l = x.originalEvent.touches[0] || x.originalEvent.changedTouches[0]; B = c(this); r = B.offset(); u = l.pageX - r.left; s = l.pageY - r.top; C = s; E = u }); p.bind("touchmove", function (x) { x.preventDefault(); x.stopImmediatePropagation(); l = x.originalEvent.touches[0] || x.originalEvent.changedTouches[0]; B = c(this).parent(); r = B.offset(); u = l.pageX - r.left; s = l.pageY - r.top; if (k.data("horizontalScroll")) { k.scrollbar("scrollTo", E - u, { trigger: "internal" }) } else { k.scrollbar("scrollTo", C - s, { trigger: "internal" }) } }) } } if (!k.data("bindEvent_scrollbar_click")) { m.bind("click", function (F) { var x = (F.pageY - m.offset().top) * k.data("scrollAmount"), y = c(F.target); if (k.data("horizontalScroll")) { x = (F.pageX - m.offset().left) * k.data("scrollAmount") } if (y.hasClass("mCSB_draggerContainer") || y.hasClass("mCSB_draggerRail")) { k.scrollbar("scrollTo", x, { trigger: "internal", scrollEasing: "draggerRailEase" }) } }); k.data({ bindEvent_scrollbar_click: true }) } if (k.data("mouseWheel")) { if (!k.data("bindEvent_mousewheel")) { h.bind("mousewheel", function (H, J) { var G, F = k.data("mouseWheelPixels"), x = Math.abs(p.position().top), I = j.position().top, y = m.height() - j.height(); if (k.data("normalizeMouseWheelDelta")) { if (J < 0) { J = -1 } else { J = 1 } } if (F === "auto") { F = 100 + Math.round(k.data("scrollAmount") / 2) } if (k.data("horizontalScroll")) { I = j.position().left; y = m.width() - j.width(); x = Math.abs(p.position().left) } if ((J > 0 && I !== 0) || (J < 0 && I !== y)) { H.preventDefault(); H.stopImmediatePropagation() } G = x - (J * F); k.scrollbar("scrollTo", G, { trigger: "internal" }) }); k.data({ bindEvent_mousewheel: true }) } } if (k.data("scrollButtons_enable")) { if (k.data("scrollButtons_scrollType") === "pixels") { if (k.data("horizontalScroll")) { v.add(A).unbind("mousedown touchstart MSPointerDown mouseup MSPointerUp mouseout MSPointerOut touchend", i, g); k.data({ bindEvent_buttonsContinuous_x: false }); if (!k.data("bindEvent_buttonsPixels_x")) { v.bind("click", function (x) { x.preventDefault(); q(Math.abs(p.position().left) + k.data("scrollButtons_scrollAmount")) }); A.bind("click", function (x) { x.preventDefault(); q(Math.abs(p.position().left) - k.data("scrollButtons_scrollAmount")) }); k.data({ bindEvent_buttonsPixels_x: true }) } } else { e.add(w).unbind("mousedown touchstart MSPointerDown mouseup MSPointerUp mouseout MSPointerOut touchend", i, g); k.data({ bindEvent_buttonsContinuous_y: false }); if (!k.data("bindEvent_buttonsPixels_y")) { e.bind("click", function (x) { x.preventDefault(); q(Math.abs(p.position().top) + k.data("scrollButtons_scrollAmount")) }); w.bind("click", function (x) { x.preventDefault(); q(Math.abs(p.position().top) - k.data("scrollButtons_scrollAmount")) }); k.data({ bindEvent_buttonsPixels_y: true }) } } function q(x) { if (!j.data("preventAction")) { j.data("preventAction", true); k.scrollbar("scrollTo", x, { trigger: "internal" }) } } } else { if (k.data("horizontalScroll")) { v.add(A).unbind("click"); k.data({ bindEvent_buttonsPixels_x: false }); if (!k.data("bindEvent_buttonsContinuous_x")) { v.bind("mousedown touchstart MSPointerDown", function (y) { y.preventDefault(); var x = z(); k.data({ mCSB_buttonScrollRight: setInterval(function () { k.scrollbar("scrollTo", Math.abs(p.position().left) + x, { trigger: "internal", scrollEasing: "easeOutCirc" }) }, 17) }) }); var i = function (x) { x.preventDefault(); clearInterval(k.data("mCSB_buttonScrollRight")) }; v.bind("mouseup touchend MSPointerUp mouseout MSPointerOut", i); A.bind("mousedown touchstart MSPointerDown", function (y) { y.preventDefault(); var x = z(); k.data({ mCSB_buttonScrollLeft: setInterval(function () { k.scrollbar("scrollTo", Math.abs(p.position().left) - x, { trigger: "internal", scrollEasing: "easeOutCirc" }) }, 17) }) }); var g = function (x) { x.preventDefault(); clearInterval(k.data("mCSB_buttonScrollLeft")) }; A.bind("mouseup touchend MSPointerUp mouseout MSPointerOut", g); k.data({ bindEvent_buttonsContinuous_x: true }) } } else { e.add(w).unbind("click"); k.data({ bindEvent_buttonsPixels_y: false }); if (!k.data("bindEvent_buttonsContinuous_y")) { e.bind("mousedown touchstart MSPointerDown", function (y) { y.preventDefault(); var x = z(); k.data({ mCSB_buttonScrollDown: setInterval(function () { k.scrollbar("scrollTo", Math.abs(p.position().top) + x, { trigger: "internal", scrollEasing: "easeOutCirc" }) }, 17) }) }); var t = function (x) { x.preventDefault(); clearInterval(k.data("mCSB_buttonScrollDown")) }; e.bind("mouseup touchend MSPointerUp mouseout MSPointerOut", t); w.bind("mousedown touchstart MSPointerDown", function (y) { y.preventDefault(); var x = z(); k.data({ mCSB_buttonScrollUp: setInterval(function () { k.scrollbar("scrollTo", Math.abs(p.position().top) - x, { trigger: "internal", scrollEasing: "easeOutCirc" }) }, 17) }) }); var f = function (x) { x.preventDefault(); clearInterval(k.data("mCSB_buttonScrollUp")) }; w.bind("mouseup touchend MSPointerUp mouseout MSPointerOut", f); k.data({ bindEvent_buttonsContinuous_y: true }) } } function z() { var x = k.data("scrollButtons_scrollSpeed"); if (k.data("scrollButtons_scrollSpeed") === "auto") { x = Math.round((k.data("scrollInertia") + 100) / 40) } return x } } } if (k.data("autoScrollOnFocus")) { if (!k.data("bindEvent_focusin")) { h.bind("focusin", function () { h.scrollTop(0).scrollLeft(0); var x = c(document.activeElement); if (x.is("input,textarea,select,button,a[tabindex],area,object")) { var G = p.position().top, y = x.position().top, F = h.height() - x.outerHeight(); if (k.data("horizontalScroll")) { G = p.position().left; y = x.position().left; F = h.width() - x.outerWidth() } if (G + y < 0 || G + y > F) { k.scrollbar("scrollTo", y, { trigger: "internal" }) } } }); k.data({ bindEvent_focusin: true }) } } if (k.data("autoHideScrollbar")) { if (!k.data("bindEvent_autoHideScrollbar")) { h.bind("mouseenter", function (x) { h.addClass("mCS-mouse-over"); d.showScrollbar.call(h.children(".mCSB_scrollTools")) }).bind("mouseleave touchend", function (x) { h.removeClass("mCS-mouse-over"); if (x.type === "mouseleave") { d.hideScrollbar.call(h.children(".mCSB_scrollTools")) } }); k.data({ bindEvent_autoHideScrollbar: true }) } } }, scrollTo: function (e, f) { var i = c(this), o = { moveDragger: false, trigger: "external", callbacks: true, scrollInertia: i.data("scrollInertia"), scrollEasing: i.data("scrollEasing") }, f = c.extend(o, f), p, g = i.children(".mCustomScrollBox"), k = g.children(".mCSB_container"), r = g.children(".mCSB_scrollTools"), j = r.children(".mCSB_draggerContainer"), h = j.children(".mCSB_dragger"), t = draggerSpeed = f.scrollInertia, q, s, m, l; if (!k.hasClass("mCS_no_scrollbar")) { i.data({ mCS_trigger: f.trigger }); if (i.data("mCS_Init")) { f.callbacks = false } if (e || e === 0) { if (typeof (e) === "number") { if (f.moveDragger) { p = e; if (i.data("horizontalScroll")) { e = h.position().left * i.data("scrollAmount") } else { e = h.position().top * i.data("scrollAmount") } draggerSpeed = 0 } else { p = e / i.data("scrollAmount") } } else { if (typeof (e) === "string") { var v; if (e === "top") { v = 0 } else { if (e === "bottom" && !i.data("horizontalScroll")) { v = k.outerHeight() - g.height() } else { if (e === "left") { v = 0 } else { if (e === "right" && i.data("horizontalScroll")) { v = k.outerWidth() - g.width() } else { if (e === "first") { v = i.find(".mCSB_container").find(":first") } else { if (e === "last") { v = i.find(".mCSB_container").find(":last") } else { v = i.find(e) } } } } } } if (v.length === 1) { if (i.data("horizontalScroll")) { e = v.position().left } else { e = v.position().top } p = e / i.data("scrollAmount") } else { p = e = v } } } if (i.data("horizontalScroll")) { if (i.data("onTotalScrollBack_Offset")) { s = -i.data("onTotalScrollBack_Offset") } if (i.data("onTotalScroll_Offset")) { l = g.width() - k.outerWidth() + i.data("onTotalScroll_Offset") } if (p < 0) { p = e = 0; clearInterval(i.data("mCSB_buttonScrollLeft")); if (!s) { q = true } } else { if (p >= j.width() - h.width()) { p = j.width() - h.width(); e = g.width() - k.outerWidth(); clearInterval(i.data("mCSB_buttonScrollRight")); if (!l) { m = true } } else { e = -e } } var n = i.data("snapAmount"); if (n) { e = Math.round(e / n) * n - i.data("snapOffset") } d.mTweenAxis.call(this, h[0], "left", Math.round(p), draggerSpeed, f.scrollEasing); d.mTweenAxis.call(this, k[0], "left", Math.round(e), t, f.scrollEasing, { onStart: function () { if (f.callbacks && !i.data("mCS_tweenRunning")) { u("onScrollStart") } if (i.data("autoHideScrollbar")) { d.showScrollbar.call(r) } }, onUpdate: function () { if (f.callbacks) { u("whileScrolling") } }, onComplete: function () { if (f.callbacks) { u("onScroll"); if (q || (s && k.position().left >= s)) { u("onTotalScrollBack") } if (m || (l && k.position().left <= l)) { u("onTotalScroll") } } h.data("preventAction", false); i.data("mCS_tweenRunning", false); if (i.data("autoHideScrollbar")) { if (!g.hasClass("mCS-mouse-over")) { d.hideScrollbar.call(r) } } } }) } else { if (i.data("onTotalScrollBack_Offset")) { s = -i.data("onTotalScrollBack_Offset") } if (i.data("onTotalScroll_Offset")) { l = g.height() - k.outerHeight() + i.data("onTotalScroll_Offset") } if (p < 0) { p = e = 0; clearInterval(i.data("mCSB_buttonScrollUp")); if (!s) { q = true } } else { if (p >= j.height() - h.height()) { p = j.height() - h.height(); e = g.height() - k.outerHeight(); clearInterval(i.data("mCSB_buttonScrollDown")); if (!l) { m = true } } else { e = -e } } var n = i.data("snapAmount"); if (n) { e = Math.round(e / n) * n - i.data("snapOffset") } d.mTweenAxis.call(this, h[0], "top", Math.round(p), draggerSpeed, f.scrollEasing); d.mTweenAxis.call(this, k[0], "top", Math.round(e), t, f.scrollEasing, { onStart: function () { if (f.callbacks && !i.data("mCS_tweenRunning")) { u("onScrollStart") } if (i.data("autoHideScrollbar")) { d.showScrollbar.call(r) } }, onUpdate: function () { if (f.callbacks) { u("whileScrolling") } }, onComplete: function () { if (f.callbacks) { u("onScroll"); if (q || (s && k.position().top >= s)) { u("onTotalScrollBack") } if (m || (l && k.position().top <= l)) { u("onTotalScroll") } } h.data("preventAction", false); i.data("mCS_tweenRunning", false); if (i.data("autoHideScrollbar")) { if (!g.hasClass("mCS-mouse-over")) { d.hideScrollbar.call(r) } } } }) } if (i.data("mCS_Init")) { i.data({ mCS_Init: false }) } } } function u(w) { this.mcs = { top: k.position().top, left: k.position().left, draggerTop: h.position().top, draggerLeft: h.position().left, topPct: Math.round((100 * Math.abs(k.position().top)) / Math.abs(k.outerHeight() - g.height())), leftPct: Math.round((100 * Math.abs(k.position().left)) / Math.abs(k.outerWidth() - g.width())) }; switch (w) { case "onScrollStart": i.data("mCS_tweenRunning", true).data("onScrollStart_Callback").call(i, this.mcs); break; case "whileScrolling": i.data("whileScrolling_Callback").call(i, this.mcs); break; case "onScroll": i.data("onScroll_Callback").call(i, this.mcs); break; case "onTotalScrollBack": i.data("onTotalScrollBack_Callback").call(i, this.mcs); break; case "onTotalScroll": i.data("onTotalScroll_Callback").call(i, this.mcs); break } } }, stop: function () { var g = c(this), e = g.children().children(".mCSB_container"), f = g.children().children().children().children(".mCSB_dragger"); d.mTweenAxisStop.call(this, e[0]); d.mTweenAxisStop.call(this, f[0]) }, disable: function (e) { var j = c(this), f = j.children(".mCustomScrollBox"), h = f.children(".mCSB_container"), g = f.children(".mCSB_scrollTools"), i = g.children().children(".mCSB_dragger"); f.unbind("mousewheel focusin mouseenter mouseleave touchend"); h.unbind("touchstart touchmove"); if (e) { if (j.data("horizontalScroll")) { i.add(h).css("left", 0) } else { i.add(h).css("top", 0) } } g.css("display", "none"); h.addClass("mCS_no_scrollbar"); j.data({ bindEvent_mousewheel: false, bindEvent_focusin: false, bindEvent_content_touch: false, bindEvent_autoHideScrollbar: false }).addClass("mCS_disabled") }, destroy: function () { var e = c(this); e.removeClass("scrollbar _mCS_" + e.data("scrollbarIndex")).addClass("mCS_destroyed").children().children(".mCSB_container").unwrap().children().unwrap().siblings(".mCSB_scrollTools").remove(); c(document).unbind("mousemove." + e.data("scrollbarIndex") + " mouseup." + e.data("scrollbarIndex") + " MSPointerMove." + e.data("scrollbarIndex") + " MSPointerUp." + e.data("scrollbarIndex")); c(window).unbind("resize." + e.data("scrollbarIndex")) } }, d = { showScrollbar: function () { this.stop().animate({ opacity: 1 }, "fast") }, hideScrollbar: function () { this.stop().animate({ opacity: 0 }, "fast") }, mTweenAxis: function (g, i, h, f, o, y) { var y = y || {}, v = y.onStart || function () { }, p = y.onUpdate || function () { }, w = y.onComplete || function () { }; var n = t(), l, j = 0, r = g.offsetTop, s = g.style; if (i === "left") { r = g.offsetLeft } var m = h - r; q(); e(); function t() { if (window.performance && window.performance.now) { return window.performance.now() } else { if (window.performance && window.performance.webkitNow) { return window.performance.webkitNow() } else { if (Date.now) { return Date.now() } else { return new Date().getTime() } } } } function x() { if (!j) { v.call() } j = t() - n; u(); if (j >= g._time) { g._time = (j > g._time) ? j + l - (j - g._time) : j + l - 1; if (g._time < j + 1) { g._time = j + 1 } } if (g._time < f) { g._id = _request(x) } else { w.call() } } function u() { if (f > 0) { g.currVal = k(g._time, r, m, f, o); s[i] = Math.round(g.currVal) + "px" } else { s[i] = h + "px" } p.call() } function e() { l = 1000 / 60; g._time = j + l; _request = (!window.requestAnimationFrame) ? function (z) { u(); return setTimeout(z, 0.01) } : window.requestAnimationFrame; g._id = _request(x) } function q() { if (g._id == null) { return } if (!window.requestAnimationFrame) { clearTimeout(g._id) } else { window.cancelAnimationFrame(g._id) } g._id = null } function k(B, A, F, E, C) { switch (C) { case "linear": return F * B / E + A; break; case "easeOutQuad": B /= E; return -F * B * (B - 2) + A; break; case "easeInOutQuad": B /= E / 2; if (B < 1) { return F / 2 * B * B + A } B--; return -F / 2 * (B * (B - 2) - 1) + A; break; case "easeOutCubic": B /= E; B--; return F * (B * B * B + 1) + A; break; case "easeOutQuart": B /= E; B--; return -F * (B * B * B * B - 1) + A; break; case "easeOutQuint": B /= E; B--; return F * (B * B * B * B * B + 1) + A; break; case "easeOutCirc": B /= E; B--; return F * Math.sqrt(1 - B * B) + A; break; case "easeOutSine": return F * Math.sin(B / E * (Math.PI / 2)) + A; break; case "easeOutExpo": return F * (-Math.pow(2, -10 * B / E) + 1) + A; break; case "mcsEaseOut": var D = (B /= E) * B, z = D * B; return A + F * (0.499999999999997 * z * D + -2.5 * D * D + 5.5 * z + -6.5 * D + 4 * B); break; case "draggerRailEase": B /= E / 2; if (B < 1) { return F / 2 * B * B * B + A } B -= 2; return F / 2 * (B * B * B + 2) + A; break } } }, mTweenAxisStop: function (e) { if (e._id == null) { return } if (!window.requestAnimationFrame) { clearTimeout(e._id) } else { window.cancelAnimationFrame(e._id) } e._id = null }, rafPolyfill: function () { var f = ["ms", "moz", "webkit", "o"], e = f.length; while (--e > -1 && !window.requestAnimationFrame) { window.requestAnimationFrame = window[f[e] + "RequestAnimationFrame"]; window.cancelAnimationFrame = window[f[e] + "CancelAnimationFrame"] || window[f[e] + "CancelRequestAnimationFrame"] } } }; d.rafPolyfill.call(); c.support.touch = !!("ontouchstart" in window); c.support.msPointer = window.navigator.msPointerEnabled; var a = ("https:" == document.location.protocol) ? "https:" : "http:"; c.event.special.mousewheel || document.write('