/* Minification failed. Returning unminified contents. (21375,15-16): run-time error JS1010: Expected identifier: . (21375,15-16): run-time error JS1195: Expected expression: . */ /*! * jQuery JavaScript Library v1.8.3 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time) */ (function (window, undefined) { var // A central reference to the root jQuery(document) rootjQuery, // The deferred used on DOM ready readyList, // Use the correct document accordingly with window argument (sandbox) document = window.document, location = window.location, navigator = window.navigator, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, // Save a reference to some core methods core_push = Array.prototype.push, core_slice = Array.prototype.slice, core_indexOf = Array.prototype.indexOf, core_toString = Object.prototype.toString, core_hasOwn = Object.prototype.hasOwnProperty, core_trim = String.prototype.trim, // Define a local copy of jQuery jQuery = function (selector, context) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init(selector, context, rootjQuery); }, // Used for matching numbers core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, // Used for detecting and trimming whitespace core_rnotwhite = /\S/, core_rspace = /\s+/, // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // A simple way to check for HTML strings // Prioritize #id over to avoid XSS via location.hash (#9521) rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function (all, letter) { return (letter + "").toUpperCase(); }, // The ready event handler and self cleanup method DOMContentLoaded = function () { if (document.addEventListener) { document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false); jQuery.ready(); } else if (document.readyState === "complete") { // we're here because readyState === "complete" in oldIE // which is good enough for us to call the dom ready! document.detachEvent("onreadystatechange", DOMContentLoaded); jQuery.ready(); } }, // [[Class]] -> type pairs class2type = {}; jQuery.fn = jQuery.prototype = { constructor: jQuery, init: function (selector, context, rootjQuery) { var match, elem, ret, doc; // Handle $(""), $(null), $(undefined), $(false) if (!selector) { return this; } // Handle $(DOMElement) if (selector.nodeType) { this.context = this[0] = selector; this.length = 1; return this; } // Handle HTML strings if (typeof selector === "string") { if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [null, selector, null]; } else { match = rquickExpr.exec(selector); } // Match html or make sure no context is specified for #id if (match && (match[1] || !context)) { // HANDLE: $(html) -> $(array) if (match[1]) { context = context instanceof jQuery ? context[0] : context; doc = (context && context.nodeType ? context.ownerDocument || context : document); // scripts is true for back-compat selector = jQuery.parseHTML(match[1], doc, true); if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { this.attr.call(selector, context, true); } return jQuery.merge(this, selector); // HANDLE: $(#id) } else { elem = document.getElementById(match[2]); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if (elem && elem.parentNode) { // Handle the case where IE and Opera return items // by name instead of ID if (elem.id !== match[2]) { return rootjQuery.find(selector); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if (!context || context.jquery) { return (context || rootjQuery).find(selector); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor(context).find(selector); } // HANDLE: $(function) // Shortcut for document ready } else if (jQuery.isFunction(selector)) { return rootjQuery.ready(selector); } if (selector.selector !== undefined) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray(selector, this); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.8.3", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function () { return this.length; }, toArray: function () { return core_slice.call(this); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function (num) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object (num < 0 ? this[this.length + num] : this[num]); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function (elems, name, selector) { // Build a new jQuery matched element set var ret = jQuery.merge(this.constructor(), elems); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if (name === "find") { ret.selector = this.selector + (this.selector ? " " : "") + selector; } else if (name) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function (callback, args) { return jQuery.each(this, callback, args); }, ready: function (fn) { // Add the callback jQuery.ready.promise().done(fn); return this; }, eq: function (i) { i = +i; return i === -1 ? this.slice(i) : this.slice(i, i + 1); }, first: function () { return this.eq(0); }, last: function () { return this.eq(-1); }, slice: function () { return this.pushStack(core_slice.apply(this, arguments), "slice", core_slice.call(arguments).join(",")); }, map: function (callback) { return this.pushStack(jQuery.map(this, function (elem, i) { return callback.call(elem, i, elem); })); }, end: function () { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: core_push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function () { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if (typeof target === "boolean") { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if (typeof target !== "object" && !jQuery.isFunction(target)) { target = {}; } // extend jQuery itself if only one argument is passed if (length === i) { target = this; --i; } for (; i < length; i++) { // Only deal with non-null/undefined values if ((options = arguments[i]) != null) { // Extend the base object for (name in options) { src = target[name]; copy = options[name]; // Prevent never-ending loop if (target === copy) { continue; } // Recurse if we're merging plain objects or arrays if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[name] = jQuery.extend(deep, clone, copy); // Don't bring in undefined values } else if (copy !== undefined) { target[name] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function (deep) { if (window.$ === jQuery) { window.$ = _$; } if (deep && window.jQuery === jQuery) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function (hold) { if (hold) { jQuery.readyWait++; } else { jQuery.ready(true); } }, // Handle when the DOM is ready ready: function (wait) { // Abort if there are pending holds or we're already ready if (wait === true ? --jQuery.readyWait : jQuery.isReady) { return; } // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if (!document.body) { return setTimeout(jQuery.ready, 1); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if (wait !== true && --jQuery.readyWait > 0) { return; } // If there are functions bound, to execute readyList.resolveWith(document, [jQuery]); // Trigger any bound ready events if (jQuery.fn.trigger) { jQuery(document).trigger("ready").off("ready"); } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function (obj) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function (obj) { return jQuery.type(obj) === "array"; }, isWindow: function (obj) { return obj != null && obj == obj.window; }, isNumeric: function (obj) { return !isNaN(parseFloat(obj)) && isFinite(obj); }, type: function (obj) { return obj == null ? String(obj) : class2type[core_toString.call(obj)] || "object"; }, isPlainObject: function (obj) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) { return false; } try { // Not own constructor property must be Object if (obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { return false; } } catch (e) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for (key in obj) { } return key === undefined || core_hasOwn.call(obj, key); }, isEmptyObject: function (obj) { var name; for (name in obj) { return false; } return true; }, error: function (msg) { throw new Error(msg); }, // data: string of html // context (optional): If specified, the fragment will be created in this context, defaults to document // scripts (optional): If true, will include scripts passed in the html string parseHTML: function (data, context, scripts) { var parsed; if (!data || typeof data !== "string") { return null; } if (typeof context === "boolean") { scripts = context; context = 0; } context = context || document; // Single tag if ((parsed = rsingleTag.exec(data))) { return [context.createElement(parsed[1])]; } parsed = jQuery.buildFragment([data], context, scripts ? null : []); return jQuery.merge([], (parsed.cacheable ? jQuery.clone(parsed.fragment) : parsed.fragment).childNodes); }, parseJSON: function (data) { if (!data || typeof data !== "string") { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim(data); // Attempt to parse using the native JSON parser first if (window.JSON && window.JSON.parse) { return window.JSON.parse(data); } // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if (rvalidchars.test(data.replace(rvalidescape, "@") .replace(rvalidtokens, "]") .replace(rvalidbraces, ""))) { return (new Function("return " + data))(); } jQuery.error("Invalid JSON: " + data); }, // Cross-browser xml parsing parseXML: function (data) { var xml, tmp; if (!data || typeof data !== "string") { return null; } try { if (window.DOMParser) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString(data, "text/xml"); } else { // IE xml = new ActiveXObject("Microsoft.XMLDOM"); xml.async = "false"; xml.loadXML(data); } } catch (e) { xml = undefined; } if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) { jQuery.error("Invalid XML: " + data); } return xml; }, noop: function () { }, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function (data) { if (data && core_rnotwhite.test(data)) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox (window.execScript || function (data) { window["eval"].call(window, data); })(data); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function (string) { return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); }, nodeName: function (elem, name) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function (obj, callback, args) { var name, i = 0, length = obj.length, isObj = length === undefined || jQuery.isFunction(obj); if (args) { if (isObj) { for (name in obj) { if (callback.apply(obj[name], args) === false) { break; } } } else { for (; i < length;) { if (callback.apply(obj[i++], args) === false) { break; } } } // A special, fast, case for the most common use of each } else { if (isObj) { for (name in obj) { if (callback.call(obj[name], name, obj[name]) === false) { break; } } } else { for (; i < length;) { if (callback.call(obj[i], i, obj[i++]) === false) { break; } } } } return obj; }, // Use native String.trim function wherever possible trim: core_trim && !core_trim.call("\uFEFF\xA0") ? function (text) { return text == null ? "" : core_trim.call(text); } : // Otherwise use our own trimming functionality function (text) { return text == null ? "" : (text + "").replace(rtrim, ""); }, // results is for internal usage only makeArray: function (arr, results) { var type, ret = results || []; if (arr != null) { // The window, strings (and functions) also have 'length' // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 type = jQuery.type(arr); if (arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow(arr)) { core_push.call(ret, arr); } else { jQuery.merge(ret, arr); } } return ret; }, inArray: function (elem, arr, i) { var len; if (arr) { if (core_indexOf) { return core_indexOf.call(arr, elem, i); } len = arr.length; i = i ? i < 0 ? Math.max(0, len + i) : i : 0; for (; i < len; i++) { // Skip accessing in sparse arrays if (i in arr && arr[i] === elem) { return i; } } } return -1; }, merge: function (first, second) { var l = second.length, i = first.length, j = 0; if (typeof l === "number") { for (; j < l; j++) { first[i++] = second[j]; } } else { while (second[j] !== undefined) { first[i++] = second[j++]; } } first.length = i; return first; }, grep: function (elems, callback, inv) { var retVal, ret = [], i = 0, length = elems.length; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for (; i < length; i++) { retVal = !!callback(elems[i], i); if (inv !== retVal) { ret.push(elems[i]); } } return ret; }, // arg is for internal usage only map: function (elems, callback, arg) { var value, key, ret = [], i = 0, length = elems.length, // jquery objects are treated as arrays isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ((length > 0 && elems[0] && elems[length - 1]) || length === 0 || jQuery.isArray(elems)); // Go through the array, translating each of the items to their if (isArray) { for (; i < length; i++) { value = callback(elems[i], i, arg); if (value != null) { ret[ret.length] = value; } } // Go through every key on the object, } else { for (key in elems) { value = callback(elems[key], key, arg); if (value != null) { ret[ret.length] = value; } } } // Flatten any nested arrays return ret.concat.apply([], ret); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function (fn, context) { var tmp, args, proxy; if (typeof context === "string") { tmp = fn[context]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if (!jQuery.isFunction(fn)) { return undefined; } // Simulated bind args = core_slice.call(arguments, 2); proxy = function () { return fn.apply(context, args.concat(core_slice.call(arguments))); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function access: function (elems, fn, key, value, chainable, emptyGet, pass) { var exec, bulk = key == null, i = 0, length = elems.length; // Sets many values if (key && typeof key === "object") { for (i in key) { jQuery.access(elems, fn, i, key[i], 1, emptyGet, value); } chainable = 1; // Sets one value } else if (value !== undefined) { // Optionally, function values get executed if exec is true exec = pass === undefined && jQuery.isFunction(value); if (bulk) { // Bulk operations only iterate when executing function values if (exec) { exec = fn; fn = function (elem, key, value) { return exec.call(jQuery(elem), value); }; // Otherwise they run against the entire set } else { fn.call(elems, value); fn = null; } } if (fn) { for (; i < length; i++) { fn(elems[i], key, exec ? value.call(elems[i], i, fn(elems[i], key)) : value, pass); } } chainable = 1; } return chainable ? elems : // Gets bulk ? fn.call(elems) : length ? fn(elems[0], key) : emptyGet; }, now: function () { return (new Date()).getTime(); } }); jQuery.ready.promise = function (obj) { if (!readyList) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if (document.readyState === "complete") { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout(jQuery.ready, 1); // Standards-based browsers support DOMContentLoaded } else if (document.addEventListener) { // Use the handy event callback document.addEventListener("DOMContentLoaded", DOMContentLoaded, false); // A fallback to window.onload, that will always work window.addEventListener("load", jQuery.ready, false); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent("onreadystatechange", DOMContentLoaded); // A fallback to window.onload, that will always work window.attachEvent("onload", jQuery.ready); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch (e) { } if (top && top.doScroll) { (function doScrollCheck() { if (!jQuery.isReady) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch (e) { return setTimeout(doScrollCheck, 50); } // and execute any waiting functions jQuery.ready(); } })(); } } } return readyList.promise(obj); }; // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function (i, name) { class2type["[object " + name + "]"] = name.toLowerCase(); }); // All jQuery objects should point back to these rootjQuery = jQuery(document); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions(options) { var object = optionsCache[options] = {}; jQuery.each(options.split(core_rspace), function (_, flag) { object[flag] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function (options) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? (optionsCache[options] || createOptions(options)) : jQuery.extend({}, options); var // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function (data) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for (; list && firingIndex < firingLength; firingIndex++) { if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) { memory = false; // To prevent further calls using add break; } } firing = false; if (list) { if (stack) { if (stack.length) { fire(stack.shift()); } } else if (memory) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function () { if (list) { // First, we save the current length var start = list.length; (function add(args) { jQuery.each(args, function (_, arg) { var type = jQuery.type(arg); if (type === "function") { if (!options.unique || !self.has(arg)) { list.push(arg); } } else if (arg && arg.length && type !== "string") { // Inspect recursively add(arg); } }); })(arguments); // Do we need to add the callbacks to the // current firing batch? if (firing) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if (memory) { firingStart = start; fire(memory); } } return this; }, // Remove a callback from the list remove: function () { if (list) { jQuery.each(arguments, function (_, arg) { var index; while ((index = jQuery.inArray(arg, list, index)) > -1) { list.splice(index, 1); // Handle firing indexes if (firing) { if (index <= firingLength) { firingLength--; } if (index <= firingIndex) { firingIndex--; } } } }); } return this; }, // Control if a given callback is in the list has: function (fn) { return jQuery.inArray(fn, list) > -1; }, // Remove all callbacks from the list empty: function () { list = []; return this; }, // Have the list do nothing anymore disable: function () { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function () { return !list; }, // Lock the list in its current state lock: function () { stack = undefined; if (!memory) { self.disable(); } return this; }, // Is it locked? locked: function () { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function (context, args) { args = args || []; args = [context, args.slice ? args.slice() : args]; if (list && (!fired || stack)) { if (firing) { stack.push(args); } else { fire(args); } } return this; }, // Call all the callbacks with the given arguments fire: function () { self.fireWith(this, arguments); return this; }, // To know if the callbacks have already been called at least once fired: function () { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function (func) { var tuples = [ // action, add listener, listener list, final state ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"], ["notify", "progress", jQuery.Callbacks("memory")] ], state = "pending", promise = { state: function () { return state; }, always: function () { deferred.done(arguments).fail(arguments); return this; }, then: function ( /* fnDone, fnFail, fnProgress */) { var fns = arguments; return jQuery.Deferred(function (newDefer) { jQuery.each(tuples, function (i, tuple) { var action = tuple[0], fn = fns[i]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[tuple[1]](jQuery.isFunction(fn) ? function () { var returned = fn.apply(this, arguments); if (returned && jQuery.isFunction(returned.promise)) { returned.promise() .done(newDefer.resolve) .fail(newDefer.reject) .progress(newDefer.notify); } else { newDefer[action + "With"](this === deferred ? newDefer : this, [returned]); } } : newDefer[action] ); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function (obj) { return obj != null ? jQuery.extend(obj, promise) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each(tuples, function (i, tuple) { var list = tuple[2], stateString = tuple[3]; // promise[ done | fail | progress ] = list.add promise[tuple[1]] = list.add; // Handle state if (stateString) { list.add(function () { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[i ^ 1][2].disable, tuples[2][2].lock); } // deferred[ resolve | reject | notify ] = list.fire deferred[tuple[0]] = list.fire; deferred[tuple[0] + "With"] = list.fireWith; }); // Make the deferred a promise promise.promise(deferred); // Call given func if any if (func) { func.call(deferred, deferred); } // All done! return deferred; }, // Deferred helper when: function (subordinate /* , ..., subordinateN */) { var i = 0, resolveValues = core_slice.call(arguments), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function (i, contexts, values) { return function (value) { contexts[i] = this; values[i] = arguments.length > 1 ? core_slice.call(arguments) : value; if (values === progressValues) { deferred.notifyWith(contexts, values); } else if (!(--remaining)) { deferred.resolveWith(contexts, values); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if (length > 1) { progressValues = new Array(length); progressContexts = new Array(length); resolveContexts = new Array(length); for (; i < length; i++) { if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) { resolveValues[i].promise() .done(updateFunc(i, resolveContexts, resolveValues)) .fail(deferred.reject) .progress(updateFunc(i, progressContexts, progressValues)); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if (!remaining) { deferred.resolveWith(resolveContexts, resolveValues); } return deferred.promise(); } }); jQuery.support = (function () { var support, all, a, select, opt, input, fragment, eventName, i, isSupported, clickFn, div = document.createElement("div"); // Setup div.setAttribute("className", "t"); div.innerHTML = "
a"; // Support tests won't run in some limited or non-browser environments all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[0]; if (!all || !a || !all.length) { return {}; } // First batch of tests select = document.createElement("select"); opt = select.appendChild(document.createElement("option")); input = div.getElementsByTagName("input")[0]; a.style.cssText = "top:1px;float:left;opacity:.5"; support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: (div.firstChild.nodeType === 3), // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText instead) style: /top/.test(a.getAttribute("style")), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: (a.getAttribute("href") === "/a"), // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.5/.test(a.style.opacity), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: (input.value === "on"), // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // Tests for enctype support on a form (#6743) enctype: !!document.createElement("form").enctype, // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works html5Clone: document.createElement("nav").cloneNode(true).outerHTML !== "<:nav>", // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode boxModel: (document.compatMode === "CSS1Compat"), // Will be defined later submitBubbles: true, changeBubbles: true, focusinBubbles: false, deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true, boxSizingReliable: true, pixelPosition: false }; // Make sure checked status is properly cloned input.checked = true; support.noCloneChecked = input.cloneNode(true).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; } catch (e) { support.deleteExpando = false; } if (!div.addEventListener && div.attachEvent && div.fireEvent) { div.attachEvent("onclick", clickFn = function () { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) support.noCloneEvent = false; }); div.cloneNode(true).fireEvent("onclick"); div.detachEvent("onclick", clickFn); } // Check if a radio maintains its value // after being appended to the DOM input = document.createElement("input"); input.value = "t"; input.setAttribute("type", "radio"); support.radioValue = input.value === "t"; input.setAttribute("checked", "checked"); // #11217 - WebKit loses check when the name is after the checked attribute input.setAttribute("name", "t"); div.appendChild(input); fragment = document.createDocumentFragment(); fragment.appendChild(div.lastChild); // WebKit doesn't clone checked state correctly in fragments support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) support.appendChecked = input.checked; fragment.removeChild(input); fragment.appendChild(div); // Technique from Juriy Zaytsev // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP // to go haywire. See: https://developer.mozilla.org/en/Security/CSP if (div.attachEvent) { for (i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; isSupported = (eventName in div); if (!isSupported) { div.setAttribute(eventName, "return;"); isSupported = (typeof div[eventName] === "function"); } support[i + "Bubbles"] = isSupported; } } // Run tests that need a body at doc ready jQuery(function () { var container, div, tds, marginDiv, divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", body = document.getElementsByTagName("body")[0]; if (!body) { // Return for frameset docs that don't have a body return; } container = document.createElement("div"); container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; body.insertBefore(container, body.firstChild); // Construct the test element div = document.createElement("div"); container.appendChild(div); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) div.innerHTML = "
t
"; tds = div.getElementsByTagName("td"); tds[0].style.cssText = "padding:0;margin:0;border:0;display:none"; isSupported = (tds[0].offsetHeight === 0); tds[0].style.display = ""; tds[1].style.display = "none"; // Check if empty table cells still have offsetWidth/Height // (IE <= 8 fail this test) support.reliableHiddenOffsets = isSupported && (tds[0].offsetHeight === 0); // Check box-sizing and margin behavior div.innerHTML = ""; div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; support.boxSizing = (div.offsetWidth === 4); support.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== 1); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if (window.getComputedStyle) { support.pixelPosition = (window.getComputedStyle(div, null) || {}).top !== "1%"; support.boxSizingReliable = (window.getComputedStyle(div, null) || { width: "4px" }).width === "4px"; // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. For more // info see bug #3333 // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right marginDiv = document.createElement("div"); marginDiv.style.cssText = div.style.cssText = divReset; marginDiv.style.marginRight = marginDiv.style.width = "0"; div.style.width = "1px"; div.appendChild(marginDiv); support.reliableMarginRight = !parseFloat((window.getComputedStyle(marginDiv, null) || {}).marginRight); } if (typeof div.style.zoom !== "undefined") { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (IE < 8 does this) div.innerHTML = ""; div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; support.inlineBlockNeedsLayout = (div.offsetWidth === 3); // Check if elements with layout shrink-wrap their children // (IE 6 does this) div.style.display = "block"; div.style.overflow = "visible"; div.innerHTML = "
"; div.firstChild.style.width = "5px"; support.shrinkWrapBlocks = (div.offsetWidth !== 3); container.style.zoom = 1; } // Null elements to avoid leaks in IE body.removeChild(container); container = div = tds = marginDiv = null; }); // Null elements to avoid leaks in IE fragment.removeChild(div); all = a = select = opt = input = fragment = div = null; return support; })(); var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, rmultiDash = /([A-Z])/g; jQuery.extend({ cache: {}, deletedIds: [], // Remove at next major release (1.9/2.0) uuid: 0, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + (jQuery.fn.jquery + Math.random()).replace(/\D/g, ""), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function (elem) { elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando]; return !!elem && !isEmptyDataObject(elem); }, data: function (elem, name, data, pvt /* Internal Use Only */) { if (!jQuery.acceptData(elem)) { return; } var thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[internalKey] : elem[internalKey] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ((!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined) { return; } if (!id) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if (isNode) { elem[internalKey] = id = jQuery.deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if (!cache[id]) { cache[id] = {}; // Avoids exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify if (!isNode) { cache[id].toJSON = jQuery.noop; } } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if (typeof name === "object" || typeof name === "function") { if (pvt) { cache[id] = jQuery.extend(cache[id], name); } else { cache[id].data = jQuery.extend(cache[id].data, name); } } thisCache = cache[id]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if (!pvt) { if (!thisCache.data) { thisCache.data = {}; } thisCache = thisCache.data; } if (data !== undefined) { thisCache[jQuery.camelCase(name)] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if (getByName) { // First Try to find as-is property data ret = thisCache[name]; // Test for null|undefined property data if (ret == null) { // Try to find the camelCased property ret = thisCache[jQuery.camelCase(name)]; } } else { ret = thisCache; } return ret; }, removeData: function (elem, name, pvt /* Internal Use Only */) { if (!jQuery.acceptData(elem)) { return; } var thisCache, i, l, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[jQuery.expando] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if (!cache[id]) { return; } if (name) { thisCache = pvt ? cache[id] : cache[id].data; if (thisCache) { // Support array or space separated string names for data keys if (!jQuery.isArray(name)) { // try the string as a key before any manipulation if (name in thisCache) { name = [name]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase(name); if (name in thisCache) { name = [name]; } else { name = name.split(" "); } } } for (i = 0, l = name.length; i < l; i++) { delete thisCache[name[i]]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if (!(pvt ? isEmptyDataObject : jQuery.isEmptyObject)(thisCache)) { return; } } } // See jQuery.data for more information if (!pvt) { delete cache[id].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if (!isEmptyDataObject(cache[id])) { return; } } // Destroy the cache if (isNode) { jQuery.cleanData([elem], true); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) } else if (jQuery.support.deleteExpando || cache != cache.window) { delete cache[id]; // When all else fails, null } else { cache[id] = null; } }, // For internal use only. _data: function (elem, name, data) { return jQuery.data(elem, name, data, true); }, // A method for determining if a DOM node can handle the data expando acceptData: function (elem) { var noData = elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && elem.getAttribute("classid") === noData; } }); jQuery.fn.extend({ data: function (key, value) { var parts, part, attr, name, l, elem = this[0], i = 0, data = null; // Gets all values if (key === undefined) { if (this.length) { data = jQuery.data(elem); if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) { attr = elem.attributes; for (l = attr.length; i < l; i++) { name = attr[i].name; if (!name.indexOf("data-")) { name = jQuery.camelCase(name.substring(5)); dataAttr(elem, name, data[name]); } } jQuery._data(elem, "parsedAttrs", true); } } return data; } // Sets multiple values if (typeof key === "object") { return this.each(function () { jQuery.data(this, key); }); } parts = key.split(".", 2); parts[1] = parts[1] ? "." + parts[1] : ""; part = parts[1] + "!"; return jQuery.access(this, function (value) { if (value === undefined) { data = this.triggerHandler("getData" + part, [parts[0]]); // Try to fetch any internally stored data first if (data === undefined && elem) { data = jQuery.data(elem, key); data = dataAttr(elem, key, data); } return data === undefined && parts[1] ? this.data(parts[0]) : data; } parts[1] = value; this.each(function () { var self = jQuery(this); self.triggerHandler("setData" + part, parts); jQuery.data(this, key, value); self.triggerHandler("changeData" + part, parts); }); }, null, value, arguments.length > 1, null, false); }, removeData: function (key) { return this.each(function () { jQuery.removeData(this, key); }); } }); function dataAttr(elem, key, data) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if (data === undefined && elem.nodeType === 1) { var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase(); data = elem.getAttribute(name); if (typeof data === "string") { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data; } catch (e) { } // Make sure we set the data so it isn't changed later jQuery.data(elem, key, data); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject(obj) { var name; for (name in obj) { // if the public data object is empty, the private is still empty if (name === "data" && jQuery.isEmptyObject(obj[name])) { continue; } if (name !== "toJSON") { return false; } } return true; } jQuery.extend({ queue: function (elem, type, data) { var queue; if (elem) { type = (type || "fx") + "queue"; queue = jQuery._data(elem, type); // Speed up dequeue by getting out quickly if this is just a lookup if (data) { if (!queue || jQuery.isArray(data)) { queue = jQuery._data(elem, type, jQuery.makeArray(data)); } else { queue.push(data); } } return queue || []; } }, dequeue: function (elem, type) { type = type || "fx"; var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type), next = function () { jQuery.dequeue(elem, type); }; // If the fx queue is dequeued, always remove the progress sentinel if (fn === "inprogress") { fn = queue.shift(); startLength--; } if (fn) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if (type === "fx") { queue.unshift("inprogress"); } // clear up the last queue stop function delete hooks.stop; fn.call(elem, next, hooks); } if (!startLength && hooks) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, or returns the current one _queueHooks: function (elem, type) { var key = type + "queueHooks"; return jQuery._data(elem, key) || jQuery._data(elem, key, { empty: jQuery.Callbacks("once memory").add(function () { jQuery.removeData(elem, type + "queue", true); jQuery.removeData(elem, key, true); }) }); } }); jQuery.fn.extend({ queue: function (type, data) { var setter = 2; if (typeof type !== "string") { data = type; type = "fx"; setter--; } if (arguments.length < setter) { return jQuery.queue(this[0], type); } return data === undefined ? this : this.each(function () { var queue = jQuery.queue(this, type, data); // ensure a hooks for this queue jQuery._queueHooks(this, type); if (type === "fx" && queue[0] !== "inprogress") { jQuery.dequeue(this, type); } }); }, dequeue: function (type) { return this.each(function () { jQuery.dequeue(this, type); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function (time, type) { time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; type = type || "fx"; return this.queue(type, function (next, hooks) { var timeout = setTimeout(next, time); hooks.stop = function () { clearTimeout(timeout); }; }); }, clearQueue: function (type) { return this.queue(type || "fx", []); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function (type, obj) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function () { if (!(--count)) { defer.resolveWith(elements, [elements]); } }; if (typeof type !== "string") { obj = type; type = undefined; } type = type || "fx"; while (i--) { tmp = jQuery._data(elements[i], type + "queueHooks"); if (tmp && tmp.empty) { count++; tmp.empty.add(resolve); } } resolve(); return defer.promise(obj); } }); var nodeHook, boolHook, fixSpecified, rclass = /[\t\r\n]/g, rreturn = /\r/g, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea|)$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, getSetAttribute = jQuery.support.getSetAttribute; jQuery.fn.extend({ attr: function (name, value) { return jQuery.access(this, jQuery.attr, name, value, arguments.length > 1); }, removeAttr: function (name) { return this.each(function () { jQuery.removeAttr(this, name); }); }, prop: function (name, value) { return jQuery.access(this, jQuery.prop, name, value, arguments.length > 1); }, removeProp: function (name) { name = jQuery.propFix[name] || name; return this.each(function () { // try/catch handles cases where IE balks (such as removing a property on window) try { this[name] = undefined; delete this[name]; } catch (e) { } }); }, addClass: function (value) { var classNames, i, l, elem, setClass, c, cl; if (jQuery.isFunction(value)) { return this.each(function (j) { jQuery(this).addClass(value.call(this, j, this.className)); }); } if (value && typeof value === "string") { classNames = value.split(core_rspace); for (i = 0, l = this.length; i < l; i++) { elem = this[i]; if (elem.nodeType === 1) { if (!elem.className && classNames.length === 1) { elem.className = value; } else { setClass = " " + elem.className + " "; for (c = 0, cl = classNames.length; c < cl; c++) { if (setClass.indexOf(" " + classNames[c] + " ") < 0) { setClass += classNames[c] + " "; } } elem.className = jQuery.trim(setClass); } } } } return this; }, removeClass: function (value) { var removes, className, elem, c, cl, i, l; if (jQuery.isFunction(value)) { return this.each(function (j) { jQuery(this).removeClass(value.call(this, j, this.className)); }); } if ((value && typeof value === "string") || value === undefined) { removes = (value || "").split(core_rspace); for (i = 0, l = this.length; i < l; i++) { elem = this[i]; if (elem.nodeType === 1 && elem.className) { className = (" " + elem.className + " ").replace(rclass, " "); // loop over each item in the removal list for (c = 0, cl = removes.length; c < cl; c++) { // Remove until there is nothing to remove, while (className.indexOf(" " + removes[c] + " ") >= 0) { className = className.replace(" " + removes[c] + " ", " "); } } elem.className = value ? jQuery.trim(className) : ""; } } } return this; }, toggleClass: function (value, stateVal) { var type = typeof value, isBool = typeof stateVal === "boolean"; if (jQuery.isFunction(value)) { return this.each(function (i) { jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal); }); } return this.each(function () { if (type === "string") { // toggle individual class names var className, i = 0, self = jQuery(this), state = stateVal, classNames = value.split(core_rspace); while ((className = classNames[i++])) { // check each className given, space separated list state = isBool ? state : !self.hasClass(className); self[state ? "addClass" : "removeClass"](className); } } else if (type === "undefined" || type === "boolean") { if (this.className) { // store className if set jQuery._data(this, "__className__", this.className); } // toggle whole className this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""; } }); }, hasClass: function (selector) { var className = " " + selector + " ", i = 0, l = this.length; for (; i < l; i++) { if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) { return true; } } return false; }, val: function (value) { var hooks, ret, isFunction, elem = this[0]; if (!arguments.length) { if (elem) { hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()]; if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction(value); return this.each(function (i) { var val, self = jQuery(this); if (this.nodeType !== 1) { return; } if (isFunction) { val = value.call(this, i, self.val()); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if (val == null) { val = ""; } else if (typeof val === "number") { val += ""; } else if (jQuery.isArray(val)) { val = jQuery.map(val, function (value) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; // If set returns undefined, fall back to normal setting if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function (elem) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function (elem) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // Loop through all the selected options for (; i < max; i++) { option = options[i]; // oldIE doesn't update selected after form reset (#2551) if ((option.selected || i === index) && // Don't return options that are disabled or in a disabled optgroup (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) { // Get the specific value for the option value = jQuery(option).val(); // We don't need an array for one selects if (one) { return value; } // Multi-Selects return an array values.push(value); } } return values; }, set: function (elem, value) { var values = jQuery.makeArray(value); jQuery(elem).find("option").each(function () { this.selected = jQuery.inArray(jQuery(this).val(), values) >= 0; }); if (!values.length) { elem.selectedIndex = -1; } return values; } } }, // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 attrFn: {}, attr: function (elem, name, value, pass) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if (!elem || nType === 3 || nType === 8 || nType === 2) { return; } if (pass && jQuery.isFunction(jQuery.fn[name])) { return jQuery(elem)[name](value); } // Fallback to prop when attributes are not supported if (typeof elem.getAttribute === "undefined") { return jQuery.prop(elem, name, value); } notxml = nType !== 1 || !jQuery.isXMLDoc(elem); // All attributes are lowercase // Grab necessary hook if one is defined if (notxml) { name = name.toLowerCase(); hooks = jQuery.attrHooks[name] || (rboolean.test(name) ? boolHook : nodeHook); } if (value !== undefined) { if (value === null) { jQuery.removeAttr(elem, name); return; } else if (hooks && "set" in hooks && notxml && (ret = hooks.set(elem, value, name)) !== undefined) { return ret; } else { elem.setAttribute(name, value + ""); return value; } } else if (hooks && "get" in hooks && notxml && (ret = hooks.get(elem, name)) !== null) { return ret; } else { ret = elem.getAttribute(name); // Non-existent attributes return null, we normalize to undefined return ret === null ? undefined : ret; } }, removeAttr: function (elem, value) { var propName, attrNames, name, isBool, i = 0; if (value && elem.nodeType === 1) { attrNames = value.split(core_rspace); for (; i < attrNames.length; i++) { name = attrNames[i]; if (name) { propName = jQuery.propFix[name] || name; isBool = rboolean.test(name); // See #9699 for explanation of this approach (setting first, then removal) // Do not do this for boolean attributes (see #10870) if (!isBool) { jQuery.attr(elem, name, ""); } elem.removeAttribute(getSetAttribute ? name : propName); // Set corresponding property to false for boolean attributes if (isBool && propName in elem) { elem[propName] = false; } } } } }, attrHooks: { type: { set: function (elem, value) { // We can't allow the type property to be changed (since it causes problems in IE) if (rtype.test(elem.nodeName) && elem.parentNode) { jQuery.error("type property can't be changed"); } else if (!jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to it's default in case type is set after value // This is for element creation var val = elem.value; elem.setAttribute("type", value); if (val) { elem.value = val; } return value; } } }, // Use the value property for back compat // Use the nodeHook for button elements in IE6/7 (#1954) value: { get: function (elem, name) { if (nodeHook && jQuery.nodeName(elem, "button")) { return nodeHook.get(elem, name); } return name in elem ? elem.value : null; }, set: function (elem, value, name) { if (nodeHook && jQuery.nodeName(elem, "button")) { return nodeHook.set(elem, value, name); } // Does not return so that setAttribute is also used elem.value = value; } } }, propFix: { tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, prop: function (elem, name, value) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if (!elem || nType === 3 || nType === 8 || nType === 2) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc(elem); if (notxml) { // Fix name and attach hooks name = jQuery.propFix[name] || name; hooks = jQuery.propHooks[name]; } if (value !== undefined) { if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { return ret; } else { return (elem[name] = value); } } else { if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { return ret; } else { return elem[name]; } } }, propHooks: { tabIndex: { get: function (elem) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributeNode = elem.getAttributeNode("tabindex"); return attributeNode && attributeNode.specified ? parseInt(attributeNode.value, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : undefined; } } } }); // Hook for boolean attributes boolHook = { get: function (elem, name) { // Align boolean attributes with corresponding properties // Fall back to attribute presence where some booleans are not supported var attrNode, property = jQuery.prop(elem, name); return property === true || typeof property !== "boolean" && (attrNode = elem.getAttributeNode(name)) && attrNode.nodeValue !== false ? name.toLowerCase() : undefined; }, set: function (elem, value, name) { var propName; if (value === false) { // Remove boolean attributes when set to false jQuery.removeAttr(elem, name); } else { // value is true since we know at this point it's type boolean and not false // Set boolean attributes to the same name and set the DOM property propName = jQuery.propFix[name] || name; if (propName in elem) { // Only set the IDL specifically if it already exists on the element elem[propName] = true; } elem.setAttribute(name, name.toLowerCase()); } return name; } }; // IE6/7 do not support getting/setting some attributes with get/setAttribute if (!getSetAttribute) { fixSpecified = { name: true, id: true, coords: true }; // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = jQuery.valHooks.button = { get: function (elem, name) { var ret; ret = elem.getAttributeNode(name); return ret && (fixSpecified[name] ? ret.value !== "" : ret.specified) ? ret.value : undefined; }, set: function (elem, value, name) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode(name); if (!ret) { ret = document.createAttribute(name); elem.setAttributeNode(ret); } return (ret.value = value + ""); } }; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each(["width", "height"], function (i, name) { jQuery.attrHooks[name] = jQuery.extend(jQuery.attrHooks[name], { set: function (elem, value) { if (value === "") { elem.setAttribute(name, "auto"); return value; } } }); }); // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { get: nodeHook.get, set: function (elem, value, name) { if (value === "") { value = "false"; } nodeHook.set(elem, value, name); } }; } // Some attributes require a special call on IE if (!jQuery.support.hrefNormalized) { jQuery.each(["href", "src", "width", "height"], function (i, name) { jQuery.attrHooks[name] = jQuery.extend(jQuery.attrHooks[name], { get: function (elem) { var ret = elem.getAttribute(name, 2); return ret === null ? undefined : ret; } }); }); } if (!jQuery.support.style) { jQuery.attrHooks.style = { get: function (elem) { // Return undefined in the case of empty string // Normalize to lowercase since IE uppercases css property names return elem.style.cssText.toLowerCase() || undefined; }, set: function (elem, value) { return (elem.style.cssText = value + ""); } }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if (!jQuery.support.optSelected) { jQuery.propHooks.selected = jQuery.extend(jQuery.propHooks.selected, { get: function (elem) { var parent = elem.parentNode; if (parent) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if (parent.parentNode) { parent.parentNode.selectedIndex; } } return null; } }); } // IE6/7 call enctype encoding if (!jQuery.support.enctype) { jQuery.propFix.enctype = "encoding"; } // Radios and checkboxes getter/setter if (!jQuery.support.checkOn) { jQuery.each(["radio", "checkbox"], function () { jQuery.valHooks[this] = { get: function (elem) { // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; } }; }); } jQuery.each(["radio", "checkbox"], function () { jQuery.valHooks[this] = jQuery.extend(jQuery.valHooks[this], { set: function (elem, value) { if (jQuery.isArray(value)) { return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0); } } }); }); var rformElems = /^(?:textarea|input|select)$/i, rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, hoverHack = function (events) { return jQuery.event.special.hover ? events : events.replace(rhoverHack, "mouseenter$1 mouseleave$1"); }; /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { add: function (elem, types, handler, data, selector) { var elemData, eventHandle, events, t, tns, type, namespaces, handleObj, handleObjIn, handlers, special; // Don't attach events to noData or text/comment nodes (allow plain objects tho) if (elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data(elem))) { return; } // Caller can pass in an object of custom data in lieu of the handler if (handler.handler) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if (!handler.guid) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first events = elemData.events; if (!events) { elemData.events = events = {}; } eventHandle = elemData.handle; if (!eventHandle) { elemData.handle = eventHandle = function (e) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply(eventHandle.elem, arguments) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = jQuery.trim(hoverHack(types)).split(" "); for (t = 0; t < types.length; t++) { tns = rtypenamespace.exec(types[t]) || []; type = tns[1]; namespaces = (tns[2] || "").split(".").sort(); // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[type] || {}; // If selector defined, determine special event api type, otherwise given type type = (selector ? special.delegateType : special.bindType) || type; // Update special based on newly reset type special = jQuery.event.special[type] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: tns[1], data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test(selector), namespace: namespaces.join(".") }, handleObjIn); // Init the event handler queue if we're the first handlers = events[type]; if (!handlers) { handlers = events[type] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { // Bind the global event handler to the element if (elem.addEventListener) { elem.addEventListener(type, eventHandle, false); } else if (elem.attachEvent) { elem.attachEvent("on" + type, eventHandle); } } } if (special.add) { special.add.call(elem, handleObj); if (!handleObj.handler.guid) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if (selector) { handlers.splice(handlers.delegateCount++, 0, handleObj); } else { handlers.push(handleObj); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[type] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function (elem, types, handler, selector, mappedTypes) { var t, tns, type, origType, namespaces, origCount, j, events, special, eventType, handleObj, elemData = jQuery.hasData(elem) && jQuery._data(elem); if (!elemData || !(events = elemData.events)) { return; } // Once for each type.namespace in types; type may be omitted types = jQuery.trim(hoverHack(types || "")).split(" "); for (t = 0; t < types.length; t++) { tns = rtypenamespace.exec(types[t]) || []; type = origType = tns[1]; namespaces = tns[2]; // Unbind all events (on this namespace, if provided) for the element if (!type) { for (type in events) { jQuery.event.remove(elem, type + types[t], handler, selector, true); } continue; } special = jQuery.event.special[type] || {}; type = (selector ? special.delegateType : special.bindType) || type; eventType = events[type] || []; origCount = eventType.length; namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; // Remove matching events for (j = 0; j < eventType.length; j++) { handleObj = eventType[j]; if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!namespaces || namespaces.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) { eventType.splice(j--, 1); if (handleObj.selector) { eventType.delegateCount--; } if (special.remove) { special.remove.call(elem, handleObj); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if (eventType.length === 0 && origCount !== eventType.length) { if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) { jQuery.removeEvent(elem, type, elemData.handle); } delete events[type]; } } // Remove the expando if it's no longer used if (jQuery.isEmptyObject(events)) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery.removeData(elem, "events", true); } }, // Events that are safe to short-circuit if no handlers are attached. // Native DOM events should not be added, they may have inline handlers. customEvent: { "getData": true, "setData": true, "changeData": true }, trigger: function (event, data, elem, onlyHandlers) { // Don't do events on text and comment nodes if (elem && (elem.nodeType === 3 || elem.nodeType === 8)) { return; } // Event object or event type var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, type = event.type || event, namespaces = []; // focus/blur morphs to focusin/out; ensure we're not firing them right now if (rfocusMorph.test(type + jQuery.event.triggered)) { return; } if (type.indexOf("!") >= 0) { // Exclusive events trigger only for the exact event (no namespaces) type = type.slice(0, -1); exclusive = true; } if (type.indexOf(".") >= 0) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } if ((!elem || jQuery.event.customEvent[type]) && !jQuery.event.global[type]) { // No jQuery handlers for this event type, and it can't have inline handlers return; } // Caller can pass in an Event, Object, or just an event type string event = typeof event === "object" ? // jQuery.Event object event[jQuery.expando] ? event : // Object literal new jQuery.Event(type, event) : // Just the event type (string) new jQuery.Event(type); event.type = type; event.isTrigger = true; event.exclusive = exclusive; event.namespace = namespaces.join("."); event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; ontype = type.indexOf(":") < 0 ? "on" + type : ""; // Handle a global trigger if (!elem) { // TODO: Stop taunting the data cache; remove global events and always attach to document cache = jQuery.cache; for (i in cache) { if (cache[i].events && cache[i].events[type]) { jQuery.event.trigger(event, data, cache[i].handle.elem, true); } } return; } // Clean up the event in case it is being reused event.result = undefined; if (!event.target) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data != null ? jQuery.makeArray(data) : []; data.unshift(event); // Allow special events to draw outside the lines special = jQuery.event.special[type] || {}; if (special.trigger && special.trigger.apply(elem, data) === false) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) eventPath = [[elem, special.bindType || type]]; if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) { bubbleType = special.delegateType || type; cur = rfocusMorph.test(bubbleType + type) ? elem : elem.parentNode; for (old = elem; cur; cur = cur.parentNode) { eventPath.push([cur, bubbleType]); old = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if (old === (elem.ownerDocument || document)) { eventPath.push([old.defaultView || old.parentWindow || window, bubbleType]); } } // Fire handlers on the event path for (i = 0; i < eventPath.length && !event.isPropagationStopped() ; i++) { cur = eventPath[i][0]; event.type = eventPath[i][1]; handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle"); if (handle) { handle.apply(cur, data); } // Note that this is a bare JS function and not a jQuery handler handle = ontype && cur[ontype]; if (handle && jQuery.acceptData(cur) && handle.apply && handle.apply(cur, data) === false) { event.preventDefault(); } } event.type = type; // If nobody prevented the default action, do it now if (!onlyHandlers && !event.isDefaultPrevented()) { if ((!special._default || special._default.apply(elem.ownerDocument, data) === false) && !(type === "click" && jQuery.nodeName(elem, "a")) && jQuery.acceptData(elem)) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) // IE<9 dies on focus/blur to hidden element (#1486) if (ontype && elem[type] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow(elem)) { // Don't re-trigger an onFOO event when we call its FOO() method old = elem[ontype]; if (old) { elem[ontype] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[type](); jQuery.event.triggered = undefined; if (old) { elem[ontype] = old; } } } } return event.result; }, dispatch: function (event) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix(event || window.event); var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, handlers = ((jQuery._data(this, "events") || {})[event.type] || []), delegateCount = handlers.delegateCount, args = core_slice.call(arguments), run_all = !event.exclusive && !event.namespace, special = jQuery.event.special[event.type] || {}, handlerQueue = []; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if (special.preDispatch && special.preDispatch.call(this, event) === false) { return; } // Determine handlers that should run if there are delegated events // Avoid non-left-click bubbling in Firefox (#3861) if (delegateCount && !(event.button && event.type === "click")) { for (cur = event.target; cur != this; cur = cur.parentNode || this) { // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) if (cur.disabled !== true || event.type !== "click") { selMatch = {}; matches = []; for (i = 0; i < delegateCount; i++) { handleObj = handlers[i]; sel = handleObj.selector; if (selMatch[sel] === undefined) { selMatch[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) >= 0 : jQuery.find(sel, this, null, [cur]).length; } if (selMatch[sel]) { matches.push(handleObj); } } if (matches.length) { handlerQueue.push({ elem: cur, matches: matches }); } } } } // Add the remaining (directly-bound) handlers if (handlers.length > delegateCount) { handlerQueue.push({ elem: this, matches: handlers.slice(delegateCount) }); } // Run delegates first; they may want to stop propagation beneath us for (i = 0; i < handlerQueue.length && !event.isPropagationStopped() ; i++) { matched = handlerQueue[i]; event.currentTarget = matched.elem; for (j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped() ; j++) { handleObj = matched.matches[j]; // Triggered event must either 1) be non-exclusive and have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if (run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test(handleObj.namespace)) { event.data = handleObj.data; event.handleObj = handleObj; ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler) .apply(matched.elem, args); if (ret !== undefined) { event.result = ret; if (ret === false) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if (special.postDispatch) { special.postDispatch.call(this, event); } return event.result; }, // Includes some event props shared by KeyEvent and MouseEvent // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function (event, original) { // Add which for key events if (event.which == null) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function (event, original) { var eventDoc, doc, body, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if (event.pageX == null && original.clientX != null) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); } // Add relatedTarget, if necessary if (!event.relatedTarget && fromElement) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if (!event.which && button !== undefined) { event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0))); } return event; } }, fix: function (event) { if (event[jQuery.expando]) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, originalEvent = event, fixHook = jQuery.event.fixHooks[event.type] || {}, copy = fixHook.props ? this.props.concat(fixHook.props) : this.props; event = jQuery.Event(originalEvent); for (i = copy.length; i;) { prop = copy[--i]; event[prop] = originalEvent[prop]; } // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) if (!event.target) { event.target = originalEvent.srcElement || document; } // Target should not be a text node (#504, Safari) if (event.target.nodeType === 3) { event.target = event.target.parentNode; } // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) event.metaKey = !!event.metaKey; return fixHook.filter ? fixHook.filter(event, originalEvent) : event; }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { delegateType: "focusin" }, blur: { delegateType: "focusout" }, beforeunload: { setup: function (data, namespaces, eventHandle) { // We only want to do this special case on windows if (jQuery.isWindow(this)) { this.onbeforeunload = eventHandle; } }, teardown: function (namespaces, eventHandle) { if (this.onbeforeunload === eventHandle) { this.onbeforeunload = null; } } } }, simulate: function (type, elem, event, bubble) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if (bubble) { jQuery.event.trigger(e, null, elem); } else { jQuery.event.dispatch.call(elem, e); } if (e.isDefaultPrevented()) { event.preventDefault(); } } }; // Some plugins are using, but it's undocumented/deprecated and will be removed. // The 1.7 special event interface should provide all the hooks needed now. jQuery.event.handle = jQuery.event.dispatch; jQuery.removeEvent = document.removeEventListener ? function (elem, type, handle) { if (elem.removeEventListener) { elem.removeEventListener(type, handle, false); } } : function (elem, type, handle) { var name = "on" + type; if (elem.detachEvent) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC if (typeof elem[name] === "undefined") { elem[name] = null; } elem.detachEvent(name, handle); } }; jQuery.Event = function (src, props) { // Allow instantiation without the 'new' keyword if (!(this instanceof jQuery.Event)) { return new jQuery.Event(src, props); } // Event object if (src && src.type) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if (props) { jQuery.extend(this, props); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[jQuery.expando] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function () { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if (!e) { return; } // if preventDefault exists run it on the original event if (e.preventDefault) { e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) } else { e.returnValue = false; } }, stopPropagation: function () { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if (!e) { return; } // if stopPropagation exists run it on the original event if (e.stopPropagation) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function () { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function (orig, fix) { jQuery.event.special[orig] = { delegateType: fix, bindType: fix, handle: function (event) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj, selector = handleObj.selector; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if (!related || (related !== target && !jQuery.contains(target, related))) { event.type = handleObj.origType; ret = handleObj.handler.apply(this, arguments); event.type = fix; } return ret; } }; }); // IE submit delegation if (!jQuery.support.submitBubbles) { jQuery.event.special.submit = { setup: function () { // Only need this for delegated form submit events if (jQuery.nodeName(this, "form")) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add(this, "click._submit keypress._submit", function (e) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined; if (form && !jQuery._data(form, "_submit_attached")) { jQuery.event.add(form, "submit._submit", function (event) { event._submit_bubble = true; }); jQuery._data(form, "_submit_attached", true); } }); // return undefined since we don't need an event listener }, postDispatch: function (event) { // If form was submitted by the user, bubble the event up the tree if (event._submit_bubble) { delete event._submit_bubble; if (this.parentNode && !event.isTrigger) { jQuery.event.simulate("submit", this.parentNode, event, true); } } }, teardown: function () { // Only need this for delegated form submit events if (jQuery.nodeName(this, "form")) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove(this, "._submit"); } }; } // IE change delegation and checkbox/radio fix if (!jQuery.support.changeBubbles) { jQuery.event.special.change = { setup: function () { if (rformElems.test(this.nodeName)) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if (this.type === "checkbox" || this.type === "radio") { jQuery.event.add(this, "propertychange._change", function (event) { if (event.originalEvent.propertyName === "checked") { this._just_changed = true; } }); jQuery.event.add(this, "click._change", function (event) { if (this._just_changed && !event.isTrigger) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate("change", this, event, true); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add(this, "beforeactivate._change", function (e) { var elem = e.target; if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "_change_attached")) { jQuery.event.add(elem, "change._change", function (event) { if (this.parentNode && !event.isSimulated && !event.isTrigger) { jQuery.event.simulate("change", this.parentNode, event, true); } }); jQuery._data(elem, "_change_attached", true); } }); }, handle: function (event) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) { return event.handleObj.handler.apply(this, arguments); } }, teardown: function () { jQuery.event.remove(this, "._change"); return !rformElems.test(this.nodeName); } }; } // Create "bubbling" focus and blur events if (!jQuery.support.focusinBubbles) { jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) { // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function (event) { jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true); }; jQuery.event.special[fix] = { setup: function () { if (attaches++ === 0) { document.addEventListener(orig, handler, true); } }, teardown: function () { if (--attaches === 0) { document.removeEventListener(orig, handler, true); } } }; }); } jQuery.fn.extend({ on: function (types, selector, data, fn, /*INTERNAL*/ one) { var origFn, type; // Types can be a map of types/handlers if (typeof types === "object") { // ( types-Object, selector, data ) if (typeof selector !== "string") { // && selector != null // ( types-Object, data ) data = data || selector; selector = undefined; } for (type in types) { this.on(type, selector, data, types[type], one); } return this; } if (data == null && fn == null) { // ( types, fn ) fn = selector; data = selector = undefined; } else if (fn == null) { if (typeof selector === "string") { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if (fn === false) { fn = returnFalse; } else if (!fn) { return this; } if (one === 1) { origFn = fn; fn = function (event) { // Can use an empty set, since event contains the info jQuery().off(event); return origFn.apply(this, arguments); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); } return this.each(function () { jQuery.event.add(this, types, fn, data, selector); }); }, one: function (types, selector, data, fn) { return this.on(types, selector, data, fn, 1); }, off: function (types, selector, fn) { var handleObj, type; if (types && types.preventDefault && types.handleObj) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery(types.delegateTarget).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if (typeof types === "object") { // ( types-object [, selector] ) for (type in types) { this.off(type, selector, types[type]); } return this; } if (selector === false || typeof selector === "function") { // ( types [, fn] ) fn = selector; selector = undefined; } if (fn === false) { fn = returnFalse; } return this.each(function () { jQuery.event.remove(this, types, fn, selector); }); }, bind: function (types, data, fn) { return this.on(types, null, data, fn); }, unbind: function (types, fn) { return this.off(types, null, fn); }, live: function (types, data, fn) { jQuery(this.context).on(types, this.selector, data, fn); return this; }, die: function (types, fn) { jQuery(this.context).off(types, this.selector || "**", fn); return this; }, delegate: function (selector, types, data, fn) { return this.on(types, selector, data, fn); }, undelegate: function (selector, types, fn) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn); }, trigger: function (type, data) { return this.each(function () { jQuery.event.trigger(type, data, this); }); }, triggerHandler: function (type, data) { if (this[0]) { return jQuery.event.trigger(type, data, this[0], true); } }, toggle: function (fn) { // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, i = 0, toggler = function (event) { // Figure out which function to execute var lastToggle = (jQuery._data(this, "lastToggle" + fn.guid) || 0) % i; jQuery._data(this, "lastToggle" + fn.guid, lastToggle + 1); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[lastToggle].apply(this, arguments) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while (i < args.length) { args[i++].guid = guid; } return this.click(toggler); }, hover: function (fnOver, fnOut) { return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); } }); jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function (i, name) { // Handle event binding jQuery.fn[name] = function (data, fn) { if (fn == null) { fn = data; data = null; } return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name); }; if (rkeyEvent.test(name)) { jQuery.event.fixHooks[name] = jQuery.event.keyHooks; } if (rmouseEvent.test(name)) { jQuery.event.fixHooks[name] = jQuery.event.mouseHooks; } }); /*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ (function (window, undefined) { var cachedruns, assertGetIdNotName, Expr, getText, isXML, contains, compile, sortOrder, hasDuplicate, outermostContext, baseHasDuplicate = true, strundefined = "undefined", expando = ("sizcache" + Math.random()).replace(".", ""), Token = String, document = window.document, docElem = document.documentElement, dirruns = 0, done = 0, pop = [].pop, push = [].push, slice = [].slice, // Use a stripped-down indexOf if a native one is unavailable indexOf = [].indexOf || function (elem) { var i = 0, len = this.length; for (; i < len; i++) { if (this[i] === elem) { return i; } } return -1; }, // Augment a function for special use by Sizzle markFunction = function (fn, value) { fn[expando] = value == null || value; return fn; }, createCache = function () { var cache = {}, keys = []; return markFunction(function (key, value) { // Only keep the most recent entries if (keys.push(key) > Expr.cacheLength) { delete cache[keys.shift()]; } // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) return (cache[key + " "] = value); }, cache); }, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), // Regex // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace("w", "w#"), // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Prefer arguments not in parens/brackets, // then attribute selectors and non-pseudos (denoted by :), // then anything else // These preferences are here to reduce the number of selectors // needing tokenize in the PSEUDO preFilter pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", // For matchExpr.POS and matchExpr.needsContext pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rcombinators = new RegExp("^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*"), rpseudo = new RegExp(pseudos), // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, rnot = /^:not/, rsibling = /[\x20\t\r\n\f]*[+~]/, rendsWithNot = /:not\($/, rheader = /h\d/i, rinputs = /input|select|textarea|button/i, rbackslash = /\\(?!\\)/g, matchExpr = { "ID": new RegExp("^#(" + characterEncoding + ")"), "CLASS": new RegExp("^\\.(" + characterEncoding + ")"), "NAME": new RegExp("^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]"), "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"), "ATTR": new RegExp("^" + attributes), "PSEUDO": new RegExp("^" + pseudos), "POS": new RegExp(pos, "i"), "CHILD": new RegExp("^:(only|nth|first|last)-child(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), // For use in libraries implementing .is() "needsContext": new RegExp("^" + whitespace + "*[>+~]|" + pos, "i") }, // Support // Used for testing something on an element assert = function (fn) { var div = document.createElement("div"); try { return fn(div); } catch (e) { return false; } finally { // release memory in IE div = null; } }, // Check if getElementsByTagName("*") returns only elements assertTagNameNoComments = assert(function (div) { div.appendChild(document.createComment("")); return !div.getElementsByTagName("*").length; }), // Check if getAttribute returns normalized href attributes assertHrefNotNormalized = assert(function (div) { div.innerHTML = ""; return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; }), // Check if attributes should be retrieved by attribute nodes assertAttributes = assert(function (div) { div.innerHTML = ""; var type = typeof div.lastChild.getAttribute("multiple"); // IE8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }), // Check if getElementsByClassName can be trusted assertUsableClassName = assert(function (div) { // Opera can't find a second classname (in 9.6) div.innerHTML = ""; if (!div.getElementsByClassName || !div.getElementsByClassName("e").length) { return false; } // Safari 3.2 caches class attributes and doesn't catch changes div.lastChild.className = "e"; return div.getElementsByClassName("e").length === 2; }), // Check if getElementById returns elements by name // Check if getElementsByName privileges form controls or returns elements by ID assertUsableName = assert(function (div) { // Inject content div.id = expando + 0; div.innerHTML = "
"; docElem.insertBefore(div, docElem.firstChild); // Test var pass = document.getElementsByName && // buggy browsers will return fewer than the correct 2 document.getElementsByName(expando).length === 2 + // buggy browsers will return more than the correct 0 document.getElementsByName(expando + 0).length; assertGetIdNotName = !document.getElementById(expando); // Cleanup docElem.removeChild(div); return pass; }); // If slice is not available, provide a backup try { slice.call(docElem.childNodes, 0)[0].nodeType; } catch (e) { slice = function (i) { var elem, results = []; for (; (elem = this[i]) ; i++) { results.push(elem); } return results; }; } function Sizzle(selector, context, results, seed) { results = results || []; context = context || document; var match, elem, xml, m, nodeType = context.nodeType; if (!selector || typeof selector !== "string") { return results; } if (nodeType !== 1 && nodeType !== 9) { return []; } xml = isXML(context); if (!xml && !seed) { if ((match = rquickExpr.exec(selector))) { // Speed-up: Sizzle("#ID") if ((m = match[1])) { if (nodeType === 9) { elem = context.getElementById(m); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if (elem && elem.parentNode) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if (elem.id === m) { results.push(elem); return results; } } else { return results; } } else { // Context is not a document if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) { results.push(elem); return results; } } // Speed-up: Sizzle("TAG") } else if (match[2]) { push.apply(results, slice.call(context.getElementsByTagName(selector), 0)); return results; // Speed-up: Sizzle(".CLASS") } else if ((m = match[3]) && assertUsableClassName && context.getElementsByClassName) { push.apply(results, slice.call(context.getElementsByClassName(m), 0)); return results; } } } // All others return select(selector.replace(rtrim, "$1"), context, results, seed, xml); } Sizzle.matches = function (expr, elements) { return Sizzle(expr, null, null, elements); }; Sizzle.matchesSelector = function (elem, expr) { return Sizzle(expr, null, null, [elem]).length > 0; }; // Returns a function to use in pseudos for input types function createInputPseudo(type) { return function (elem) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } // Returns a function to use in pseudos for buttons function createButtonPseudo(type) { return function (elem) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo(fn) { return markFunction(function (argument) { argument = +argument; return markFunction(function (seed, matches) { var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length; // Match elements found at the specified indexes while (i--) { if (seed[(j = matchIndexes[i])]) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function (elem) { var node, ret = "", i = 0, nodeType = elem.nodeType; if (nodeType) { if (nodeType === 1 || nodeType === 9 || nodeType === 11) { // Use textContent for elements // innerText usage removed for consistency of new lines (see #11153) if (typeof elem.textContent === "string") { return elem.textContent; } else { // Traverse its children for (elem = elem.firstChild; elem; elem = elem.nextSibling) { ret += getText(elem); } } } else if (nodeType === 3 || nodeType === 4) { return elem.nodeValue; } // Do not include comment or processing instruction nodes } else { // If no nodeType, this is expected to be an array for (; (node = elem[i]) ; i++) { // Do not traverse comment nodes ret += getText(node); } } return ret; }; isXML = Sizzle.isXML = function (elem) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; // Element contains another contains = Sizzle.contains = docElem.contains ? function (a, b) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!(bup && bup.nodeType === 1 && adown.contains && adown.contains(bup)); } : docElem.compareDocumentPosition ? function (a, b) { return b && !!(a.compareDocumentPosition(b) & 16); } : function (a, b) { while ((b = b.parentNode)) { if (b === a) { return true; } } return false; }; Sizzle.attr = function (elem, name) { var val, xml = isXML(elem); if (!xml) { name = name.toLowerCase(); } if ((val = Expr.attrHandle[name])) { return val(elem); } if (xml || assertAttributes) { return elem.getAttribute(name); } val = elem.getAttributeNode(name); return val ? typeof elem[name] === "boolean" ? elem[name] ? name : null : val.specified ? val.value : null : null; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, // IE6/7 return a modified href attrHandle: assertHrefNotNormalized ? {} : { "href": function (elem) { return elem.getAttribute("href", 2); }, "type": function (elem) { return elem.getAttribute("type"); } }, find: { "ID": assertGetIdNotName ? function (id, context, xml) { if (typeof context.getElementById !== strundefined && !xml) { var m = context.getElementById(id); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } } : function (id, context, xml) { if (typeof context.getElementById !== strundefined && !xml) { var m = context.getElementById(id); return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; } }, "TAG": assertTagNameNoComments ? function (tag, context) { if (typeof context.getElementsByTagName !== strundefined) { return context.getElementsByTagName(tag); } } : function (tag, context) { var results = context.getElementsByTagName(tag); // Filter out possible comments if (tag === "*") { var elem, tmp = [], i = 0; for (; (elem = results[i]) ; i++) { if (elem.nodeType === 1) { tmp.push(elem); } } return tmp; } return results; }, "NAME": assertUsableName && function (tag, context) { if (typeof context.getElementsByName !== strundefined) { return context.getElementsByName(name); } }, "CLASS": assertUsableClassName && function (className, context, xml) { if (typeof context.getElementsByClassName !== strundefined && !xml) { return context.getElementsByClassName(className); } } }, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function (match) { match[1] = match[1].replace(rbackslash, ""); // Move the given value to match[3] whether quoted or unquoted match[3] = (match[4] || match[5] || "").replace(rbackslash, ""); if (match[2] === "~=") { match[3] = " " + match[3] + " "; } return match.slice(0, 4); }, "CHILD": function (match) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 3 xn-component of xn+y argument ([+-]?\d*n|) 4 sign of xn-component 5 x of xn-component 6 sign of y-component 7 y of y-component */ match[1] = match[1].toLowerCase(); if (match[1] === "nth") { // nth-child requires argument if (!match[2]) { Sizzle.error(match[0]); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[3] = +(match[3] ? match[4] + (match[5] || 1) : 2 * (match[2] === "even" || match[2] === "odd")); match[4] = +((match[6] + match[7]) || match[2] === "odd"); // other types prohibit arguments } else if (match[2]) { Sizzle.error(match[0]); } return match; }, "PSEUDO": function (match) { var unquoted, excess; if (matchExpr["CHILD"].test(match[0])) { return null; } if (match[3]) { match[2] = match[3]; } else if ((unquoted = match[4])) { // Only check arguments that contain a pseudo if (rpseudo.test(unquoted) && // Get excess from tokenize (recursively) (excess = tokenize(unquoted, true)) && // advance to the next closing parenthesis (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { // excess is a negative index unquoted = unquoted.slice(0, excess); match[0] = match[0].slice(0, excess); } match[2] = unquoted; } // Return only captures needed by the pseudo filter method (type and argument) return match.slice(0, 3); } }, filter: { "ID": assertGetIdNotName ? function (id) { id = id.replace(rbackslash, ""); return function (elem) { return elem.getAttribute("id") === id; }; } : function (id) { id = id.replace(rbackslash, ""); return function (elem) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === id; }; }, "TAG": function (nodeName) { if (nodeName === "*") { return function () { return true; }; } nodeName = nodeName.replace(rbackslash, "").toLowerCase(); return function (elem) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function (className) { var pattern = classCache[expando][className + " "]; return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) { return pattern.test(elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || ""); }); }, "ATTR": function (name, operator, check) { return function (elem, context) { var result = Sizzle.attr(elem, name); if (result == null) { return operator === "!="; } if (!operator) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.substr(result.length - check.length) === check : operator === "~=" ? (" " + result + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.substr(0, check.length + 1) === check + "-" : false; }; }, "CHILD": function (type, argument, first, last) { if (type === "nth") { return function (elem) { var node, diff, parent = elem.parentNode; if (first === 1 && last === 0) { return true; } if (parent) { diff = 0; for (node = parent.firstChild; node; node = node.nextSibling) { if (node.nodeType === 1) { diff++; if (elem === node) { break; } } } } // Incorporate the offset (or cast to NaN), then check against cycle size diff -= last; return diff === first || (diff % first === 0 && diff / first >= 0); }; } return function (elem) { var node = elem; switch (type) { case "only": case "first": while ((node = node.previousSibling)) { if (node.nodeType === 1) { return false; } } if (type === "first") { return true; } node = elem; /* falls through */ case "last": while ((node = node.nextSibling)) { if (node.nodeType === 1) { return false; } } return true; } }; }, "PSEUDO": function (pseudo, argument) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if (fn[expando]) { return fn(argument); } // But maintain support for old signatures if (fn.length > 1) { args = [pseudo, pseudo, "", argument]; return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) { var idx, matched = fn(seed, argument), i = matched.length; while (i--) { idx = indexOf.call(seed, matched[i]); seed[idx] = !(matches[idx] = matched[i]); } }) : function (elem) { return fn(elem, 0, args); }; } return fn; } }, pseudos: { "not": markFunction(function (selector) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile(selector.replace(rtrim, "$1")); return matcher[expando] ? markFunction(function (seed, matches, context, xml) { var elem, unmatched = matcher(seed, null, xml, []), i = seed.length; // Match elements unmatched by `matcher` while (i--) { if ((elem = unmatched[i])) { seed[i] = !(matches[i] = elem); } } }) : function (elem, context, xml) { input[0] = elem; matcher(input, null, xml, results); return !results.pop(); }; }), "has": markFunction(function (selector) { return function (elem) { return Sizzle(selector, elem).length > 0; }; }), "contains": markFunction(function (text) { return function (elem) { return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1; }; }), "enabled": function (elem) { return elem.disabled === false; }, "disabled": function (elem) { return elem.disabled === true; }, "checked": function (elem) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function (elem) { // Accessing this property makes selected-by-default // options in Safari work properly if (elem.parentNode) { elem.parentNode.selectedIndex; } return elem.selected === true; }, "parent": function (elem) { return !Expr.pseudos["empty"](elem); }, "empty": function (elem) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // Thanks to Diego Perini for the nodeName shortcut // Greater than "@" means alpha characters (specifically not starting with "#" or "?") var nodeType; elem = elem.firstChild; while (elem) { if (elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4) { return false; } elem = elem.nextSibling; } return true; }, "header": function (elem) { return rheader.test(elem.nodeName); }, "text": function (elem) { var type, attr; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && (type = elem.type) === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type); }, // Input types "radio": createInputPseudo("radio"), "checkbox": createInputPseudo("checkbox"), "file": createInputPseudo("file"), "password": createInputPseudo("password"), "image": createInputPseudo("image"), "submit": createButtonPseudo("submit"), "reset": createButtonPseudo("reset"), "button": function (elem) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "input": function (elem) { return rinputs.test(elem.nodeName); }, "focus": function (elem) { var doc = elem.ownerDocument; return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, "active": function (elem) { return elem === elem.ownerDocument.activeElement; }, // Positional types "first": createPositionalPseudo(function () { return [0]; }), "last": createPositionalPseudo(function (matchIndexes, length) { return [length - 1]; }), "eq": createPositionalPseudo(function (matchIndexes, length, argument) { return [argument < 0 ? argument + length : argument]; }), "even": createPositionalPseudo(function (matchIndexes, length) { for (var i = 0; i < length; i += 2) { matchIndexes.push(i); } return matchIndexes; }), "odd": createPositionalPseudo(function (matchIndexes, length) { for (var i = 1; i < length; i += 2) { matchIndexes.push(i); } return matchIndexes; }), "lt": createPositionalPseudo(function (matchIndexes, length, argument) { for (var i = argument < 0 ? argument + length : argument; --i >= 0;) { matchIndexes.push(i); } return matchIndexes; }), "gt": createPositionalPseudo(function (matchIndexes, length, argument) { for (var i = argument < 0 ? argument + length : argument; ++i < length;) { matchIndexes.push(i); } return matchIndexes; }) } }; function siblingCheck(a, b, ret) { if (a === b) { return ret; } var cur = a.nextSibling; while (cur) { if (cur === b) { return -1; } cur = cur.nextSibling; } return 1; } sortOrder = docElem.compareDocumentPosition ? function (a, b) { if (a === b) { hasDuplicate = true; return 0; } return (!a.compareDocumentPosition || !b.compareDocumentPosition ? a.compareDocumentPosition : a.compareDocumentPosition(b) & 4 ) ? -1 : 1; } : function (a, b) { // The nodes are identical, we can exit early if (a === b) { hasDuplicate = true; return 0; // Fallback to using sourceIndex (in IE) if it's available on both nodes } else if (a.sourceIndex && b.sourceIndex) { return a.sourceIndex - b.sourceIndex; } var al, bl, ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, cur = aup; // If the nodes are siblings (or identical) we can do a quick check if (aup === bup) { return siblingCheck(a, b); // If no parents were found then the nodes are disconnected } else if (!aup) { return -1; } else if (!bup) { return 1; } // Otherwise they're somewhere else in the tree so we need // to build up a full list of the parentNodes for comparison while (cur) { ap.unshift(cur); cur = cur.parentNode; } cur = bup; while (cur) { bp.unshift(cur); cur = cur.parentNode; } al = ap.length; bl = bp.length; // Start walking down the tree looking for a discrepancy for (var i = 0; i < al && i < bl; i++) { if (ap[i] !== bp[i]) { return siblingCheck(ap[i], bp[i]); } } // We ended someplace up the tree so do a sibling check return i === al ? siblingCheck(a, bp[i], -1) : siblingCheck(ap[i], b, 1); }; // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). [0, 0].sort(sortOrder); baseHasDuplicate = !hasDuplicate; // Document sorting and removing duplicates Sizzle.uniqueSort = function (results) { var elem, duplicates = [], i = 1, j = 0; hasDuplicate = baseHasDuplicate; results.sort(sortOrder); if (hasDuplicate) { for (; (elem = results[i]) ; i++) { if (elem === results[i - 1]) { j = duplicates.push(i); } } while (j--) { results.splice(duplicates[j], 1); } } return results; }; Sizzle.error = function (msg) { throw new Error("Syntax error, unrecognized expression: " + msg); }; function tokenize(selector, parseOnly) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[expando][selector + " "]; if (cached) { return parseOnly ? 0 : cached.slice(0); } soFar = selector; groups = []; preFilters = Expr.preFilter; while (soFar) { // Comma and first run if (!matched || (match = rcomma.exec(soFar))) { if (match) { // Don't consume trailing commas as valid soFar = soFar.slice(match[0].length) || soFar; } groups.push(tokens = []); } matched = false; // Combinators if ((match = rcombinators.exec(soFar))) { tokens.push(matched = new Token(match.shift())); soFar = soFar.slice(matched.length); // Cast descendant combinators to space matched.type = match[0].replace(rtrim, " "); } // Filters for (type in Expr.filter) { if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { tokens.push(matched = new Token(match.shift())); soFar = soFar.slice(matched.length); matched.type = type; matched.matches = match; } } if (!matched) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : // Cache the tokens tokenCache(selector, groups).slice(0); } function addCombinator(matcher, combinator, base) { var dir = combinator.dir, checkNonElements = base && combinator.dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function (elem, context, xml) { while ((elem = elem[dir])) { if (checkNonElements || elem.nodeType === 1) { return matcher(elem, context, xml); } } } : // Check against all ancestor/preceding elements function (elem, context, xml) { // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if (!xml) { var cache, dirkey = dirruns + " " + doneName + " ", cachedkey = dirkey + cachedruns; while ((elem = elem[dir])) { if (checkNonElements || elem.nodeType === 1) { if ((cache = elem[expando]) === cachedkey) { return elem.sizset; } else if (typeof cache === "string" && cache.indexOf(dirkey) === 0) { if (elem.sizset) { return elem; } } else { elem[expando] = cachedkey; if (matcher(elem, context, xml)) { elem.sizset = true; return elem; } elem.sizset = false; } } } } else { while ((elem = elem[dir])) { if (checkNonElements || elem.nodeType === 1) { if (matcher(elem, context, xml)) { return elem; } } } } }; } function elementMatcher(matchers) { return matchers.length > 1 ? function (elem, context, xml) { var i = matchers.length; while (i--) { if (!matchers[i](elem, context, xml)) { return false; } } return true; } : matchers[0]; } function condense(unmatched, map, filter, context, xml) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for (; i < len; i++) { if ((elem = unmatched[i])) { if (!filter || filter(elem, context, xml)) { newUnmatched.push(elem); if (mapped) { map.push(i); } } } } return newUnmatched; } function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { if (postFilter && !postFilter[expando]) { postFilter = setMatcher(postFilter); } if (postFinder && !postFinder[expando]) { postFinder = setMatcher(postFinder, postSelector); } return markFunction(function (seed, results, context, xml) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || (seed ? preFilter : preexisting || postFilter) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if (matcher) { matcher(matcherIn, matcherOut, context, xml); } // Apply postFilter if (postFilter) { temp = condense(matcherOut, postMap); postFilter(temp, [], context, xml); // Un-match failing elements by moving them back to matcherIn i = temp.length; while (i--) { if ((elem = temp[i])) { matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); } } } if (seed) { if (postFinder || preFilter) { if (postFinder) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while (i--) { if ((elem = matcherOut[i])) { // Restore matcherIn since elem is not yet a final match temp.push((matcherIn[i] = elem)); } } postFinder(null, (matcherOut = []), temp, xml); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while (i--) { if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut ); if (postFinder) { postFinder(null, results, matcherOut, xml); } else { push.apply(results, matcherOut); } } }); } function matcherFromTokens(tokens) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator(function (elem) { return elem === checkContext; }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) { return indexOf.call(checkContext, elem) > -1; }, implicitRelative, true), matchers = [function (elem, context, xml) { return (!leadingRelative && (xml || context !== outermostContext)) || ( (checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); }]; for (; i < len; i++) { if ((matcher = Expr.relative[tokens[i].type])) { matchers = [addCombinator(elementMatcher(matchers), matcher)]; } else { matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); // Return special upon seeing a positional matcher if (matcher[expando]) { // Find the next relative operator (if any) for proper handling j = ++i; for (; j < len; j++) { if (Expr.relative[tokens[j].type]) { break; } } return setMatcher( i > 1 && elementMatcher(matchers), i > 1 && tokens.slice(0, i - 1).join("").replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && tokens.join("") ); } matchers.push(matcher); } } return elementMatcher(matchers); } function matcherFromGroupMatchers(elementMatchers, setMatchers) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, expandContext) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]("*", expandContext && context.parentNode || context), // Nested matchers should use non-integer dirruns dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); if (outermost) { outermostContext = context !== document && context; cachedruns = superMatcher.el; } // Add elements passing elementMatchers directly to results for (; (elem = elems[i]) != null; i++) { if (byElement && elem) { for (j = 0; (matcher = elementMatchers[j]) ; j++) { if (matcher(elem, context, xml)) { results.push(elem); break; } } if (outermost) { dirruns = dirrunsUnique; cachedruns = ++superMatcher.el; } } // Track unmatched elements for set filters if (bySet) { // They will have gone through all possible matchers if ((elem = !matcher && elem)) { matchedCount--; } // Lengthen the array for every element, matched or not if (seed) { unmatched.push(elem); } } } // Apply set filters to unmatched elements matchedCount += i; if (bySet && i !== matchedCount) { for (j = 0; (matcher = setMatchers[j]) ; j++) { matcher(unmatched, setMatched, context, xml); } if (seed) { // Reintegrate element matches to eliminate the need for sorting if (matchedCount > 0) { while (i--) { if (!(unmatched[i] || setMatched[i])) { setMatched[i] = pop.call(results); } } } // Discard index placeholder values to get only actual matches setMatched = condense(setMatched); } // Add matches to results push.apply(results, setMatched); // Seedless set matches succeeding multiple successful matchers stipulate sorting if (outermost && !seed && setMatched.length > 0 && (matchedCount + setMatchers.length) > 1) { Sizzle.uniqueSort(results); } } // Override manipulation of globals by nested matchers if (outermost) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; superMatcher.el = 0; return bySet ? markFunction(superMatcher) : superMatcher; } compile = Sizzle.compile = function (selector, group /* Internal Use Only */) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[expando][selector + " "]; if (!cached) { // Generate a function of recursive functions that can be used to check each element if (!group) { group = tokenize(selector); } i = group.length; while (i--) { cached = matcherFromTokens(group[i]); if (cached[expando]) { setMatchers.push(cached); } else { elementMatchers.push(cached); } } // Cache the compiled function cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); } return cached; }; function multipleContexts(selector, contexts, results) { var i = 0, len = contexts.length; for (; i < len; i++) { Sizzle(selector, contexts[i], results); } return results; } function select(selector, context, results, seed, xml) { var i, tokens, token, type, find, match = tokenize(selector), j = match.length; if (!seed) { // Try to minimize operations if there is only one group if (match.length === 1) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice(0); if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !xml && Expr.relative[tokens[1].type]) { context = Expr.find["ID"](token.matches[0].replace(rbackslash, ""), context, xml)[0]; if (!context) { return results; } selector = selector.slice(tokens.shift().length); } // Fetch a seed set for right-to-left matching for (i = matchExpr["POS"].test(selector) ? -1 : tokens.length - 1; i >= 0; i--) { token = tokens[i]; // Abort if we hit a combinator if (Expr.relative[(type = token.type)]) { break; } if ((find = Expr.find[type])) { // Search, expanding context for leading sibling combinators if ((seed = find( token.matches[0].replace(rbackslash, ""), rsibling.test(tokens[0].type) && context.parentNode || context, xml ))) { // If seed is empty or no tokens remain, we can return early tokens.splice(i, 1); selector = seed.length && tokens.join(""); if (!selector) { push.apply(results, slice.call(seed, 0)); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile(selector, match)( seed, context, xml, results, rsibling.test(selector) ); return results; } if (document.querySelectorAll) { (function () { var disconnectedMatch, oldSelect = select, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA // A support test would require too much code (would include document ready) rbuggyQSA = [":focus"], // matchesSelector(:active) reports false when true (IE9/Opera 11.5) // A support test would require too much code (would include document ready) // just skip matchesSelector for :active rbuggyMatches = [":active"], matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector; // Build QSA regex // Regex strategy adopted from Diego Perini assert(function (div) { // Select is set to empty string on purpose // This is to test IE's treatment of not explictly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerHTML = ""; // IE8 - Some boolean attributes are not treated correctly if (!div.querySelectorAll("[selected]").length) { rbuggyQSA.push("\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)"); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here (do not put tests after this one) if (!div.querySelectorAll(":checked").length) { rbuggyQSA.push(":checked"); } }); assert(function (div) { // Opera 10-12/IE9 - ^= $= *= and empty values // Should not select anything div.innerHTML = "

"; if (div.querySelectorAll("[test^='']").length) { rbuggyQSA.push("[*^$]=" + whitespace + "*(?:\"\"|'')"); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here (do not put tests after this one) div.innerHTML = ""; if (!div.querySelectorAll(":enabled").length) { rbuggyQSA.push(":enabled", ":disabled"); } }); // rbuggyQSA always contains :focus, so no need for a length check rbuggyQSA = /* rbuggyQSA.length && */ new RegExp(rbuggyQSA.join("|")); select = function (selector, context, results, seed, xml) { // Only use querySelectorAll when not filtering, // when this is not xml, // and when no QSA bugs apply if (!seed && !xml && !rbuggyQSA.test(selector)) { var groups, i, old = true, nid = expando, newContext = context, newSelector = context.nodeType === 9 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if (context.nodeType === 1 && context.nodeName.toLowerCase() !== "object") { groups = tokenize(selector); if ((old = context.getAttribute("id"))) { nid = old.replace(rescape, "\\$&"); } else { context.setAttribute("id", nid); } nid = "[id='" + nid + "'] "; i = groups.length; while (i--) { groups[i] = nid + groups[i].join(""); } newContext = rsibling.test(selector) && context.parentNode || context; newSelector = groups.join(","); } if (newSelector) { try { push.apply(results, slice.call(newContext.querySelectorAll( newSelector ), 0)); return results; } catch (qsaError) { } finally { if (!old) { context.removeAttribute("id"); } } } } return oldSelect(selector, context, results, seed, xml); }; if (matches) { assert(function (div) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) disconnectedMatch = matches.call(div, "div"); // This should fail with an exception // Gecko does not error, returns false instead try { matches.call(div, "[test!='']:sizzle"); rbuggyMatches.push("!=", pseudos); } catch (e) { } }); // rbuggyMatches always contains :active and :focus, so no need for a length check rbuggyMatches = /* rbuggyMatches.length && */ new RegExp(rbuggyMatches.join("|")); Sizzle.matchesSelector = function (elem, expr) { // Make sure that attribute selectors are quoted expr = expr.replace(rattributeQuotes, "='$1']"); // rbuggyMatches always contains :active, so no need for an existence check if (!isXML(elem) && !rbuggyMatches.test(expr) && !rbuggyQSA.test(expr)) { try { var ret = matches.call(elem, expr); // IE 9's matchesSelector returns false on disconnected nodes if (ret || disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11) { return ret; } } catch (e) { } } return Sizzle(expr, null, null, [elem]).length > 0; }; } })(); } // Deprecated Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Back-compat function setFilters() { } Expr.filters = setFilters.prototype = Expr.pseudos; Expr.setFilters = new setFilters(); // Override sizzle attribute retrieval Sizzle.attr = jQuery.attr; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })(window); var runtil = /Until$/, rparentsprev = /^(?:parents|prev(?:Until|All))/, isSimple = /^.[^:#\[\.,]*$/, rneedsContext = jQuery.expr.match.needsContext, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function (selector) { var i, l, length, n, r, ret, self = this; if (typeof selector !== "string") { return jQuery(selector).filter(function () { for (i = 0, l = self.length; i < l; i++) { if (jQuery.contains(self[i], this)) { return true; } } }); } ret = this.pushStack("", "find", selector); for (i = 0, l = this.length; i < l; i++) { length = ret.length; jQuery.find(selector, this[i], ret); if (i > 0) { // Make sure that the results are unique for (n = length; n < ret.length; n++) { for (r = 0; r < length; r++) { if (ret[r] === ret[n]) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function (target) { var i, targets = jQuery(target, this), len = targets.length; return this.filter(function () { for (i = 0; i < len; i++) { if (jQuery.contains(this, targets[i])) { return true; } } }); }, not: function (selector) { return this.pushStack(winnow(this, selector, false), "not", selector); }, filter: function (selector) { return this.pushStack(winnow(this, selector, true), "filter", selector); }, is: function (selector) { return !!selector && ( typeof selector === "string" ? // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". rneedsContext.test(selector) ? jQuery(selector, this.context).index(this[0]) >= 0 : jQuery.filter(selector, this).length > 0 : this.filter(selector).length > 0); }, closest: function (selectors, context) { var cur, i = 0, l = this.length, ret = [], pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? jQuery(selectors, context || this.context) : 0; for (; i < l; i++) { cur = this[i]; while (cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11) { if (pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors)) { ret.push(cur); break; } cur = cur.parentNode; } } ret = ret.length > 1 ? jQuery.unique(ret) : ret; return this.pushStack(ret, "closest", selectors); }, // Determine the position of an element within // the matched set of elements index: function (elem) { // No argument, return index in parent if (!elem) { return (this[0] && this[0].parentNode) ? this.prevAll().length : -1; } // index in selector if (typeof elem === "string") { return jQuery.inArray(this[0], jQuery(elem)); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this); }, add: function (selector, context) { var set = typeof selector === "string" ? jQuery(selector, context) : jQuery.makeArray(selector && selector.nodeType ? [selector] : selector), all = jQuery.merge(this.get(), set); return this.pushStack(isDisconnected(set[0]) || isDisconnected(all[0]) ? all : jQuery.unique(all)); }, addBack: function (selector) { return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); jQuery.fn.andSelf = jQuery.fn.addBack; // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected(node) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } function sibling(cur, dir) { do { cur = cur[dir]; } while (cur && cur.nodeType !== 1); return cur; } jQuery.each({ parent: function (elem) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function (elem) { return jQuery.dir(elem, "parentNode"); }, parentsUntil: function (elem, i, until) { return jQuery.dir(elem, "parentNode", until); }, next: function (elem) { return sibling(elem, "nextSibling"); }, prev: function (elem) { return sibling(elem, "previousSibling"); }, nextAll: function (elem) { return jQuery.dir(elem, "nextSibling"); }, prevAll: function (elem) { return jQuery.dir(elem, "previousSibling"); }, nextUntil: function (elem, i, until) { return jQuery.dir(elem, "nextSibling", until); }, prevUntil: function (elem, i, until) { return jQuery.dir(elem, "previousSibling", until); }, siblings: function (elem) { return jQuery.sibling((elem.parentNode || {}).firstChild, elem); }, children: function (elem) { return jQuery.sibling(elem.firstChild); }, contents: function (elem) { return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.merge([], elem.childNodes); } }, function (name, fn) { jQuery.fn[name] = function (until, selector) { var ret = jQuery.map(this, fn, until); if (!runtil.test(name)) { selector = until; } if (selector && typeof selector === "string") { ret = jQuery.filter(selector, ret); } ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret; if (this.length > 1 && rparentsprev.test(name)) { ret = ret.reverse(); } return this.pushStack(ret, name, core_slice.call(arguments).join(",")); }; }); jQuery.extend({ filter: function (expr, elems, not) { if (not) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [] : jQuery.find.matches(expr, elems); }, dir: function (elem, dir, until) { var matched = [], cur = elem[dir]; while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) { if (cur.nodeType === 1) { matched.push(cur); } cur = cur[dir]; } return matched; }, sibling: function (n, elem) { var r = []; for (; n; n = n.nextSibling) { if (n.nodeType === 1 && n !== elem) { r.push(n); } } return r; } }); // Implement the identical functionality for filter and not function winnow(elements, qualifier, keep) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if (jQuery.isFunction(qualifier)) { return jQuery.grep(elements, function (elem, i) { var retVal = !!qualifier.call(elem, i, elem); return retVal === keep; }); } else if (qualifier.nodeType) { return jQuery.grep(elements, function (elem, i) { return (elem === qualifier) === keep; }); } else if (typeof qualifier === "string") { var filtered = jQuery.grep(elements, function (elem) { return elem.nodeType === 1; }); if (isSimple.test(qualifier)) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter(qualifier, filtered); } } return jQuery.grep(elements, function (elem, i) { return (jQuery.inArray(elem, qualifier) >= 0) === keep; }); } function createSafeFragment(document) { var list = nodeNames.split("|"), safeFrag = document.createDocumentFragment(); if (safeFrag.createElement) { while (list.length) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /]", "i"), rcheckableType = /^(?:checkbox|radio)$/, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /\/(java|ecma)script/i, rcleanScript = /^\s*\s*$/g, wrapMap = { option: [1, ""], legend: [1, "
", "
"], thead: [1, "", "
"], tr: [2, "", "
"], td: [3, "", "
"], col: [2, "", "
"], area: [1, "", ""], _default: [0, "", ""] }, safeFragment = createSafeFragment(document), fragmentDiv = safeFragment.appendChild(document.createElement("div")); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. if (!jQuery.support.htmlSerialize) { wrapMap._default = [1, "X
", "
"]; } jQuery.fn.extend({ text: function (value) { return jQuery.access(this, function (value) { return value === undefined ? jQuery.text(this) : this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value)); }, null, value, arguments.length); }, wrapAll: function (html) { if (jQuery.isFunction(html)) { return this.each(function (i) { jQuery(this).wrapAll(html.call(this, i)); }); } if (this[0]) { // The elements to wrap the target around var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); if (this[0].parentNode) { wrap.insertBefore(this[0]); } wrap.map(function () { var elem = this; while (elem.firstChild && elem.firstChild.nodeType === 1) { elem = elem.firstChild; } return elem; }).append(this); } return this; }, wrapInner: function (html) { if (jQuery.isFunction(html)) { return this.each(function (i) { jQuery(this).wrapInner(html.call(this, i)); }); } return this.each(function () { var self = jQuery(this), contents = self.contents(); if (contents.length) { contents.wrapAll(html); } else { self.append(html); } }); }, wrap: function (html) { var isFunction = jQuery.isFunction(html); return this.each(function (i) { jQuery(this).wrapAll(isFunction ? html.call(this, i) : html); }); }, unwrap: function () { return this.parent().each(function () { if (!jQuery.nodeName(this, "body")) { jQuery(this).replaceWith(this.childNodes); } }).end(); }, append: function () { return this.domManip(arguments, true, function (elem) { if (this.nodeType === 1 || this.nodeType === 11) { this.appendChild(elem); } }); }, prepend: function () { return this.domManip(arguments, true, function (elem) { if (this.nodeType === 1 || this.nodeType === 11) { this.insertBefore(elem, this.firstChild); } }); }, before: function () { if (!isDisconnected(this[0])) { return this.domManip(arguments, false, function (elem) { this.parentNode.insertBefore(elem, this); }); } if (arguments.length) { var set = jQuery.clean(arguments); return this.pushStack(jQuery.merge(set, this), "before", this.selector); } }, after: function () { if (!isDisconnected(this[0])) { return this.domManip(arguments, false, function (elem) { this.parentNode.insertBefore(elem, this.nextSibling); }); } if (arguments.length) { var set = jQuery.clean(arguments); return this.pushStack(jQuery.merge(this, set), "after", this.selector); } }, // keepData is for internal use only--do not document remove: function (selector, keepData) { var elem, i = 0; for (; (elem = this[i]) != null; i++) { if (!selector || jQuery.filter(selector, [elem]).length) { if (!keepData && elem.nodeType === 1) { jQuery.cleanData(elem.getElementsByTagName("*")); jQuery.cleanData([elem]); } if (elem.parentNode) { elem.parentNode.removeChild(elem); } } } return this; }, empty: function () { var elem, i = 0; for (; (elem = this[i]) != null; i++) { // Remove element nodes and prevent memory leaks if (elem.nodeType === 1) { jQuery.cleanData(elem.getElementsByTagName("*")); } // Remove any remaining nodes while (elem.firstChild) { elem.removeChild(elem.firstChild); } } return this; }, clone: function (dataAndEvents, deepDataAndEvents) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map(function () { return jQuery.clone(this, dataAndEvents, deepDataAndEvents); }); }, html: function (value) { return jQuery.access(this, function (value) { var elem = this[0] || {}, i = 0, l = this.length; if (value === undefined) { return elem.nodeType === 1 ? elem.innerHTML.replace(rinlinejQuery, "") : undefined; } // See if we can take a shortcut and just use innerHTML if (typeof value === "string" && !rnoInnerhtml.test(value) && (jQuery.support.htmlSerialize || !rnoshimcache.test(value)) && (jQuery.support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) { value = value.replace(rxhtmlTag, "<$1>"); try { for (; i < l; i++) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if (elem.nodeType === 1) { jQuery.cleanData(elem.getElementsByTagName("*")); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch (e) { } } if (elem) { this.empty().append(value); } }, null, value, arguments.length); }, replaceWith: function (value) { if (!isDisconnected(this[0])) { // Make sure that the elements are removed from the DOM before they are inserted // this can help fix replacing a parent with child elements if (jQuery.isFunction(value)) { return this.each(function (i) { var self = jQuery(this), old = self.html(); self.replaceWith(value.call(this, i, old)); }); } if (typeof value !== "string") { value = jQuery(value).detach(); } return this.each(function () { var next = this.nextSibling, parent = this.parentNode; jQuery(this).remove(); if (next) { jQuery(next).before(value); } else { jQuery(parent).append(value); } }); } return this.length ? this.pushStack(jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value) : this; }, detach: function (selector) { return this.remove(selector, true); }, domManip: function (args, table, callback) { // Flatten any nested arrays args = [].concat.apply([], args); var results, first, fragment, iNoClone, i = 0, value = args[0], scripts = [], l = this.length; // We can't cloneNode fragments that contain checked, in WebKit if (!jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test(value)) { return this.each(function () { jQuery(this).domManip(args, table, callback); }); } if (jQuery.isFunction(value)) { return this.each(function (i) { var self = jQuery(this); args[0] = value.call(this, i, table ? self.html() : undefined); self.domManip(args, table, callback); }); } if (this[0]) { results = jQuery.buildFragment(args, this, scripts); fragment = results.fragment; first = fragment.firstChild; if (fragment.childNodes.length === 1) { fragment = first; } if (first) { table = table && jQuery.nodeName(first, "tr"); // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). // Fragments from the fragment cache must always be cloned and never used in place. for (iNoClone = results.cacheable || l - 1; i < l; i++) { callback.call( table && jQuery.nodeName(this[i], "table") ? findOrAppend(this[i], "tbody") : this[i], i === iNoClone ? fragment : jQuery.clone(fragment, true, true) ); } } // Fix #11809: Avoid leaking memory fragment = first = null; if (scripts.length) { jQuery.each(scripts, function (i, elem) { if (elem.src) { if (jQuery.ajax) { jQuery.ajax({ url: elem.src, type: "GET", dataType: "script", async: false, global: false, "throws": true }); } else { jQuery.error("no ajax"); } } else { jQuery.globalEval((elem.text || elem.textContent || elem.innerHTML || "").replace(rcleanScript, "")); } if (elem.parentNode) { elem.parentNode.removeChild(elem); } }); } } return this; } }); function findOrAppend(elem, tag) { return elem.getElementsByTagName(tag)[0] || elem.appendChild(elem.ownerDocument.createElement(tag)); } function cloneCopyEvent(src, dest) { if (dest.nodeType !== 1 || !jQuery.hasData(src)) { return; } var type, i, l, oldData = jQuery._data(src), curData = jQuery._data(dest, oldData), events = oldData.events; if (events) { delete curData.handle; curData.events = {}; for (type in events) { for (i = 0, l = events[type].length; i < l; i++) { jQuery.event.add(dest, type, events[type][i]); } } } // make the cloned public data object a copy from the original if (curData.data) { curData.data = jQuery.extend({}, curData.data); } } function cloneFixAttributes(src, dest) { var nodeName; // We do not need to do anything for non-Elements if (dest.nodeType !== 1) { return; } // clearAttributes removes the attributes, which we don't want, // but also removes the attachEvent events, which we *do* want if (dest.clearAttributes) { dest.clearAttributes(); } // mergeAttributes, in contrast, only merges back on the // original attributes, not the events if (dest.mergeAttributes) { dest.mergeAttributes(src); } nodeName = dest.nodeName.toLowerCase(); if (nodeName === "object") { // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. if (dest.parentNode) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if (jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) { dest.innerHTML = src.innerHTML; } } else if (nodeName === "input" && rcheckableType.test(src.type)) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if (dest.value !== src.value) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if (nodeName === "option") { dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if (nodeName === "input" || nodeName === "textarea") { dest.defaultValue = src.defaultValue; // IE blanks contents when cloning scripts } else if (nodeName === "script" && dest.text !== src.text) { dest.text = src.text; } // Event data gets referenced instead of copied if the expando // gets copied too dest.removeAttribute(jQuery.expando); } jQuery.buildFragment = function (args, context, scripts) { var fragment, cacheable, cachehit, first = args[0]; // Set context from what may come in as undefined or a jQuery collection or a node // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception context = context || document; context = !context.nodeType && context[0] || context; context = context.ownerDocument || context; // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put or elements in a fragment // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 if (args.length === 1 && typeof first === "string" && first.length < 512 && context === document && first.charAt(0) === "<" && !rnocache.test(first) && (jQuery.support.checkClone || !rchecked.test(first)) && (jQuery.support.html5Clone || !rnoshimcache.test(first))) { // Mark cacheable and look for a hit cacheable = true; fragment = jQuery.fragments[first]; cachehit = fragment !== undefined; } if (!fragment) { fragment = context.createDocumentFragment(); jQuery.clean(args, context, fragment, scripts); // Update the cache, but only store false // unless this is a second parsing of the same content if (cacheable) { jQuery.fragments[first] = cachehit && fragment; } } return { fragment: fragment, cacheable: cacheable }; }; jQuery.fragments = {}; jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function (name, original) { jQuery.fn[name] = function (selector) { var elems, i = 0, ret = [], insert = jQuery(selector), l = insert.length, parent = this.length === 1 && this[0].parentNode; if ((parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1) { insert[original](this[0]); return this; } else { for (; i < l; i++) { elems = (i > 0 ? this.clone(true) : this).get(); jQuery(insert[i])[original](elems); ret = ret.concat(elems); } return this.pushStack(ret, name, insert.selector); } }; }); function getAll(elem) { if (typeof elem.getElementsByTagName !== "undefined") { return elem.getElementsByTagName("*"); } else if (typeof elem.querySelectorAll !== "undefined") { return elem.querySelectorAll("*"); } else { return []; } } // Used in clean, fixes the defaultChecked property function fixDefaultChecked(elem) { if (rcheckableType.test(elem.type)) { elem.defaultChecked = elem.checked; } } jQuery.extend({ clone: function (elem, dataAndEvents, deepDataAndEvents) { var srcElements, destElements, i, clone; if (jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) { clone = elem.cloneNode(true); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild(clone = fragmentDiv.firstChild); } if ((!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) { // IE copies events bound via attachEvent when using cloneNode. // Calling detachEvent on the clone will also remove the events // from the original. In order to get around this, we use some // proprietary methods to clear the events. Thanks to MooTools // guys for this hotness. cloneFixAttributes(elem, clone); // Using Sizzle here is crazy slow, so we use getElementsByTagName instead srcElements = getAll(elem); destElements = getAll(clone); // Weird iteration because IE will replace the length property // with an element if you are cloning the body and one of the // elements on the page has a name or id of "length" for (i = 0; srcElements[i]; ++i) { // Ensure that the destination node is not null; Fixes #9587 if (destElements[i]) { cloneFixAttributes(srcElements[i], destElements[i]); } } } // Copy the events from the original to the clone if (dataAndEvents) { cloneCopyEvent(elem, clone); if (deepDataAndEvents) { srcElements = getAll(elem); destElements = getAll(clone); for (i = 0; srcElements[i]; ++i) { cloneCopyEvent(srcElements[i], destElements[i]); } } } srcElements = destElements = null; // Return the cloned set return clone; }, clean: function (elems, context, fragment, scripts) { var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, safe = context === document && safeFragment, ret = []; // Ensure that context is a document if (!context || typeof context.createDocumentFragment === "undefined") { context = document; } // Use the already-created safe fragment if context permits for (i = 0; (elem = elems[i]) != null; i++) { if (typeof elem === "number") { elem += ""; } if (!elem) { continue; } // Convert html string into DOM nodes if (typeof elem === "string") { if (!rhtml.test(elem)) { elem = context.createTextNode(elem); } else { // Ensure a safe container in which to render the html safe = safe || createSafeFragment(context); div = context.createElement("div"); safe.appendChild(div); // Fix "XHTML"-style tags in all browsers elem = elem.replace(rxhtmlTag, "<$1>"); // Go to html and back, then peel off extra wrappers tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); wrap = wrapMap[tag] || wrapMap._default; depth = wrap[0]; div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while (depth--) { div = div.lastChild; } // Remove IE's autoinserted from table fragments if (!jQuery.support.tbody) { // String was a , *may* have spurious hasBody = rtbody.test(elem); tbody = tag === "table" && !hasBody ? div.firstChild && div.firstChild.childNodes : // String was a bare or wrap[1] === "
" && !hasBody ? div.childNodes : []; for (j = tbody.length - 1; j >= 0 ; --j) { if (jQuery.nodeName(tbody[j], "tbody") && !tbody[j].childNodes.length) { tbody[j].parentNode.removeChild(tbody[j]); } } } // IE completely kills leading whitespace when innerHTML is used if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem)) { div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]), div.firstChild); } elem = div.childNodes; // Take out of fragment container (we need a fresh div each time) div.parentNode.removeChild(div); } } if (elem.nodeType) { ret.push(elem); } else { jQuery.merge(ret, elem); } } // Fix #11356: Clear elements from safeFragment if (div) { elem = div = safe = null; } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if (!jQuery.support.appendChecked) { for (i = 0; (elem = ret[i]) != null; i++) { if (jQuery.nodeName(elem, "input")) { fixDefaultChecked(elem); } else if (typeof elem.getElementsByTagName !== "undefined") { jQuery.grep(elem.getElementsByTagName("input"), fixDefaultChecked); } } } // Append elements to a provided document fragment if (fragment) { // Special handling of each script element handleScript = function (elem) { // Check if we consider it executable if (!elem.type || rscriptType.test(elem.type)) { // Detach the script and store it in the scripts array (if provided) or the fragment // Return truthy to indicate that it has been handled return scripts ? scripts.push(elem.parentNode ? elem.parentNode.removeChild(elem) : elem) : fragment.appendChild(elem); } }; for (i = 0; (elem = ret[i]) != null; i++) { // Check if we're done after handling an executable script if (!(jQuery.nodeName(elem, "script") && handleScript(elem))) { // Append to fragment and handle embedded scripts fragment.appendChild(elem); if (typeof elem.getElementsByTagName !== "undefined") { // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration jsTags = jQuery.grep(jQuery.merge([], elem.getElementsByTagName("script")), handleScript); // Splice the scripts into ret after their former ancestor and advance our index beyond them ret.splice.apply(ret, [i + 1, 0].concat(jsTags)); i += jsTags.length; } } } } return ret; }, cleanData: function (elems, /* internal */ acceptData) { var data, id, elem, type, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = jQuery.support.deleteExpando, special = jQuery.event.special; for (; (elem = elems[i]) != null; i++) { if (acceptData || jQuery.acceptData(elem)) { id = elem[internalKey]; data = id && cache[id]; if (data) { if (data.events) { for (type in data.events) { if (special[type]) { jQuery.event.remove(elem, type); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent(elem, type, data.handle); } } } // Remove cache only if it was not already removed by jQuery.event.remove if (cache[id]) { delete cache[id]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if (deleteExpando) { delete elem[internalKey]; } else if (elem.removeAttribute) { elem.removeAttribute(internalKey); } else { elem[internalKey] = null; } jQuery.deletedIds.push(id); } } } } } }); // Limit scope pollution from any deprecated API (function () { var matched, browser; // Use of jQuery.browser is frowned upon. // More details: http://api.jquery.com/jQuery.browser // jQuery.uaMatch maintained for back-compat jQuery.uaMatch = function (ua) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; return { browser: match[1] || "", version: match[2] || "0" }; }; matched = jQuery.uaMatch(navigator.userAgent); browser = {}; if (matched.browser) { browser[matched.browser] = true; browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if (browser.chrome) { browser.webkit = true; } else if (browser.webkit) { browser.safari = true; } jQuery.browser = browser; jQuery.sub = function () { function jQuerySub(selector, context) { return new jQuerySub.fn.init(selector, context); } jQuery.extend(true, jQuerySub, this); jQuerySub.superclass = this; jQuerySub.fn = jQuerySub.prototype = this(); jQuerySub.fn.constructor = jQuerySub; jQuerySub.sub = this.sub; jQuerySub.fn.init = function init(selector, context) { if (context && context instanceof jQuery && !(context instanceof jQuerySub)) { context = jQuerySub(context); } return jQuery.fn.init.call(this, selector, context, rootjQuerySub); }; jQuerySub.fn.init.prototype = jQuerySub.fn; var rootjQuerySub = jQuerySub(document); return jQuerySub; }; })(); var curCSS, iframe, iframeDoc, ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, rposition = /^(top|right|bottom|left)$/, // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rmargin = /^margin/, rnumsplit = new RegExp("^(" + core_pnum + ")(.*)$", "i"), rnumnonpx = new RegExp("^(" + core_pnum + ")(?!px)[a-z%]+$", "i"), rrelNum = new RegExp("^([-+])=(" + core_pnum + ")", "i"), elemdisplay = { BODY: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: 0, fontWeight: 400 }, cssExpand = ["Top", "Right", "Bottom", "Left"], cssPrefixes = ["Webkit", "O", "Moz", "ms"], eventsToggle = jQuery.fn.toggle; // return a css property mapped to a potentially vendor prefixed property function vendorPropName(style, name) { // shortcut for names that are not vendor prefixed if (name in style) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while (i--) { name = cssPrefixes[i] + capName; if (name in style) { return name; } } return origName; } function isHidden(elem, el) { elem = el || elem; return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem); } function showHide(elements, show) { var elem, display, values = [], index = 0, length = elements.length; for (; index < length; index++) { elem = elements[index]; if (!elem.style) { continue; } values[index] = jQuery._data(elem, "olddisplay"); if (show) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if (!values[index] && elem.style.display === "none") { elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if (elem.style.display === "" && isHidden(elem)) { values[index] = jQuery._data(elem, "olddisplay", css_defaultDisplay(elem.nodeName)); } } else { display = curCSS(elem, "display"); if (!values[index] && display !== "none") { jQuery._data(elem, "olddisplay", display); } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for (index = 0; index < length; index++) { elem = elements[index]; if (!elem.style) { continue; } if (!show || elem.style.display === "none" || elem.style.display === "") { elem.style.display = show ? values[index] || "" : "none"; } } return elements; } jQuery.fn.extend({ css: function (name, value) { return jQuery.access(this, function (elem, name, value) { return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name); }, name, value, arguments.length > 1); }, show: function () { return showHide(this, true); }, hide: function () { return showHide(this); }, toggle: function (state, fn2) { var bool = typeof state === "boolean"; if (jQuery.isFunction(state) && jQuery.isFunction(fn2)) { return eventsToggle.apply(this, arguments); } return this.each(function () { if (bool ? state : isHidden(this)) { jQuery(this).show(); } else { jQuery(this).hide(); } }); } }); jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function (elem, computed) { if (computed) { // We should always get a number back from opacity var ret = curCSS(elem, "opacity"); return ret === "" ? "1" : ret; } } } }, // Exclude the following css properties to add px cssNumber: { "fillOpacity": true, "fontWeight": true, "lineHeight": true, "opacity": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { // normalize float css property "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" }, // Get and set the style property on a DOM Node style: function (elem, name, value, extra) { // Don't set styles on text and comment nodes if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase(name), style = elem.style; name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName)); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; // Check if we're setting a value if (value !== undefined) { type = typeof value; // convert relative number strings (+= or -=) to relative numbers. #7345 if (type === "string" && (ret = rrelNum.exec(value))) { value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name)); // Fixes bug #9237 type = "number"; } // Make sure that NaN and null values aren't set. See: #7116 if (value == null || type === "number" && isNaN(value)) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) if (type === "number" && !jQuery.cssNumber[origName]) { value += "px"; } // If a hook was provided, use that value, otherwise just set the specified value if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) { // Wrapped to prevent IE from throwing errors when 'invalid' values are provided // Fixes bug #5509 try { style[name] = value; } catch (e) { } } } else { // If a hook was provided get the non-computed value from there if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) { return ret; } // Otherwise just get the value from the style object return style[name]; } }, css: function (elem, name, numeric, extra) { var val, num, hooks, origName = jQuery.camelCase(name); // Make sure that we're working with the right name name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName)); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; // If a hook was provided get the computed value from there if (hooks && "get" in hooks) { val = hooks.get(elem, true, extra); } // Otherwise, if a way to get the computed value exists, use that if (val === undefined) { val = curCSS(elem, name); } //convert "normal" to computed value if (val === "normal" && name in cssNormalTransform) { val = cssNormalTransform[name]; } // Return, converting to number if forced or a qualifier was provided and val looks numeric if (numeric || extra !== undefined) { num = parseFloat(val); return numeric || jQuery.isNumeric(num) ? num || 0 : val; } return val; }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function (elem, options, callback) { var ret, name, old = {}; // Remember the old values, and insert the new ones for (name in options) { old[name] = elem.style[name]; elem.style[name] = options[name]; } ret = callback.call(elem); // Revert the old values for (name in options) { elem.style[name] = old[name]; } return ret; } }); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if (window.getComputedStyle) { curCSS = function (elem, name) { var ret, width, minWidth, maxWidth, computed = window.getComputedStyle(elem, null), style = elem.style; if (computed) { // getPropertyValue is only needed for .css('filter') in IE9, see #12537 ret = computed.getPropertyValue(name) || computed[name]; if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) { ret = jQuery.style(elem, name); } // A tribute to the "awesome hack by Dean Edwards" // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values if (rnumnonpx.test(ret) && rmargin.test(name)) { width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret; }; } else if (document.documentElement.currentStyle) { curCSS = function (elem, name) { var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[name], style = elem.style; // Avoid setting ret to empty string here // so we don't default to auto if (ret == null && style && style[name]) { ret = style[name]; } // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // but not position css attributes, as those are proportional to the parent element instead // and we can't measure the parent instead because it might trigger a "stacking dolls" problem if (rnumnonpx.test(ret) && !rposition.test(name)) { // Remember the original values left = style.left; rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; // Put in the new values to get a computed value out if (rsLeft) { elem.runtimeStyle.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : ret; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; if (rsLeft) { elem.runtimeStyle.left = rsLeft; } } return ret === "" ? "auto" : ret; }; } function setPositiveNumber(elem, value, subtract) { var matches = rnumsplit.exec(value); return matches ? Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") : value; } function augmentWidthOrHeight(elem, name, extra, isBorderBox) { var i = extra === (isBorderBox ? "border" : "content") ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for (; i < 4; i += 2) { // both box models exclude margin, so add it if we want it if (extra === "margin") { // we use jQuery.css instead of curCSS here // because of the reliableMarginRight CSS hook! val += jQuery.css(elem, extra + cssExpand[i], true); } // From this point on we use curCSS for maximum performance (relevant in animations) if (isBorderBox) { // border-box includes padding, so remove it if we want content if (extra === "content") { val -= parseFloat(curCSS(elem, "padding" + cssExpand[i])) || 0; } // at this point, extra isn't border nor margin, so remove border if (extra !== "margin") { val -= parseFloat(curCSS(elem, "border" + cssExpand[i] + "Width")) || 0; } } else { // at this point, extra isn't content, so add padding val += parseFloat(curCSS(elem, "padding" + cssExpand[i])) || 0; // at this point, extra isn't content nor padding, so add border if (extra !== "padding") { val += parseFloat(curCSS(elem, "border" + cssExpand[i] + "Width")) || 0; } } } return val; } function getWidthOrHeight(elem, name, extra) { // Start with offset property, which is equivalent to the border-box value var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, valueIsBorderBox = true, isBorderBox = jQuery.support.boxSizing && jQuery.css(elem, "boxSizing") === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if (val <= 0 || val == null) { // Fall back to computed then uncomputed css if necessary val = curCSS(elem, name); if (val < 0 || val == null) { val = elem.style[name]; } // Computed unit is not pixels. Stop here and return. if (rnumnonpx.test(val)) { return val; } // we need the check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && (jQuery.support.boxSizingReliable || val === elem.style[name]); // Normalize "", auto, and prepare for extra val = parseFloat(val) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return (val + augmentWidthOrHeight( elem, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox ) ) + "px"; } // Try to determine the default display value of an element function css_defaultDisplay(nodeName) { if (elemdisplay[nodeName]) { return elemdisplay[nodeName]; } var elem = jQuery("<" + nodeName + ">").appendTo(document.body), display = elem.css("display"); elem.remove(); // If the simple way fails, // get element's real default display by attaching it to a temp iframe if (display === "none" || display === "") { // Use the already-created iframe if possible iframe = document.body.appendChild( iframe || jQuery.extend(document.createElement("iframe"), { frameBorder: 0, width: 0, height: 0 }) ); // Create a cacheable copy of the iframe document on first call. // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML // document to it; WebKit & Firefox won't allow reusing the iframe document. if (!iframeDoc || !iframe.createElement) { iframeDoc = (iframe.contentWindow || iframe.contentDocument).document; iframeDoc.write(""); iframeDoc.close(); } elem = iframeDoc.body.appendChild(iframeDoc.createElement(nodeName)); display = curCSS(elem, "display"); document.body.removeChild(iframe); } // Store the correct default display elemdisplay[nodeName] = display; return display; } jQuery.each(["height", "width"], function (i, name) { jQuery.cssHooks[name] = { get: function (elem, computed, extra) { if (computed) { // certain elements can have dimension info if we invisibly show them // however, it must have a current display style that would benefit from this if (elem.offsetWidth === 0 && rdisplayswap.test(curCSS(elem, "display"))) { return jQuery.swap(elem, cssShow, function () { return getWidthOrHeight(elem, name, extra); }); } else { return getWidthOrHeight(elem, name, extra); } } }, set: function (elem, value, extra) { return setPositiveNumber(elem, value, extra ? augmentWidthOrHeight( elem, name, extra, jQuery.support.boxSizing && jQuery.css(elem, "boxSizing") === "border-box" ) : 0 ); } }; }); if (!jQuery.support.opacity) { jQuery.cssHooks.opacity = { get: function (elem, computed) { // IE uses filters for opacity return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? (0.01 * parseFloat(RegExp.$1)) + "" : computed ? "1" : ""; }, set: function (elem, value) { var style = elem.style, currentStyle = elem.currentStyle, opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "", filter = currentStyle && currentStyle.filter || style.filter || ""; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 if (value >= 1 && jQuery.trim(filter.replace(ralpha, "")) === "" && style.removeAttribute) { // Setting style.filter to null, "" & " " still leave "filter:" in the cssText // if "filter:" is present at all, clearType is disabled, we want to avoid this // style.removeAttribute is IE Only, but so apparently is this code path... style.removeAttribute("filter"); // if there there is no filter style applied in a css rule, we are done if (currentStyle && !currentStyle.filter) { return; } } // otherwise, set new filter values style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : filter + " " + opacity; } }; } // These hooks cannot be added until DOM ready because the support test // for it is not run until after DOM ready jQuery(function () { if (!jQuery.support.reliableMarginRight) { jQuery.cssHooks.marginRight = { get: function (elem, computed) { // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // Work around by temporarily setting element display to inline-block return jQuery.swap(elem, { "display": "inline-block" }, function () { if (computed) { return curCSS(elem, "marginRight"); } }); } }; } // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // getComputedStyle returns percent when specified for top/left/bottom/right // rather than make the css module depend on the offset module, we just check for it here if (!jQuery.support.pixelPosition && jQuery.fn.position) { jQuery.each(["top", "left"], function (i, prop) { jQuery.cssHooks[prop] = { get: function (elem, computed) { if (computed) { var ret = curCSS(elem, prop); // if curCSS returns percentage, fallback to offset return rnumnonpx.test(ret) ? jQuery(elem).position()[prop] + "px" : ret; } } }; }); } }); if (jQuery.expr && jQuery.expr.filters) { jQuery.expr.filters.hidden = function (elem) { return (elem.offsetWidth === 0 && elem.offsetHeight === 0) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS(elem, "display")) === "none"); }; jQuery.expr.filters.visible = function (elem) { return !jQuery.expr.filters.hidden(elem); }; } // These hooks are used by animate to expand properties jQuery.each({ margin: "", padding: "", border: "Width" }, function (prefix, suffix) { jQuery.cssHooks[prefix + suffix] = { expand: function (value) { var i, // assumes a single number if not a string parts = typeof value === "string" ? value.split(" ") : [value], expanded = {}; for (i = 0; i < 4; i++) { expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]; } return expanded; } }; if (!rmargin.test(prefix)) { jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; } }); var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, rselectTextarea = /^(?:select|textarea)/i; jQuery.fn.extend({ serialize: function () { return jQuery.param(this.serializeArray()); }, serializeArray: function () { return this.map(function () { return this.elements ? jQuery.makeArray(this.elements) : this; }) .filter(function () { return this.name && !this.disabled && (this.checked || rselectTextarea.test(this.nodeName) || rinput.test(this.type)); }) .map(function (i, elem) { var val = jQuery(this).val(); return val == null ? null : jQuery.isArray(val) ? jQuery.map(val, function (val, i) { return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; }) : { name: elem.name, value: val.replace(rCRLF, "\r\n") }; }).get(); } }); //Serialize an array of form elements or a set of //key/values into a query string jQuery.param = function (a, traditional) { var prefix, s = [], add = function (key, value) { // If value is a function, invoke it and return its value value = jQuery.isFunction(value) ? value() : (value == null ? "" : value); s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if (traditional === undefined) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { // Serialize the form elements jQuery.each(a, function () { add(this.name, this.value); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for (prefix in a) { buildParams(prefix, a[prefix], traditional, add); } } // Return the resulting serialization return s.join("&").replace(r20, "+"); }; function buildParams(prefix, obj, traditional, add) { var name; if (jQuery.isArray(obj)) { // Serialize array item. jQuery.each(obj, function (i, v) { if (traditional || rbracket.test(prefix)) { // Treat each array item as a scalar. add(prefix, v); } else { // If array item is non-scalar (array or object), encode its // numeric index to resolve deserialization ambiguity issues. // Note that rack (as of 1.0.0) can't currently deserialize // nested arrays properly, and attempting to do so may cause // a server error. Possible fixes are to modify rack's // deserialization algorithm or to provide an option or flag // to force array serialization to be shallow. buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add); } }); } else if (!traditional && jQuery.type(obj) === "object") { // Serialize object item. for (name in obj) { buildParams(prefix + "[" + name + "]", obj[name], traditional, add); } } else { // Serialize scalar item. add(prefix, obj); } } var // Document location ajaxLocParts, ajaxLocation, rhash = /#.*$/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, rscript = /)<[^<]*)*<\/script>/gi, rts = /([?&])_=[^&]*/, rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, // Keep a copy of the old load method _load = jQuery.fn.load, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = ["*/"] + ["*"]; // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set try { ajaxLocation = location.href; } catch (e) { // Use the href attribute of an A element // since IE will modify it given document.location ajaxLocation = document.createElement("a"); ajaxLocation.href = ""; ajaxLocation = ajaxLocation.href; } // Segment location into parts ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports(structure) { // dataTypeExpression is optional and defaults to "*" return function (dataTypeExpression, func) { if (typeof dataTypeExpression !== "string") { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, list, placeBefore, dataTypes = dataTypeExpression.toLowerCase().split(core_rspace), i = 0, length = dataTypes.length; if (jQuery.isFunction(func)) { // For each dataType in the dataTypeExpression for (; i < length; i++) { dataType = dataTypes[i]; // We control if we're asked to add before // any existing element placeBefore = /^\+/.test(dataType); if (placeBefore) { dataType = dataType.substr(1) || "*"; } list = structure[dataType] = structure[dataType] || []; // then we add to the structure accordingly list[placeBefore ? "unshift" : "push"](func); } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR, dataType /* internal */, inspected /* internal */) { dataType = dataType || options.dataTypes[0]; inspected = inspected || {}; inspected[dataType] = true; var selection, list = structure[dataType], i = 0, length = list ? list.length : 0, executeOnly = (structure === prefilters); for (; i < length && (executeOnly || !selection) ; i++) { selection = list[i](options, originalOptions, jqXHR); // If we got redirected to another dataType // we try there if executing only and not done already if (typeof selection === "string") { if (!executeOnly || inspected[selection]) { selection = undefined; } else { options.dataTypes.unshift(selection); selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, selection, inspected); } } } // If we're only executing or nothing was selected // we try the catchall dataType if not done already if ((executeOnly || !selection) && !inspected["*"]) { selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, "*", inspected); } // unnecessary when only executing (prefilters) // but it'll be ignored by the caller in that case return selection; } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend(target, src) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for (key in src) { if (src[key] !== undefined) { (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]; } } if (deep) { jQuery.extend(true, target, deep); } } jQuery.fn.load = function (url, params, callback) { if (typeof url !== "string" && _load) { return _load.apply(this, arguments); } // Don't do a request if no elements are being requested if (!this.length) { return this; } var selector, type, response, self = this, off = url.indexOf(" "); if (off >= 0) { selector = url.slice(off, url.length); url = url.slice(0, off); } // If it's a function if (jQuery.isFunction(params)) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if (params && typeof params === "object") { type = "POST"; } // Request the remote document jQuery.ajax({ url: url, // if "type" variable is undefined, then "GET" method will be used type: type, dataType: "html", data: params, complete: function (jqXHR, status) { if (callback) { self.each(callback, response || [jqXHR.responseText, status, jqXHR]); } } }).done(function (responseText) { // Save response for use in complete callback response = arguments; // See if a selector was specified self.html(selector ? // Create a dummy div to hold the results jQuery("
") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE .append(responseText.replace(rscript, "")) // Locate the specified elements .find(selector) : // If not, just inject the full result responseText); }); return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function (i, o) { jQuery.fn[o] = function (f) { return this.on(o, f); }; }); jQuery.each(["get", "post"], function (i, method) { jQuery[method] = function (url, data, callback, type) { // shift arguments if data argument was omitted if (jQuery.isFunction(data)) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ type: method, url: url, data: data, success: callback, dataType: type }); }; }); jQuery.extend({ getScript: function (url, callback) { return jQuery.get(url, undefined, callback, "script"); }, getJSON: function (url, data, callback) { return jQuery.get(url, data, callback, "json"); }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function (target, settings) { if (settings) { // Building a settings object ajaxExtend(target, jQuery.ajaxSettings); } else { // Extending ajaxSettings settings = target; target = jQuery.ajaxSettings; } ajaxExtend(target, settings); return target; }, ajaxSettings: { url: ajaxLocation, isLocal: rlocalProtocol.test(ajaxLocParts[1]), global: true, type: "GET", contentType: "application/x-www-form-urlencoded; charset=UTF-8", processData: true, async: true, /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { xml: "application/xml, text/xml", html: "text/html", text: "text/plain", json: "application/json, text/javascript", "*": allTypes }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText" }, // List of data converters // 1) key format is "source_type destination_type" (a single space in-between) // 2) the catchall symbol "*" can be used for source_type converters: { // Convert anything to text "* text": window.String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { context: true, url: true } }, ajaxPrefilter: addToPrefiltersOrTransports(prefilters), ajaxTransport: addToPrefiltersOrTransports(transports), // Main method ajax: function (url, options) { // If url is an object, simulate pre-1.5 signature if (typeof url === "object") { options = url; url = undefined; } // Force options to be an object options = options || {}; var // ifModified key ifModifiedKey, // Response headers responseHeadersString, responseHeaders, // transport transport, // timeout handle timeoutTimer, // Cross-domain detection vars parts, // To know if global events are to be dispatched fireGlobals, // Loop variable i, // Create the final options object s = jQuery.ajaxSetup({}, options), // Callbacks context callbackContext = s.context || s, // Context for global events // It's the callbackContext if one was provided in the options // and if it's a DOM node or a jQuery collection globalEventContext = callbackContext !== s && (callbackContext.nodeType || callbackContext instanceof jQuery) ? jQuery(callbackContext) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // The jqXHR state state = 0, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Caches the header setRequestHeader: function (name, value) { if (!state) { var lname = name.toLowerCase(); name = requestHeadersNames[lname] = requestHeadersNames[lname] || name; requestHeaders[name] = value; } return this; }, // Raw string getAllResponseHeaders: function () { return state === 2 ? responseHeadersString : null; }, // Builds headers hashtable if needed getResponseHeader: function (key) { var match; if (state === 2) { if (!responseHeaders) { responseHeaders = {}; while ((match = rheaders.exec(responseHeadersString))) { responseHeaders[match[1].toLowerCase()] = match[2]; } } match = responseHeaders[key.toLowerCase()]; } return match === undefined ? null : match; }, // Overrides response content-type header overrideMimeType: function (type) { if (!state) { s.mimeType = type; } return this; }, // Cancel the request abort: function (statusText) { statusText = statusText || strAbort; if (transport) { transport.abort(statusText); } done(0, statusText); return this; } }; // Callback for when everything is done // It is defined here because jslint complains if it is declared // at the end of the function (which would be more logical and readable) function done(status, nativeStatusText, responses, headers) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if (state === 2) { return; } // State is "done" now state = 2; // Clear timeout if it exists if (timeoutTimer) { clearTimeout(timeoutTimer); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Get response data if (responses) { response = ajaxHandleResponses(s, jqXHR, responses); } // If successful, handle type chaining if (status >= 200 && status < 300 || status === 304) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if (s.ifModified) { modified = jqXHR.getResponseHeader("Last-Modified"); if (modified) { jQuery.lastModified[ifModifiedKey] = modified; } modified = jqXHR.getResponseHeader("Etag"); if (modified) { jQuery.etag[ifModifiedKey] = modified; } } // If not modified if (status === 304) { statusText = "notmodified"; isSuccess = true; // If we have data } else { isSuccess = ajaxConvert(s, response); statusText = isSuccess.state; success = isSuccess.data; error = isSuccess.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if (!statusText || status) { statusText = "error"; if (status < 0) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = (nativeStatusText || statusText) + ""; // Success/Error if (isSuccess) { deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); } else { deferred.rejectWith(callbackContext, [jqXHR, statusText, error]); } // Status-dependent callbacks jqXHR.statusCode(statusCode); statusCode = undefined; if (fireGlobals) { globalEventContext.trigger("ajax" + (isSuccess ? "Success" : "Error"), [jqXHR, s, isSuccess ? success : error]); } // Complete completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); if (fireGlobals) { globalEventContext.trigger("ajaxComplete", [jqXHR, s]); // Handle the global AJAX counter if (!(--jQuery.active)) { jQuery.event.trigger("ajaxStop"); } } } // Attach deferreds deferred.promise(jqXHR); jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; jqXHR.complete = completeDeferred.add; // Status-dependent callbacks jqXHR.statusCode = function (map) { if (map) { var tmp; if (state < 2) { for (tmp in map) { statusCode[tmp] = [statusCode[tmp], map[tmp]]; } } else { tmp = map[jqXHR.status]; jqXHR.always(tmp); } } return this; }; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // We also use the url parameter if available s.url = ((url || s.url) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//"); // Extract dataTypes list s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().split(core_rspace); // A cross-domain request is in order when we have a protocol:host:port mismatch if (s.crossDomain == null) { parts = rurl.exec(s.url.toLowerCase()); s.crossDomain = !!(parts && (parts[1] !== ajaxLocParts[1] || parts[2] !== ajaxLocParts[2] || (parts[3] || (parts[1] === "http:" ? 80 : 443)) != (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? 80 : 443))) ); } // Convert data if not already a string if (s.data && s.processData && typeof s.data !== "string") { s.data = jQuery.param(s.data, s.traditional); } // Apply prefilters inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); // If request was aborted inside a prefilter, stop there if (state === 2) { return jqXHR; } // We can fire global events as of now if asked to fireGlobals = s.global; // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test(s.type); // Watch for a new set of requests if (fireGlobals && jQuery.active++ === 0) { jQuery.event.trigger("ajaxStart"); } // More options handling for requests with no content if (!s.hasContent) { // If data is available, append data to url if (s.data) { s.url += (rquery.test(s.url) ? "&" : "?") + s.data; // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Get ifModifiedKey before adding the anti-cache parameter ifModifiedKey = s.url; // Add anti-cache in url if needed if (s.cache === false) { var ts = jQuery.now(), // try replacing _= if it is there ret = s.url.replace(rts, "$1_=" + ts); // if nothing was replaced, add timestamp to the end s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : ""); } } // Set the correct header, if data is being sent if (s.data && s.hasContent && s.contentType !== false || options.contentType) { jqXHR.setRequestHeader("Content-Type", s.contentType); } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if (s.ifModified) { ifModifiedKey = ifModifiedKey || s.url; if (jQuery.lastModified[ifModifiedKey]) { jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[ifModifiedKey]); } if (jQuery.etag[ifModifiedKey]) { jqXHR.setRequestHeader("If-None-Match", jQuery.etag[ifModifiedKey]); } } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"] ); // Check for headers option for (i in s.headers) { jqXHR.setRequestHeader(i, s.headers[i]); } // Allow custom headers/mimetypes and early abort if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) { // Abort if not done already and return return jqXHR.abort(); } // aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds for (i in { success: 1, error: 1, complete: 1 }) { jqXHR[i](s[i]); } // Get transport transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); // If no transport, we auto-abort if (!transport) { done(-1, "No Transport"); } else { jqXHR.readyState = 1; // Send global event if (fireGlobals) { globalEventContext.trigger("ajaxSend", [jqXHR, s]); } // Timeout if (s.async && s.timeout > 0) { timeoutTimer = setTimeout(function () { jqXHR.abort("timeout"); }, s.timeout); } try { state = 1; transport.send(requestHeaders, done); } catch (e) { // Propagate exception as error if not done if (state < 2) { done(-1, e); // Simply rethrow otherwise } else { throw e; } } } return jqXHR; }, // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {} }); /* Handles responses to an ajax request: * - sets all responseXXX fields accordingly * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses(s, jqXHR, responses) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes, responseFields = s.responseFields; // Fill responseXXX fields for (type in responseFields) { if (type in responses) { jqXHR[responseFields[type]] = responses[type]; } } // Remove auto dataType and get content-type in the process while (dataTypes[0] === "*") { dataTypes.shift(); if (ct === undefined) { ct = s.mimeType || jqXHR.getResponseHeader("content-type"); } } // Check if we're dealing with a known content-type if (ct) { for (type in contents) { if (contents[type] && contents[type].test(ct)) { dataTypes.unshift(type); break; } } } // Check to see if we have a response for the expected dataType if (dataTypes[0] in responses) { finalDataType = dataTypes[0]; } else { // Try convertible dataTypes for (type in responses) { if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { finalDataType = type; break; } if (!firstDataType) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if (finalDataType) { if (finalDataType !== dataTypes[0]) { dataTypes.unshift(finalDataType); } return responses[finalDataType]; } } // Chain conversions given the request and the original response function ajaxConvert(s, response) { var conv, conv2, current, tmp, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(), prev = dataTypes[0], converters = {}, i = 0; // Apply the dataFilter if provided if (s.dataFilter) { response = s.dataFilter(response, s.dataType); } // Create converters map with lowercased keys if (dataTypes[1]) { for (conv in s.converters) { converters[conv.toLowerCase()] = s.converters[conv]; } } // Convert to each sequential dataType, tolerating list modification for (; (current = dataTypes[++i]) ;) { // There's only work to do if current dataType is non-auto if (current !== "*") { // Convert response if prev dataType is non-auto and differs from current if (prev !== "*" && prev !== current) { // Seek a direct converter conv = converters[prev + " " + current] || converters["* " + current]; // If none found, seek a pair if (!conv) { for (conv2 in converters) { // If conv2 outputs current tmp = conv2.split(" "); if (tmp[1] === current) { // If prev can be converted to accepted input conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]]; if (conv) { // Condense equivalence converters if (conv === true) { conv = converters[conv2]; // Otherwise, insert the intermediate dataType } else if (converters[conv2] !== true) { current = tmp[0]; dataTypes.splice(i--, 0, current); } break; } } } } // Apply converter (if not an equivalence) if (conv !== true) { // Unless errors are allowed to bubble, catch and return them if (conv && s["throws"]) { response = conv(response); } else { try { response = conv(response); } catch (e) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } // Update prev for next iteration prev = current; } } return { state: "success", data: response }; } var oldCallbacks = [], rquestion = /\?/, rjsonp = /(=)\?(?=&|$)|\?\?/, nonce = jQuery.now(); // Default jsonp settings jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function () { var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++)); this[callback] = true; return callback; } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) { var callbackName, overwritten, responseContainer, data = s.data, url = s.url, hasCallback = s.jsonp !== false, replaceInUrl = hasCallback && rjsonp.test(url), replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && !(s.contentType || "").indexOf("application/x-www-form-urlencoded") && rjsonp.test(data); // Handle iff the expected data type is "jsonp" or we have a parameter to set if (s.dataTypes[0] === "jsonp" || replaceInUrl || replaceInData) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback; overwritten = window[callbackName]; // Insert callback into url or form data if (replaceInUrl) { s.url = url.replace(rjsonp, "$1" + callbackName); } else if (replaceInData) { s.data = data.replace(rjsonp, "$1" + callbackName); } else if (hasCallback) { s.url += (rquestion.test(url) ? "&" : "?") + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters["script json"] = function () { if (!responseContainer) { jQuery.error(callbackName + " was not called"); } return responseContainer[0]; }; // force json dataType s.dataTypes[0] = "json"; // Install callback window[callbackName] = function () { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always(function () { // Restore preexisting value window[callbackName] = overwritten; // Save back as free if (s[callbackName]) { // make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // save the callback name for future use oldCallbacks.push(callbackName); } // Call if it was a function and we have a response if (responseContainer && jQuery.isFunction(overwritten)) { overwritten(responseContainer[0]); } responseContainer = overwritten = undefined; }); // Delegate to script return "script"; } }); // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /javascript|ecmascript/ }, converters: { "text script": function (text) { jQuery.globalEval(text); return text; } } }); // Handle cache's special case and global jQuery.ajaxPrefilter("script", function (s) { if (s.cache === undefined) { s.cache = false; } if (s.crossDomain) { s.type = "GET"; s.global = false; } }); // Bind script tag hack transport jQuery.ajaxTransport("script", function (s) { // This transport only deals with cross domain requests if (s.crossDomain) { var script, head = document.head || document.getElementsByTagName("head")[0] || document.documentElement; return { send: function (_, callback) { script = document.createElement("script"); script.async = "async"; if (s.scriptCharset) { script.charset = s.scriptCharset; } script.src = s.url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function (_, isAbort) { if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; // Remove the script if (head && script.parentNode) { head.removeChild(script); } // Dereference the script script = undefined; // Callback if not abort if (!isAbort) { callback(200, "success"); } } }; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore(script, head.firstChild); }, abort: function () { if (script) { script.onload(0, 1); } } }; } }); var xhrCallbacks, // #5280: Internet Explorer will keep connections alive if we don't abort on unload xhrOnUnloadAbort = window.ActiveXObject ? function () { // Abort all pending requests for (var key in xhrCallbacks) { xhrCallbacks[key](0, 1); } } : false, xhrId = 0; // Functions to create xhrs function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch (e) { } } function createActiveXHR() { try { return new window.ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject ? /* Microsoft failed to properly * implement the XMLHttpRequest in IE7 (can't request local files), * so we use the ActiveXObject when it is available * Additionally XMLHttpRequest can be disabled in IE7/IE8 so * we need a fallback. */ function () { return !this.isLocal && createStandardXHR() || createActiveXHR(); } : // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; // Determine support properties (function (xhr) { jQuery.extend(jQuery.support, { ajax: !!xhr, cors: !!xhr && ("withCredentials" in xhr) }); })(jQuery.ajaxSettings.xhr()); // Create transport if the browser can provide an xhr if (jQuery.support.ajax) { jQuery.ajaxTransport(function (s) { // Cross domain only allowed if supported through XMLHttpRequest if (!s.crossDomain || jQuery.support.cors) { var callback; return { send: function (headers, complete) { // Get a new xhr var handle, i, xhr = s.xhr(); // Open the socket // Passing null username, generates a login popup on Opera (#2865) if (s.username) { xhr.open(s.type, s.url, s.async, s.username, s.password); } else { xhr.open(s.type, s.url, s.async); } // Apply custom fields if provided if (s.xhrFields) { for (i in s.xhrFields) { xhr[i] = s.xhrFields[i]; } } // Override mime type if needed if (s.mimeType && xhr.overrideMimeType) { xhr.overrideMimeType(s.mimeType); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if (!s.crossDomain && !headers["X-Requested-With"]) { headers["X-Requested-With"] = "XMLHttpRequest"; } // Need an extra try/catch for cross domain requests in Firefox 3 try { for (i in headers) { xhr.setRequestHeader(i, headers[i]); } } catch (_) { } // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) xhr.send((s.hasContent && s.data) || null); // Listener callback = function (_, isAbort) { var status, statusText, responseHeaders, responses, xml; // Firefox throws exceptions when accessing properties // of an xhr when a network error occurred // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) try { // Was never called and is aborted or complete if (callback && (isAbort || xhr.readyState === 4)) { // Only called once callback = undefined; // Do not keep as active anymore if (handle) { xhr.onreadystatechange = jQuery.noop; if (xhrOnUnloadAbort) { delete xhrCallbacks[handle]; } } // If it's an abort if (isAbort) { // Abort it manually if needed if (xhr.readyState !== 4) { xhr.abort(); } } else { status = xhr.status; responseHeaders = xhr.getAllResponseHeaders(); responses = {}; xml = xhr.responseXML; // Construct response list if (xml && xml.documentElement /* #4958 */) { responses.xml = xml; } // When requesting binary data, IE6-9 will throw an exception // on any attempt to access responseText (#11426) try { responses.text = xhr.responseText; } catch (e) { } // Firefox throws an exception when accessing // statusText for faulty cross-domain requests try { statusText = xhr.statusText; } catch (e) { // We normalize with Webkit giving an empty statusText statusText = ""; } // Filter status for non standard behaviors // If the request is local and we have data: assume a success // (success with no data won't get notified, that's the best we // can do given current implementations) if (!status && s.isLocal && !s.crossDomain) { status = responses.text ? 200 : 404; // IE - #1450: sometimes returns 1223 when it should be 204 } else if (status === 1223) { status = 204; } } } } catch (firefoxAccessException) { if (!isAbort) { complete(-1, firefoxAccessException); } } // Call complete if needed if (responses) { complete(status, statusText, responses, responseHeaders); } }; if (!s.async) { // if we're in sync mode we fire the callback callback(); } else if (xhr.readyState === 4) { // (IE6 & IE7) if it's in cache and has been // retrieved directly we need to fire the callback setTimeout(callback, 0); } else { handle = ++xhrId; if (xhrOnUnloadAbort) { // Create the active xhrs callbacks list if needed // and attach the unload handler if (!xhrCallbacks) { xhrCallbacks = {}; jQuery(window).unload(xhrOnUnloadAbort); } // Add to list of active xhrs callbacks xhrCallbacks[handle] = callback; } xhr.onreadystatechange = callback; } }, abort: function () { if (callback) { callback(0, 1); } } }; } }); } var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp("^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i"), rrun = /queueHooks$/, animationPrefilters = [defaultPrefilter], tweeners = { "*": [function (prop, value) { var end, unit, tween = this.createTween(prop, value), parts = rfxnum.exec(value), target = tween.cur(), start = +target || 0, scale = 1, maxIterations = 20; if (parts) { end = +parts[2]; unit = parts[3] || (jQuery.cssNumber[prop] ? "" : "px"); // We need to compute starting value if (unit !== "px" && start) { // Iteratively approximate from a nonzero starting point // Prefer the current property, because this process will be trivial if it uses the same units // Fallback to end or a simple constant start = jQuery.css(tween.elem, prop, true) || end || 1; do { // If previous iteration zeroed out, double until we get *something* // Use a string for doubling factor so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply start = start / scale; jQuery.style(tween.elem, prop, start + unit); // Update scale, tolerating zero or NaN from tween.cur() // And breaking the loop if scale is unchanged or perfect, or if we've just had enough } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations); } tween.unit = unit; tween.start = start; // If a +=/-= token was provided, we're doing a relative animation tween.end = parts[1] ? start + (parts[1] + 1) * end : end; } return tween; }] }; // Animations created synchronously will run synchronously function createFxNow() { setTimeout(function () { fxNow = undefined; }, 0); return (fxNow = jQuery.now()); } function createTweens(animation, props) { jQuery.each(props, function (prop, value) { var collection = (tweeners[prop] || []).concat(tweeners["*"]), index = 0, length = collection.length; for (; index < length; index++) { if (collection[index].call(animation, prop, value)) { // we're done with this property return; } } }); } function Animation(elem, properties, options) { var result, index = 0, tweenerIndex = 0, length = animationPrefilters.length, deferred = jQuery.Deferred().always(function () { // don't match elem in the :animated selector delete tick.elem; }), tick = function () { var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for (; index < length ; index++) { animation.tweens[index].run(percent); } deferred.notifyWith(elem, [animation, percent, remaining]); if (percent < 1 && length) { return remaining; } else { deferred.resolveWith(elem, [animation]); return false; } }, animation = deferred.promise({ elem: elem, props: jQuery.extend({}, properties), opts: jQuery.extend(true, { specialEasing: {} }, options), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function (prop, end, easing) { var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing); animation.tweens.push(tween); return tween; }, stop: function (gotoEnd) { var index = 0, // if we are going to the end, we want to run all the tweens // otherwise we skip this part length = gotoEnd ? animation.tweens.length : 0; for (; index < length ; index++) { animation.tweens[index].run(1); } // resolve when we played the last frame // otherwise, reject if (gotoEnd) { deferred.resolveWith(elem, [animation, gotoEnd]); } else { deferred.rejectWith(elem, [animation, gotoEnd]); } return this; } }), props = animation.props; propFilter(props, animation.opts.specialEasing); for (; index < length ; index++) { result = animationPrefilters[index].call(animation, elem, props, animation.opts); if (result) { return result; } } createTweens(animation, props); if (jQuery.isFunction(animation.opts.start)) { animation.opts.start.call(elem, animation); } jQuery.fx.timer( jQuery.extend(tick, { anim: animation, queue: animation.opts.queue, elem: elem }) ); // attach callbacks from options return animation.progress(animation.opts.progress) .done(animation.opts.done, animation.opts.complete) .fail(animation.opts.fail) .always(animation.opts.always); } function propFilter(props, specialEasing) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for (index in props) { name = jQuery.camelCase(index); easing = specialEasing[name]; value = props[index]; if (jQuery.isArray(value)) { easing = value[1]; value = props[index] = value[0]; } if (index !== name) { props[name] = value; delete props[index]; } hooks = jQuery.cssHooks[name]; if (hooks && "expand" in hooks) { value = hooks.expand(value); delete props[name]; // not quite $.extend, this wont overwrite keys already present. // also - reusing 'index' from above because we have the correct "name" for (index in value) { if (!(index in props)) { props[index] = value[index]; specialEasing[index] = easing; } } } else { specialEasing[name] = easing; } } } jQuery.Animation = jQuery.extend(Animation, { tweener: function (props, callback) { if (jQuery.isFunction(props)) { callback = props; props = ["*"]; } else { props = props.split(" "); } var prop, index = 0, length = props.length; for (; index < length ; index++) { prop = props[index]; tweeners[prop] = tweeners[prop] || []; tweeners[prop].unshift(callback); } }, prefilter: function (callback, prepend) { if (prepend) { animationPrefilters.unshift(callback); } else { animationPrefilters.push(callback); } } }); function defaultPrefilter(elem, props, opts) { var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, anim = this, style = elem.style, orig = {}, handled = [], hidden = elem.nodeType && isHidden(elem); // handle queue: false promises if (!opts.queue) { hooks = jQuery._queueHooks(elem, "fx"); if (hooks.unqueued == null) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function () { if (!hooks.unqueued) { oldfire(); } }; } hooks.unqueued++; anim.always(function () { // doing this makes sure that the complete handler will be called // before this completes anim.always(function () { hooks.unqueued--; if (!jQuery.queue(elem, "fx").length) { hooks.empty.fire(); } }); }); } // height/width overflow pass if (elem.nodeType === 1 && ("height" in props || "width" in props)) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE does not // change the overflow attribute when overflowX and // overflowY are set to the same value opts.overflow = [style.overflow, style.overflowX, style.overflowY]; // Set display property to inline-block for height/width // animations on inline elements that are having width/height animated if (jQuery.css(elem, "display") === "inline" && jQuery.css(elem, "float") === "none") { // inline-level elements accept inline-block; // block-level elements need to be inline with layout if (!jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay(elem.nodeName) === "inline") { style.display = "inline-block"; } else { style.zoom = 1; } } } if (opts.overflow) { style.overflow = "hidden"; if (!jQuery.support.shrinkWrapBlocks) { anim.done(function () { style.overflow = opts.overflow[0]; style.overflowX = opts.overflow[1]; style.overflowY = opts.overflow[2]; }); } } // show/hide pass for (index in props) { value = props[index]; if (rfxtypes.exec(value)) { delete props[index]; toggle = toggle || value === "toggle"; if (value === (hidden ? "hide" : "show")) { continue; } handled.push(index); } } length = handled.length; if (length) { dataShow = jQuery._data(elem, "fxshow") || jQuery._data(elem, "fxshow", {}); if ("hidden" in dataShow) { hidden = dataShow.hidden; } // store state if its toggle - enables .stop().toggle() to "reverse" if (toggle) { dataShow.hidden = !hidden; } if (hidden) { jQuery(elem).show(); } else { anim.done(function () { jQuery(elem).hide(); }); } anim.done(function () { var prop; jQuery.removeData(elem, "fxshow", true); for (prop in orig) { jQuery.style(elem, prop, orig[prop]); } }); for (index = 0 ; index < length ; index++) { prop = handled[index]; tween = anim.createTween(prop, hidden ? dataShow[prop] : 0); orig[prop] = dataShow[prop] || jQuery.style(elem, prop); if (!(prop in dataShow)) { dataShow[prop] = tween.start; if (hidden) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } } } function Tween(elem, options, prop, end, easing) { return new Tween.prototype.init(elem, options, prop, end, easing); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function (elem, options, prop, end, easing, unit) { this.elem = elem; this.prop = prop; this.easing = easing || "swing"; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); }, cur: function () { var hooks = Tween.propHooks[this.prop]; return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this); }, run: function (percent) { var eased, hooks = Tween.propHooks[this.prop]; if (this.options.duration) { this.pos = eased = jQuery.easing[this.easing]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = (this.end - this.start) * eased + this.start; if (this.options.step) { this.options.step.call(this.elem, this.now, this); } if (hooks && hooks.set) { hooks.set(this); } else { Tween.propHooks._default.set(this); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function (tween) { var result; if (tween.elem[tween.prop] != null && (!tween.elem.style || tween.elem.style[tween.prop] == null)) { return tween.elem[tween.prop]; } // passing any value as a 4th parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails // so, simple values such as "10px" are parsed to Float. // complex values such as "rotate(1rad)" are returned as is. result = jQuery.css(tween.elem, tween.prop, false, ""); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, set: function (tween) { // use step hook for back compat - use cssHook if its there - use .style if its // available and use plain properties where available if (jQuery.fx.step[tween.prop]) { jQuery.fx.step[tween.prop](tween); } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) { jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); } else { tween.elem[tween.prop] = tween.now; } } } }; // Remove in 2.0 - this supports IE8's panic based approach // to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function (tween) { if (tween.elem.nodeType && tween.elem.parentNode) { tween.elem[tween.prop] = tween.now; } } }; jQuery.each(["toggle", "show", "hide"], function (i, name) { var cssFn = jQuery.fn[name]; jQuery.fn[name] = function (speed, easing, callback) { return speed == null || typeof speed === "boolean" || // special check for .toggle( handler, handler, ... ) (!i && jQuery.isFunction(speed) && jQuery.isFunction(easing)) ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback); }; }); jQuery.fn.extend({ fadeTo: function (speed, to, easing, callback) { // show any hidden elements after setting opacity to 0 return this.filter(isHidden).css("opacity", 0).show() // animate to the value specified .end().animate({ opacity: to }, speed, easing, callback); }, animate: function (prop, speed, easing, callback) { var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback), doAnimation = function () { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation(this, jQuery.extend({}, prop), optall); // Empty animations resolve immediately if (empty) { anim.stop(true); } }; return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation); }, stop: function (type, clearQueue, gotoEnd) { var stopQueue = function (hooks) { var stop = hooks.stop; delete hooks.stop; stop(gotoEnd); }; if (typeof type !== "string") { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if (clearQueue && type !== false) { this.queue(type || "fx", []); } return this.each(function () { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = jQuery._data(this); if (index) { if (data[index] && data[index].stop) { stopQueue(data[index]); } } else { for (index in data) { if (data[index] && data[index].stop && rrun.test(index)) { stopQueue(data[index]); } } } for (index = timers.length; index--;) { if (timers[index].elem === this && (type == null || timers[index].queue === type)) { timers[index].anim.stop(gotoEnd); dequeue = false; timers.splice(index, 1); } } // start the next in the queue if the last step wasn't forced // timers currently will call their complete callbacks, which will dequeue // but only if they were gotoEnd if (dequeue || !gotoEnd) { jQuery.dequeue(this, type); } }); } }); // Generate parameters to create a standard animation function genFx(type, includeWidth) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth ? 1 : 0; for (; i < 4 ; i += 2 - includeWidth) { which = cssExpand[i]; attrs["margin" + which] = attrs["padding" + which] = type; } if (includeWidth) { attrs.opacity = attrs.width = type; } return attrs; } // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show"), slideUp: genFx("hide"), slideToggle: genFx("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function (name, props) { jQuery.fn[name] = function (speed, easing, callback) { return this.animate(props, speed, easing, callback); }; }); jQuery.speed = function (speed, easing, fn) { var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { complete: fn || !fn && easing || jQuery.isFunction(speed) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction(easing) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; // normalize opt.queue - true/undefined/null -> "fx" if (opt.queue == null || opt.queue === true) { opt.queue = "fx"; } // Queueing opt.old = opt.complete; opt.complete = function () { if (jQuery.isFunction(opt.old)) { opt.old.call(this); } if (opt.queue) { jQuery.dequeue(this, opt.queue); } }; return opt; }; jQuery.easing = { linear: function (p) { return p; }, swing: function (p) { return 0.5 - Math.cos(p * Math.PI) / 2; } }; jQuery.timers = []; jQuery.fx = Tween.prototype.init; jQuery.fx.tick = function () { var timer, timers = jQuery.timers, i = 0; fxNow = jQuery.now(); for (; i < timers.length; i++) { timer = timers[i]; // Checks the timer has not already been removed if (!timer() && timers[i] === timer) { timers.splice(i--, 1); } } if (!timers.length) { jQuery.fx.stop(); } fxNow = undefined; }; jQuery.fx.timer = function (timer) { if (timer() && jQuery.timers.push(timer) && !timerId) { timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval); } }; jQuery.fx.interval = 13; jQuery.fx.stop = function () { clearInterval(timerId); timerId = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, // Default speed _default: 400 }; // Back Compat <1.8 extension point jQuery.fx.step = {}; if (jQuery.expr && jQuery.expr.filters) { jQuery.expr.filters.animated = function (elem) { return jQuery.grep(jQuery.timers, function (fn) { return elem === fn.elem; }).length; }; } var rroot = /^(?:body|html)$/i; jQuery.fn.offset = function (options) { if (arguments.length) { return options === undefined ? this : this.each(function (i) { jQuery.offset.setOffset(this, options, i); }); } var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, box = { top: 0, left: 0 }, elem = this[0], doc = elem && elem.ownerDocument; if (!doc) { return; } if ((body = doc.body) === elem) { return jQuery.offset.bodyOffset(elem); } docElem = doc.documentElement; // Make sure it's not a disconnected DOM node if (!jQuery.contains(docElem, elem)) { return box; } // If we don't have gBCR, just use 0,0 rather than error // BlackBerry 5, iOS 3 (original iPhone) if (typeof elem.getBoundingClientRect !== "undefined") { box = elem.getBoundingClientRect(); } win = getWindow(doc); clientTop = docElem.clientTop || body.clientTop || 0; clientLeft = docElem.clientLeft || body.clientLeft || 0; scrollTop = win.pageYOffset || docElem.scrollTop; scrollLeft = win.pageXOffset || docElem.scrollLeft; return { top: box.top + scrollTop - clientTop, left: box.left + scrollLeft - clientLeft }; }; jQuery.offset = { bodyOffset: function (body) { var top = body.offsetTop, left = body.offsetLeft; if (jQuery.support.doesNotIncludeMarginInBodyOffset) { top += parseFloat(jQuery.css(body, "marginTop")) || 0; left += parseFloat(jQuery.css(body, "marginLeft")) || 0; } return { top: top, left: left }; }, setOffset: function (elem, options, i) { var position = jQuery.css(elem, "position"); // set position first, in-case top/left are set even on static elem if (position === "static") { elem.style.position = "relative"; } var curElem = jQuery(elem), curOffset = curElem.offset(), curCSSTop = jQuery.css(elem, "top"), curCSSLeft = jQuery.css(elem, "left"), calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, props = {}, curPosition = {}, curTop, curLeft; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if (calculatePosition) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat(curCSSTop) || 0; curLeft = parseFloat(curCSSLeft) || 0; } if (jQuery.isFunction(options)) { options = options.call(elem, i, curOffset); } if (options.top != null) { props.top = (options.top - curOffset.top) + curTop; } if (options.left != null) { props.left = (options.left - curOffset.left) + curLeft; } if ("using" in options) { options.using.call(elem, props); } else { curElem.css(props); } } }; jQuery.fn.extend({ position: function () { if (!this[0]) { return; } var elem = this[0], // Get *real* offsetParent offsetParent = this.offsetParent(), // Get correct offsets offset = this.offset(), parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= parseFloat(jQuery.css(elem, "marginTop")) || 0; offset.left -= parseFloat(jQuery.css(elem, "marginLeft")) || 0; // Add offsetParent borders parentOffset.top += parseFloat(jQuery.css(offsetParent[0], "borderTopWidth")) || 0; parentOffset.left += parseFloat(jQuery.css(offsetParent[0], "borderLeftWidth")) || 0; // Subtract the two offsets return { top: offset.top - parentOffset.top, left: offset.left - parentOffset.left }; }, offsetParent: function () { return this.map(function () { var offsetParent = this.offsetParent || document.body; while (offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static")) { offsetParent = offsetParent.offsetParent; } return offsetParent || document.body; }); } }); // Create scrollLeft and scrollTop methods jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) { var top = /Y/.test(prop); jQuery.fn[method] = function (val) { return jQuery.access(this, function (elem, method, val) { var win = getWindow(elem); if (val === undefined) { return win ? (prop in win) ? win[prop] : win.document.documentElement[method] : elem[method]; } if (win) { win.scrollTo( !top ? val : jQuery(win).scrollLeft(), top ? val : jQuery(win).scrollTop() ); } else { elem[method] = val; } }, method, val, arguments.length, null); }; }); function getWindow(elem) { return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each({ Height: "height", Width: "width" }, function (name, type) { jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) { // margin is only for outerHeight, outerWidth jQuery.fn[funcName] = function (margin, value) { var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); return jQuery.access(this, function (elem, type, value) { var doc; if (jQuery.isWindow(elem)) { // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there // isn't a whole lot we can do. See pull request at this URL for discussion: // https://github.com/jquery/jquery/pull/764 return elem.document.documentElement["client" + name]; } // Get document width or height if (elem.nodeType === 9) { doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. return Math.max( elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name] ); } return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat jQuery.css(elem, type, value, extra) : // Set width or height on the element jQuery.style(elem, type, value, extra); }, type, chainable ? margin : undefined, chainable, null); }; }); }); // Expose jQuery to the global object window.jQuery = window.$ = jQuery; // Expose jQuery as an AMD module, but only for AMD loaders that // understand the issues with loading multiple versions of jQuery // in a page that all might call define(). The loader will indicate // they have special allowances for multiple jQuery versions by // specifying define.amd.jQuery = true. Register as a named module, // since jQuery can be concatenated with other files that may use define, // but not use a proper concatenation script that understands anonymous // AMD modules. A named AMD is safest and most robust way to register. // Lowercase jquery is used because AMD module names are derived from // file names, and jQuery is normally delivered in a lowercase file name. // Do this after creating the global so that if an AMD module wants to call // noConflict to hide this version of jQuery, it will work. if (typeof define === "function" && define.amd && define.amd.jQuery) { define("jquery", [], function () { return jQuery; }); } })(window);; /*! * Modernizr v2.6.2 * www.modernizr.com * * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton * Available under the BSD and MIT licenses: www.modernizr.com/license/ */ /* * Modernizr tests which native CSS3 and HTML5 features are available in * the current UA and makes the results available to you in two ways: * as properties on a global Modernizr object, and as classes on the * element. This information allows you to progressively enhance * your pages with a granular level of control over the experience. * * Modernizr has an optional (not included) conditional resource loader * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). * To get a build that includes Modernizr.load(), as well as choosing * which tests to include, go to www.modernizr.com/download/ * * Authors Faruk Ates, Paul Irish, Alex Sexton * Contributors Ryan Seddon, Ben Alman */ window.Modernizr = (function( window, document, undefined ) { var version = '2.6.2', Modernizr = {}, /*>>cssclasses*/ // option for enabling the HTML classes to be added enableClasses = true, /*>>cssclasses*/ docElement = document.documentElement, /** * Create our "modernizr" element that we do most feature tests on. */ mod = 'modernizr', modElem = document.createElement(mod), mStyle = modElem.style, /** * Create the input element for various Web Forms feature tests. */ inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ , /*>>smile*/ smile = ':)', /*>>smile*/ toString = {}.toString, // TODO :: make the prefixes more granular /*>>prefixes*/ // List of property values to set for css tests. See ticket #21 prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), /*>>prefixes*/ /*>>domprefixes*/ // Following spec is to expose vendor-specific style properties as: // elem.style.WebkitBorderRadius // and the following would be incorrect: // elem.style.webkitBorderRadius // Webkit ghosts their properties in lowercase but Opera & Moz do not. // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+ // erik.eae.net/archives/2008/03/10/21.48.10/ // More here: github.com/Modernizr/Modernizr/issues/issue/21 omPrefixes = 'Webkit Moz O ms', cssomPrefixes = omPrefixes.split(' '), domPrefixes = omPrefixes.toLowerCase().split(' '), /*>>domprefixes*/ /*>>ns*/ ns = {'svg': 'http://www.w3.org/2000/svg'}, /*>>ns*/ tests = {}, inputs = {}, attrs = {}, classes = [], slice = classes.slice, featureName, // used in testing loop /*>>teststyles*/ // Inject element with style element and some CSS rules injectElementWithStyles = function( rule, callback, nodes, testnames ) { var style, ret, node, docOverflow, div = document.createElement('div'), // After page load injecting a fake body doesn't work so check if body exists body = document.body, // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it. fakeBody = body || document.createElement('body'); if ( parseInt(nodes, 10) ) { // In order not to give false positives we create a node for each test // This also allows the method to scale for unspecified uses while ( nodes-- ) { node = document.createElement('div'); node.id = testnames ? testnames[nodes] : mod + (nodes + 1); div.appendChild(node); } } // '].join(''); div.id = mod; // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody. // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270 (body ? div : fakeBody).innerHTML += style; fakeBody.appendChild(div); if ( !body ) { //avoid crashing IE8, if background image is used fakeBody.style.background = ''; //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible fakeBody.style.overflow = 'hidden'; docOverflow = docElement.style.overflow; docElement.style.overflow = 'hidden'; docElement.appendChild(fakeBody); } ret = callback(div, rule); // If this is done after page load we don't want to remove the body so check if body exists if ( !body ) { fakeBody.parentNode.removeChild(fakeBody); docElement.style.overflow = docOverflow; } else { div.parentNode.removeChild(div); } return !!ret; }, /*>>teststyles*/ /*>>mq*/ // adapted from matchMedia polyfill // by Scott Jehl and Paul Irish // gist.github.com/786768 testMediaQuery = function( mq ) { var matchMedia = window.matchMedia || window.msMatchMedia; if ( matchMedia ) { return matchMedia(mq).matches; } var bool; injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { bool = (window.getComputedStyle ? getComputedStyle(node, null) : node.currentStyle)['position'] == 'absolute'; }); return bool; }, /*>>mq*/ /*>>hasevent*/ // // isEventSupported determines if a given element supports the given event // kangax.github.com/iseventsupported/ // // The following results are known incorrects: // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333 // ... isEventSupported = (function() { var TAGNAMES = { 'select': 'input', 'change': 'input', 'submit': 'form', 'reset': 'form', 'error': 'img', 'load': 'img', 'abort': 'img' }; function isEventSupported( eventName, element ) { element = element || document.createElement(TAGNAMES[eventName] || 'div'); eventName = 'on' + eventName; // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those var isSupported = eventName in element; if ( !isSupported ) { // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element if ( !element.setAttribute ) { element = document.createElement('div'); } if ( element.setAttribute && element.removeAttribute ) { element.setAttribute(eventName, ''); isSupported = is(element[eventName], 'function'); // If property was created, "remove it" (by setting value to `undefined`) if ( !is(element[eventName], 'undefined') ) { element[eventName] = undefined; } element.removeAttribute(eventName); } } element = null; return isSupported; } return isEventSupported; })(), /*>>hasevent*/ // TODO :: Add flag for hasownprop ? didn't last time // hasOwnProperty shim by kangax needed for Safari 2.0 support _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { hasOwnProp = function (object, property) { return _hasOwnProperty.call(object, property); }; } else { hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ return ((property in object) && is(object.constructor.prototype[property], 'undefined')); }; } // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js // es5.github.com/#x15.3.4.5 if (!Function.prototype.bind) { Function.prototype.bind = function bind(that) { var target = this; if (typeof target != "function") { throw new TypeError(); } var args = slice.call(arguments, 1), bound = function () { if (this instanceof bound) { var F = function(){}; F.prototype = target.prototype; var self = new F(); var result = target.apply( self, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return self; } else { return target.apply( that, args.concat(slice.call(arguments)) ); } }; return bound; }; } /** * setCss applies given styles to the Modernizr DOM node. */ function setCss( str ) { mStyle.cssText = str; } /** * setCssAll extrapolates all vendor-specific css strings. */ function setCssAll( str1, str2 ) { return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); } /** * is returns a boolean for if typeof obj is exactly type. */ function is( obj, type ) { return typeof obj === type; } /** * contains returns a boolean for if substr is found within str. */ function contains( str, substr ) { return !!~('' + str).indexOf(substr); } /*>>testprop*/ // testProps is a generic CSS / DOM property test. // In testing support for a given CSS property, it's legit to test: // `elem.style[styleName] !== undefined` // If the property is supported it will return an empty string, // if unsupported it will return undefined. // We'll take advantage of this quick test and skip setting a style // on our modernizr element, but instead just testing undefined vs // empty string. // Because the testing of the CSS property names (with "-", as // opposed to the camelCase DOM properties) is non-portable and // non-standard but works in WebKit and IE (but not Gecko or Opera), // we explicitly reject properties with dashes so that authors // developing in WebKit or IE first don't end up with // browser-specific content by accident. function testProps( props, prefixed ) { for ( var i in props ) { var prop = props[i]; if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { return prefixed == 'pfx' ? prop : true; } } return false; } /*>>testprop*/ // TODO :: add testDOMProps /** * testDOMProps is a generic DOM property test; if a browser supports * a certain property, it won't return undefined for it. */ function testDOMProps( props, obj, elem ) { for ( var i in props ) { var item = obj[props[i]]; if ( item !== undefined) { // return the property name as a string if (elem === false) return props[i]; // let's bind a function if (is(item, 'function')){ // default to autobind unless override return item.bind(elem || obj); } // return the unbound function or obj or value return item; } } return false; } /*>>testallprops*/ /** * testPropsAll tests a list of DOM properties we want to check against. * We specify literally ALL possible (known and/or likely) properties on * the element including the non-vendor prefixed one, for forward- * compatibility. */ function testPropsAll( prop, prefixed, elem ) { var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); // did they call .prefixed('boxSizing') or are we just testing a prop? if(is(prefixed, "string") || is(prefixed, "undefined")) { return testProps(props, prefixed); // otherwise, they called .prefixed('requestAnimationFrame', window[, elem]) } else { props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); return testDOMProps(props, prefixed, elem); } } /*>>testallprops*/ /** * Tests * ----- */ // The *new* flexbox // dev.w3.org/csswg/css3-flexbox tests['flexbox'] = function() { return testPropsAll('flexWrap'); }; // The *old* flexbox // www.w3.org/TR/2009/WD-css3-flexbox-20090723/ tests['flexboxlegacy'] = function() { return testPropsAll('boxDirection'); }; // On the S60 and BB Storm, getContext exists, but always returns undefined // so we actually have to call getContext() to verify // github.com/Modernizr/Modernizr/issues/issue/97/ tests['canvas'] = function() { var elem = document.createElement('canvas'); return !!(elem.getContext && elem.getContext('2d')); }; tests['canvastext'] = function() { return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); }; // webk.it/70117 is tracking a legit WebGL feature detect proposal // We do a soft detect which may false positive in order to avoid // an expensive context creation: bugzil.la/732441 tests['webgl'] = function() { return !!window.WebGLRenderingContext; }; /* * The Modernizr.touch test only indicates if the browser supports * touch events, which does not necessarily reflect a touchscreen * device, as evidenced by tablets running Windows 7 or, alas, * the Palm Pre / WebOS (touch) phones. * * Additionally, Chrome (desktop) used to lie about its support on this, * but that has since been rectified: crbug.com/36415 * * We also test for Firefox 4 Multitouch Support. * * For more info, see: modernizr.github.com/Modernizr/touch.html */ tests['touch'] = function() { var bool; if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { bool = true; } else { injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { bool = node.offsetTop === 9; }); } return bool; }; // geolocation is often considered a trivial feature detect... // Turns out, it's quite tricky to get right: // // Using !!navigator.geolocation does two things we don't want. It: // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 // 2. Disables page caching in WebKit: webk.it/43956 // // Meanwhile, in Firefox < 8, an about:config setting could expose // a false positive that would throw an exception: bugzil.la/688158 tests['geolocation'] = function() { return 'geolocation' in navigator; }; tests['postmessage'] = function() { return !!window.postMessage; }; // Chrome incognito mode used to throw an exception when using openDatabase // It doesn't anymore. tests['websqldatabase'] = function() { return !!window.openDatabase; }; // Vendors had inconsistent prefixing with the experimental Indexed DB: // - Webkit's implementation is accessible through webkitIndexedDB // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB // For speed, we don't test the legacy (and beta-only) indexedDB tests['indexedDB'] = function() { return !!testPropsAll("indexedDB", window); }; // documentMode logic from YUI to filter out IE8 Compat Mode // which false positives. tests['hashchange'] = function() { return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); }; // Per 1.6: // This used to be Modernizr.historymanagement but the longer // name has been deprecated in favor of a shorter and property-matching one. // The old API is still available in 1.6, but as of 2.0 will throw a warning, // and in the first release thereafter disappear entirely. tests['history'] = function() { return !!(window.history && history.pushState); }; tests['draganddrop'] = function() { var div = document.createElement('div'); return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); }; // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10 // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17. // FF10 still uses prefixes, so check for it until then. // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/ tests['websockets'] = function() { return 'WebSocket' in window || 'MozWebSocket' in window; }; // css-tricks.com/rgba-browser-support/ tests['rgba'] = function() { // Set an rgba() color and check the returned value setCss('background-color:rgba(150,255,150,.5)'); return contains(mStyle.backgroundColor, 'rgba'); }; tests['hsla'] = function() { // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, // except IE9 who retains it as hsla setCss('background-color:hsla(120,40%,100%,.5)'); return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); }; tests['multiplebgs'] = function() { // Setting multiple images AND a color on the background shorthand property // and then querying the style.background property value for the number of // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! setCss('background:url(https://),url(https://),red url(https://)'); // If the UA supports multiple backgrounds, there should be three occurrences // of the string "url(" in the return value for elemStyle.background return (/(url\s*\(.*?){3}/).test(mStyle.background); }; // this will false positive in Opera Mini // github.com/Modernizr/Modernizr/issues/396 tests['backgroundsize'] = function() { return testPropsAll('backgroundSize'); }; tests['borderimage'] = function() { return testPropsAll('borderImage'); }; // Super comprehensive table about all the unique implementations of // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance tests['borderradius'] = function() { return testPropsAll('borderRadius'); }; // WebOS unfortunately false positives on this test. tests['boxshadow'] = function() { return testPropsAll('boxShadow'); }; // FF3.0 will false positive on this test tests['textshadow'] = function() { return document.createElement('div').style.textShadow === ''; }; tests['opacity'] = function() { // Browsers that actually have CSS Opacity implemented have done so // according to spec, which means their return values are within the // range of [0.0,1.0] - including the leading zero. setCssAll('opacity:.55'); // The non-literal . in this regex is intentional: // German Chrome returns this value as 0,55 // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 return (/^0.55$/).test(mStyle.opacity); }; // Note, Android < 4 will pass this test, but can only animate // a single property at a time // daneden.me/2011/12/putting-up-with-androids-bullshit/ tests['cssanimations'] = function() { return testPropsAll('animationName'); }; tests['csscolumns'] = function() { return testPropsAll('columnCount'); }; tests['cssgradients'] = function() { /** * For CSS Gradients syntax, please see: * webkit.org/blog/175/introducing-css-gradients/ * developer.mozilla.org/en/CSS/-moz-linear-gradient * developer.mozilla.org/en/CSS/-moz-radial-gradient * dev.w3.org/csswg/css3-images/#gradients- */ var str1 = 'background-image:', str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', str3 = 'linear-gradient(left top,#9f9, white);'; setCss( // legacy webkit syntax (FIXME: remove when syntax not in use anymore) (str1 + '-webkit- '.split(' ').join(str2 + str1) + // standard syntax // trailing 'background-image:' prefixes.join(str3 + str1)).slice(0, -str1.length) ); return contains(mStyle.backgroundImage, 'gradient'); }; tests['cssreflections'] = function() { return testPropsAll('boxReflect'); }; tests['csstransforms'] = function() { return !!testPropsAll('transform'); }; tests['csstransforms3d'] = function() { var ret = !!testPropsAll('perspective'); // Webkit's 3D transforms are passed off to the browser's own graphics renderer. // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in // some conditions. As a result, Webkit typically recognizes the syntax but // will sometimes throw a false positive, thus we must do a more thorough check: if ( ret && 'webkitPerspective' in docElement.style ) { // Webkit allows this media query to succeed only if the feature is enabled. // `@media (transform-3d),(-webkit-transform-3d){ ... }` injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { ret = node.offsetLeft === 9 && node.offsetHeight === 3; }); } return ret; }; tests['csstransitions'] = function() { return testPropsAll('transition'); }; /*>>fontface*/ // @font-face detection routine by Diego Perini // javascript.nwbox.com/CSSSupport/ // false positives: // WebOS github.com/Modernizr/Modernizr/issues/342 // WP7 github.com/Modernizr/Modernizr/issues/538 tests['fontface'] = function() { var bool; injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { var style = document.getElementById('smodernizr'), sheet = style.sheet || style.styleSheet, cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; }); return bool; }; /*>>fontface*/ // CSS generated content detection tests['generatedcontent'] = function() { var bool; injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) { bool = node.offsetHeight >= 3; }); return bool; }; // These tests evaluate support of the video/audio elements, as well as // testing what types of content they support. // // We're using the Boolean constructor here, so that we can extend the value // e.g. Modernizr.video // true // Modernizr.video.ogg // 'probably' // // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 // thx to NielsLeenheer and zcorpan // Note: in some older browsers, "no" was a return value instead of empty string. // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 tests['video'] = function() { var elem = document.createElement('video'), bool = false; // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 try { if ( bool = !!elem.canPlayType ) { bool = new Boolean(bool); bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); } } catch(e) { } return bool; }; tests['audio'] = function() { var elem = document.createElement('audio'), bool = false; try { if ( bool = !!elem.canPlayType ) { bool = new Boolean(bool); bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); // Mimetypes accepted: // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements // bit.ly/iphoneoscodecs bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); bool.m4a = ( elem.canPlayType('audio/x-m4a;') || elem.canPlayType('audio/aac;')) .replace(/^no$/,''); } } catch(e) { } return bool; }; // In FF4, if disabled, window.localStorage should === null. // Normally, we could not test that directly and need to do a // `('localStorage' in window) && ` test first because otherwise Firefox will // throw bugzil.la/365772 if cookies are disabled // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem // will throw the exception: // QUOTA_EXCEEDED_ERRROR DOM Exception 22. // Peculiarly, getItem and removeItem calls do not throw. // Because we are forced to try/catch this, we'll go aggressive. // Just FWIW: IE8 Compat mode supports these features completely: // www.quirksmode.org/dom/html5.html // But IE8 doesn't support either with local files tests['localstorage'] = function() { try { localStorage.setItem(mod, mod); localStorage.removeItem(mod); return true; } catch(e) { return false; } }; tests['sessionstorage'] = function() { try { sessionStorage.setItem(mod, mod); sessionStorage.removeItem(mod); return true; } catch(e) { return false; } }; tests['webworkers'] = function() { return !!window.Worker; }; tests['applicationcache'] = function() { return !!window.applicationCache; }; // Thanks to Erik Dahlstrom tests['svg'] = function() { return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; }; // specifically for SVG inline in HTML, not within XHTML // test page: paulirish.com/demo/inline-svg tests['inlinesvg'] = function() { var div = document.createElement('div'); div.innerHTML = ''; return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; }; // SVG SMIL animation tests['smil'] = function() { return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); }; // This test is only for clip paths in SVG proper, not clip paths on HTML content // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg // However read the comments to dig into applying SVG clippaths to HTML content here: // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491 tests['svgclippaths'] = function() { return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); }; /*>>webforms*/ // input features and input types go directly onto the ret object, bypassing the tests loop. // Hold this guy to execute in a moment. function webforms() { /*>>input*/ // Run through HTML5's new input attributes to see if the UA understands any. // We're using f which is the element created early on // Mike Taylr has created a comprehensive resource for testing these attributes // when applied to all input types: // miketaylr.com/code/input-type-attr.html // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary // Only input placeholder is tested while textarea's placeholder is not. // Currently Safari 4 and Opera 11 have support only for the input placeholder // Both tests are available in feature-detects/forms-placeholder.js Modernizr['input'] = (function( props ) { for ( var i = 0, len = props.length; i < len; i++ ) { attrs[ props[i] ] = !!(props[i] in inputElem); } if (attrs.list){ // safari false positive's on datalist: webk.it/74252 // see also github.com/Modernizr/Modernizr/issues/146 attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); } return attrs; })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); /*>>input*/ /*>>inputtypes*/ // Run through HTML5's new input types to see if the UA understands any. // This is put behind the tests runloop because it doesn't return a // true/false like all the other tests; instead, it returns an object // containing each input type with its corresponding true/false value // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/ Modernizr['inputtypes'] = (function(props) { for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { inputElem.setAttribute('type', inputElemType = props[i]); bool = inputElem.type !== 'text'; // We first check to see if the type we give it sticks.. // If the type does, we feed it a textual value, which shouldn't be valid. // If the value doesn't stick, we know there's input sanitization which infers a custom UI if ( bool ) { inputElem.value = smile; inputElem.style.cssText = 'position:absolute;visibility:hidden;'; if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { docElement.appendChild(inputElem); defaultView = document.defaultView; // Safari 2-4 allows the smiley as a value, despite making a slider bool = defaultView.getComputedStyle && defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && // Mobile android web browser has false positive, so must // check the height to see if the widget is actually there. (inputElem.offsetHeight !== 0); docElement.removeChild(inputElem); } else if ( /^(search|tel)$/.test(inputElemType) ){ // Spec doesn't define any special parsing or detectable UI // behaviors so we pass these through as true // Interestingly, opera fails the earlier test, so it doesn't // even make it here. } else if ( /^(url|email)$/.test(inputElemType) ) { // Real url and email support comes with prebaked validation. bool = inputElem.checkValidity && inputElem.checkValidity() === false; } else { // If the upgraded input compontent rejects the :) text, we got a winner bool = inputElem.value != smile; } } inputs[ props[i] ] = !!bool; } return inputs; })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); /*>>inputtypes*/ } /*>>webforms*/ // End of test definitions // ----------------------- // Run through all tests and detect their support in the current UA. // todo: hypothetically we could be doing an array of tests and use a basic loop here. for ( var feature in tests ) { if ( hasOwnProp(tests, feature) ) { // run the test, throw the return value into the Modernizr, // then based on that boolean, define an appropriate className // and push it into an array of classes we'll join later. featureName = feature.toLowerCase(); Modernizr[featureName] = tests[feature](); classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); } } /*>>webforms*/ // input tests need to run. Modernizr.input || webforms(); /*>>webforms*/ /** * addTest allows the user to define their own feature tests * the result will be added onto the Modernizr object, * as well as an appropriate className set on the html element * * @param feature - String naming the feature * @param test - Function returning true if feature is supported, false if not */ Modernizr.addTest = function ( feature, test ) { if ( typeof feature == 'object' ) { for ( var key in feature ) { if ( hasOwnProp( feature, key ) ) { Modernizr.addTest( key, feature[ key ] ); } } } else { feature = feature.toLowerCase(); if ( Modernizr[feature] !== undefined ) { // we're going to quit if you're trying to overwrite an existing test // if we were to allow it, we'd do this: // var re = new RegExp("\\b(no-)?" + feature + "\\b"); // docElement.className = docElement.className.replace( re, '' ); // but, no rly, stuff 'em. return Modernizr; } test = typeof test == 'function' ? test() : test; if (typeof enableClasses !== "undefined" && enableClasses) { docElement.className += ' ' + (test ? '' : 'no-') + feature; } Modernizr[feature] = test; } return Modernizr; // allow chaining. }; // Reset modElem.cssText to nothing to reduce memory footprint. setCss(''); modElem = inputElem = null; /*>>shiv*/ /*! HTML5 Shiv v3.6.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ ;(function(window, document) { /*jshint evil:true */ /** Preset options */ var options = window.html5 || {}; /** Used to skip problem elements */ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; /** Not all elements can be cloned in IE **/ var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; /** Detect whether the browser supports default html5 styles */ var supportsHtml5Styles; /** Name of the expando, to work with multiple documents or to re-shiv one document */ var expando = '_html5shiv'; /** The id for the the documents expando */ var expanID = 0; /** Cached data for each document */ var expandoData = {}; /** Detect whether the browser supports unknown elements */ var supportsUnknownElements; (function() { try { var a = document.createElement('a'); a.innerHTML = ''; //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles supportsHtml5Styles = ('hidden' in a); supportsUnknownElements = a.childNodes.length == 1 || (function() { // assign a false positive if unable to shiv (document.createElement)('a'); var frag = document.createDocumentFragment(); return ( typeof frag.cloneNode == 'undefined' || typeof frag.createDocumentFragment == 'undefined' || typeof frag.createElement == 'undefined' ); }()); } catch(e) { supportsHtml5Styles = true; supportsUnknownElements = true; } }()); /*--------------------------------------------------------------------------*/ /** * Creates a style sheet with the given CSS text and adds it to the document. * @private * @param {Document} ownerDocument The document. * @param {String} cssText The CSS text. * @returns {StyleSheet} The style element. */ function addStyleSheet(ownerDocument, cssText) { var p = ownerDocument.createElement('p'), parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; p.innerHTML = 'x'; return parent.insertBefore(p.lastChild, parent.firstChild); } /** * Returns the value of `html5.elements` as an array. * @private * @returns {Array} An array of shived element node names. */ function getElements() { var elements = html5.elements; return typeof elements == 'string' ? elements.split(' ') : elements; } /** * Returns the data associated to the given document * @private * @param {Document} ownerDocument The document. * @returns {Object} An object of data. */ function getExpandoData(ownerDocument) { var data = expandoData[ownerDocument[expando]]; if (!data) { data = {}; expanID++; ownerDocument[expando] = expanID; expandoData[expanID] = data; } return data; } /** * returns a shived element for the given nodeName and document * @memberOf html5 * @param {String} nodeName name of the element * @param {Document} ownerDocument The context document. * @returns {Object} The shived element. */ function createElement(nodeName, ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createElement(nodeName); } if (!data) { data = getExpandoData(ownerDocument); } var node; if (data.cache[nodeName]) { node = data.cache[nodeName].cloneNode(); } else if (saveClones.test(nodeName)) { node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); } else { node = data.createElem(nodeName); } // Avoid adding some elements to fragments in IE < 9 because // * Attributes like `name` or `type` cannot be set/changed once an element // is inserted into a document/fragment // * Link elements with `src` attributes that are inaccessible, as with // a 403 response, will cause the tab/window to crash // * Script elements appended to fragments will execute when their `src` // or `text` property is set return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node; } /** * returns a shived DocumentFragment for the given document * @memberOf html5 * @param {Document} ownerDocument The context document. * @returns {Object} The shived DocumentFragment. */ function createDocumentFragment(ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createDocumentFragment(); } data = data || getExpandoData(ownerDocument); var clone = data.frag.cloneNode(), i = 0, elems = getElements(), l = elems.length; for(;i>shiv*/ // Assign private properties to the return object with prefix Modernizr._version = version; // expose these for the plugin API. Look in the source for how to join() them against your input /*>>prefixes*/ Modernizr._prefixes = prefixes; /*>>prefixes*/ /*>>domprefixes*/ Modernizr._domPrefixes = domPrefixes; Modernizr._cssomPrefixes = cssomPrefixes; /*>>domprefixes*/ /*>>mq*/ // Modernizr.mq tests a given media query, live against the current state of the window // A few important notes: // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false // * A max-width or orientation query will be evaluated against the current state, which may change later. // * You must specify values. Eg. If you are testing support for the min-width media query use: // Modernizr.mq('(min-width:0)') // usage: // Modernizr.mq('only screen and (max-width:768)') Modernizr.mq = testMediaQuery; /*>>mq*/ /*>>hasevent*/ // Modernizr.hasEvent() detects support for a given event, with an optional element to test on // Modernizr.hasEvent('gesturestart', elem) Modernizr.hasEvent = isEventSupported; /*>>hasevent*/ /*>>testprop*/ // Modernizr.testProp() investigates whether a given style property is recognized // Note that the property names must be provided in the camelCase variant. // Modernizr.testProp('pointerEvents') Modernizr.testProp = function(prop){ return testProps([prop]); }; /*>>testprop*/ /*>>testallprops*/ // Modernizr.testAllProps() investigates whether a given style property, // or any of its vendor-prefixed variants, is recognized // Note that the property names must be provided in the camelCase variant. // Modernizr.testAllProps('boxSizing') Modernizr.testAllProps = testPropsAll; /*>>testallprops*/ /*>>teststyles*/ // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) Modernizr.testStyles = injectElementWithStyles; /*>>teststyles*/ /*>>prefixed*/ // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: // // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); // If you're trying to ascertain which transition end event to bind to, you might do something like... // // var transEndEventNames = { // 'WebkitTransition' : 'webkitTransitionEnd', // 'MozTransition' : 'transitionend', // 'OTransition' : 'oTransitionEnd', // 'msTransition' : 'MSTransitionEnd', // 'transition' : 'transitionend' // }, // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; Modernizr.prefixed = function(prop, obj, elem){ if(!obj) { return testPropsAll(prop, 'pfx'); } else { // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame' return testPropsAll(prop, obj, elem); } }; /*>>prefixed*/ /*>>cssclasses*/ // Remove "no-js" class from element, if it exists: docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + // Add the new classes to the element. (enableClasses ? ' js ' + classes.join(' ') : ''); /*>>cssclasses*/ return Modernizr; })(this, this.document); ; /*! lozad.js - v1.7.0 - 2018-11-08 * https://github.com/ApoorvSaxena/lozad.js * Copyright (c) 2018 Apoorv Saxena; Licensed MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.lozad = factory()); }(this, (function () { 'use strict'; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** * Detect IE browser * @const {boolean} * @private */ var isIE = typeof document !== 'undefined' && document.documentMode; var defaultConfig = { rootMargin: '0px', threshold: 0, load: function load(element) { if (element.nodeName.toLowerCase() === 'picture') { var img = document.createElement('img'); if (isIE && element.getAttribute('data-iesrc')) { img.src = element.getAttribute('data-iesrc'); } else if (element.getAttribute('data-src')){ img.src = element.getAttribute('data-src'); } if (element.getAttribute('data-alt')) { img.alt = element.getAttribute('data-alt'); } if (element.getAttribute('data-class')) { img.className = element.getAttribute('data-class'); } if (element.getAttribute('data-title')) { img.title = element.getAttribute('data-title'); } element.appendChild(img); } if (element.getAttribute('data-src')) { element.src = element.getAttribute('data-src'); } if (element.getAttribute('data-srcset')) { element.setAttribute('srcset', element.getAttribute('data-srcset')); } if (element.getAttribute('data-background-image')) { element.style.backgroundImage = 'url(\'' + element.getAttribute('data-background-image') + '\')'; } if (element.getAttribute('data-toggle-class')) { element.classList.toggle(element.getAttribute('data-toggle-class')); } }, loaded: function loaded() { } }; function markAsLoaded(element) { element.setAttribute('data-loaded', true); } var isLoaded = function isLoaded(element) { return element.getAttribute('data-loaded') === 'true'; }; var onIntersection = function onIntersection(load, loaded) { return function (entries, observer) { entries.forEach(function (entry) { if (entry.intersectionRatio > 0 || entry.isIntersecting) { observer.unobserve(entry.target); if (!isLoaded(entry.target)) { load(entry.target); markAsLoaded(entry.target); loaded(entry.target); } } }); }; }; var getElements = function getElements(selector) { var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; if (selector instanceof Element) { return [selector]; } if (selector instanceof NodeList) { return selector; } return root.querySelectorAll(selector); }; function lozad() { var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.lozad'; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var _defaultConfig$option = _extends({}, defaultConfig, options), root = _defaultConfig$option.root, rootMargin = _defaultConfig$option.rootMargin, threshold = _defaultConfig$option.threshold, load = _defaultConfig$option.load, loaded = _defaultConfig$option.loaded; var observer = void 0; if (window.IntersectionObserver) { observer = new IntersectionObserver(onIntersection(load, loaded), { root: root, rootMargin: rootMargin, threshold: threshold }); } return { observe: function observe() { var elements = getElements(selector, root); for (var i = 0; i < elements.length; i++) { if (isLoaded(elements[i])) { continue; } if (observer) { observer.observe(elements[i]); continue; } load(elements[i]); markAsLoaded(elements[i]); loaded(elements[i]); } }, triggerLoad: function triggerLoad(element) { if (isLoaded(element)) { return; } load(element); markAsLoaded(element); loaded(element); }, observer: observer }; } return lozad; })));; /*! * The Final Countdown for jQuery v2.2.0 (http://hilios.github.io/jQuery.countdown/) * Copyright (c) 2016 Edson Hilios * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ (function (factory) { "use strict"; if (typeof define === "function" && define.amd) { define(["jquery"], factory); } else { factory(jQuery); } })(function ($) { "use strict"; var countdownOldDateSeconds = new Date().getSeconds(); var instances = [], matchers = [], defaultOptions = { precision: 100, elapse: false, defer: false }; matchers.push(/^[0-9]*$/.source); matchers.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source); matchers.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source); matchers = new RegExp(matchers.join("|")); function parseDateString(dateString) { if (dateString instanceof Date) { return dateString; } if (String(dateString).match(matchers)) { if (String(dateString).match(/^[0-9]*$/)) { dateString = Number(dateString); } if (String(dateString).match(/\-/)) { dateString = String(dateString).replace(/\-/g, "/"); } return new Date(dateString); } else { throw new Error("Couldn't cast `" + dateString + "` to a date object."); } } var DIRECTIVE_KEY_MAP = { Y: "years", m: "months", n: "daysToMonth", d: "daysToWeek", w: "weeks", W: "weeksToMonth", H: "hours", M: "minutes", S: "seconds", D: "totalDays", I: "totalHours", N: "totalMinutes", T: "totalSeconds" }; function escapedRegExp(str) { var sanitize = str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); return new RegExp(sanitize); } function strftime(offsetObject) { return function (format) { var directives = format.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi); if (directives) { for (var i = 0, len = directives.length; i < len; ++i) { var directive = directives[i].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/), regexp = escapedRegExp(directive[0]), modifier = directive[1] || "", plural = directive[3] || "", value = null; directive = directive[2]; if (DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) { value = DIRECTIVE_KEY_MAP[directive]; value = Number(offsetObject[value]); } if (value !== null) { if (modifier === "!") { value = pluralize(plural, value); } if (modifier === "") { if (value < 10) { value = "0" + value.toString(); } } format = format.replace(regexp, value.toString()); } } } format = format.replace(/%%/, "%"); return format; }; } function pluralize(format, count) { var plural = "s", singular = ""; if (format) { format = format.replace(/(:|;|\s)/gi, "").split(/\,/); if (format.length === 1) { plural = format[0]; } else { singular = format[0]; plural = format[1]; } } if (Math.abs(count) > 1) { return plural; } else { return singular; } } var Countdown = function (el, finalDate, options) { this.el = el; this.$el = $(el); this.interval = null; this.offset = {}; this.options = $.extend({}, defaultOptions); this.instanceNumber = instances.length; instances.push(this); this.$el.data("countdown-instance", this.instanceNumber); if (options) { if (typeof options === "function") { this.$el.on("update.countdown", options); this.$el.on("stoped.countdown", options); this.$el.on("finish.countdown", options); } else { this.options = $.extend({}, defaultOptions, options); } } this.setFinalDate(finalDate); if (this.options.defer === false) { this.start(); } }; $.extend(Countdown.prototype, { start: function () { if (this.interval !== null) { clearInterval(this.interval); } var self = this; this.update(); this.interval = setInterval(function () { self.update.call(self); }, this.options.precision); }, stop: function () { clearInterval(this.interval); this.interval = null; this.dispatchEvent("stoped"); }, toggle: function () { if (this.interval) { this.stop(); } else { this.start(); } }, pause: function () { this.stop(); }, resume: function () { this.start(); }, remove: function () { this.stop.call(this); instances[this.instanceNumber] = null; delete this.$el.data().countdownInstance; }, setFinalDate: function (value) { this.finalDate = parseDateString(value); }, update: function () { if (this.$el.closest("html").length === 0) { this.remove(); return; } var hasEventsAttached = $._data(this.el, "events") !== undefined, now = new Date(new Date().getTime() + localServerDiff), newTotalSecsLeft; newTotalSecsLeft = this.finalDate.getTime() - now.getTime(); newTotalSecsLeft = Math.ceil(newTotalSecsLeft / 1e3); newTotalSecsLeft = !this.options.elapse && newTotalSecsLeft < 0 ? 0 : Math.abs(newTotalSecsLeft); if (this.totalSecsLeft === newTotalSecsLeft || !hasEventsAttached) { return; } else { this.totalSecsLeft = newTotalSecsLeft; } this.elapsed = now >= this.finalDate; this.offset = { seconds: this.totalSecsLeft % 60, minutes: Math.floor(this.totalSecsLeft / 60) % 60, hours: Math.floor(this.totalSecsLeft / 60 / 60) % 24, days: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7, daysToWeek: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7, daysToMonth: Math.floor(this.totalSecsLeft / 60 / 60 / 24 % 30.4368), weeks: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7), weeksToMonth: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7) % 4, months: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 30.4368), years: Math.abs(this.finalDate.getFullYear() - now.getFullYear()), totalDays: Math.floor(this.totalSecsLeft / 60 / 60 / 24), totalHours: Math.floor(this.totalSecsLeft / 60 / 60), totalMinutes: Math.floor(this.totalSecsLeft / 60), totalSeconds: this.totalSecsLeft }; if (!this.options.elapse && this.totalSecsLeft === 0) { this.stop(); this.dispatchEvent("finish"); } else { this.dispatchEvent("update"); } }, dispatchEvent: function (eventName) { var event = $.Event(eventName + ".countdown"); event.finalDate = this.finalDate; event.elapsed = this.elapsed; event.offset = $.extend({}, this.offset); event.strftime = strftime(this.offset); this.$el.trigger(event); } }); $.fn.countdown = function () { var argumentsArray = Array.prototype.slice.call(arguments, 0); return this.each(function () { var instanceNumber = $(this).data("countdown-instance"); if (instanceNumber !== undefined) { var instance = instances[instanceNumber], method = argumentsArray[0]; if (Countdown.prototype.hasOwnProperty(method)) { instance[method].apply(instance, argumentsArray.slice(1)); } else if (String(method).match(/^[$A-Z_][0-9A-Z_$]*$/i) === null) { instance.setFinalDate.call(instance, method); instance.start(); } else { $.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi, method)); } } else { new Countdown(this, argumentsArray[0], argumentsArray[1]); } }); }; });; // Underscore.js 1.8.3 // http://underscorejs.org // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Underscore may be freely distributed under the MIT license. (function () { // Baseline setup // -------------- // Establish the root object, `window` in the browser, or `exports` on the server. var root = this; // Save the previous value of the `_` variable. var previousUnderscore = root._; // Save bytes in the minified (but not gzipped) version: var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; // Create quick reference variables for speed access to core prototypes. var push = ArrayProto.push, slice = ArrayProto.slice, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty; // All **ECMAScript 5** native function implementations that we hope to use // are declared here. var nativeIsArray = Array.isArray, nativeKeys = Object.keys, nativeBind = FuncProto.bind, nativeCreate = Object.create; // Naked function reference for surrogate-prototype-swapping. var Ctor = function () { }; // Create a safe reference to the Underscore object for use below. var _ = function (obj) { if (obj instanceof _) return obj; if (!(this instanceof _)) return new _(obj); this._wrapped = obj; }; // Export the Underscore object for **Node.js**, with // backwards-compatibility for the old `require()` API. If we're in // the browser, add `_` as a global object. if (typeof exports !== 'undefined') { if (typeof module !== 'undefined' && module.exports) { exports = module.exports = _; } exports._ = _; } else { root._ = _; } // Current version. _.VERSION = '1.8.3'; // Internal function that returns an efficient (for current engines) version // of the passed-in callback, to be repeatedly applied in other Underscore // functions. var optimizeCb = function (func, context, argCount) { if (context === void 0) return func; switch (argCount == null ? 3 : argCount) { case 1: return function (value) { return func.call(context, value); }; case 2: return function (value, other) { return func.call(context, value, other); }; case 3: return function (value, index, collection) { return func.call(context, value, index, collection); }; case 4: return function (accumulator, value, index, collection) { return func.call(context, accumulator, value, index, collection); }; } return function () { return func.apply(context, arguments); }; }; // A mostly-internal function to generate callbacks that can be applied // to each element in a collection, returning the desired result — either // identity, an arbitrary callback, a property matcher, or a property accessor. var cb = function (value, context, argCount) { if (value == null) return _.identity; if (_.isFunction(value)) return optimizeCb(value, context, argCount); if (_.isObject(value)) return _.matcher(value); return _.property(value); }; _.iteratee = function (value, context) { return cb(value, context, Infinity); }; // An internal function for creating assigner functions. var createAssigner = function (keysFunc, undefinedOnly) { return function (obj) { var length = arguments.length; if (length < 2 || obj == null) return obj; for (var index = 1; index < length; index++) { var source = arguments[index], keys = keysFunc(source), l = keys.length; for (var i = 0; i < l; i++) { var key = keys[i]; if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key]; } } return obj; }; }; // An internal function for creating a new object that inherits from another. var baseCreate = function (prototype) { if (!_.isObject(prototype)) return {}; if (nativeCreate) return nativeCreate(prototype); Ctor.prototype = prototype; var result = new Ctor; Ctor.prototype = null; return result; }; var property = function (key) { return function (obj) { return obj == null ? void 0 : obj[key]; }; }; // Helper for collection methods to determine whether a collection // should be iterated as an array or as an object // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094 var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; var getLength = property('length'); var isArrayLike = function (collection) { var length = getLength(collection); return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; }; // Collection Functions // -------------------- // The cornerstone, an `each` implementation, aka `forEach`. // Handles raw objects in addition to array-likes. Treats all // sparse array-likes as if they were dense. _.each = _.forEach = function (obj, iteratee, context) { iteratee = optimizeCb(iteratee, context); var i, length; if (isArrayLike(obj)) { for (i = 0, length = obj.length; i < length; i++) { iteratee(obj[i], i, obj); } } else { var keys = _.keys(obj); for (i = 0, length = keys.length; i < length; i++) { iteratee(obj[keys[i]], keys[i], obj); } } return obj; }; // Return the results of applying the iteratee to each element. _.map = _.collect = function (obj, iteratee, context) { iteratee = cb(iteratee, context); var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length, results = Array(length); for (var index = 0; index < length; index++) { var currentKey = keys ? keys[index] : index; results[index] = iteratee(obj[currentKey], currentKey, obj); } return results; }; // Create a reducing function iterating left or right. function createReduce(dir) { // Optimized iterator function as using arguments.length // in the main function will deoptimize the, see #1991. function iterator(obj, iteratee, memo, keys, index, length) { for (; index >= 0 && index < length; index += dir) { var currentKey = keys ? keys[index] : index; memo = iteratee(memo, obj[currentKey], currentKey, obj); } return memo; } return function (obj, iteratee, memo, context) { iteratee = optimizeCb(iteratee, context, 4); var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length, index = dir > 0 ? 0 : length - 1; // Determine the initial value if none is provided. if (arguments.length < 3) { memo = obj[keys ? keys[index] : index]; index += dir; } return iterator(obj, iteratee, memo, keys, index, length); }; } // **Reduce** builds up a single result from a list of values, aka `inject`, // or `foldl`. _.reduce = _.foldl = _.inject = createReduce(1); // The right-associative version of reduce, also known as `foldr`. _.reduceRight = _.foldr = createReduce(-1); // Return the first value which passes a truth test. Aliased as `detect`. _.find = _.detect = function (obj, predicate, context) { var key; if (isArrayLike(obj)) { key = _.findIndex(obj, predicate, context); } else { key = _.findKey(obj, predicate, context); } if (key !== void 0 && key !== -1) return obj[key]; }; // Return all the elements that pass a truth test. // Aliased as `select`. _.filter = _.select = function (obj, predicate, context) { var results = []; predicate = cb(predicate, context); _.each(obj, function (value, index, list) { if (predicate(value, index, list)) results.push(value); }); return results; }; // Return all the elements for which a truth test fails. _.reject = function (obj, predicate, context) { return _.filter(obj, _.negate(cb(predicate)), context); }; // Determine whether all of the elements match a truth test. // Aliased as `all`. _.every = _.all = function (obj, predicate, context) { predicate = cb(predicate, context); var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length; for (var index = 0; index < length; index++) { var currentKey = keys ? keys[index] : index; if (!predicate(obj[currentKey], currentKey, obj)) return false; } return true; }; // Determine if at least one element in the object matches a truth test. // Aliased as `any`. _.some = _.any = function (obj, predicate, context) { predicate = cb(predicate, context); var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length; for (var index = 0; index < length; index++) { var currentKey = keys ? keys[index] : index; if (predicate(obj[currentKey], currentKey, obj)) return true; } return false; }; // Determine if the array or object contains a given item (using `===`). // Aliased as `includes` and `include`. _.contains = _.includes = _.include = function (obj, item, fromIndex, guard) { if (!isArrayLike(obj)) obj = _.values(obj); if (typeof fromIndex != 'number' || guard) fromIndex = 0; return _.indexOf(obj, item, fromIndex) >= 0; }; // Invoke a method (with arguments) on every item in a collection. _.invoke = function (obj, method) { var args = slice.call(arguments, 2); var isFunc = _.isFunction(method); return _.map(obj, function (value) { var func = isFunc ? method : value[method]; return func == null ? func : func.apply(value, args); }); }; // Convenience version of a common use case of `map`: fetching a property. _.pluck = function (obj, key) { return _.map(obj, _.property(key)); }; // Convenience version of a common use case of `filter`: selecting only objects // containing specific `key:value` pairs. _.where = function (obj, attrs) { return _.filter(obj, _.matcher(attrs)); }; // Convenience version of a common use case of `find`: getting the first object // containing specific `key:value` pairs. _.findWhere = function (obj, attrs) { return _.find(obj, _.matcher(attrs)); }; // Return the maximum element (or element-based computation). _.max = function (obj, iteratee, context) { var result = -Infinity, lastComputed = -Infinity, value, computed; if (iteratee == null && obj != null) { obj = isArrayLike(obj) ? obj : _.values(obj); for (var i = 0, length = obj.length; i < length; i++) { value = obj[i]; if (value > result) { result = value; } } } else { iteratee = cb(iteratee, context); _.each(obj, function (value, index, list) { computed = iteratee(value, index, list); if (computed > lastComputed || computed === -Infinity && result === -Infinity) { result = value; lastComputed = computed; } }); } return result; }; // Return the minimum element (or element-based computation). _.min = function (obj, iteratee, context) { var result = Infinity, lastComputed = Infinity, value, computed; if (iteratee == null && obj != null) { obj = isArrayLike(obj) ? obj : _.values(obj); for (var i = 0, length = obj.length; i < length; i++) { value = obj[i]; if (value < result) { result = value; } } } else { iteratee = cb(iteratee, context); _.each(obj, function (value, index, list) { computed = iteratee(value, index, list); if (computed < lastComputed || computed === Infinity && result === Infinity) { result = value; lastComputed = computed; } }); } return result; }; // Shuffle a collection, using the modern version of the // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). _.shuffle = function (obj) { var set = isArrayLike(obj) ? obj : _.values(obj); var length = set.length; var shuffled = Array(length); for (var index = 0, rand; index < length; index++) { rand = _.random(0, index); if (rand !== index) shuffled[index] = shuffled[rand]; shuffled[rand] = set[index]; } return shuffled; }; // Sample **n** random values from a collection. // If **n** is not specified, returns a single random element. // The internal `guard` argument allows it to work with `map`. _.sample = function (obj, n, guard) { if (n == null || guard) { if (!isArrayLike(obj)) obj = _.values(obj); return obj[_.random(obj.length - 1)]; } return _.shuffle(obj).slice(0, Math.max(0, n)); }; // Sort the object's values by a criterion produced by an iteratee. _.sortBy = function (obj, iteratee, context) { iteratee = cb(iteratee, context); return _.pluck(_.map(obj, function (value, index, list) { return { value: value, index: index, criteria: iteratee(value, index, list) }; }).sort(function (left, right) { var a = left.criteria; var b = right.criteria; if (a !== b) { if (a > b || a === void 0) return 1; if (a < b || b === void 0) return -1; } return left.index - right.index; }), 'value'); }; // An internal function used for aggregate "group by" operations. var group = function (behavior) { return function (obj, iteratee, context) { var result = {}; iteratee = cb(iteratee, context); _.each(obj, function (value, index) { var key = iteratee(value, index, obj); behavior(result, value, key); }); return result; }; }; // Groups the object's values by a criterion. Pass either a string attribute // to group by, or a function that returns the criterion. _.groupBy = group(function (result, value, key) { if (_.has(result, key)) result[key].push(value); else result[key] = [value]; }); // Indexes the object's values by a criterion, similar to `groupBy`, but for // when you know that your index values will be unique. _.indexBy = group(function (result, value, key) { result[key] = value; }); // Counts instances of an object that group by a certain criterion. Pass // either a string attribute to count by, or a function that returns the // criterion. _.countBy = group(function (result, value, key) { if (_.has(result, key)) result[key]++; else result[key] = 1; }); // Safely create a real, live array from anything iterable. _.toArray = function (obj) { if (!obj) return []; if (_.isArray(obj)) return slice.call(obj); if (isArrayLike(obj)) return _.map(obj, _.identity); return _.values(obj); }; // Return the number of elements in an object. _.size = function (obj) { if (obj == null) return 0; return isArrayLike(obj) ? obj.length : _.keys(obj).length; }; // Split a collection into two arrays: one whose elements all satisfy the given // predicate, and one whose elements all do not satisfy the predicate. _.partition = function (obj, predicate, context) { predicate = cb(predicate, context); var pass = [], fail = []; _.each(obj, function (value, key, obj) { (predicate(value, key, obj) ? pass : fail).push(value); }); return [pass, fail]; }; // Array Functions // --------------- // Get the first element of an array. Passing **n** will return the first N // values in the array. Aliased as `head` and `take`. The **guard** check // allows it to work with `_.map`. _.first = _.head = _.take = function (array, n, guard) { if (array == null) return void 0; if (n == null || guard) return array[0]; return _.initial(array, array.length - n); }; // Returns everything but the last entry of the array. Especially useful on // the arguments object. Passing **n** will return all the values in // the array, excluding the last N. _.initial = function (array, n, guard) { return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); }; // Get the last element of an array. Passing **n** will return the last N // values in the array. _.last = function (array, n, guard) { if (array == null) return void 0; if (n == null || guard) return array[array.length - 1]; return _.rest(array, Math.max(0, array.length - n)); }; // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. // Especially useful on the arguments object. Passing an **n** will return // the rest N values in the array. _.rest = _.tail = _.drop = function (array, n, guard) { return slice.call(array, n == null || guard ? 1 : n); }; // Trim out all falsy values from an array. _.compact = function (array) { return _.filter(array, _.identity); }; // Internal implementation of a recursive `flatten` function. var flatten = function (input, shallow, strict, startIndex) { var output = [], idx = 0; for (var i = startIndex || 0, length = getLength(input) ; i < length; i++) { var value = input[i]; if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) { //flatten current level of array or arguments object if (!shallow) value = flatten(value, shallow, strict); var j = 0, len = value.length; output.length += len; while (j < len) { output[idx++] = value[j++]; } } else if (!strict) { output[idx++] = value; } } return output; }; // Flatten out an array, either recursively (by default), or just one level. _.flatten = function (array, shallow) { return flatten(array, shallow, false); }; // Return a version of the array that does not contain the specified value(s). _.without = function (array) { return _.difference(array, slice.call(arguments, 1)); }; // Produce a duplicate-free version of the array. If the array has already // been sorted, you have the option of using a faster algorithm. // Aliased as `unique`. _.uniq = _.unique = function (array, isSorted, iteratee, context) { if (!_.isBoolean(isSorted)) { context = iteratee; iteratee = isSorted; isSorted = false; } if (iteratee != null) iteratee = cb(iteratee, context); var result = []; var seen = []; for (var i = 0, length = getLength(array) ; i < length; i++) { var value = array[i], computed = iteratee ? iteratee(value, i, array) : value; if (isSorted) { if (!i || seen !== computed) result.push(value); seen = computed; } else if (iteratee) { if (!_.contains(seen, computed)) { seen.push(computed); result.push(value); } } else if (!_.contains(result, value)) { result.push(value); } } return result; }; // Produce an array that contains the union: each distinct element from all of // the passed-in arrays. _.union = function () { return _.uniq(flatten(arguments, true, true)); }; // Produce an array that contains every item shared between all the // passed-in arrays. _.intersection = function (array) { var result = []; var argsLength = arguments.length; for (var i = 0, length = getLength(array) ; i < length; i++) { var item = array[i]; if (_.contains(result, item)) continue; for (var j = 1; j < argsLength; j++) { if (!_.contains(arguments[j], item)) break; } if (j === argsLength) result.push(item); } return result; }; // Take the difference between one array and a number of other arrays. // Only the elements present in just the first array will remain. _.difference = function (array) { var rest = flatten(arguments, true, true, 1); return _.filter(array, function (value) { return !_.contains(rest, value); }); }; // Zip together multiple lists into a single array -- elements that share // an index go together. _.zip = function () { return _.unzip(arguments); }; // Complement of _.zip. Unzip accepts an array of arrays and groups // each array's elements on shared indices _.unzip = function (array) { var length = array && _.max(array, getLength).length || 0; var result = Array(length); for (var index = 0; index < length; index++) { result[index] = _.pluck(array, index); } return result; }; // Converts lists into objects. Pass either a single array of `[key, value]` // pairs, or two parallel arrays of the same length -- one of keys, and one of // the corresponding values. _.object = function (list, values) { var result = {}; for (var i = 0, length = getLength(list) ; i < length; i++) { if (values) { result[list[i]] = values[i]; } else { result[list[i][0]] = list[i][1]; } } return result; }; // Generator function to create the findIndex and findLastIndex functions function createPredicateIndexFinder(dir) { return function (array, predicate, context) { predicate = cb(predicate, context); var length = getLength(array); var index = dir > 0 ? 0 : length - 1; for (; index >= 0 && index < length; index += dir) { if (predicate(array[index], index, array)) return index; } return -1; }; } // Returns the first index on an array-like that passes a predicate test _.findIndex = createPredicateIndexFinder(1); _.findLastIndex = createPredicateIndexFinder(-1); // Use a comparator function to figure out the smallest index at which // an object should be inserted so as to maintain order. Uses binary search. _.sortedIndex = function (array, obj, iteratee, context) { iteratee = cb(iteratee, context, 1); var value = iteratee(obj); var low = 0, high = getLength(array); while (low < high) { var mid = Math.floor((low + high) / 2); if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; } return low; }; // Generator function to create the indexOf and lastIndexOf functions function createIndexFinder(dir, predicateFind, sortedIndex) { return function (array, item, idx) { var i = 0, length = getLength(array); if (typeof idx == 'number') { if (dir > 0) { i = idx >= 0 ? idx : Math.max(idx + length, i); } else { length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1; } } else if (sortedIndex && idx && length) { idx = sortedIndex(array, item); return array[idx] === item ? idx : -1; } if (item !== item) { idx = predicateFind(slice.call(array, i, length), _.isNaN); return idx >= 0 ? idx + i : -1; } for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) { if (array[idx] === item) return idx; } return -1; }; } // Return the position of the first occurrence of an item in an array, // or -1 if the item is not included in the array. // If the array is large and already in sort order, pass `true` // for **isSorted** to use binary search. _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex); _.lastIndexOf = createIndexFinder(-1, _.findLastIndex); // Generate an integer Array containing an arithmetic progression. A port of // the native Python `range()` function. See // [the Python documentation](http://docs.python.org/library/functions.html#range). _.range = function (start, stop, step) { if (stop == null) { stop = start || 0; start = 0; } step = step || 1; var length = Math.max(Math.ceil((stop - start) / step), 0); var range = Array(length); for (var idx = 0; idx < length; idx++, start += step) { range[idx] = start; } return range; }; // Function (ahem) Functions // ------------------ // Determines whether to execute a function as a constructor // or a normal function with the provided arguments var executeBound = function (sourceFunc, boundFunc, context, callingContext, args) { if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); var self = baseCreate(sourceFunc.prototype); var result = sourceFunc.apply(self, args); if (_.isObject(result)) return result; return self; }; // Create a function bound to a given object (assigning `this`, and arguments, // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if // available. _.bind = function (func, context) { if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function'); var args = slice.call(arguments, 2); var bound = function () { return executeBound(func, bound, context, this, args.concat(slice.call(arguments))); }; return bound; }; // Partially apply a function by creating a version that has had some of its // arguments pre-filled, without changing its dynamic `this` context. _ acts // as a placeholder, allowing any combination of arguments to be pre-filled. _.partial = function (func) { var boundArgs = slice.call(arguments, 1); var bound = function () { var position = 0, length = boundArgs.length; var args = Array(length); for (var i = 0; i < length; i++) { args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i]; } while (position < arguments.length) args.push(arguments[position++]); return executeBound(func, bound, this, this, args); }; return bound; }; // Bind a number of an object's methods to that object. Remaining arguments // are the method names to be bound. Useful for ensuring that all callbacks // defined on an object belong to it. _.bindAll = function (obj) { var i, length = arguments.length, key; if (length <= 1) throw new Error('bindAll must be passed function names'); for (i = 1; i < length; i++) { key = arguments[i]; obj[key] = _.bind(obj[key], obj); } return obj; }; // Memoize an expensive function by storing its results. _.memoize = function (func, hasher) { var memoize = function (key) { var cache = memoize.cache; var address = '' + (hasher ? hasher.apply(this, arguments) : key); if (!_.has(cache, address)) cache[address] = func.apply(this, arguments); return cache[address]; }; memoize.cache = {}; return memoize; }; // Delays a function for the given number of milliseconds, and then calls // it with the arguments supplied. _.delay = function (func, wait) { var args = slice.call(arguments, 2); return setTimeout(function () { return func.apply(null, args); }, wait); }; // Defers a function, scheduling it to run after the current call stack has // cleared. _.defer = _.partial(_.delay, _, 1); // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. Normally, the throttled function will run // as much as it can, without ever going more than once per `wait` duration; // but if you'd like to disable the execution on the leading edge, pass // `{leading: false}`. To disable execution on the trailing edge, ditto. _.throttle = function (func, wait, options) { var context, args, result; var timeout = null; var previous = 0; if (!options) options = {}; var later = function () { previous = options.leading === false ? 0 : _.now(); timeout = null; result = func.apply(context, args); if (!timeout) context = args = null; }; return function () { var now = _.now(); if (!previous && options.leading === false) previous = now; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0 || remaining > wait) { if (timeout) { clearTimeout(timeout); timeout = null; } previous = now; result = func.apply(context, args); if (!timeout) context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; }; // Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. _.debounce = function (func, wait, immediate) { var timeout, args, context, timestamp, result; var later = function () { var last = _.now() - timestamp; if (last < wait && last >= 0) { timeout = setTimeout(later, wait - last); } else { timeout = null; if (!immediate) { result = func.apply(context, args); if (!timeout) context = args = null; } } }; return function () { context = this; args = arguments; timestamp = _.now(); var callNow = immediate && !timeout; if (!timeout) timeout = setTimeout(later, wait); if (callNow) { result = func.apply(context, args); context = args = null; } return result; }; }; // Returns the first function passed as an argument to the second, // allowing you to adjust arguments, run code before and after, and // conditionally execute the original function. _.wrap = function (func, wrapper) { return _.partial(wrapper, func); }; // Returns a negated version of the passed-in predicate. _.negate = function (predicate) { return function () { return !predicate.apply(this, arguments); }; }; // Returns a function that is the composition of a list of functions, each // consuming the return value of the function that follows. _.compose = function () { var args = arguments; var start = args.length - 1; return function () { var i = start; var result = args[start].apply(this, arguments); while (i--) result = args[i].call(this, result); return result; }; }; // Returns a function that will only be executed on and after the Nth call. _.after = function (times, func) { return function () { if (--times < 1) { return func.apply(this, arguments); } }; }; // Returns a function that will only be executed up to (but not including) the Nth call. _.before = function (times, func) { var memo; return function () { if (--times > 0) { memo = func.apply(this, arguments); } if (times <= 1) func = null; return memo; }; }; // Returns a function that will be executed at most one time, no matter how // often you call it. Useful for lazy initialization. _.once = _.partial(_.before, 2); // Object Functions // ---------------- // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. var hasEnumBug = !{ toString: null }.propertyIsEnumerable('toString'); var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; function collectNonEnumProps(obj, keys) { var nonEnumIdx = nonEnumerableProps.length; var constructor = obj.constructor; var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto; // Constructor is a special case. var prop = 'constructor'; if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop); while (nonEnumIdx--) { prop = nonEnumerableProps[nonEnumIdx]; if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) { keys.push(prop); } } } // Retrieve the names of an object's own properties. // Delegates to **ECMAScript 5**'s native `Object.keys` _.keys = function (obj) { if (!_.isObject(obj)) return []; if (nativeKeys) return nativeKeys(obj); var keys = []; for (var key in obj) if (_.has(obj, key)) keys.push(key); // Ahem, IE < 9. if (hasEnumBug) collectNonEnumProps(obj, keys); return keys; }; // Retrieve all the property names of an object. _.allKeys = function (obj) { if (!_.isObject(obj)) return []; var keys = []; for (var key in obj) keys.push(key); // Ahem, IE < 9. if (hasEnumBug) collectNonEnumProps(obj, keys); return keys; }; // Retrieve the values of an object's properties. _.values = function (obj) { var keys = _.keys(obj); var length = keys.length; var values = Array(length); for (var i = 0; i < length; i++) { values[i] = obj[keys[i]]; } return values; }; // Returns the results of applying the iteratee to each element of the object // In contrast to _.map it returns an object _.mapObject = function (obj, iteratee, context) { iteratee = cb(iteratee, context); var keys = _.keys(obj), length = keys.length, results = {}, currentKey; for (var index = 0; index < length; index++) { currentKey = keys[index]; results[currentKey] = iteratee(obj[currentKey], currentKey, obj); } return results; }; // Convert an object into a list of `[key, value]` pairs. _.pairs = function (obj) { var keys = _.keys(obj); var length = keys.length; var pairs = Array(length); for (var i = 0; i < length; i++) { pairs[i] = [keys[i], obj[keys[i]]]; } return pairs; }; // Invert the keys and values of an object. The values must be serializable. _.invert = function (obj) { var result = {}; var keys = _.keys(obj); for (var i = 0, length = keys.length; i < length; i++) { result[obj[keys[i]]] = keys[i]; } return result; }; // Return a sorted list of the function names available on the object. // Aliased as `methods` _.functions = _.methods = function (obj) { var names = []; for (var key in obj) { if (_.isFunction(obj[key])) names.push(key); } return names.sort(); }; // Extend a given object with all the properties in passed-in object(s). _.extend = createAssigner(_.allKeys); // Assigns a given object with all the own properties in the passed-in object(s) // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) _.extendOwn = _.assign = createAssigner(_.keys); // Returns the first key on an object that passes a predicate test _.findKey = function (obj, predicate, context) { predicate = cb(predicate, context); var keys = _.keys(obj), key; for (var i = 0, length = keys.length; i < length; i++) { key = keys[i]; if (predicate(obj[key], key, obj)) return key; } }; // Return a copy of the object only containing the whitelisted properties. _.pick = function (object, oiteratee, context) { var result = {}, obj = object, iteratee, keys; if (obj == null) return result; if (_.isFunction(oiteratee)) { keys = _.allKeys(obj); iteratee = optimizeCb(oiteratee, context); } else { keys = flatten(arguments, false, false, 1); iteratee = function (value, key, obj) { return key in obj; }; obj = Object(obj); } for (var i = 0, length = keys.length; i < length; i++) { var key = keys[i]; var value = obj[key]; if (iteratee(value, key, obj)) result[key] = value; } return result; }; // Return a copy of the object without the blacklisted properties. _.omit = function (obj, iteratee, context) { if (_.isFunction(iteratee)) { iteratee = _.negate(iteratee); } else { var keys = _.map(flatten(arguments, false, false, 1), String); iteratee = function (value, key) { return !_.contains(keys, key); }; } return _.pick(obj, iteratee, context); }; // Fill in a given object with default properties. _.defaults = createAssigner(_.allKeys, true); // Creates an object that inherits from the given prototype object. // If additional properties are provided then they will be added to the // created object. _.create = function (prototype, props) { var result = baseCreate(prototype); if (props) _.extendOwn(result, props); return result; }; // Create a (shallow-cloned) duplicate of an object. _.clone = function (obj) { if (!_.isObject(obj)) return obj; return _.isArray(obj) ? obj.slice() : _.extend({}, obj); }; // Invokes interceptor with the obj, and then returns obj. // The primary purpose of this method is to "tap into" a method chain, in // order to perform operations on intermediate results within the chain. _.tap = function (obj, interceptor) { interceptor(obj); return obj; }; // Returns whether an object has a given set of `key:value` pairs. _.isMatch = function (object, attrs) { var keys = _.keys(attrs), length = keys.length; if (object == null) return !length; var obj = Object(object); for (var i = 0; i < length; i++) { var key = keys[i]; if (attrs[key] !== obj[key] || !(key in obj)) return false; } return true; }; // Internal recursive comparison function for `isEqual`. var eq = function (a, b, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). if (a === b) return a !== 0 || 1 / a === 1 / b; // A strict comparison is necessary because `null == undefined`. if (a == null || b == null) return a === b; // Unwrap any wrapped objects. if (a instanceof _) a = a._wrapped; if (b instanceof _) b = b._wrapped; // Compare `[[Class]]` names. var className = toString.call(a); if (className !== toString.call(b)) return false; switch (className) { // Strings, numbers, regular expressions, dates, and booleans are compared by value. case '[object RegExp]': // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') case '[object String]': // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. return '' + a === '' + b; case '[object Number]': // `NaN`s are equivalent, but non-reflexive. // Object(NaN) is equivalent to NaN if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values. return +a === 0 ? 1 / +a === 1 / b : +a === +b; case '[object Date]': case '[object Boolean]': // Coerce dates and booleans to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are not equivalent. return +a === +b; } var areArrays = className === '[object Array]'; if (!areArrays) { if (typeof a != 'object' || typeof b != 'object') return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s // from different frames are. var aCtor = a.constructor, bCtor = b.constructor; if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && _.isFunction(bCtor) && bCtor instanceof bCtor) && ('constructor' in a && 'constructor' in b)) { return false; } } // Assume equality for cyclic structures. The algorithm for detecting cyclic // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. // Initializing stack of traversed objects. // It's done here since we only need them for objects and arrays comparison. aStack = aStack || []; bStack = bStack || []; var length = aStack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. if (aStack[length] === a) return bStack[length] === b; } // Add the first object to the stack of traversed objects. aStack.push(a); bStack.push(b); // Recursively compare objects and arrays. if (areArrays) { // Compare array lengths to determine if a deep comparison is necessary. length = a.length; if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties. while (length--) { if (!eq(a[length], b[length], aStack, bStack)) return false; } } else { // Deep compare objects. var keys = _.keys(a), key; length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality. if (_.keys(b).length !== length) return false; while (length--) { // Deep compare each member key = keys[length]; if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; } } // Remove the first object from the stack of traversed objects. aStack.pop(); bStack.pop(); return true; }; // Perform a deep comparison to check if two objects are equal. _.isEqual = function (a, b) { return eq(a, b); }; // Is a given array, string, or object empty? // An "empty" object has no enumerable own-properties. _.isEmpty = function (obj) { if (obj == null) return true; if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0; return _.keys(obj).length === 0; }; // Is a given value a DOM element? _.isElement = function (obj) { return !!(obj && obj.nodeType === 1); }; // Is a given value an array? // Delegates to ECMA5's native Array.isArray _.isArray = nativeIsArray || function (obj) { return toString.call(obj) === '[object Array]'; }; // Is a given variable an object? _.isObject = function (obj) { var type = typeof obj; return type === 'function' || type === 'object' && !!obj; }; // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError. _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function (name) { _['is' + name] = function (obj) { return toString.call(obj) === '[object ' + name + ']'; }; }); // Define a fallback version of the method in browsers (ahem, IE < 9), where // there isn't any inspectable "Arguments" type. if (!_.isArguments(arguments)) { _.isArguments = function (obj) { return _.has(obj, 'callee'); }; } // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8, // IE 11 (#1621), and in Safari 8 (#1929). if (typeof /./ != 'function' && typeof Int8Array != 'object') { _.isFunction = function (obj) { return typeof obj == 'function' || false; }; } // Is a given object a finite number? _.isFinite = function (obj) { return isFinite(obj) && !isNaN(parseFloat(obj)); }; // Is the given value `NaN`? (NaN is the only number which does not equal itself). _.isNaN = function (obj) { return _.isNumber(obj) && obj !== +obj; }; // Is a given value a boolean? _.isBoolean = function (obj) { return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; }; // Is a given value equal to null? _.isNull = function (obj) { return obj === null; }; // Is a given variable undefined? _.isUndefined = function (obj) { return obj === void 0; }; // Shortcut function for checking if an object has a given property directly // on itself (in other words, not on a prototype). _.has = function (obj, key) { return obj != null && hasOwnProperty.call(obj, key); }; // Utility Functions // ----------------- // Run Underscore.js in *noConflict* mode, returning the `_` variable to its // previous owner. Returns a reference to the Underscore object. _.noConflict = function () { root._ = previousUnderscore; return this; }; // Keep the identity function around for default iteratees. _.identity = function (value) { return value; }; // Predicate-generating functions. Often useful outside of Underscore. _.constant = function (value) { return function () { return value; }; }; _.noop = function () { }; _.property = property; // Generates a function for a given object that returns a given property. _.propertyOf = function (obj) { return obj == null ? function () { } : function (key) { return obj[key]; }; }; // Returns a predicate for checking whether an object has a given set of // `key:value` pairs. _.matcher = _.matches = function (attrs) { attrs = _.extendOwn({}, attrs); return function (obj) { return _.isMatch(obj, attrs); }; }; // Run a function **n** times. _.times = function (n, iteratee, context) { var accum = Array(Math.max(0, n)); iteratee = optimizeCb(iteratee, context, 1); for (var i = 0; i < n; i++) accum[i] = iteratee(i); return accum; }; // Return a random integer between min and max (inclusive). _.random = function (min, max) { if (max == null) { max = min; min = 0; } return min + Math.floor(Math.random() * (max - min + 1)); }; // A (possibly faster) way to get the current timestamp as an integer. _.now = Date.now || function () { return new Date().getTime(); }; // List of HTML entities for escaping. var escapeMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '`': '`' }; var unescapeMap = _.invert(escapeMap); // Functions for escaping and unescaping strings to/from HTML interpolation. var createEscaper = function (map) { var escaper = function (match) { return map[match]; }; // Regexes for identifying a key that needs to be escaped var source = '(?:' + _.keys(map).join('|') + ')'; var testRegexp = RegExp(source); var replaceRegexp = RegExp(source, 'g'); return function (string) { string = string == null ? '' : '' + string; return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; }; }; _.escape = createEscaper(escapeMap); _.unescape = createEscaper(unescapeMap); // If the value of the named `property` is a function then invoke it with the // `object` as context; otherwise, return it. _.result = function (object, property, fallback) { var value = object == null ? void 0 : object[property]; if (value === void 0) { value = fallback; } return _.isFunction(value) ? value.call(object) : value; }; // Generate a unique integer id (unique within the entire client session). // Useful for temporary DOM ids. var idCounter = 0; _.uniqueId = function (prefix) { var id = ++idCounter + ''; return prefix ? prefix + id : id; }; // By default, Underscore uses ERB-style template delimiters, change the // following template settings to use alternative delimiters. _.templateSettings = { evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g, escape: /<%-([\s\S]+?)%>/g }; // When customizing `templateSettings`, if you don't want to define an // interpolation, evaluation or escaping regex, we need one that is // guaranteed not to match. var noMatch = /(.)^/; // Certain characters need to be escaped so that they can be put into a // string literal. var escapes = { "'": "'", '\\': '\\', '\r': 'r', '\n': 'n', '\u2028': 'u2028', '\u2029': 'u2029' }; var escaper = /\\|'|\r|\n|\u2028|\u2029/g; var escapeChar = function (match) { return '\\' + escapes[match]; }; // JavaScript micro-templating, similar to John Resig's implementation. // Underscore templating handles arbitrary delimiters, preserves whitespace, // and correctly escapes quotes within interpolated code. // NB: `oldSettings` only exists for backwards compatibility. _.template = function (text, settings, oldSettings) { if (!settings && oldSettings) settings = oldSettings; settings = _.defaults({}, settings, _.templateSettings); // Combine delimiters into one regular expression via alternation. var matcher = RegExp([ (settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source ].join('|') + '|$', 'g'); // Compile the template source, escaping string literals appropriately. var index = 0; var source = "__p+='"; text.replace(matcher, function (match, escape, interpolate, evaluate, offset) { source += text.slice(index, offset).replace(escaper, escapeChar); index = offset + match.length; if (escape) { source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; } else if (interpolate) { source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; } else if (evaluate) { source += "';\n" + evaluate + "\n__p+='"; } // Adobe VMs need the match returned to produce the correct offest. return match; }); source += "';\n"; // If a variable is not specified, place data values in local scope. if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; source = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + source + 'return __p;\n'; try { var render = new Function(settings.variable || 'obj', '_', source); } catch (e) { e.source = source; throw e; } var template = function (data) { return render.call(this, data, _); }; // Provide the compiled source as a convenience for precompilation. var argument = settings.variable || 'obj'; template.source = 'function(' + argument + '){\n' + source + '}'; return template; }; // Add a "chain" function. Start chaining a wrapped Underscore object. _.chain = function (obj) { var instance = _(obj); instance._chain = true; return instance; }; // OOP // --------------- // If Underscore is called as a function, it returns a wrapped object that // can be used OO-style. This wrapper holds altered versions of all the // underscore functions. Wrapped objects may be chained. // Helper function to continue chaining intermediate results. var result = function (instance, obj) { return instance._chain ? _(obj).chain() : obj; }; // Add your own custom functions to the Underscore object. _.mixin = function (obj) { _.each(_.functions(obj), function (name) { var func = _[name] = obj[name]; _.prototype[name] = function () { var args = [this._wrapped]; push.apply(args, arguments); return result(this, func.apply(_, args)); }; }); }; // Add all of the Underscore functions to the wrapper object. _.mixin(_); // Add all mutator Array functions to the wrapper. _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function (name) { var method = ArrayProto[name]; _.prototype[name] = function () { var obj = this._wrapped; method.apply(obj, arguments); if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0]; return result(this, obj); }; }); // Add all accessor Array functions to the wrapper. _.each(['concat', 'join', 'slice'], function (name) { var method = ArrayProto[name]; _.prototype[name] = function () { return result(this, method.apply(this._wrapped, arguments)); }; }); // Extracts the result from a wrapped and chained object. _.prototype.value = function () { return this._wrapped; }; // Provide unwrapping proxy for some methods used in engine operations // such as arithmetic and JSON stringification. _.prototype.valueOf = _.prototype.toJSON = _.prototype.value; _.prototype.toString = function () { return '' + this._wrapped; }; // AMD registration happens at the end for compatibility with AMD loaders // that may not enforce next-turn semantics on modules. Even though general // practice for AMD registration is to be anonymous, underscore registers // as a named module because, like jQuery, it is a base library that is // popular enough to be bundled in a third party lib, but not be part of // an AMD load request. Those cases could generate an error when an // anonymous define() is called outside of a loader request. if (typeof define === 'function' && define.amd) { define('underscore', [], function () { return _; }); } }.call(this));; var timeDebugger = new Date(); var lastTime = 0; function setTimeDebuggerPoint(pointName, seconds) { var currentTime = new Date() , diff = currentTime.getTime() - timeDebugger.getTime() , diffSecs = seconds ? Math.ceil(diff / 1000) : diff , timeName = seconds ? "Seconds" : "Milliseconds" , pointName = pointName ? pointName : "No Point Name"; console.log("When at '" + pointName + "': " + diffSecs + " " + timeName + " passed. (" + (diffSecs - lastTime) + " " + timeName + " from last point)"); lastTime = diffSecs; } //setTimeDebuggerPoint("Begin");; var obj_window = $(window), // phoneDim = 481, // Hero Slider won't appear on phone phoneDim = 1, // Hero slider will appear on phone tabletDim = 768, desktopDim = 1031/*desktopBreakingPoint 2*/, currentDim = 0, currentDevice = "", aligningItems = false; obj_window.resize(function () { currentDim = window.innerWidth; if (currentDim < phoneDim) { //PHONE FUNCTIONS currentDevice = "phone"; if ($("#mainslider").hasClass("gridList")) $("#step-1 #productCount").trigger("click"); if ($("#homepage #hero").hasClass("slick-initialized")) handleHomepageSlider(true); // Destroy Homepage Slider (if applicable) if (typeof productGallery != "undefined") { productGallery.clearZoom(); productGallery.setImageGalleryEvents(); } } else if (currentDim <= tabletDim) { //TABLET PORTRAIT FUNCTIONS currentDevice = "tablet-portrait"; if (!$("#homepage #hero").hasClass("slick-initialized")) handleHomepageSlider(); // Start Homepage Slider (if applicable) if (typeof productGallery != "undefined") { productGallery.clearZoom(); productGallery.setImageGalleryEvents(); } } else if (currentDim <= desktopDim) { //TABLET LANDSCAPE FUNCTIONS currentDevice = "tablet-landscape"; if (!$("#homepage #hero").hasClass("slick-initialized")) handleHomepageSlider(); // Start Homepage Slider (if applicable) if (typeof productGallery != "undefined") { productGallery.clearZoom(); productGallery.setImageGalleryEvents(); } } else { //DESKTOP FUNCTIONS currentDevice = "desktop"; if (!$("#homepage #hero").hasClass("slick-initialized")) handleHomepageSlider(); // Start Homepage Slider (if applicable) if (typeof productGallery != "undefined") { productGallery.clearZoom(); productGallery.setImageGalleryEvents(); } } if(typeof productPage!="undefined") productPage.showHideViewAll(); if ($("#imperoLandingPage").length) setVideoSource(); bodyBrowserClass(); if (!aligningItems) alignSizes(); }); $(function () { obj_window.resize(); }); function alignSizes() { aligningItems = true; setTimeout(function () { var alignSizesHolder = $(".alignSizesHolder"); for (var i = 0, n = alignSizesHolder.length; i < n; i++) { var alignable = $(alignSizesHolder[i]).children(".alignable"); alignable.removeAttr("style"); var height = $(alignable[0]).height() , oneIsBigger = false; for (var j = 1, m = alignable.length; j < m; j++) { if ($(alignable[j]).height() > height) { height = $(alignable[j]).height(); oneIsBigger = true; } } if (oneIsBigger) { for (var j = 0, m = alignable.length; j < m; j++) { $(alignable[j]).height(height); } } } aligningItems = false; }, 1000); } function handleHomepageSlider(destroy) { if (destroy) { $("#homepage #hero").slick("destroy"); } else { if ($("#homepage #hero > .slide").length > 1) { $("#homepage #hero").slick({ autoplay: true , arrows: false , dots: true , autoplaySpeed: 7000 }); } } } function bodyBrowserClass() { var browserClass = ""; if (typeof $.browser !== "undefined") { if (navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/)) || $.browser.msie == 1) { browserClass = "iexplorer"; if (currentDim >= 769) iePictureFix(); }else if (window.navigator.userAgent.indexOf("Edge") > -1) { browserClass = "edge"; }else if ($.browser.chrome == true) { browserClass = "chrome"; } else if ($.browser.mozilla == true) { browserClass = "firefox"; } else if ($.browser.safari == true) { browserClass = "safari"; } $("body").addClass(browserClass); } } function iePictureFix() { var iePics = $("picture>img"); for (var i = 0, n = iePics.length; i < n;i++){ var el = $(iePics[i]); el.attr("src", el.attr("data-iesrc")); } } ; //var GoogleTracking = { // Init:{ // }, // Events: { // ViewProduct: function () { // } // }, // PageView:{ // BasketAndCheckout: function () { // } // } //} var GoogleTracking = { containerId: "GTM-P86RX2", init: function(selectedCountry, selectedCurrency, selectedLanguage, pageType) { window.dataLayer = window.dataLayer || []; this.SelectedCountry = selectedCountry; this.SelectedCurrency = selectedCurrency; this.SelectedLanguage = selectedLanguage; this.PageType = pageType; }, UpdateCountry: function(selectedCountry) { this.SelectedCountry = selectedCountry; }, UpdateCurrency: function (selectedCurrency) { this.SelectedCurrency = selectedCurrency; }, ViewSelectProduct: function (productItem) { var obj = {}; obj.event = "view_product"; obj.productItem = productItem; this._Push(obj); }, BasketCheckoutPageView: function (productCategory, productSubCategory, productItem, productPrice, totalPrice) { var obj = this._GetStandardViewObj(); obj.productItem = productItem; obj.productCategory = productCategory; obj.productSubCategory = productSubCategory; obj.productPrice = productPrice; obj.basketValue = totalPrice; this._Push(obj); }, CategoryPageView: function (productCategory) { var obj = this._GetStandardViewObj(); obj.productCategory = productCategory; this._Push(obj); }, ShopPageView: function (productCategory, productSubCategory, productItem) { var obj = this._GetStandardViewObj(); obj.productItem = productItem; obj.productCategory = productCategory; obj.productSubCategory = productSubCategory; this._Push(obj); }, PageView: function () { var obj = this._GetStandardViewObj(); this._Push(obj); }, SpeakWithOurAdvisors: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "form submission"; obj.ga_event.action = "speak with our expert advisors"; this._Push(obj); }, EmailEnquiry: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "form submission"; obj.ga_event.action = "email us your enquiries"; this._Push(obj); }, MoreInformation: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "form submission"; obj.ga_event.action = "request more information"; this._Push(obj); }, EarlyBirdSignup: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "early bird"; obj.ga_event.action = "sign up"; this._Push(obj); }, EarlyBirdLogin: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "early bird"; obj.ga_event.action = "login"; this._Push(obj); }, BlackFridaySignup: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "black friday"; obj.ga_event.action = "sign up"; this._Push(obj); }, RequestAppointment: function (label,step) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "form submission"; if(label){ if(label.includes('localised')){ obj.ga_event.action = 'complete form step ' + step; } else { obj.ga_event.action = "request an appointment"; } obj.ga_event.label = label; } this._Push(obj); }, SendToFriend: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "form submission"; obj.ga_event.action = "send to a friend"; this._Push(obj); }, VoucherCode: function (code, callback) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "voucher code"; obj.ga_event.action = code; obj.voucherCode = code; obj.eventCallback = callback; this._Push(obj); }, CompareCarat: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "compare carat"; obj.ga_event.action = "learn more"; this._Push(obj); }, CompareCaratSlider: function (size) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "compare carat"; obj.ga_event.action = "slider"; obj.ga_event.label = size; this._Push(obj); }, AddToBasketComparison: function (price, callback) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "comparison"; obj.ga_event.action = "add to shopping bag"; obj.ga_event.label = "comparison page (/compare-diamonds.aspx)"; obj.ga_event.value = price; obj.eventCallback = function (containerId) { if (containerId === GoogleTracking.containerId) { callback(); } } this._Push(obj); }, AddToBasketShop: function (productCategory, productSubCategory, product, url, quick, callback) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "product interactions | " + productCategory; obj.ga_event.action = quick == true ? "add to shopping bag quick sticky" : "add to shopping bag"; obj.ga_event.label = this._ReadableLabel(productCategory, productSubCategory, product, url); obj.ga_event.value = 0; obj.eventCallback = function (containerId) { if (containerId === GoogleTracking.containerId) { callback(); } } this._Push(obj); }, CheckoutStep1: function () { var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = "/checkout/completed-personal-details"; obj.ga_vpv.title = "Checkout Page | Completed Personal Details"; this._Push(obj); }, CheckoutStep2: function () { var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = "/checkout/completed-billing-and-delivery-details"; obj.ga_vpv.title = "Checkout Page | Completed Billing and Delivery Details"; this._Push(obj); }, CheckoutStep3: function (paymentMethod, hyphenatedPayment, callback, orderTotalInGBP) { var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = "/checkout/completed-payment/" + hyphenatedPayment; obj.ga_vpv.title = "Checkout Page | Completed Payment"; obj.paymentMethod = paymentMethod; obj.eventCallback = callback; obj.orderTotalInGBP = orderTotalInGBP; this._Push(obj); }, NewsletterSignup: function(page, title){ var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = page; obj.ga_vpv.title = title; obj.accountStatus = title; this._Push(obj); }, DesignYourDream: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "form submission"; obj.ga_event.action = "design your dream"; this._Push(obj); }, PostSignupSocialMedia: function (action) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "post signup - follow us on social media"; obj.ga_event.action = action; this._Push(obj); }, socialmediaTracking: function (socialmedia,page) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "post signup - follow us on social media"; obj.ga_event.action = 'follow us on ' + socialmedia + ' - ' + page; this._Push(obj); }, ShowroomPopover: function (city, action) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "request appointment popup"; obj.ga_event.label = 'localised popup - ' + city; obj.ga_event.action = action; this._Push(obj); }, ShowroomPopoverPageView: function(city, action){ var cityName = city.toLowerCase() var obj = this._GetStandardVirtualPageObj(); var link = "/localised-popup/" + action + "/" + cityName; obj.ga_vpv.page = link; obj.ga_vpv.title = "Localised Popup | " + cityName; obj.ga_vpv.pageType = "PageView"; this._Push(obj); try { decibelInsight('trackPageView', link); } catch (error) { } }, //deprecated FindOutMore: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "form submission"; obj.ga_event.action = "find out more"; this._Push(obj); }, ShowroomConsultation: function () { var obj = this._GetStandardEventObj(); obj.ga_event.category = "form submission"; obj.ga_event.action = "arrange a showroom consultation"; this._Push(obj); }, //###### New SHOP Pushes ###### SelectSetting: function (productCategory, productSubCategory) { var friendlyProductSubCategory = productSubCategory .split(',') .map(function (productSubCategory) { return GoogleTracking._FriendlyString(productSubCategory) }) .join('/'); var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = "/shop/select-setting/" + this._FriendlyString(productCategory) + (productSubCategory ? "/" + friendlyProductSubCategory : ""); obj.ga_vpv.title = "Shop Page | " + productCategory + (productSubCategory ? " | " + productSubCategory : ""); obj.ga_vpv.pageType = "Shop"; obj.ga_vpv.productCategory = productCategory; if (productSubCategory) obj.ga_vpv.productSubCategory = productSubCategory; this._Push(obj); }, ViewSetting: function (productCategory, productSubCategory, productName, productMetal, productShape) { var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = "/shop/view-setting/" + this._FriendlyString(productCategory) + "/" + this._FriendlyString(productSubCategory) + "/" + this._FriendlyString(productName); obj.ga_vpv.title = "Shop Page | " + productCategory + " | " + productSubCategory + " | " + productName; obj.ga_vpv.pageType = "Shop"; obj.ga_vpv.productCategory = productCategory; obj.ga_vpv.productSubCategory = productSubCategory; obj.ga_vpv.productMetal = productMetal; if(productShape) obj.ga_vpv.productShape = productShape; this._Push(obj); }, SelectDiamond: function (productCategory, productSubCategory, productName, productMetal, productShape) { var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = "/shop/select-diamond/" + this._FriendlyString(productCategory) + "/" + this._FriendlyString(productSubCategory) + "/" + this._FriendlyString(productName); obj.ga_vpv.title = "Shop Page | " + productCategory + " | " + productSubCategory + " | " + productName; obj.ga_vpv.pageType = "Shop"; obj.ga_vpv.productCategory = productCategory; obj.ga_vpv.productSubCategory = productSubCategory; obj.ga_vpv.productMetal = productMetal; obj.ga_vpv.productShape = productShape; this._Push(obj); }, CompleteSelection: function (productCategory, productSubCategory, productName, productMetal, productShape) { var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = "/shop/complete-product/" + this._FriendlyString(productCategory) + "/" + this._FriendlyString(productSubCategory) + "/" + this._FriendlyString(productName); obj.ga_vpv.title = "Shop Page | " + productCategory + " | " + productSubCategory + " | " + productName; obj.ga_vpv.pageType = "Shop"; obj.ga_vpv.productCategory = productCategory; obj.ga_vpv.productSubCategory = productSubCategory; obj.ga_vpv.productMetal = productMetal; if (productShape) obj.ga_vpv.productShape = productShape; this._Push(obj); }, FilterChanged: function (productCategory, filter, value) { if (typeof value !== "undefined" && value) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "product interactions | " + this._FriendlyString(productCategory); obj.ga_event.action = "product filter | " + filter + " | " + value; this._Push(obj); } }, DiamondFilterChanged: function (productCategory, filter, value) { var obj = this._GetStandardEventObj(); obj.ga_event.category = "product interactions | " + this._FriendlyString(productCategory); obj.ga_event.action = "change diamond option | " + filter + " | " + value; this._Push(obj); }, DiamondPage: function () { var obj = this._GetStandardVirtualPageObj(); obj.ga_vpv.page = "/view-diamonds-list"; obj.ga_vpv.title = "Diamonds Page"; obj.ga_vpv.pageType = "PageView"; this._Push(obj); }, //##### END ###### PushObj: function(obj) { this._Push(obj); }, _GetStandardVirtualPageObj: function () { var obj = {}; obj.event = "ga_vpv"; obj.ga_vpv = {}; return obj; }, _GetStandardEventObj: function () { var obj = {}; obj.event = "ga_event"; obj.ga_event = {}; obj.ga_event.label = ""; obj.ga_event.value = 0; obj.ga_event.nonInteraction = "false"; return obj; }, _GetStandardViewObj: function () { var obj = {}; obj.event = "dataLoaded"; //obj.userId = "0"; do not set obj.loggedIn = "no"; obj.pageType = this.PageType == null ? "Other" : this.PageType; obj.selectedCountry = this.SelectedCountry; obj.selectedCurrency = this.SelectedCurrency; obj.selectedLanguage = this.SelectedLanguage; obj.productEnvironment = "new"; return obj; }, _Push: function (obj) { window.dataLayer.push(obj); }, _ReadableLabel: function (productCategory, productSubCategory, product, url) { try { if (this.PageType.match(/Category/g)) { return "Category Page | " + productCategory } else if (this.PageType.match(/Shop/g)) { return "Shop Page | " + productCategory + " | " + productSubCategory + " | " + product; } else if (typeof this.PageType !== "undefined") { return this.PageType + ' Page (' + url + ')'; } else { return 'Other Page (' + url + ')'; } } catch (e) { } return ""; }, _FriendlyString: function(name) { name = name.toString(); // Convert to string try { name = name.normalize('NFD'); // Change diacritics } catch (e) {} return name // Change diacritics .replace(/[\u0300-\u036f]/g, '') // Remove illegal characters .replace(/\s+/g, '-') // Change whitespace to dashes .toLowerCase() // Change to lowercase .replace(/&/g, '-and-') // Replace ampersand .replace(/[^a-z0-9\-]/g, '') // Remove anything that is not a letter, number or dash .replace(/-+/g, '-') // Remove duplicate dashes .replace(/^-*/, '') // Remove starting dashes .replace(/-*$/, ''); } } //function PageViewTracking() { // var prodCat = ''; // var prodSubCat = ''; // var itemName = ''; // var itemPrice = ''; // if ($(".menu-top").find("li a.selected").length == 1) { // prodCat = $(".menu-top").find("li a.selected").data("cat-name"); // } else if (window.location.href.toLowerCase().indexOf('diamond-earrings.html') > -1) { // prodCat = 'Diamond Earrings'; // } else if (window.location.href.toLowerCase().indexOf('diamond_necklaces.html') > -1) { // prodCat = 'Diamond Necklaces'; // } // if ($("#ucTopNav_").find("li.active").length == 1) { // prodSubCat = $.trim($("#ucTopNav_").find("li.active a span").text()); // } // if ($("#productItemList").find("h3.active").length == 1) { // itemName = $.trim($('#productItemList h3.active').text()); // } // prodCat = $.trim(prodCat); // prodSubCat = $.trim(prodSubCat); // itemName = $.trim(itemName); // //loose/matching pair/colour diamonds - we don't need to track the items since it's diamonds only // if (xtItemId == -1 || xtItemId == -2 || xtItemId == -3) { // window.dataLayer = window.dataLayer || []; // window.dataLayer.push({ // "event": "dataLoaded", // "userId": (_userId == 0) ? undefined : "" + _userId + "", // "loggedIn": _loggedIn, // "pageType": "" + _pageType + "", // "productCategory": (prodCat != '') ? "" + prodCat + "" : undefined, // "productSubCategory": (prodSubCat != '') ? "" + prodSubCat + "" : undefined, // "selectedCountry": "" + _selectedCountry + "", // "selectedCurrency": "" + _selectedCurrency + "", // "selectedLanguage": "" + _selectedLanguage + "" // }); // }//checkout/basket // else if (_pageType == "Checkout" || _pageType == "Basket") { // prodCat = $("#ctl00_ContentPlaceHolder1_hnMostExpensiveItemCategory").val(); // prodSubCat = $("#ctl00_ContentPlaceHolder1_hnMostExpensiveItemSubCategory").val(); // itemName = $("#ctl00_ContentPlaceHolder1_hnMostExpensiveItemName").val(); // itemPrice = $("#ctl00_ContentPlaceHolder1_hnMostExpensiveItemPrice").val(); // window.dataLayer = window.dataLayer || []; // window.dataLayer.push({ // "event": "dataLoaded", // "userId": (_userId == 0) ? undefined : "" + _userId + "", // "loggedIn": _loggedIn, // "pageType": "" + _pageType + "", // "productCategory": (prodCat != '') ? "" + prodCat + "" : undefined, // "productSubCategory": (prodSubCat != '') ? "" + prodSubCat + "" : undefined, // "productItem": (itemName != '') ? "" + itemName + "" : undefined, // "productPrice": (itemPrice != '') ? "" + itemPrice + "" : undefined, // "selectedCountry": "" + _selectedCountry + "", // "selectedCurrency": "" + _selectedCurrency + "", // "selectedLanguage": "" + _selectedLanguage + "" // }); // } // else { // window.dataLayer = window.dataLayer || []; // window.dataLayer.push({ // "event": "dataLoaded", // "userId": (_userId == 0) ? undefined : "" + _userId + "", // "loggedIn": _loggedIn, // "pageType": "" + _pageType + "", // "productCategory": (prodCat != '') ? "" + prodCat + "" : undefined, // "productSubCategory": (prodSubCat != '') ? "" + prodSubCat + "" : undefined, // "productItem": (itemName != '') ? "" + itemName + "" : undefined, // "selectedCountry": "" + _selectedCountry + "", // "selectedCurrency": "" + _selectedCurrency + "", // "selectedLanguage": "" + _selectedLanguage + "" // }); // } //}; var DataLayer = { init: function (country, currency, language, type) { window.dataLayer = window.dataLayer || []; this.country = country; this.currency = currency; this.language = language; this.pageType = type; this.forms = []; // call on page load this.pageView(); // handle links/ctas clicks this.linkCtaInteraction(); }, push: function (data) { window.dataLayer.push(data); }, event: function (event) { window.dataLayer.push({ event: event, }); }, pageView: function () { this.push({ event: "pageView", page: { url: window.location.href, path: window.location.pathname, queryString: window.location.search, type: this.pageType || "Other", }, user: { country: this.country, currency: this.currency, language: this.language, }, }); }, linkCtaInteraction: function () { var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i++) { var current = links[i]; current.addEventListener("click", function (e) { var text = e.target.innerText; var category = e.target.getAttribute("data-ga4-category"); if (category && category.length > 0) { category = category.trim(); } else { category = "unavailable"; } var location = ""; var classes = []; for (var i = 0; i < e.target.classList.length; i++) { var cls = e.target.classList[i]; classes.push(cls); } if (findClass(classes, "menu-title")) { location = "Header Menu"; } else if ( findClass(classes, "submenu-title") || getParents(e.target, "sub-menu") ) { location = "Mega Menu"; } else if (getParents(e.target, "footer")) { location = "Footer Menu"; } else { location = "Page Body"; } if (findClass(classes, "cta")) { DataLayer.push({ event: "ctaInteraction", cta: { location: location, category: category, text: text, }, }); } else { DataLayer.push({ event: "linkInteraction", link: { location: location, category: category, text: text, }, }); } e.stopPropagation(); }); } }, formInteraction: function (element) { if (element && element.length > 0) { var elementDom = document.querySelector(element); if (!elementDom || elementDom.length == 0) return; var name = elementDom.getAttribute("data-ga4-form"); if (name == null || name.length == 0) return; name = name.replace(/^\s+|\s+$/g, ""); if (this.forms.includes(name)) return; this.forms.push(name); var inputs = document.querySelectorAll(element + " input"); if (inputs && inputs.length > 0) { for (var i = 0; i < inputs.length; i++) { var current = inputs[i]; var notUsedTypes = ["file"]; if (notUsedTypes.includes(current.type)) continue; current.addEventListener("change", function (e) { var label = e.target.getAttribute("data-ga4-label"); var value = e.target.getAttribute("data-ga4-pii") != null ? e.target.value : "redacted"; DataLayer.push({ event: "formInteraction", form: { action: "updated", name: name, fieldQuestion: label, fieldAnswer: e.target.value.length == 0 ? "" : value, }, }); }); } } var textarea = document.querySelector(element + " textarea"); if (textarea) { textarea.addEventListener("change", function (e) { var label = e.target.getAttribute("data-ga4-label"); var value = e.target.getAttribute("data-ga4-pii") != null ? e.target.value : "redacted"; DataLayer.push({ event: "formInteraction", form: { action: "updated", name: name, fieldQuestion: label, fieldAnswer: e.target.value.length == 0 ? "" : value, }, }); }); } } }, submitForm: function (element) { var name = document.querySelector(element).getAttribute("data-ga4-form"); if (!name && name.length == 0) return; name = name.replace(/^\s+|\s+$/g, ""); DataLayer.push({ event: "formInteraction", form: { action: "submitted", name: name, }, }); }, errorShown: function (type, text) { if (!type) type = "form field"; if (!text) text = ""; DataLayer.push({ event: "errorShown", error: { type: type, text: text, }, }); }, bookAppointmentStepChange: function (stepNumber, stepName, storeLocation) { if (!stepNumber) stepNumber = ""; if (!stepName) stepName = ""; if (!storeLocation) storeLocation = ""; DataLayer.push({ event: "bookAppointmentStepChange", bookAppointment: { stepNumber: stepNumber, stepName: stepName, storeLocation: storeLocation, }, }); }, productListingFilterInteraction: function ( category, selectedOptions, action ) { DataLayer.push({ event: "productListingFilterInteraction", productListFilter: { category: category, selectedOptions: selectedOptions, action: action, }, }); }, productCartObject: function ( event, items, shippingOption, paymentType, orderId, orderPrice ) { try { if (!event) { event = ""; } if (!items) { items = []; } if (!shippingOption) { shippingOption = ""; } if (!paymentType) { paymentType = ""; } if (!orderId) { orderId = ""; } var itemsArr = []; items.forEach(function (item) { var diamonds = null; if (item.diamonds && item.diamonds.length > 0) { diamonds = item.diamonds .map(function (d) { d.code; }) .join(", "); } var itemFound = itemsArr.find(function (i) { var itemDiamonds = null; if (i.diamonds && i.diamonds.length > 0) { itemDiamonds = i.diamonds .map(function (d) { d.code; }) .join(", "); } if (i.itemId === item.itemId && diamonds === itemDiamonds) { return true; } }); if (itemFound) { itemFound.quantity += 1; } else { item.quantity = 1; itemsArr.push(item); } }); var product = itemsArr.map(function (item, index) { var name = item.itemDescription || ""; var price = item.ItemPrice; var discount = ""; var category = item.Category || ""; var subCategory = item.SubCategory || ""; var itemType = ""; var metal = item.metalDescription || ""; if (item.diamonds && item.diamonds.length > 0) { var diamonds = item.diamonds .map(function (d) { d.code; }) .join(", "); name = name + " with " + diamonds; } if (price && price.HasDiscount) { if (price.SettingDiscountInfo && price.SettingDiscountInfo.Code) discount = price.SettingDiscountInfo.Code; else if (price.ItemDiscountInfo && price.ItemDiscountInfo.Code) discount = price.ItemDiscountInfo.Code; } if (item.IsEarring) itemType = "Earring"; else if (item.IsNecklace) itemType = "Necklace"; else itemType = "Ring"; return { id: item.itemId, name: name, brand: "77Diamonds", price: price && price.TotalPrice ? price.TotalPrice.FinalPrice.NumericPrice.WithVat : "", quantity: item.quantity, index: index.toString(), promotionName: "", discount: discount, affiliation: "", itemListName: category, categories: [itemType, category, subCategory], variant: [metal], }; }); var layerData = { event: event, product: product, }; if (event == "addShippingInfo" || event == "addPaymentInfo") { layerData.checkout = { shippingOption: shippingOption, paymentType: paymentType, }; } else if (event == "purchaseComplete") { var id = orderId || ""; var value = ""; var tax = ""; var shipping = "0.00"; var coupon = ""; if (orderPrice) { if (orderPrice.TotalPrice) { value = parseFloat( orderPrice.TotalPrice.FinalPrice.NumericPrice.WithVat ).toFixed(2); tax = parseFloat( orderPrice.TotalPrice.FinalPrice.NumericPrice.Vat ).toFixed(2); } if (orderPrice.HasDiscount && orderPrice.OrderDiscountInfo) coupon = price.OrderDiscountInfo.Code; } layerData.transaction = { id: id, value: value, tax: tax, shipping: shipping, coupon: coupon, paymentType: paymentType, }; } DataLayer.push(layerData); } catch (error) { console.log(error); } }, }; function getParents(elem, className) { var parents = []; while (elem.parentNode && elem.parentNode.nodeName.toLowerCase() != "body") { elem = elem.parentNode; if (elem.className && elem.className.length > 0) { parents.push(elem.className.trim()); } } return findClass(parents, className); } function findClass(classes, className) { var match = classes.find(function (singleClass) { return singleClass.indexOf(className) > -1; }); return match; } ; window.WebsiteService = { Ajax: function(method, data, success, error) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "/WebService.asmx/" + method, dataType: "json", data: JSON.stringify(data), success: function(result) { success(result.d); }, error: function (jqXhr, textStatus, errorThrown) { if (textStatus !== "abort") { if (textStatus === "error" && method !== "DebugLogRequests") { var log = "data: " + JSON.stringify(data) + ";jqXHR: " + jqXhr.responseText; window.WebsiteService.Ajax("DebugLogRequests", { endpoint: method, log: log }, function(response){}, function(error){}); } error(textStatus); } } }); } } ; var _77T = { elems: null, init: function (json) { try { this.elems = JSON.parse(json); } catch (err) { console.error(err.message); } }, L: function (url) { if (this.elems != null && this.elems.Urls[url] != undefined) { return decodeURIComponent(this.elems.Urls[url]); } else { return decodeURIComponent(url); } }, T: function (code, en) { en = typeof en !== 'undefined' ? en : ""; if (this.elems != null && this.elems.Translations[code] != undefined) { return this.elems.Translations[code]; } else if (this.elems != null && this.elems.CommonTranslations[code] != undefined) { return this.elems.CommonTranslations[code]; } else { return en; } }, TS: function (code, en) { en = typeof en !== 'undefined' ? en : ""; this.T(code, en).replace(/<(?:.|\n)*?>/gm, ''); } } _77T.init(_77Translation);; var _77B = { elems: null, init: function (json) { try { this.elems = JSON.parse(json); } catch (err) { console.error(err.message); } }, Get: function (pageId) { if (this.elems != null) { return this.elems.find(p => p.PageId === pageId); } } } _77B.init(_77BreadCrumbs);; //// Add new prototype, same as split, but returns empty array if first is null or empty //String.prototype.splitPlus = function (sep) { // var a = this.split(sep) // if (a[0] == '' && a.length == 1) return []; // return a; //}; //// Avoid `console` errors in browsers that lack a console. //(function () { // var method; // var noop = function noop() { }; // var methods = [ // 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', // 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', // 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', // 'timeStamp', 'trace', 'warn' // ]; // var length = methods.length; // var console = (window.console = window.console || {}); // while (length--) { // method = methods[length]; // // Only stub undefined methods. // if (!console[method]) { // console[method] = noop; // } // } //}()); //// place any jQuery/helper plugins in here, instead of separate, slower script files. ///*//////////// INDEX ////////////*/ ///* // * What have we used / added in here... // * 1. jquery easing 1.3 // * 2. bootstrap transition v2.2.1 // * 3. bootstrap collapse v2.2.1 // * 4. dropdown // * 5. jquery cycle 3.0.3 // * 6. ui tools 1.2.5 // * 7. mousewheel 3.0.6 // * 8. touch swipe 1.3.3 // * 9. caroufredsel 6.2.1 // * 10. imagesLoaded v3.1.8 // * 11. BxSlider v4.0 // * 12. Flowplayer Commercial v5.5.2 // * 13. fancybox 2.1.5 // * 14. cookie v1.4.0 // * 15. timepicker 1.5.1 // * 16. bootstrap datepicker // * 17. Sticky-kit v1.1.1 // * 18. throttle / debounce // * 19. jquery.validationEngine-en.js // * 20. jquery.validationEngine.js // * 21. flowplayer-3.2.4.min.js // * 22. flowplayer.ipad-3.2.12.min.js // * 23. alertify.min.js // * 25. slick slider //*/ ///* // * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ // * Copyright (c) 2008 George McGinley Smith and (c) 2001 Robert Penner // * Open source under the BSD License. (http://www.opensource.org/licenses/bsd-license.php) //*/ //jQuery.easing.jswing = jQuery.easing.swing; jQuery.extend(jQuery.easing, { def: "easeOutQuad", swing: function (e, f, a, h, g) { return jQuery.easing[jQuery.easing.def](e, f, a, h, g) }, easeInQuad: function (e, f, a, h, g) { return h * (f /= g) * f + a }, easeOutQuad: function (e, f, a, h, g) { return -h * (f /= g) * (f - 2) + a }, easeInOutQuad: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f + a } return -h / 2 * ((--f) * (f - 2) - 1) + a }, easeInCubic: function (e, f, a, h, g) { return h * (f /= g) * f * f + a }, easeOutCubic: function (e, f, a, h, g) { return h * ((f = f / g - 1) * f * f + 1) + a }, easeInOutCubic: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f + a } return h / 2 * ((f -= 2) * f * f + 2) + a }, easeInQuart: function (e, f, a, h, g) { return h * (f /= g) * f * f * f + a }, easeOutQuart: function (e, f, a, h, g) { return -h * ((f = f / g - 1) * f * f * f - 1) + a }, easeInOutQuart: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f * f + a } return -h / 2 * ((f -= 2) * f * f * f - 2) + a }, easeInQuint: function (e, f, a, h, g) { return h * (f /= g) * f * f * f * f + a }, easeOutQuint: function (e, f, a, h, g) { return h * ((f = f / g - 1) * f * f * f * f + 1) + a }, easeInOutQuint: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f * f * f + a } return h / 2 * ((f -= 2) * f * f * f * f + 2) + a }, easeInSine: function (e, f, a, h, g) { return -h * Math.cos(f / g * (Math.PI / 2)) + h + a }, easeOutSine: function (e, f, a, h, g) { return h * Math.sin(f / g * (Math.PI / 2)) + a }, easeInOutSine: function (e, f, a, h, g) { return -h / 2 * (Math.cos(Math.PI * f / g) - 1) + a }, easeInExpo: function (e, f, a, h, g) { return (f == 0) ? a : h * Math.pow(2, 10 * (f / g - 1)) + a }, easeOutExpo: function (e, f, a, h, g) { return (f == g) ? a + h : h * (-Math.pow(2, -10 * f / g) + 1) + a }, easeInOutExpo: function (e, f, a, h, g) { if (f == 0) { return a } if (f == g) { return a + h } if ((f /= g / 2) < 1) { return h / 2 * Math.pow(2, 10 * (f - 1)) + a } return h / 2 * (-Math.pow(2, -10 * --f) + 2) + a }, easeInCirc: function (e, f, a, h, g) { return -h * (Math.sqrt(1 - (f /= g) * f) - 1) + a }, easeOutCirc: function (e, f, a, h, g) { return h * Math.sqrt(1 - (f = f / g - 1) * f) + a }, easeInOutCirc: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return -h / 2 * (Math.sqrt(1 - f * f) - 1) + a } return h / 2 * (Math.sqrt(1 - (f -= 2) * f) + 1) + a }, easeInElastic: function (f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k) == 1) { return e + l } if (!j) { j = k * 0.3 } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } return -(g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e }, easeOutElastic: function (f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k) == 1) { return e + l } if (!j) { j = k * 0.3 } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } return g * Math.pow(2, -10 * h) * Math.sin((h * k - i) * (2 * Math.PI) / j) + l + e }, easeInOutElastic: function (f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k / 2) == 2) { return e + l } if (!j) { j = k * (0.3 * 1.5) } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } if (h < 1) { return -0.5 * (g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e } return g * Math.pow(2, -10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j) * 0.5 + l + e }, easeInBack: function (e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } return i * (f /= h) * f * ((g + 1) * f - g) + a }, easeOutBack: function (e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } return i * ((f = f / h - 1) * f * ((g + 1) * f + g) + 1) + a }, easeInOutBack: function (e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } if ((f /= h / 2) < 1) { return i / 2 * (f * f * (((g *= (1.525)) + 1) * f - g)) + a } return i / 2 * ((f -= 2) * f * (((g *= (1.525)) + 1) * f + g) + 2) + a }, easeInBounce: function (e, f, a, h, g) { return h - jQuery.easing.easeOutBounce(e, g - f, 0, h, g) + a }, easeOutBounce: function (e, f, a, h, g) { if ((f /= g) < (1 / 2.75)) { return h * (7.5625 * f * f) + a } else { if (f < (2 / 2.75)) { return h * (7.5625 * (f -= (1.5 / 2.75)) * f + 0.75) + a } else { if (f < (2.5 / 2.75)) { return h * (7.5625 * (f -= (2.25 / 2.75)) * f + 0.9375) + a } else { return h * (7.5625 * (f -= (2.625 / 2.75)) * f + 0.984375) + a } } } }, easeInOutBounce: function (e, f, a, h, g) { if (f < g / 2) { return jQuery.easing.easeInBounce(e, f * 2, 0, h, g) * 0.5 + a } return jQuery.easing.easeOutBounce(e, f * 2 - g, 0, h, g) * 0.5 + h * 0.5 + a } }); /* =================================================== * bootstrap-transition.js v2.2.1 * http://twitter.github.com/bootstrap/javascript.html#transitions * =================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) * ======================================================= */ $(function () { $.support.transition = (function () { var transitionEnd = (function () { var el = document.createElement('bootstrap') , transEndEventNames = { 'WebkitTransition': 'webkitTransitionEnd' , 'MozTransition': 'transitionend' , 'OTransition': 'oTransitionEnd otransitionend' , 'transition': 'transitionend' } , name for (name in transEndEventNames) { if (el.style[name] !== undefined) { return transEndEventNames[name] } } }()) return transitionEnd && { end: transitionEnd } })() }) }(window.jQuery); /* ============================================================= * bootstrap-collapse.js v2.2.1 * http://twitter.github.com/bootstrap/javascript.html#collapse * ============================================================= * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* COLLAPSE PUBLIC CLASS DEFINITION * ================================ */ var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.collapse.defaults, options) if (this.options.parent) { this.$parent = $(this.options.parent) } this.options.toggle && this.toggle() } Collapse.prototype = { constructor: Collapse , dimension: function () { var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } , show: function () { var dimension , scroll , actives , hasData if (this.transitioning) return dimension = this.dimension() scroll = $.camelCase(['scroll', dimension].join('-')) actives = this.$parent && this.$parent.find('> .accordion-group > .in') if (actives && actives.length) { hasData = actives.data('collapse') if (hasData && hasData.transitioning) return actives.collapse('hide') hasData || actives.data('collapse', null) } this.$element[dimension](0) this.transition('addClass', $.Event('show'), 'shown') $.support.transition && this.$element[dimension](this.$element[0][scroll]) } , hide: function () { var dimension if (this.transitioning) return dimension = this.dimension() this.reset(this.$element[dimension]()) this.transition('removeClass', $.Event('hide'), 'hidden') this.$element[dimension](0) } , reset: function (size) { var dimension = this.dimension() this.$element .removeClass('collapse') [dimension](size || 'auto') [0].offsetWidth this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') return this } , transition: function (method, startEvent, completeEvent) { var that = this , complete = function () { if (startEvent.type == 'show') that.reset() that.transitioning = 0 that.$element.trigger(completeEvent) } this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return this.transitioning = 1 this.$element[method]('in') $.support.transition && this.$element.hasClass('collapse') ? this.$element.one($.support.transition.end, complete) : complete() } , toggle: function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() } } /* COLLAPSIBLE PLUGIN DEFINITION * ============================== */ $.fn.collapse = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('collapse') , options = typeof option == 'object' && option if (!data) $this.data('collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.collapse.defaults = { toggle: true } $.fn.collapse.Constructor = Collapse /* COLLAPSIBLE DATA-API * ==================== */ $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { var $this = $(this), href , target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 , option = $(target).data('collapse') ? 'toggle' : $this.data() $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') $(target).collapse(option) }) }(window.jQuery); /* * jQuery dropdown: A simple dropdown plugin * * Copyright 2013 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/) * * Licensed under the MIT license: http://opensource.org/licenses/MIT * */ if (jQuery) (function ($) { $.extend($.fn, { dropdown: function (method, data) { switch (method) { case 'show': show(null, $(this)); return $(this); case 'hide': hide(); return $(this); case 'attach': return $(this).attr('data-dropdown', data); case 'detach': hide(); return $(this).removeAttr('data-dropdown'); case 'disable': return $(this).addClass('dropdown-disabled'); case 'enable': hide(); return $(this).removeClass('dropdown-disabled'); } } }); function show(event, object) { var trigger = event ? $(this) : object, dropdown = trigger.children($(trigger.attr('data-dropdown'))), isOpen = trigger.hasClass('dropdown-open'); // In some cases we don't want to show it if (event) { if ($(event.target).hasClass('dropdown-ignore') || $(event.target).closest('.dropdown-ignore').length) return; event.preventDefault(); event.stopPropagation(); } else { if (trigger !== object.target && $(object.target).hasClass('dropdown-ignore')) return; } hide(event); if (isOpen || trigger.hasClass('dropdown-disabled')) return; // Show it $(trigger.target).addClass('dropdown-open'); dropdown .data('dropdown-trigger', trigger) .show(); // Position it position(); // Trigger the show callback dropdown .trigger('show', { dropdown: dropdown, trigger: trigger }); } function hide(event) { // In some cases we don't hide them var targetGroup = event ? $(event.target).parents().addBack() : null; // Are we clicking anywhere in a dropdown? if (targetGroup && targetGroup.is('.dropdown')) { // Is it a dropdown menu? if (targetGroup.is('.dropdown-menu')) { // Did we click on an option? If so close it. if (!targetGroup.is('A')) return; } else { // Nope, it's a panel. Leave it open. return; } } // Hide any dropdown that may be showing $(document).find('.dropdown:visible').each(function () { var dropdown = $(this); dropdown .hide() .removeData('dropdown-trigger') .trigger('hide', { dropdown: dropdown }); //special case - country dropdown - must change the arrow if (dropdown.attr('id') == 'divHeaderItem2') HideLanguageBox(); }); // Remove all dropdown-open classes $(document).find('.dropdown-open').removeClass('dropdown-open'); } function position() { var dropdown = $('.dropdown:visible').eq(0); if (dropdown.data('static') !== undefined) return; var trigger = dropdown.data('dropdown-trigger'), hOffset = trigger ? parseInt(trigger.attr('data-horizontal-offset') || 0, 10) : null, vOffset = trigger ? parseInt(trigger.attr('data-vertical-offset') || 0, 10) : null; if (dropdown.length === 0 || !trigger) return; // Position the dropdown relative-to-parent... if (dropdown.hasClass('dropdown-relative')) { dropdown.css({ left: dropdown.hasClass('dropdown-anchor-right') ? trigger.position().left - (dropdown.outerWidth(true) - trigger.outerWidth(true)) - parseInt(trigger.css('margin-right'), 10) + hOffset : trigger.position().left + parseInt(trigger.css('margin-left'), 10) + hOffset, top: trigger.position().top + trigger.outerHeight(true) - parseInt(trigger.css('margin-top'), 10) + vOffset }); } else { // ...or relative to document dropdown.css({ left: dropdown.hasClass('dropdown-anchor-right') ? trigger.offset().left - (dropdown.outerWidth() - trigger.outerWidth()) + hOffset : trigger.offset().left + hOffset, top: trigger.offset().top + trigger.outerHeight() + vOffset }); } } $(document).on('click.dropdown', '[data-dropdown]', show); $(document).on('click.dropdown', hide); $(window).on('resize', position); })(jQuery); ///*! // * jQuery Cycle Plugin (with Transition Definitions) // * Examples and documentation at: http://jquery.malsup.com/cycle/ // * Copyright (c) 2007-2013 M. Alsup // * Version: 3.0.3 (11-JUL-2013) // * Dual licensed under the MIT and GPL licenses. // * http://jquery.malsup.com/license.html // * Requires: jQuery v1.7.1 or later // */ //; (function ($, undefined) { // "use strict"; // var ver = '3.0.3'; // function debug(s) { // if ($.fn.cycle.debug) // log(s); // } // function log() { // /*global console */ // if (window.console && console.log) // console.log('[cycle] ' + Array.prototype.join.call(arguments, ' ')); // } // $.expr[':'].paused = function (el) { // return el.cyclePause; // }; // // the options arg can be... // // a number - indicates an immediate transition should occur to the given slide index // // a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc) // // an object - properties to control the slideshow // // // // the arg2 arg can be... // // the name of an fx (only used in conjunction with a numeric value for 'options') // // the value true (only used in first arg == 'resume') and indicates // // that the resume should occur immediately (not wait for next timeout) // $.fn.cycle = function (options, arg2) { // var o = { s: this.selector, c: this.context }; // // in 1.3+ we can fix mistakes with the ready state // if (this.length === 0 && options != 'stop') { // if (!$.isReady && o.s) { // log('DOM not ready, queuing slideshow'); // $(function () { // $(o.s, o.c).cycle(options, arg2); // }); // return this; // } // // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() // log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); // return this; // } // // iterate the matched nodeset // return this.each(function () { // var opts = handleArguments(this, options, arg2); // if (opts === false) // return; // opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink; // // stop existing slideshow for this container (if there is one) // if (this.cycleTimeout) // clearTimeout(this.cycleTimeout); // this.cycleTimeout = this.cyclePause = 0; // this.cycleStop = 0; // issue #108 // var $cont = $(this); // var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children(); // var els = $slides.get(); // if (els.length < 2) { // log('terminating; too few slides: ' + els.length); // return; // } // var opts2 = buildOptions($cont, $slides, els, opts, o); // if (opts2 === false) // return; // var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards); // // if it's an auto slideshow, kick it off // if (startTime) { // startTime += (opts2.delay || 0); // if (startTime < 10) // startTime = 10; // debug('first timeout: ' + startTime); // this.cycleTimeout = setTimeout(function () { go(els, opts2, 0, !opts.backwards); }, startTime); // } // }); // }; // function triggerPause(cont, byHover, onPager) { // var opts = $(cont).data('cycle.opts'); // if (!opts) // return; // var paused = !!cont.cyclePause; // if (paused && opts.paused) // opts.paused(cont, opts, byHover, onPager); // else if (!paused && opts.resumed) // opts.resumed(cont, opts, byHover, onPager); // } // // process the args that were passed to the plugin fn // function handleArguments(cont, options, arg2) { // if (cont.cycleStop === undefined) // cont.cycleStop = 0; // if (options === undefined || options === null) // options = {}; // if (options.constructor == String) { // switch (options) { // case 'destroy': // case 'stop': // var opts = $(cont).data('cycle.opts'); // if (!opts) // return false; // cont.cycleStop++; // callbacks look for change // if (cont.cycleTimeout) // clearTimeout(cont.cycleTimeout); // cont.cycleTimeout = 0; // if (opts.elements) // $(opts.elements).stop(); // $(cont).removeData('cycle.opts'); // if (options == 'destroy') // destroy(cont, opts); // return false; // case 'toggle': // cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1; // checkInstantResume(cont.cyclePause, arg2, cont); // triggerPause(cont); // return false; // case 'pause': // cont.cyclePause = 1; // triggerPause(cont); // return false; // case 'resume': // cont.cyclePause = 0; // checkInstantResume(false, arg2, cont); // triggerPause(cont); // return false; // case 'prev': // case 'next': // opts = $(cont).data('cycle.opts'); // if (!opts) { // log('options not found, "prev/next" ignored'); // return false; // } // if (typeof arg2 == 'string') // opts.oneTimeFx = arg2; // $.fn.cycle[options](opts); // return false; // default: // options = { fx: options }; // } // return options; // } // else if (options.constructor == Number) { // // go to the requested slide // var num = options; // options = $(cont).data('cycle.opts'); // if (!options) { // log('options not found, can not advance slide'); // return false; // } // if (num < 0 || num >= options.elements.length) { // log('invalid slide index: ' + num); // return false; // } // options.nextSlide = num; // if (cont.cycleTimeout) { // clearTimeout(cont.cycleTimeout); // cont.cycleTimeout = 0; // } // if (typeof arg2 == 'string') // options.oneTimeFx = arg2; // go(options.elements, options, 1, num >= options.currSlide); // return false; // } // return options; // function checkInstantResume(isPaused, arg2, cont) { // if (!isPaused && arg2 === true) { // resume now! // var options = $(cont).data('cycle.opts'); // if (!options) { // log('options not found, can not resume'); // return false; // } // if (cont.cycleTimeout) { // clearTimeout(cont.cycleTimeout); // cont.cycleTimeout = 0; // } // go(options.elements, options, 1, !options.backwards); // } // } // } // function removeFilter(el, opts) { // if (!$.support.opacity && opts.cleartype && el.style.filter) { // try { el.style.removeAttribute('filter'); } // catch (smother) { } // handle old opera versions // } // } // // unbind event handlers // function destroy(cont, opts) { // if (opts.next) // $(opts.next).unbind(opts.prevNextEvent); // if (opts.prev) // $(opts.prev).unbind(opts.prevNextEvent); // if (opts.pager || opts.pagerAnchorBuilder) // $.each(opts.pagerAnchors || [], function () { // this.unbind().remove(); // }); // opts.pagerAnchors = null; // $(cont).unbind('mouseenter.cycle mouseleave.cycle'); // if (opts.destroy) // callback // opts.destroy(opts); // } // // one-time initialization // function buildOptions($cont, $slides, els, options, o) { // var startingSlideSpecified; // // support metadata plugin (v1.0 and v2.0) // var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); // var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null; // if (meta) // opts = $.extend(opts, meta); // if (opts.autostop) // opts.countdown = opts.autostopCount || els.length; // var cont = $cont[0]; // $cont.data('cycle.opts', opts); // opts.$cont = $cont; // opts.stopCount = cont.cycleStop; // opts.elements = els; // opts.before = opts.before ? [opts.before] : []; // opts.after = opts.after ? [opts.after] : []; // // push some after callbacks // if (!$.support.opacity && opts.cleartype) // opts.after.push(function () { removeFilter(this, opts); }); // if (opts.continuous) // opts.after.push(function () { go(els, opts, 0, !opts.backwards); }); // saveOriginalOpts(opts); // // clearType corrections // if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) // clearTypeFix($slides); // // container requires non-static position so that slides can be position within // if ($cont.css('position') == 'static') // $cont.css('position', 'relative'); // if (opts.width) // $cont.width(opts.width); // if (opts.height && opts.height != 'auto') // $cont.height(opts.height); // if (opts.startingSlide !== undefined) { // opts.startingSlide = parseInt(opts.startingSlide, 10); // if (opts.startingSlide >= els.length || opts.startSlide < 0) // opts.startingSlide = 0; // catch bogus input // else // startingSlideSpecified = true; // } // else if (opts.backwards) // opts.startingSlide = els.length - 1; // else // opts.startingSlide = 0; // // if random, mix up the slide array // if (opts.random) { // opts.randomMap = []; // for (var i = 0; i < els.length; i++) // opts.randomMap.push(i); // opts.randomMap.sort(function (a, b) { return Math.random() - 0.5; }); // if (startingSlideSpecified) { // // try to find the specified starting slide and if found set start slide index in the map accordingly // for (var cnt = 0; cnt < els.length; cnt++) { // if (opts.startingSlide == opts.randomMap[cnt]) { // opts.randomIndex = cnt; // } // } // } // else { // opts.randomIndex = 1; // opts.startingSlide = opts.randomMap[1]; // } // } // else if (opts.startingSlide >= els.length) // opts.startingSlide = 0; // catch bogus input // opts.currSlide = opts.startingSlide || 0; // var first = opts.startingSlide; // // set position and zIndex on all the slides // $slides.css({ position: 'absolute', top: 0, left: 0 }).hide().each(function (i) { // var z; // if (opts.backwards) // z = first ? i <= first ? els.length + (i - first) : first - i : els.length - i; // else // z = first ? i >= first ? els.length - (i - first) : first - i : els.length - i; // $(this).css('z-index', z); // }); // // make sure first slide is visible // $(els[first]).css('opacity', 1).show(); // opacity bit needed to handle restart use case // removeFilter(els[first], opts); // // stretch slides // if (opts.fit) { // if (!opts.aspect) { // if (opts.width) // $slides.width(opts.width); // if (opts.height && opts.height != 'auto') // $slides.height(opts.height); // } else { // $slides.each(function () { // var $slide = $(this); // var ratio = (opts.aspect === true) ? $slide.width() / $slide.height() : opts.aspect; // if (opts.width && $slide.width() != opts.width) { // $slide.width(opts.width); // $slide.height(opts.width / ratio); // } // if (opts.height && $slide.height() < opts.height) { // $slide.height(opts.height); // $slide.width(opts.height * ratio); // } // }); // } // } // if (opts.center && ((!opts.fit) || opts.aspect)) { // $slides.each(function () { // var $slide = $(this); // $slide.css({ // "margin-left": opts.width ? // ((opts.width - $slide.width()) / 2) + "px" : // 0, // "margin-top": opts.height ? // ((opts.height - $slide.height()) / 2) + "px" : // 0 // }); // }); // } // if (opts.center && !opts.fit && !opts.slideResize) { // $slides.each(function () { // var $slide = $(this); // $slide.css({ // "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0, // "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0 // }); // }); // } // // stretch container // var reshape = (opts.containerResize || opts.containerResizeHeight) && $cont.innerHeight() < 1; // if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9 // var maxw = 0, maxh = 0; // for (var j = 0; j < els.length; j++) { // var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight(); // if (!w) w = e.offsetWidth || e.width || $e.attr('width'); // if (!h) h = e.offsetHeight || e.height || $e.attr('height'); // maxw = w > maxw ? w : maxw; // maxh = h > maxh ? h : maxh; // } // if (opts.containerResize && maxw > 0 && maxh > 0) // $cont.css({ width: maxw + 'px', height: maxh + 'px' }); // if (opts.containerResizeHeight && maxh > 0) // $cont.css({ height: maxh + 'px' }); // } // var pauseFlag = false; // https://github.com/malsup/cycle/issues/44 // if (opts.pause) // $cont.bind('mouseenter.cycle', function () { // pauseFlag = true; // this.cyclePause++; // triggerPause(cont, true); // }).bind('mouseleave.cycle', function () { // if (pauseFlag) // this.cyclePause--; // triggerPause(cont, true); // }); // if (supportMultiTransitions(opts) === false) // return false; // // apparently a lot of people use image slideshows without height/width attributes on the images. // // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that. // var requeue = false; // options.requeueAttempts = options.requeueAttempts || 0; // $slides.each(function () { // // try to get height/width of each slide // var $el = $(this); // this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0); // this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0); // if ($el.is('img')) { // var loading = (this.cycleH === 0 && this.cycleW === 0 && !this.complete); // // don't requeue for images that are still loading but have a valid size // if (loading) { // if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever // log(options.requeueAttempts, ' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH); // setTimeout(function () { $(o.s, o.c).cycle(options); }, opts.requeueTimeout); // requeue = true; // return false; // break each loop // } // else { // log('could not determine size of image: ' + this.src, this.cycleW, this.cycleH); // } // } // } // return true; // }); // if (requeue) // return false; // opts.cssBefore = opts.cssBefore || {}; // opts.cssAfter = opts.cssAfter || {}; // opts.cssFirst = opts.cssFirst || {}; // opts.animIn = opts.animIn || {}; // opts.animOut = opts.animOut || {}; // $slides.not(':eq(' + first + ')').css(opts.cssBefore); // $($slides[first]).css(opts.cssFirst); // if (opts.timeout) { // opts.timeout = parseInt(opts.timeout, 10); // // ensure that timeout and speed settings are sane // if (opts.speed.constructor == String) // opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed, 10); // if (!opts.sync) // opts.speed = opts.speed / 2; // var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250; // while ((opts.timeout - opts.speed) < buffer) // sanitize timeout // opts.timeout += opts.speed; // } // if (opts.easing) // opts.easeIn = opts.easeOut = opts.easing; // if (!opts.speedIn) // opts.speedIn = opts.speed; // if (!opts.speedOut) // opts.speedOut = opts.speed; // opts.slideCount = els.length; // opts.currSlide = opts.lastSlide = first; // if (opts.random) { // if (++opts.randomIndex == els.length) // opts.randomIndex = 0; // opts.nextSlide = opts.randomMap[opts.randomIndex]; // } // else if (opts.backwards) // opts.nextSlide = opts.startingSlide === 0 ? (els.length - 1) : opts.startingSlide - 1; // else // opts.nextSlide = opts.startingSlide >= (els.length - 1) ? 0 : opts.startingSlide + 1; // // run transition init fn // if (!opts.multiFx) { // var init = $.fn.cycle.transitions[opts.fx]; // if ($.isFunction(init)) // init($cont, $slides, opts); // else if (opts.fx != 'custom' && !opts.multiFx) { // log('unknown transition: ' + opts.fx, '; slideshow terminating'); // return false; // } // } // // fire artificial events // var e0 = $slides[first]; // if (!opts.skipInitializationCallbacks) { // if (opts.before.length) // opts.before[0].apply(e0, [e0, e0, opts, true]); // if (opts.after.length) // opts.after[0].apply(e0, [e0, e0, opts, true]); // } // if (opts.next) // $(opts.next).bind(opts.prevNextEvent, function () { return advance(opts, 1); }); // if (opts.prev) // $(opts.prev).bind(opts.prevNextEvent, function () { return advance(opts, 0); }); // if (opts.pager || opts.pagerAnchorBuilder) // buildPager(els, opts); // exposeAddSlide(opts, els); // return opts; // } // // save off original opts so we can restore after clearing state // function saveOriginalOpts(opts) { // opts.original = { before: [], after: [] }; // opts.original.cssBefore = $.extend({}, opts.cssBefore); // opts.original.cssAfter = $.extend({}, opts.cssAfter); // opts.original.animIn = $.extend({}, opts.animIn); // opts.original.animOut = $.extend({}, opts.animOut); // $.each(opts.before, function () { opts.original.before.push(this); }); // $.each(opts.after, function () { opts.original.after.push(this); }); // } // function supportMultiTransitions(opts) { // var i, tx, txs = $.fn.cycle.transitions; // // look for multiple effects // if (opts.fx.indexOf(',') > 0) { // opts.multiFx = true; // opts.fxs = opts.fx.replace(/\s*/g, '').split(','); // // discard any bogus effect names // for (i = 0; i < opts.fxs.length; i++) { // var fx = opts.fxs[i]; // tx = txs[fx]; // if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) { // log('discarding unknown transition: ', fx); // opts.fxs.splice(i, 1); // i--; // } // } // // if we have an empty list then we threw everything away! // if (!opts.fxs.length) { // log('No valid transitions named; slideshow terminating.'); // return false; // } // } // else if (opts.fx == 'all') { // auto-gen the list of transitions // opts.multiFx = true; // opts.fxs = []; // for (var p in txs) { // if (txs.hasOwnProperty(p)) { // tx = txs[p]; // if (txs.hasOwnProperty(p) && $.isFunction(tx)) // opts.fxs.push(p); // } // } // } // if (opts.multiFx && opts.randomizeEffects) { // // munge the fxs array to make effect selection random // var r1 = Math.floor(Math.random() * 20) + 30; // for (i = 0; i < r1; i++) { // var r2 = Math.floor(Math.random() * opts.fxs.length); // opts.fxs.push(opts.fxs.splice(r2, 1)[0]); // } // debug('randomized fx sequence: ', opts.fxs); // } // return true; // } // // provide a mechanism for adding slides after the slideshow has started // function exposeAddSlide(opts, els) { // opts.addSlide = function (newSlide, prepend) { // var $s = $(newSlide), s = $s[0]; // if (!opts.autostopCount) // opts.countdown++; // els[prepend ? 'unshift' : 'push'](s); // if (opts.els) // opts.els[prepend ? 'unshift' : 'push'](s); // shuffle needs this // opts.slideCount = els.length; // // add the slide to the random map and resort // if (opts.random) { // opts.randomMap.push(opts.slideCount - 1); // opts.randomMap.sort(function (a, b) { return Math.random() - 0.5; }); // } // $s.css('position', 'absolute'); // $s[prepend ? 'prependTo' : 'appendTo'](opts.$cont); // if (prepend) { // opts.currSlide++; // opts.nextSlide++; // } // if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) // clearTypeFix($s); // if (opts.fit && opts.width) // $s.width(opts.width); // if (opts.fit && opts.height && opts.height != 'auto') // $s.height(opts.height); // s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height(); // s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width(); // $s.css(opts.cssBefore); // if (opts.pager || opts.pagerAnchorBuilder) // $.fn.cycle.createPagerAnchor(els.length - 1, s, $(opts.pager), els, opts); // if ($.isFunction(opts.onAddSlide)) // opts.onAddSlide($s); // else // $s.hide(); // default behavior // }; // } // // reset internal state; we do this on every pass in order to support multiple effects // $.fn.cycle.resetState = function (opts, fx) { // fx = fx || opts.fx; // opts.before = []; opts.after = []; // opts.cssBefore = $.extend({}, opts.original.cssBefore); // opts.cssAfter = $.extend({}, opts.original.cssAfter); // opts.animIn = $.extend({}, opts.original.animIn); // opts.animOut = $.extend({}, opts.original.animOut); // opts.fxFn = null; // $.each(opts.original.before, function () { opts.before.push(this); }); // $.each(opts.original.after, function () { opts.after.push(this); }); // // re-init // var init = $.fn.cycle.transitions[fx]; // if ($.isFunction(init)) // init(opts.$cont, $(opts.elements), opts); // }; // // this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt // function go(els, opts, manual, fwd) { // var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide]; // // opts.busy is true if we're in the middle of an animation // if (manual && opts.busy && opts.manualTrump) { // // let manual transitions requests trump active ones // debug('manualTrump in go(), stopping active transition'); // $(els).stop(true, true); // opts.busy = 0; // clearTimeout(p.cycleTimeout); // } // // don't begin another timeout-based transition if there is one active // if (opts.busy) { // debug('transition active, ignoring new tx request'); // return; // } // // stop cycling if we have an outstanding stop request // if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual) // return; // // check to see if we should stop cycling based on autostop options // if (!manual && !p.cyclePause && !opts.bounce && // ((opts.autostop && (--opts.countdown <= 0)) || // (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) { // if (opts.end) // opts.end(opts); // return; // } // // if slideshow is paused, only transition on a manual trigger // var changed = false; // if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) { // changed = true; // var fx = opts.fx; // // keep trying to get the slide size if we don't have it yet // curr.cycleH = curr.cycleH || $(curr).height(); // curr.cycleW = curr.cycleW || $(curr).width(); // next.cycleH = next.cycleH || $(next).height(); // next.cycleW = next.cycleW || $(next).width(); // // support multiple transition types // if (opts.multiFx) { // if (fwd && (opts.lastFx === undefined || ++opts.lastFx >= opts.fxs.length)) // opts.lastFx = 0; // else if (!fwd && (opts.lastFx === undefined || --opts.lastFx < 0)) // opts.lastFx = opts.fxs.length - 1; // fx = opts.fxs[opts.lastFx]; // } // // one-time fx overrides apply to: $('div').cycle(3,'zoom'); // if (opts.oneTimeFx) { // fx = opts.oneTimeFx; // opts.oneTimeFx = null; // } // $.fn.cycle.resetState(opts, fx); // // run the before callbacks // if (opts.before.length) // $.each(opts.before, function (i, o) { // if (p.cycleStop != opts.stopCount) return; // o.apply(next, [curr, next, opts, fwd]); // }); // // stage the after callacks // var after = function () { // opts.busy = 0; // $.each(opts.after, function (i, o) { // if (p.cycleStop != opts.stopCount) return; // o.apply(next, [curr, next, opts, fwd]); // }); // if (!p.cycleStop) { // // queue next transition // queueNext(); // } // }; // debug('tx firing(' + fx + '); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide); // // get ready to perform the transition // opts.busy = 1; // if (opts.fxFn) // fx function provided? // opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent); // else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ? // $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent); // else // $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent); // } // else { // queueNext(); // } // if (changed || opts.nextSlide == opts.currSlide) { // // calculate the next slide // var roll; // opts.lastSlide = opts.currSlide; // if (opts.random) { // opts.currSlide = opts.nextSlide; // if (++opts.randomIndex == els.length) { // opts.randomIndex = 0; // opts.randomMap.sort(function (a, b) { return Math.random() - 0.5; }); // } // opts.nextSlide = opts.randomMap[opts.randomIndex]; // if (opts.nextSlide == opts.currSlide) // opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1; // } // else if (opts.backwards) { // roll = (opts.nextSlide - 1) < 0; // if (roll && opts.bounce) { // opts.backwards = !opts.backwards; // opts.nextSlide = 1; // opts.currSlide = 0; // } // else { // opts.nextSlide = roll ? (els.length - 1) : opts.nextSlide - 1; // opts.currSlide = roll ? 0 : opts.nextSlide + 1; // } // } // else { // sequence // roll = (opts.nextSlide + 1) == els.length; // if (roll && opts.bounce) { // opts.backwards = !opts.backwards; // opts.nextSlide = els.length - 2; // opts.currSlide = els.length - 1; // } // else { // opts.nextSlide = roll ? 0 : opts.nextSlide + 1; // opts.currSlide = roll ? els.length - 1 : opts.nextSlide - 1; // } // } // } // if (changed && opts.pager) // opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass); // function queueNext() { // // stage the next transition // var ms = 0, timeout = opts.timeout; // if (opts.timeout && !opts.continuous) { // ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd); // if (opts.fx == 'shuffle') // ms -= opts.speedOut; // } // else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic // ms = 10; // if (ms > 0) // p.cycleTimeout = setTimeout(function () { go(els, opts, 0, !opts.backwards); }, ms); // } // } // // invoked after transition // $.fn.cycle.updateActivePagerLink = function (pager, currSlide, clsName) { // $(pager).each(function () { // $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName); // }); // }; // // calculate timeout value for current transition // function getTimeout(curr, next, opts, fwd) { // if (opts.timeoutFn) { // // call user provided calc fn // var t = opts.timeoutFn.call(curr, curr, next, opts, fwd); // while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout // t += opts.speed; // debug('calculated timeout: ' + t + '; speed: ' + opts.speed); // if (t !== false) // return t; // } // return opts.timeout; // } // // expose next/prev function, caller must pass in state // $.fn.cycle.next = function (opts) { advance(opts, 1); }; // $.fn.cycle.prev = function (opts) { advance(opts, 0); }; // // advance slide forward or back // function advance(opts, moveForward) { // var val = moveForward ? 1 : -1; // var els = opts.elements; // var p = opts.$cont[0], timeout = p.cycleTimeout; // if (timeout) { // clearTimeout(timeout); // p.cycleTimeout = 0; // } // if (opts.random && val < 0) { // // move back to the previously display slide // opts.randomIndex--; // if (--opts.randomIndex == -2) // opts.randomIndex = els.length - 2; // else if (opts.randomIndex == -1) // opts.randomIndex = els.length - 1; // opts.nextSlide = opts.randomMap[opts.randomIndex]; // } // else if (opts.random) { // opts.nextSlide = opts.randomMap[opts.randomIndex]; // } // else { // opts.nextSlide = opts.currSlide + val; // if (opts.nextSlide < 0) { // if (opts.nowrap) return false; // opts.nextSlide = els.length - 1; // } // else if (opts.nextSlide >= els.length) { // if (opts.nowrap) return false; // opts.nextSlide = 0; // } // } // var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated // if ($.isFunction(cb)) // cb(val > 0, opts.nextSlide, els[opts.nextSlide]); // go(els, opts, 1, moveForward); // return false; // } // function buildPager(els, opts) { // var $p = $(opts.pager); // $.each(els, function (i, o) { // $.fn.cycle.createPagerAnchor(i, o, $p, els, opts); // }); // opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass); // } // $.fn.cycle.createPagerAnchor = function (i, el, $p, els, opts) { // var a; // if ($.isFunction(opts.pagerAnchorBuilder)) { // a = opts.pagerAnchorBuilder(i, el); // debug('pagerAnchorBuilder(' + i + ', el) returned: ' + a); // } // else // a = '' + (i + 1) + ''; // if (!a) // return; // var $a = $(a); // // don't reparent if anchor is in the dom // if ($a.parents('body').length === 0) { // var arr = []; // if ($p.length > 1) { // $p.each(function () { // var $clone = $a.clone(true); // $(this).append($clone); // arr.push($clone[0]); // }); // $a = $(arr); // } // else { // $a.appendTo($p); // } // } // opts.pagerAnchors = opts.pagerAnchors || []; // opts.pagerAnchors.push($a); // var pagerFn = function (e) { // e.preventDefault(); // opts.nextSlide = i; // var p = opts.$cont[0], timeout = p.cycleTimeout; // if (timeout) { // clearTimeout(timeout); // p.cycleTimeout = 0; // } // var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated // if ($.isFunction(cb)) // cb(opts.nextSlide, els[opts.nextSlide]); // go(els, opts, 1, opts.currSlide < i); // trigger the trans // // return false; // <== allow bubble // }; // if (/mouseenter|mouseover/i.test(opts.pagerEvent)) { // $a.hover(pagerFn, function () {/* no-op */ }); // } // else { // $a.bind(opts.pagerEvent, pagerFn); // } // if (! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble) // $a.bind('click.cycle', function () { return false; }); // suppress click // var cont = opts.$cont[0]; // var pauseFlag = false; // https://github.com/malsup/cycle/issues/44 // if (opts.pauseOnPagerHover) { // $a.hover( // function () { // pauseFlag = true; // cont.cyclePause++; // triggerPause(cont, true, true); // }, function () { // if (pauseFlag) // cont.cyclePause--; // triggerPause(cont, true, true); // } // ); // } // }; // // helper fn to calculate the number of slides between the current and the next // $.fn.cycle.hopsFromLast = function (opts, fwd) { // var hops, l = opts.lastSlide, c = opts.currSlide; // if (fwd) // hops = c > l ? c - l : opts.slideCount - l; // else // hops = c < l ? l - c : l + opts.slideCount - c; // return hops; // }; // // fix clearType problems in ie6 by setting an explicit bg color // // (otherwise text slides look horrible during a fade transition) // function clearTypeFix($slides) { // debug('applying clearType background-color hack'); // function hex(s) { // s = parseInt(s, 10).toString(16); // return s.length < 2 ? '0' + s : s; // } // function getBg(e) { // for (; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) { // var v = $.css(e, 'background-color'); // if (v && v.indexOf('rgb') >= 0) { // var rgb = v.match(/\d+/g); // return '#' + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); // } // if (v && v != 'transparent') // return v; // } // return '#ffffff'; // } // $slides.each(function () { $(this).css('background-color', getBg(this)); }); // } // // reset common props before the next transition // $.fn.cycle.commonReset = function (curr, next, opts, w, h, rev) { // $(opts.elements).not(curr).hide(); // if (typeof opts.cssBefore.opacity == 'undefined') // opts.cssBefore.opacity = 1; // opts.cssBefore.display = 'block'; // if (opts.slideResize && w !== false && next.cycleW > 0) // opts.cssBefore.width = next.cycleW; // if (opts.slideResize && h !== false && next.cycleH > 0) // opts.cssBefore.height = next.cycleH; // opts.cssAfter = opts.cssAfter || {}; // opts.cssAfter.display = 'none'; // $(curr).css('zIndex', opts.slideCount + (rev === true ? 1 : 0)); // $(next).css('zIndex', opts.slideCount + (rev === true ? 0 : 1)); // }; // // the actual fn for effecting a transition // $.fn.cycle.custom = function (curr, next, opts, cb, fwd, speedOverride) { // var $l = $(curr), $n = $(next); // var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut, animInDelay = opts.animInDelay, animOutDelay = opts.animOutDelay; // $n.css(opts.cssBefore); // if (speedOverride) { // if (typeof speedOverride == 'number') // speedIn = speedOut = speedOverride; // else // speedIn = speedOut = 1; // easeIn = easeOut = null; // } // var fn = function () { // $n.delay(animInDelay).animate(opts.animIn, speedIn, easeIn, function () { // cb(); // }); // }; // $l.delay(animOutDelay).animate(opts.animOut, speedOut, easeOut, function () { // $l.css(opts.cssAfter); // if (!opts.sync) // fn(); // }); // if (opts.sync) fn(); // }; // // transition definitions - only fade is defined here, transition pack defines the rest // $.fn.cycle.transitions = { // fade: function ($cont, $slides, opts) { // $slides.not(':eq(' + opts.currSlide + ')').css('opacity', 0); // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts); // opts.cssBefore.opacity = 0; // }); // opts.animIn = { opacity: 1 }; // opts.animOut = { opacity: 0 }; // opts.cssBefore = { top: 0, left: 0 }; // } // }; // $.fn.cycle.ver = function () { return ver; }; // // override these globally if you like (they are all optional) // $.fn.cycle.defaults = { // activePagerClass: 'activeSlide', // class name used for the active pager link // after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag) // allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling // animIn: null, // properties that define how the slide animates in // animInDelay: 0, // allows delay before next slide transitions in // animOut: null, // properties that define how the slide animates out // animOutDelay: 0, // allows delay before current slide transitions out // aspect: false, // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option) // autostop: 0, // true to end slideshow after X transitions (where X == slide count) // autostopCount: 0, // number of transitions (optionally used with autostop to define X) // backwards: false, // true to start slideshow at last slide and move backwards through the stack // before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag) // center: null, // set to true to have cycle add top/left margin to each slide (use with width and height options) // cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE) // cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides) // containerResize: 1, // resize container to fit largest slide // containerResizeHeight: 0, // resize containers height to fit the largest slide but leave the width dynamic // continuous: 0, // true to start next transition immediately after current one completes // cssAfter: null, // properties that defined the state of the slide after transitioning out // cssBefore: null, // properties that define the initial state of the slide before transitioning in // delay: 0, // additional delay (in ms) for first transition (hint: can be negative) // easeIn: null, // easing for "in" transition // easeOut: null, // easing for "out" transition // easing: null, // easing method for both in and out transitions // end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options) // fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms // fit: 0, // force slides to fit container // fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle') // fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) // height: 'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well) // manualTrump: true, // causes manual transition to stop an active transition instead of being ignored // metaAttr: 'cycle', // data- attribute that holds the option data for the slideshow // next: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide // nowrap: 0, // true to prevent slideshow from wrapping // onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement) // onPrevNextEvent: null, // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement) // pager: null, // element, jQuery object, or jQuery selector string for the element to use as pager container // pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement) // pagerEvent: 'click.cycle', // name of event which drives the pager navigation // pause: 0, // true to enable "pause on hover" // pauseOnPagerHover: 0, // true to pause when hovering over pager link // prev: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide // prevNextEvent: 'click.cycle',// event which drives the manual transition to the previous or next slide // random: 0, // true for random, false for sequence (not applicable to shuffle fx) // randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random // requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded // requeueTimeout: 250, // ms delay for requeue // rev: 0, // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle) // shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 } // skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition // slideExpr: null, // expression for selecting slides (if something other than all children is required) // slideResize: 1, // force slide width/height to fixed size before every transition // speed: 1000, // speed of the transition (any valid fx speed value) // speedIn: null, // speed of the 'in' transition // speedOut: null, // speed of the 'out' transition // startingSlide: undefined,// zero-based index of the first slide to be displayed // sync: 1, // true if in/out transitions should occur simultaneously // timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance) // timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag) // updateActivePagerLink: null,// callback fn invoked to update the active pager link (adds/removes activePagerClass style) // width: null // container width (if the 'fit' option is true, the slides will be set to this width as well) // }; //})(jQuery); ///*! // * jQuery Cycle Plugin Transition Definitions // * This script is a plugin for the jQuery Cycle Plugin // * Examples and documentation at: http://malsup.com/jquery/cycle/ // * Copyright (c) 2007-2010 M. Alsup // * Version: 2.73 // * Dual licensed under the MIT and GPL licenses: // * http://www.opensource.org/licenses/mit-license.php // * http://www.gnu.org/licenses/gpl.html // */ //(function ($) { // "use strict"; // // // // These functions define slide initialization and properties for the named // // transitions. To save file size feel free to remove any of these that you // // don't need. // // // $.fn.cycle.transitions.none = function ($cont, $slides, opts) { // opts.fxFn = function (curr, next, opts, after) { // $(next).show(); // $(curr).hide(); // after(); // }; // }; // // not a cross-fade, fadeout only fades out the top slide // $.fn.cycle.transitions.fadeout = function ($cont, $slides, opts) { // $slides.not(':eq(' + opts.currSlide + ')').css({ display: 'block', 'opacity': 1 }); // opts.before.push(function (curr, next, opts, w, h, rev) { // $(curr).css('zIndex', opts.slideCount + (rev !== true ? 1 : 0)); // $(next).css('zIndex', opts.slideCount + (rev !== true ? 0 : 1)); // }); // opts.animIn.opacity = 1; // opts.animOut.opacity = 0; // opts.cssBefore.opacity = 1; // opts.cssBefore.display = 'block'; // opts.cssAfter.zIndex = 0; // }; // // scrollUp/Down/Left/Right // $.fn.cycle.transitions.scrollUp = function ($cont, $slides, opts) { // $cont.css('overflow', 'hidden'); // opts.before.push($.fn.cycle.commonReset); // var h = $cont.height(); // opts.cssBefore.top = h; // opts.cssBefore.left = 0; // opts.cssFirst.top = 0; // opts.animIn.top = 0; // opts.animOut.top = -h; // }; // $.fn.cycle.transitions.scrollDown = function ($cont, $slides, opts) { // $cont.css('overflow', 'hidden'); // opts.before.push($.fn.cycle.commonReset); // var h = $cont.height(); // opts.cssFirst.top = 0; // opts.cssBefore.top = -h; // opts.cssBefore.left = 0; // opts.animIn.top = 0; // opts.animOut.top = h; // }; // $.fn.cycle.transitions.scrollLeft = function ($cont, $slides, opts) { // $cont.css('overflow', 'hidden'); // opts.before.push($.fn.cycle.commonReset); // var w = $cont.width(); // opts.cssFirst.left = 0; // opts.cssBefore.left = w; // opts.cssBefore.top = 0; // opts.animIn.left = 0; // opts.animOut.left = 0 - w; // }; // $.fn.cycle.transitions.scrollRight = function ($cont, $slides, opts) { // $cont.css('overflow', 'hidden'); // opts.before.push($.fn.cycle.commonReset); // var w = $cont.width(); // opts.cssFirst.left = 0; // opts.cssBefore.left = -w; // opts.cssBefore.top = 0; // opts.animIn.left = 0; // opts.animOut.left = w; // }; // $.fn.cycle.transitions.scrollHorz = function ($cont, $slides, opts) { // $cont.css('overflow', 'hidden').width(); // opts.before.push(function (curr, next, opts, fwd) { // if (opts.rev) // fwd = !fwd; // $.fn.cycle.commonReset(curr, next, opts); // opts.cssBefore.left = fwd ? (next.cycleW - 1) : (1 - next.cycleW); // opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW; // }); // opts.cssFirst.left = 0; // opts.cssBefore.top = 0; // opts.animIn.left = 0; // opts.animOut.top = 0; // }; // $.fn.cycle.transitions.scrollVert = function ($cont, $slides, opts) { // $cont.css('overflow', 'hidden'); // opts.before.push(function (curr, next, opts, fwd) { // if (opts.rev) // fwd = !fwd; // $.fn.cycle.commonReset(curr, next, opts); // opts.cssBefore.top = fwd ? (1 - next.cycleH) : (next.cycleH - 1); // opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH; // }); // opts.cssFirst.top = 0; // opts.cssBefore.left = 0; // opts.animIn.top = 0; // opts.animOut.left = 0; // }; // // slideX/slideY // $.fn.cycle.transitions.slideX = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $(opts.elements).not(curr).hide(); // $.fn.cycle.commonReset(curr, next, opts, false, true); // opts.animIn.width = next.cycleW; // }); // opts.cssBefore.left = 0; // opts.cssBefore.top = 0; // opts.cssBefore.width = 0; // opts.animIn.width = 'show'; // opts.animOut.width = 0; // }; // $.fn.cycle.transitions.slideY = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $(opts.elements).not(curr).hide(); // $.fn.cycle.commonReset(curr, next, opts, true, false); // opts.animIn.height = next.cycleH; // }); // opts.cssBefore.left = 0; // opts.cssBefore.top = 0; // opts.cssBefore.height = 0; // opts.animIn.height = 'show'; // opts.animOut.height = 0; // }; // // shuffle // $.fn.cycle.transitions.shuffle = function ($cont, $slides, opts) { // var i, w = $cont.css('overflow', 'visible').width(); // $slides.css({ left: 0, top: 0 }); // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, true, true, true); // }); // // only adjust speed once! // if (!opts.speedAdjusted) { // opts.speed = opts.speed / 2; // shuffle has 2 transitions // opts.speedAdjusted = true; // } // opts.random = 0; // opts.shuffle = opts.shuffle || { left: -w, top: 15 }; // opts.els = []; // for (i = 0; i < $slides.length; i++) // opts.els.push($slides[i]); // for (i = 0; i < opts.currSlide; i++) // opts.els.push(opts.els.shift()); // // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!) // opts.fxFn = function (curr, next, opts, cb, fwd) { // if (opts.rev) // fwd = !fwd; // var $el = fwd ? $(curr) : $(next); // $(next).css(opts.cssBefore); // var count = opts.slideCount; // $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function () { // var hops = $.fn.cycle.hopsFromLast(opts, fwd); // for (var k = 0; k < hops; k++) { // if (fwd) // opts.els.push(opts.els.shift()); // else // opts.els.unshift(opts.els.pop()); // } // if (fwd) { // for (var i = 0, len = opts.els.length; i < len; i++) // $(opts.els[i]).css('z-index', len - i + count); // } // else { // var z = $(curr).css('z-index'); // $el.css('z-index', parseInt(z, 10) + 1 + count); // } // $el.animate({ left: 0, top: 0 }, opts.speedOut, opts.easeOut, function () { // $(fwd ? this : curr).hide(); // if (cb) cb(); // }); // }); // }; // $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 }); // }; // // turnUp/Down/Left/Right // $.fn.cycle.transitions.turnUp = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, true, false); // opts.cssBefore.top = next.cycleH; // opts.animIn.height = next.cycleH; // opts.animOut.width = next.cycleW; // }); // opts.cssFirst.top = 0; // opts.cssBefore.left = 0; // opts.cssBefore.height = 0; // opts.animIn.top = 0; // opts.animOut.height = 0; // }; // $.fn.cycle.transitions.turnDown = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, true, false); // opts.animIn.height = next.cycleH; // opts.animOut.top = curr.cycleH; // }); // opts.cssFirst.top = 0; // opts.cssBefore.left = 0; // opts.cssBefore.top = 0; // opts.cssBefore.height = 0; // opts.animOut.height = 0; // }; // $.fn.cycle.transitions.turnLeft = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, false, true); // opts.cssBefore.left = next.cycleW; // opts.animIn.width = next.cycleW; // }); // opts.cssBefore.top = 0; // opts.cssBefore.width = 0; // opts.animIn.left = 0; // opts.animOut.width = 0; // }; // $.fn.cycle.transitions.turnRight = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, false, true); // opts.animIn.width = next.cycleW; // opts.animOut.left = curr.cycleW; // }); // $.extend(opts.cssBefore, { top: 0, left: 0, width: 0 }); // opts.animIn.left = 0; // opts.animOut.width = 0; // }; // // zoom // $.fn.cycle.transitions.zoom = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, false, false, true); // opts.cssBefore.top = next.cycleH / 2; // opts.cssBefore.left = next.cycleW / 2; // $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH }); // $.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH / 2, left: curr.cycleW / 2 }); // }); // opts.cssFirst.top = 0; // opts.cssFirst.left = 0; // opts.cssBefore.width = 0; // opts.cssBefore.height = 0; // }; // // fadeZoom // $.fn.cycle.transitions.fadeZoom = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, false, false); // opts.cssBefore.left = next.cycleW / 2; // opts.cssBefore.top = next.cycleH / 2; // $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH }); // }); // opts.cssBefore.width = 0; // opts.cssBefore.height = 0; // opts.animOut.opacity = 0; // }; // // blindX // $.fn.cycle.transitions.blindX = function ($cont, $slides, opts) { // var w = $cont.css('overflow', 'hidden').width(); // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts); // opts.animIn.width = next.cycleW; // opts.animOut.left = curr.cycleW; // }); // opts.cssBefore.left = w; // opts.cssBefore.top = 0; // opts.animIn.left = 0; // opts.animOut.left = w; // }; // // blindY // $.fn.cycle.transitions.blindY = function ($cont, $slides, opts) { // var h = $cont.css('overflow', 'hidden').height(); // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts); // opts.animIn.height = next.cycleH; // opts.animOut.top = curr.cycleH; // }); // opts.cssBefore.top = h; // opts.cssBefore.left = 0; // opts.animIn.top = 0; // opts.animOut.top = h; // }; // // blindZ // $.fn.cycle.transitions.blindZ = function ($cont, $slides, opts) { // var h = $cont.css('overflow', 'hidden').height(); // var w = $cont.width(); // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts); // opts.animIn.height = next.cycleH; // opts.animOut.top = curr.cycleH; // }); // opts.cssBefore.top = h; // opts.cssBefore.left = w; // opts.animIn.top = 0; // opts.animIn.left = 0; // opts.animOut.top = h; // opts.animOut.left = w; // }; // // growX - grow horizontally from centered 0 width // $.fn.cycle.transitions.growX = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, false, true); // opts.cssBefore.left = this.cycleW / 2; // opts.animIn.left = 0; // opts.animIn.width = this.cycleW; // opts.animOut.left = 0; // }); // opts.cssBefore.top = 0; // opts.cssBefore.width = 0; // }; // // growY - grow vertically from centered 0 height // $.fn.cycle.transitions.growY = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, true, false); // opts.cssBefore.top = this.cycleH / 2; // opts.animIn.top = 0; // opts.animIn.height = this.cycleH; // opts.animOut.top = 0; // }); // opts.cssBefore.height = 0; // opts.cssBefore.left = 0; // }; // // curtainX - squeeze in both edges horizontally // $.fn.cycle.transitions.curtainX = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, false, true, true); // opts.cssBefore.left = next.cycleW / 2; // opts.animIn.left = 0; // opts.animIn.width = this.cycleW; // opts.animOut.left = curr.cycleW / 2; // opts.animOut.width = 0; // }); // opts.cssBefore.top = 0; // opts.cssBefore.width = 0; // }; // // curtainY - squeeze in both edges vertically // $.fn.cycle.transitions.curtainY = function ($cont, $slides, opts) { // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, true, false, true); // opts.cssBefore.top = next.cycleH / 2; // opts.animIn.top = 0; // opts.animIn.height = next.cycleH; // opts.animOut.top = curr.cycleH / 2; // opts.animOut.height = 0; // }); // opts.cssBefore.height = 0; // opts.cssBefore.left = 0; // }; // // cover - curr slide covered by next slide // $.fn.cycle.transitions.cover = function ($cont, $slides, opts) { // var d = opts.direction || 'left'; // var w = $cont.css('overflow', 'hidden').width(); // var h = $cont.height(); // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts); // opts.cssAfter.display = ''; // if (d == 'right') // opts.cssBefore.left = -w; // else if (d == 'up') // opts.cssBefore.top = h; // else if (d == 'down') // opts.cssBefore.top = -h; // else // opts.cssBefore.left = w; // }); // opts.animIn.left = 0; // opts.animIn.top = 0; // opts.cssBefore.top = 0; // opts.cssBefore.left = 0; // }; // // uncover - curr slide moves off next slide // $.fn.cycle.transitions.uncover = function ($cont, $slides, opts) { // var d = opts.direction || 'left'; // var w = $cont.css('overflow', 'hidden').width(); // var h = $cont.height(); // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, true, true, true); // if (d == 'right') // opts.animOut.left = w; // else if (d == 'up') // opts.animOut.top = -h; // else if (d == 'down') // opts.animOut.top = h; // else // opts.animOut.left = -w; // }); // opts.animIn.left = 0; // opts.animIn.top = 0; // opts.cssBefore.top = 0; // opts.cssBefore.left = 0; // }; // // toss - move top slide and fade away // $.fn.cycle.transitions.toss = function ($cont, $slides, opts) { // var w = $cont.css('overflow', 'visible').width(); // var h = $cont.height(); // opts.before.push(function (curr, next, opts) { // $.fn.cycle.commonReset(curr, next, opts, true, true, true); // // provide default toss settings if animOut not provided // if (!opts.animOut.left && !opts.animOut.top) // $.extend(opts.animOut, { left: w * 2, top: -h / 2, opacity: 0 }); // else // opts.animOut.opacity = 0; // }); // opts.cssBefore.left = 0; // opts.cssBefore.top = 0; // opts.animIn.left = 0; // }; // // wipe - clip animation // $.fn.cycle.transitions.wipe = function ($cont, $slides, opts) { // var w = $cont.css('overflow', 'hidden').width(); // var h = $cont.height(); // opts.cssBefore = opts.cssBefore || {}; // var clip; // if (opts.clip) { // if (/l2r/.test(opts.clip)) // clip = 'rect(0px 0px ' + h + 'px 0px)'; // else if (/r2l/.test(opts.clip)) // clip = 'rect(0px ' + w + 'px ' + h + 'px ' + w + 'px)'; // else if (/t2b/.test(opts.clip)) // clip = 'rect(0px ' + w + 'px 0px 0px)'; // else if (/b2t/.test(opts.clip)) // clip = 'rect(' + h + 'px ' + w + 'px ' + h + 'px 0px)'; // else if (/zoom/.test(opts.clip)) { // var top = parseInt(h / 2, 10); // var left = parseInt(w / 2, 10); // clip = 'rect(' + top + 'px ' + left + 'px ' + top + 'px ' + left + 'px)'; // } // } // opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)'; // var d = opts.cssBefore.clip.match(/(\d+)/g); // var t = parseInt(d[0], 10), r = parseInt(d[1], 10), b = parseInt(d[2], 10), l = parseInt(d[3], 10); // opts.before.push(function (curr, next, opts) { // if (curr == next) return; // var $curr = $(curr), $next = $(next); // $.fn.cycle.commonReset(curr, next, opts, true, true, false); // opts.cssAfter.display = 'block'; // var step = 1, count = parseInt((opts.speedIn / 13), 10) - 1; // (function f() { // var tt = t ? t - parseInt(step * (t / count), 10) : 0; // var ll = l ? l - parseInt(step * (l / count), 10) : 0; // var bb = b < h ? b + parseInt(step * ((h - b) / count || 1), 10) : h; // var rr = r < w ? r + parseInt(step * ((w - r) / count || 1), 10) : w; // $next.css({ clip: 'rect(' + tt + 'px ' + rr + 'px ' + bb + 'px ' + ll + 'px)' }); // (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none'); // })(); // }); // $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 }); // opts.animIn = { left: 0 }; // opts.animOut = { left: 0 }; // }; //})(jQuery); ///* // * jQuery Tools 1.2.5 - The missing UI library for the Web // * // * [dateinput, rangeinput, validator] // * // * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE. // * // * http://flowplayer.org/tools/ // * // * File generated: Wed Jan 12 23:12:22 GMT 2011 // */ //(function (d) { // function R(a, c) { return 32 - (new Date(a, c, 32)).getDate() } function S(a, c) { a = "" + a; for (c = c || 2; a.length < c;)a = "0" + a; return a } function T(a, c, j) { var q = a.getDate(), h = a.getDay(), r = a.getMonth(); a = a.getFullYear(); var f = { d: q, dd: S(q), ddd: B[j].shortDays[h], dddd: B[j].days[h], m: r + 1, mm: S(r + 1), mmm: B[j].shortMonths[r], mmmm: B[j].months[r], yy: String(a).slice(2), yyyy: a }; c = c.replace(X, function (s) { return s in f ? f[s] : s.slice(1, s.length - 1) }); return Y.html(c).html() } function v(a) { return parseInt(a, 10) } function U(a, // c) { return a.getFullYear() === c.getFullYear() && a.getMonth() == c.getMonth() && a.getDate() == c.getDate() } function C(a) { if (a) { if (a.constructor == Date) return a; if (typeof a == "string") { var c = a.split("-"); if (c.length == 3) return new Date(v(c[0]), v(c[1]) - 1, v(c[2])); if (!/^-?\d+$/.test(a)) return; a = v(a) } c = new Date; c.setDate(c.getDate() + a); return c } } function Z(a, c) { // function j(b, e, g) { // n = b; D = b.getFullYear(); E = b.getMonth(); G = b.getDate(); g = g || d.Event("api"); g.type = "change"; H.trigger(g, [b]); if (!g.isDefaultPrevented()) { // a.val(T(b, // e.format, e.lang)); a.data("date", b); h.hide(g) // } // } function q(b) { // b.type = "onShow"; H.trigger(b); d(document).bind("keydown.d", function (e) { // if (e.ctrlKey) return true; var g = e.keyCode; if (g == 8) { a.val(""); return h.hide(e) } if (g == 27) return h.hide(e); if (d(V).index(g) >= 0) { // if (!w) { h.show(e); return e.preventDefault() } var i = d("#" + f.weeks + " a"), t = d("." + f.focus), o = i.index(t); t.removeClass(f.focus); if (g == 74 || g == 40) o += 7; else if (g == 75 || g == 38) o -= 7; else if (g == 76 || g == 39) o += 1; else if (g == 72 || g == 37) o -= 1; if (o > 41) { // h.addMonth(); t = d("#" + // f.weeks + " a:eq(" + (o - 42) + ")") // } else if (o < 0) { h.addMonth(-1); t = d("#" + f.weeks + " a:eq(" + (o + 42) + ")") } else t = i.eq(o); t.addClass(f.focus); return e.preventDefault() // } if (g == 34) return h.addMonth(); if (g == 33) return h.addMonth(-1); if (g == 36) return h.today(); if (g == 13) d(e.target).is("select") || d("." + f.focus).click(); return d([16, 17, 18, 9]).index(g) >= 0 // }); d(document).bind("click.d", function (e) { var g = e.target; if (!d(g).parents("#" + f.root).length && g != a[0] && (!L || g != L[0])) h.hide(e) }) // } var h = this, r = new Date, f = c.css, s = B[c.lang], // k = d("#" + f.root), M = k.find("#" + f.title), L, I, J, D, E, G, n = a.attr("data-value") || c.value || a.val(), m = a.attr("min") || c.min, p = a.attr("max") || c.max, w; if (m === 0) m = "0"; n = C(n) || r; m = C(m || c.yearRange[0] * 365); p = C(p || c.yearRange[1] * 365); if (!s) throw "Dateinput: invalid language: " + c.lang; if (a.attr("type") == "date") { var N = d(""); d.each("class,disabled,id,maxlength,name,readonly,required,size,style,tabindex,title,value".split(","), function (b, e) { N.attr(e, a.attr(e)) }); a.replaceWith(N); a = N } a.addClass(f.input); var H = // a.add(h); if (!k.length) { // k = d("
").hide().css({ position: "absolute" }).attr("id", f.root); k.children().eq(0).attr("id", f.head).end().eq(1).attr("id", f.body).children().eq(0).attr("id", f.days).end().eq(1).attr("id", f.weeks).end().end().end().find("a").eq(0).attr("id", f.prev).end().eq(1).attr("id", f.next); M = k.find("#" + f.head).find("div").attr("id", f.title); if (c.selectors) { var z = d("").attr("id", f.year); M.html(z.add(A)) } for (var $ = // k.find("#" + f.days), O = 0; O < 7; O++)$.append(d("").text(s.shortDays[(O + c.firstDay) % 7])); d("body").append(k) // } if (c.trigger) L = d("").attr("href", "#").addClass(f.trigger).click(function (b) { h.show(); return b.preventDefault() }).insertAfter(a); var K = k.find("#" + f.weeks); A = k.find("#" + f.year); z = k.find("#" + f.month); d.extend(h, { // show: function (b) { // if (!(a.attr("readonly") || a.attr("disabled") || w)) { // b = b || d.Event(); b.type = "onBeforeShow"; H.trigger(b); if (!b.isDefaultPrevented()) { // d.each(W, function () { this.hide() }); // w = true; z.unbind("change").change(function () { h.setValue(A.val(), d(this).val()) }); A.unbind("change").change(function () { h.setValue(d(this).val(), z.val()) }); I = k.find("#" + f.prev).unbind("click").click(function () { I.hasClass(f.disabled) || h.addMonth(-1); return false }); J = k.find("#" + f.next).unbind("click").click(function () { J.hasClass(f.disabled) || h.addMonth(); return false }); h.setValue(n); var e = a.offset(); if (/iPad/i.test(navigator.userAgent)) e.top -= d(window).scrollTop(); k.css({ // top: e.top + a.outerHeight({ margins: true }) + // c.offset[0], left: e.left + c.offset[1] // }); if (c.speed) k.show(c.speed, function () { q(b) }); else { k.show(); q(b) } return h // } // } // }, setValue: function (b, e, g) { // var i = v(e) >= -1 ? new Date(v(b), v(e), v(g || 1)) : b || n; if (i < m) i = m; else if (i > p) i = p; b = i.getFullYear(); e = i.getMonth(); g = i.getDate(); if (e == -1) { e = 11; b-- } else if (e == 12) { e = 0; b++ } if (!w) { j(i, c); return h } E = e; D = b; g = new Date(b, e, 1 - c.firstDay); g = g.getDay(); var t = R(b, e), o = R(b, e - 1), P; if (c.selectors) { // z.empty(); d.each(s.months, function (x, F) { // m < new Date(b, x + 1, -1) && p > new Date(b, x, 0) && z.append(d(""); if (l % 7 === 0) { P = d("
").addClass(f.week); K.append(P) } if (l < g) { u.addClass(f.off); y = o - g + l + 1; i = new Date(b, e - 1, y) } else if (l >= g + t) { u.addClass(f.off); y = l - t - g + 1; i = new Date(b, e + 1, y) } else { // y = l - g + 1; i = new Date(b, // e, y); if (U(n, i)) u.attr("id", f.current).addClass(f.focus); else U(r, i) && u.attr("id", f.today) // } m && i < m && u.add(I).addClass(f.disabled); p && i > p && u.add(J).addClass(f.disabled); u.attr("href", "#" + y).text(y).data("date", i); P.append(u) // } K.find("a").click(function (x) { var F = d(this); if (!F.hasClass(f.disabled)) { d("#" + f.current).removeAttr("id"); F.attr("id", f.current); j(F.data("date"), c, x) } return false }); f.sunday && K.find(f.week).each(function () { var x = c.firstDay ? 7 - c.firstDay : 0; d(this).children().slice(x, x + 1).addClass(f.sunday) }); // return h // }, setMin: function (b, e) { m = C(b); e && n < m && h.setValue(m); return h }, setMax: function (b, e) { p = C(b); e && n > p && h.setValue(p); return h }, today: function () { return h.setValue(r) }, addDay: function (b) { return this.setValue(D, E, G + (b || 1)) }, addMonth: function (b) { return this.setValue(D, E + (b || 1), G) }, addYear: function (b) { return this.setValue(D + (b || 1), E, G) }, hide: function (b) { if (w) { b = d.Event(); b.type = "onHide"; H.trigger(b); d(document).unbind("click.d").unbind("keydown.d"); if (b.isDefaultPrevented()) return; k.hide(); w = false } return h }, // getConf: function () { return c }, getInput: function () { return a }, getCalendar: function () { return k }, getValue: function (b) { return b ? T(n, b, c.lang) : n }, isOpen: function () { return w } // }); d.each(["onBeforeShow", "onShow", "change", "onHide"], function (b, e) { d.isFunction(c[e]) && d(h).bind(e, c[e]); h[e] = function (g) { g && d(h).bind(e, g); return h } }); a.bind("focus click", h.show).keydown(function (b) { var e = b.keyCode; if (!w && d(V).index(e) >= 0) { h.show(b); return b.preventDefault() } return b.shiftKey || b.ctrlKey || b.altKey || e == 9 ? true : b.preventDefault() }); // C(a.val()) && j(n, c) // } d.tools = d.tools || { version: "1.2.5" }; var W = [], Q, V = [75, 76, 38, 39, 74, 72, 40, 37], B = {}; Q = d.tools.dateinput = { // conf: { format: "mm/dd/yy", selectors: false, yearRange: [-5, 5], lang: "en", offset: [0, 0], speed: 0, firstDay: 0, min: undefined, max: undefined, trigger: false, css: { prefix: "cal", input: "date", root: 0, head: 0, title: 0, prev: 0, next: 0, month: 0, year: 0, days: 0, body: 0, weeks: 0, today: 0, current: 0, week: 0, off: 0, sunday: 0, focus: 0, disabled: 0, trigger: 0 } }, localize: function (a, c) { // d.each(c, function (j, q) { c[j] = q.split(",") }); // B[a] = c // } // }; Q.localize("en", { months: "January,February,March,April,May,June,July,August,September,October,November,December", shortMonths: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", days: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday", shortDays: "Sun,Mon,Tue,Wed,Thu,Fri,Sat" }); var X = /d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g, Y = d(""); d.expr[":"].date = function (a) { var c = a.getAttribute("type"); return c && c == "date" || !!d(a).data("dateinput") }; d.fn.dateinput = function (a) { // if (this.data("dateinput")) return this; // a = d.extend(true, {}, Q.conf, a); d.each(a.css, function (j, q) { if (!q && j != "prefix") a.css[j] = (a.css.prefix || "") + (q || j) }); var c; this.each(function () { var j = new Z(d(this), a); W.push(j); j = j.getInput().data("dateinput", j); c = c ? c.add(j) : j }); return c ? c : this // } //})(jQuery); //(function (e) { // function F(d, a) { a = Math.pow(10, a); return Math.round(d * a) / a } function q(d, a) { if (a = parseInt(d.css(a), 10)) return a; return (d = d[0].currentStyle) && d.width && parseInt(d.width, 10) } function C(d) { return (d = d.data("events")) && d.onSlide } function G(d, a) { // function h(c, b, f, j) { // if (f === undefined) f = b / k * z; else if (j) f -= a.min; if (s) f = Math.round(f / s) * s; if (b === undefined || s) b = f * k / z; if (isNaN(f)) return g; b = Math.max(0, Math.min(b, k)); f = b / k * z; if (j || !n) f += a.min; if (n) if (j) b = k - b; else f = a.max - f; f = F(f, t); var r = c.type == "click"; // if (D && l !== undefined && !r) { c.type = "onSlide"; A.trigger(c, [f, b]); if (c.isDefaultPrevented()) return g } j = r ? a.speed : 0; r = r ? function () { c.type = "change"; A.trigger(c, [f]) } : null; if (n) { m.animate({ top: b }, j, r); a.progress && B.animate({ height: k - b + m.width() / 2 }, j) } else { m.animate({ left: b }, j, r); a.progress && B.animate({ width: b + m.width() / 2 }, j) } l = f; H = b; d.val(f); return g // } function o() { if (n = a.vertical || q(i, "height") > q(i, "width")) { k = q(i, "height") - q(m, "height"); u = i.offset().top + k } else { k = q(i, "width") - q(m, "width"); u = i.offset().left } } // function v() { o(); g.setValue(a.value !== undefined ? a.value : a.min) } var g = this, p = a.css, i = e("
").data("rangeinput", g), n, l, u, k, H; d.before(i); var m = i.addClass(p.slider).find("a").addClass(p.handle), B = i.find("div").addClass(p.progress); e.each("min,max,step,value".split(","), function (c, b) { c = d.attr(b); if (parseFloat(c)) a[b] = parseFloat(c, 10) }); var z = a.max - a.min, s = a.step == "any" ? 0 : a.step, t = a.precision; if (t === undefined) try { t = s.toString().split(".")[1].length } catch (I) { t = 0 } if (d.attr("type") == // "range") { var w = e(""); e.each("class,disabled,id,maxlength,name,readonly,required,size,style,tabindex,title,value".split(","), function (c, b) { w.attr(b, d.attr(b)) }); w.val(a.value); d.replaceWith(w); d = w } d.addClass(p.input); var A = e(g).add(d), D = true; e.extend(g, { // getValue: function () { return l }, setValue: function (c, b) { o(); return h(b || e.Event("api"), undefined, c, true) }, getConf: function () { return a }, getProgress: function () { return B }, getHandle: function () { return m }, getInput: function () { return d }, step: function (c, // b) { b = b || e.Event(); var f = a.step == "any" ? 1 : a.step; g.setValue(l + f * (c || 1), b) }, stepUp: function (c) { return g.step(c || 1) }, stepDown: function (c) { return g.step(-c || -1) } // }); e.each("onSlide,change".split(","), function (c, b) { e.isFunction(a[b]) && e(g).bind(b, a[b]); g[b] = function (f) { f && e(g).bind(b, f); return g } }); m.drag({ drag: false }).bind("dragStart", function () { o(); D = C(e(g)) || C(d) }).bind("drag", function (c, b, f) { if (d.is(":disabled")) return false; h(c, n ? b : f) }).bind("dragEnd", function (c) { // if (!c.isDefaultPrevented()) { // c.type = // "change"; A.trigger(c, [l]) // } // }).click(function (c) { return c.preventDefault() }); i.click(function (c) { if (d.is(":disabled") || c.target == m[0]) return c.preventDefault(); o(); var b = m.width() / 2; h(c, n ? k - u - b + c.pageY : c.pageX - u - b) }); a.keyboard && d.keydown(function (c) { if (!d.attr("readonly")) { var b = c.keyCode, f = e([75, 76, 38, 33, 39]).index(b) != -1, j = e([74, 72, 40, 34, 37]).index(b) != -1; if ((f || j) && !(c.shiftKey || c.altKey || c.ctrlKey)) { if (f) g.step(b == 33 ? 10 : 1, c); else if (j) g.step(b == 34 ? -10 : -1, c); return c.preventDefault() } } }); d.blur(function (c) { // var b = // e(this).val(); b !== l && g.setValue(b, c) // }); e.extend(d[0], { stepUp: g.stepUp, stepDown: g.stepDown }); v(); k || e(window).load(v) // } e.tools = e.tools || { version: "1.2.5" }; var E; E = e.tools.rangeinput = { conf: { min: 0, max: 100, step: "any", steps: 0, value: 0, precision: undefined, vertical: 0, keyboard: true, progress: false, speed: 100, css: { input: "range", slider: "slider", progress: "progress", handle: "handle" } } }; var x, y; e.fn.drag = function (d) { // document.ondragstart = function () { return false }; d = e.extend({ x: true, y: true, drag: true }, d); x = x || e(document).bind("mousedown mouseup", // function (a) { var h = e(a.target); if (a.type == "mousedown" && h.data("drag")) { var o = h.position(), v = a.pageX - o.left, g = a.pageY - o.top, p = true; x.bind("mousemove.drag", function (i) { var n = i.pageX - v; i = i.pageY - g; var l = {}; if (d.x) l.left = n; if (d.y) l.top = i; if (p) { h.trigger("dragStart"); p = false } d.drag && h.css(l); h.trigger("drag", [i, n]); y = h }); a.preventDefault() } else try { y && y.trigger("dragEnd") } finally { x.unbind("mousemove.drag"); y = null } }); return this.data("drag", true) // }; e.expr[":"].range = function (d) { // var a = d.getAttribute("type"); // return a && a == "range" || !!e(d).filter("input").data("rangeinput") // }; e.fn.rangeinput = function (d) { if (this.data("rangeinput")) return this; d = e.extend(true, {}, E.conf, d); var a; this.each(function () { var h = new G(e(this), e.extend(true, {}, d)); h = h.getInput().data("rangeinput", h); a = a ? a.add(h) : h }); return a ? a : this } //})(jQuery); //(function (e) { // function t(a, b, c) { var k = a.offset().top, f = a.offset().left, l = c.position.split(/,?\s+/), p = l[0]; l = l[1]; k -= b.outerHeight() - c.offset[0]; f += a.outerWidth() + c.offset[1]; if (/iPad/i.test(navigator.userAgent)) k -= e(window).scrollTop(); c = b.outerHeight() + a.outerHeight(); if (p == "center") k += c / 2; if (p == "bottom") k += c; a = a.outerWidth(); if (l == "center") f -= (a + b.outerWidth()) / 2; if (l == "left") f -= a; return { top: k, left: f } } function y(a) { function b() { return this.getAttribute("type") == a } b.key = "[type=" + a + "]"; return b } function u(a, // b, c) { // function k(g, d, i) { if (!(!c.grouped && g.length)) { var j; if (i === false || e.isArray(i)) { j = h.messages[d.key || d] || h.messages["*"]; j = j[c.lang] || h.messages["*"].en; (d = j.match(/\$\d/g)) && e.isArray(i) && e.each(d, function (m) { j = j.replace(this, i[m]) }) } else j = i[c.lang] || i; g.push(j) } } var f = this, l = b.add(f); a = a.not(":button, :image, :reset, :submit"); e.extend(f, { // getConf: function () { return c }, getForm: function () { return b }, getInputs: function () { return a }, reflow: function () { // a.each(function () { // var g = e(this), d = g.data("msg.el"); // if (d) { g = t(g, d, c); d.css({ top: g.top, left: g.left }) } // }); return f // }, invalidate: function (g, d) { if (!d) { var i = []; e.each(g, function (j, m) { j = a.filter("[name='" + j + "']"); if (j.length) { j.trigger("OI", [m]); i.push({ input: j, messages: [m] }) } }); g = i; d = e.Event() } d.type = "onFail"; l.trigger(d, [g]); d.isDefaultPrevented() || q[c.effect][0].call(f, g, d); return f }, reset: function (g) { // g = g || a; g.removeClass(c.errorClass).each(function () { var d = e(this).data("msg.el"); if (d) { d.remove(); e(this).data("msg.el", null) } }).unbind(c.errorInputEvent || // ""); return f // }, destroy: function () { b.unbind(c.formEvent + ".V").unbind("reset.V"); a.unbind(c.inputEvent + ".V").unbind("change.V"); return f.reset() }, checkValidity: function (g, d) { // g = g || a; g = g.not(":disabled"); if (!g.length) return true; d = d || e.Event(); d.type = "onBeforeValidate"; l.trigger(d, [g]); if (d.isDefaultPrevented()) return d.result; var i = []; g.not(":radio:not(:checked)").each(function () { // var m = [], n = e(this).data("messages", m), v = r && n.is(":date") ? "onHide.v" : c.errorInputEvent + ".v"; n.unbind(v); e.each(w, function () { // var o = // this, s = o[0]; if (n.filter(s).length) { o = o[1].call(f, n, n.val()); if (o !== true) { d.type = "onBeforeFail"; l.trigger(d, [n, s]); if (d.isDefaultPrevented()) return false; var x = n.attr(c.messageAttr); if (x) { m = [x]; return false } else k(m, s, o) } } // }); if (m.length) { i.push({ input: n, messages: m }); n.trigger("OI", [m]); c.errorInputEvent && n.bind(v, function (o) { f.checkValidity(n, o) }) } if (c.singleError && i.length) return false // }); var j = q[c.effect]; if (!j) throw 'Validator: cannot find effect "' + c.effect + '"'; if (i.length) { f.invalidate(i, d); return false } else { // j[1].call(f, // g, d); d.type = "onSuccess"; l.trigger(d, [g]); g.unbind(c.errorInputEvent + ".v") // } return true // } // }); e.each("onBeforeValidate,onBeforeFail,onFail,onSuccess".split(","), function (g, d) { e.isFunction(c[d]) && e(f).bind(d, c[d]); f[d] = function (i) { i && e(f).bind(d, i); return f } }); c.formEvent && b.bind(c.formEvent + ".V", function (g) { if (!f.checkValidity(null, g)) return g.preventDefault() }); b.bind("reset.V", function () { f.reset() }); a[0] && a[0].validity && a.each(function () { this.oninvalid = function () { return false } }); if (b[0]) b[0].checkValidity = // f.checkValidity; c.inputEvent && a.bind(c.inputEvent + ".V", function (g) { f.checkValidity(e(this), g) }); a.filter(":checkbox, select").filter("[required]").bind("change.V", function (g) { var d = e(this); if (this.checked || d.is("select") && e(this).val()) q[c.effect][1].call(f, d, g) }); var p = a.filter(":radio").change(function (g) { f.checkValidity(p, g) }); e(window).resize(function () { f.reflow() }) // } e.tools = e.tools || { version: "1.2.5" }; var z = /\[type=([a-z]+)\]/, A = /^-?[0-9]*(\.[0-9]+)?$/, r = e.tools.dateinput, B = /^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$/i, // C = /^(https?:\/\/)?[\da-z\.\-]+\.[a-z\.]{2,6}[#&+_\?\/\w \.\-=]*$/i, h; h = e.tools.validator = { // conf: { grouped: false, effect: "default", errorClass: "invalid", inputEvent: null, errorInputEvent: "keyup", formEvent: "submit", lang: "en", message: "
", messageAttr: "data-message", messageClass: "error", offset: [0, 0], position: "center right", singleError: false, speed: "normal" }, messages: { "*": { en: "Please correct this value" } }, localize: function (a, b) { e.each(b, function (c, k) { h.messages[c] = h.messages[c] || {}; h.messages[c][a] = k }) }, // localizeFn: function (a, b) { h.messages[a] = h.messages[a] || {}; e.extend(h.messages[a], b) }, fn: function (a, b, c) { if (e.isFunction(b)) c = b; else { if (typeof b == "string") b = { en: b }; this.messages[a.key || a] = b } if (b = z.exec(a)) a = y(b[1]); w.push([a, c]) }, addEffect: function (a, b, c) { q[a] = [b, c] } // }; var w = [], q = { // "default": [function (a) { // var b = this.getConf(); e.each(a, function (c, k) { // c = k.input; c.addClass(b.errorClass); var f = c.data("msg.el"); if (!f) { f = e(b.message).addClass(b.messageClass).appendTo(document.body); c.data("msg.el", f) } f.css({ visibility: "hidden" }).find("p").remove(); // e.each(k.messages, function (l, p) { e("

").html(p).appendTo(f) }); f.outerWidth() == f.parent().width() && f.add(f.find("p")).css({ display: "inline" }); k = t(c, f, b); f.css({ visibility: "visible", position: "absolute", top: k.top, left: k.left }).fadeIn(b.speed) // }) // }, function (a) { var b = this.getConf(); a.removeClass(b.errorClass).each(function () { var c = e(this).data("msg.el"); c && c.css({ visibility: "hidden" }) }) }] // }; e.each("email,url,number".split(","), function (a, b) { e.expr[":"][b] = function (c) { return c.getAttribute("type") === b } }); // e.fn.oninvalid = function (a) { return this[a ? "bind" : "trigger"]("OI", a) }; h.fn(":email", "Please enter a valid email address", function (a, b) { return !b || B.test(b) }); h.fn(":url", "Please enter a valid URL", function (a, b) { return !b || C.test(b) }); h.fn(":number", "Please enter a numeric value.", function (a, b) { return A.test(b) }); h.fn("[max]", "Please enter a value smaller than $1", function (a, b) { if (b === "" || r && a.is(":date")) return true; a = a.attr("max"); return parseFloat(b) <= parseFloat(a) ? true : [a] }); h.fn("[min]", "Please enter a value larger than $1", // function (a, b) { if (b === "" || r && a.is(":date")) return true; a = a.attr("min"); return parseFloat(b) >= parseFloat(a) ? true : [a] }); h.fn("[required]", "Please complete this mandatory field.", function (a, b) { if (a.is(":checkbox")) return a.is(":checked"); return !!b }); h.fn("[pattern]", function (a) { var b = new RegExp("^" + a.attr("pattern") + "$"); return b.test(a.val()) }); e.fn.validator = function (a) { // var b = this.data("validator"); if (b) { b.destroy(); this.removeData("validator") } a = e.extend(true, {}, h.conf, a); if (this.is("form")) return this.each(function () { // var c = // e(this); b = new u(c.find(":input"), c, a); c.data("validator", b) // }); else { b = new u(this, this.eq(0).closest("form"), a); return this.data("validator", b) } // } //})(jQuery); ///*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) // * Licensed under the MIT License (LICENSE.txt). // * // * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. // * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. // * Thanks to: Seamus Leahy for adding deltaX and deltaY // * // * Version: 3.0.6 // * // * Requires: 1.2.2+ // */ //(function (a) { function d(b) { var c = b || window.event, d = [].slice.call(arguments, 1), e = 0, f = !0, g = 0, h = 0; return b = a.event.fix(c), b.type = "mousewheel", c.wheelDelta && (e = c.wheelDelta / 120), c.detail && (e = -c.detail / 3), h = e, c.axis !== undefined && c.axis === c.HORIZONTAL_AXIS && (h = 0, g = -1 * e), c.wheelDeltaY !== undefined && (h = c.wheelDeltaY / 120), c.wheelDeltaX !== undefined && (g = -1 * c.wheelDeltaX / 120), d.unshift(b, e, g, h), (a.event.dispatch || a.event.handle).apply(this, d) } var b = ["DOMMouseScroll", "mousewheel"]; if (a.event.fixHooks) for (var c = b.length; c;)a.event.fixHooks[b[--c]] = a.event.mouseHooks; a.event.special.mousewheel = { setup: function () { if (this.addEventListener) for (var a = b.length; a;)this.addEventListener(b[--a], d, !1); else this.onmousewheel = d }, teardown: function () { if (this.removeEventListener) for (var a = b.length; a;)this.removeEventListener(b[--a], d, !1); else this.onmousewheel = null } }, a.fn.extend({ mousewheel: function (a) { return a ? this.bind("mousewheel", a) : this.trigger("mousewheel") }, unmousewheel: function (a) { return this.unbind("mousewheel", a) } }) })(jQuery); ///* //* touchSwipe - jQuery Plugin //* https://github.com/mattbryson/TouchSwipe-Jquery-Plugin //* http://labs.skinkers.com/touchSwipe/ //* http://plugins.jquery.com/project/touchSwipe //* //* Copyright (c) 2010 Matt Bryson (www.skinkers.com) //* Dual licensed under the MIT or GPL Version 2 licenses. //* //* $version: 1.3.3 //*/ //(function (g) { function P(c) { if (c && void 0 === c.allowPageScroll && (void 0 !== c.swipe || void 0 !== c.swipeStatus)) c.allowPageScroll = G; c || (c = {}); c = g.extend({}, g.fn.swipe.defaults, c); return this.each(function () { var b = g(this), f = b.data(w); f || (f = new W(this, c), b.data(w, f)) }) } function W(c, b) { var f, p, r, s; function H(a) { var a = a.originalEvent, c, Q = n ? a.touches[0] : a; d = R; n ? h = a.touches.length : a.preventDefault(); i = 0; j = null; k = 0; !n || h === b.fingers || b.fingers === x ? (r = f = Q.pageX, s = p = Q.pageY, y = (new Date).getTime(), b.swipeStatus && (c = l(a, d))) : t(a); if (!1 === c) return d = m, l(a, d), c; e.bind(I, J); e.bind(K, L) } function J(a) { a = a.originalEvent; if (!(d === q || d === m)) { var c, e = n ? a.touches[0] : a; f = e.pageX; p = e.pageY; u = (new Date).getTime(); j = S(); n && (h = a.touches.length); d = z; var e = a, g = j; if (b.allowPageScroll === G) e.preventDefault(); else { var o = b.allowPageScroll === T; switch (g) { case v: (b.swipeLeft && o || !o && b.allowPageScroll != M) && e.preventDefault(); break; case A: (b.swipeRight && o || !o && b.allowPageScroll != M) && e.preventDefault(); break; case B: (b.swipeUp && o || !o && b.allowPageScroll != N) && e.preventDefault(); break; case C: (b.swipeDown && o || !o && b.allowPageScroll != N) && e.preventDefault() } } h === b.fingers || b.fingers === x || !n ? (i = U(), k = u - y, b.swipeStatus && (c = l(a, d, j, i, k)), b.triggerOnTouchEnd || (e = !(b.maxTimeThreshold ? !(k >= b.maxTimeThreshold) : 1), !0 === D() ? (d = q, c = l(a, d)) : e && (d = m, l(a, d)))) : (d = m, l(a, d)); !1 === c && (d = m, l(a, d)) } } function L(a) { a = a.originalEvent; a.preventDefault(); u = (new Date).getTime(); i = U(); j = S(); k = u - y; if (b.triggerOnTouchEnd || !1 === b.triggerOnTouchEnd && d === z) if (d = q, (h === b.fingers || b.fingers === x || !n) && 0 !== f) { var c = !(b.maxTimeThreshold ? !(k >= b.maxTimeThreshold) : 1); if ((!0 === D() || null === D()) && !c) l(a, d); else if (c || !1 === D()) d = m, l(a, d) } else d = m, l(a, d); else d === z && (d = m, l(a, d)); e.unbind(I, J, !1); e.unbind(K, L, !1) } function t() { y = u = p = f = s = r = h = 0 } function l(a, c) { var d = void 0; b.swipeStatus && (d = b.swipeStatus.call(e, a, c, j || null, i || 0, k || 0, h)); if (c === m && b.click && (1 === h || !n) && (isNaN(i) || 0 === i)) d = b.click.call(e, a, a.target); if (c == q) switch (b.swipe && (d = b.swipe.call(e, a, j, i, k, h)), j) { case v: b.swipeLeft && (d = b.swipeLeft.call(e, a, j, i, k, h)); break; case A: b.swipeRight && (d = b.swipeRight.call(e, a, j, i, k, h)); break; case B: b.swipeUp && (d = b.swipeUp.call(e, a, j, i, k, h)); break; case C: b.swipeDown && (d = b.swipeDown.call(e, a, j, i, k, h)) }(c === m || c === q) && t(a); return d } function D() { return null !== b.threshold ? i >= b.threshold : null } function U() { return Math.round(Math.sqrt(Math.pow(f - r, 2) + Math.pow(p - s, 2))) } function S() { var a; a = Math.atan2(p - s, r - f); a = Math.round(180 * a / Math.PI); 0 > a && (a = 360 - Math.abs(a)); return 45 >= a && 0 <= a ? v : 360 >= a && 315 <= a ? v : 135 <= a && 225 >= a ? A : 45 < a && 135 > a ? C : B } function V() { e.unbind(E, H); e.unbind(F, t); e.unbind(I, J); e.unbind(K, L) } var O = n || !b.fallbackToMouseEvents, E = O ? "touchstart" : "mousedown", I = O ? "touchmove" : "mousemove", K = O ? "touchend" : "mouseup", F = "touchcancel", i = 0, j = null, k = 0, e = g(c), d = "start", h = 0, y = p = f = s = r = 0, u = 0; try { e.bind(E, H), e.bind(F, t) } catch (P) { g.error("events not supported " + E + "," + F + " on jQuery.swipe") } this.enable = function () { e.bind(E, H); e.bind(F, t); return e }; this.disable = function () { V(); return e }; this.destroy = function () { V(); e.data(w, null); return e } } var v = "left", A = "right", B = "up", C = "down", G = "none", T = "auto", M = "horizontal", N = "vertical", x = "all", R = "start", z = "move", q = "end", m = "cancel", n = "ontouchstart" in window, w = "TouchSwipe"; g.fn.swipe = function (c) { var b = g(this), f = b.data(w); if (f && "string" === typeof c) { if (f[c]) return f[c].apply(this, Array.prototype.slice.call(arguments, 1)); g.error("Method " + c + " does not exist on jQuery.swipe") } else if (!f && ("object" === typeof c || !c)) return P.apply(this, arguments); return b }; g.fn.swipe.defaults = { fingers: 1, threshold: 75, maxTimeThreshold: null, swipe: null, swipeLeft: null, swipeRight: null, swipeUp: null, swipeDown: null, swipeStatus: null, click: null, triggerOnTouchEnd: !0, allowPageScroll: "auto", fallbackToMouseEvents: !0 }; g.fn.swipe.phases = { PHASE_START: R, PHASE_MOVE: z, PHASE_END: q, PHASE_CANCEL: m }; g.fn.swipe.directions = { LEFT: v, RIGHT: A, UP: B, DOWN: C }; g.fn.swipe.pageScroll = { NONE: G, HORIZONTAL: M, VERTICAL: N, AUTO: T }; g.fn.swipe.fingers = { ONE: 1, TWO: 2, THREE: 3, ALL: x } })(jQuery); ///* // * jQuery carouFredSel 6.2.1 // * Demo's and documentation: // * caroufredsel.dev7studios.com // * // * Copyright (c) 2013 Fred Heusschen // * www.frebsite.nl // * // * Dual licensed under the MIT and GPL licenses. // * http://en.wikipedia.org/wiki/MIT_License // * http://en.wikipedia.org/wiki/GNU_General_Public_License // * //(function($){function sc_setScroll(a,b,c){return"transition"==c.transition&&"swing"==b&&(b="ease"),{anims:[],duration:a,orgDuration:a,easing:b,startTime:getTime()}}function sc_startScroll(a,b){for(var c=0,d=a.anims.length;d>c;c++){var e=a.anims[c];e&&e[0][b.transition](e[1],a.duration,a.easing,e[2])}}function sc_stopScroll(a,b){is_boolean(b)||(b=!0),is_object(a.pre)&&sc_stopScroll(a.pre,b);for(var c=0,d=a.anims.length;d>c;c++){var e=a.anims[c];e[0].stop(!0),b&&(e[0].css(e[1]),is_function(e[2])&&e[2]())}is_object(a.post)&&sc_stopScroll(a.post,b)}function sc_afterScroll(a,b,c){switch(b&&b.remove(),c.fx){case"fade":case"crossfade":case"cover-fade":case"uncover-fade":a.css("opacity",1),a.css("filter","")}}function sc_fireCallbacks(a,b,c,d,e){if(b[c]&&b[c].call(a,d),e[c].length)for(var f=0,g=e[c].length;g>f;f++)e[c][f].call(a,d);return[]}function sc_fireQueue(a,b,c){return b.length&&(a.trigger(cf_e(b[0][0],c),b[0][1]),b.shift()),b}function sc_hideHiddenItems(a){a.each(function(){var a=$(this);a.data("_cfs_isHidden",a.is(":hidden")).hide()})}function sc_showHiddenItems(a){a&&a.each(function(){var a=$(this);a.data("_cfs_isHidden")||a.show()})}function sc_clearTimers(a){return a.auto&&clearTimeout(a.auto),a.progress&&clearInterval(a.progress),a}function sc_mapCallbackArguments(a,b,c,d,e,f,g){return{width:g.width,height:g.height,items:{old:a,skipped:b,visible:c},scroll:{items:d,direction:e,duration:f}}}function sc_getDuration(a,b,c,d){var e=a.duration;return"none"==a.fx?0:("auto"==e?e=b.scroll.duration/b.scroll.items*c:10>e&&(e=d/e),1>e?0:("fade"==a.fx&&(e/=2),Math.round(e)))}function nv_showNavi(a,b,c){var d=is_number(a.items.minimum)?a.items.minimum:a.items.visible+1;if("show"==b||"hide"==b)var e=b;else if(d>b){debug(c,"Not enough items ("+b+" total, "+d+" needed): Hiding navigation.");var e="hide"}else var e="show";var f="show"==e?"removeClass":"addClass",g=cf_c("hidden",c);a.auto.button&&a.auto.button[e]()[f](g),a.prev.button&&a.prev.button[e]()[f](g),a.next.button&&a.next.button[e]()[f](g),a.pagination.container&&a.pagination.container[e]()[f](g)}function nv_enableNavi(a,b,c){if(!a.circular&&!a.infinite){var d="removeClass"==b||"addClass"==b?b:!1,e=cf_c("disabled",c);if(a.auto.button&&d&&a.auto.button[d](e),a.prev.button){var f=d||0==b?"addClass":"removeClass";a.prev.button[f](e)}if(a.next.button){var f=d||b==a.items.visible?"addClass":"removeClass";a.next.button[f](e)}}}function go_getObject(a,b){return is_function(b)?b=b.call(a):is_undefined(b)&&(b={}),b}function go_getItemsObject(a,b){return b=go_getObject(a,b),is_number(b)?b={visible:b}:"variable"==b?b={visible:b,width:b,height:b}:is_object(b)||(b={}),b}function go_getScrollObject(a,b){return b=go_getObject(a,b),is_number(b)?b=50>=b?{items:b}:{duration:b}:is_string(b)?b={easing:b}:is_object(b)||(b={}),b}function go_getNaviObject(a,b){if(b=go_getObject(a,b),is_string(b)){var c=cf_getKeyCode(b);b=-1==c?$(b):c}return b}function go_getAutoObject(a,b){return b=go_getNaviObject(a,b),is_jquery(b)?b={button:b}:is_boolean(b)?b={play:b}:is_number(b)&&(b={timeoutDuration:b}),b.progress&&(is_string(b.progress)||is_jquery(b.progress))&&(b.progress={bar:b.progress}),b}function go_complementAutoObject(a,b){return is_function(b.button)&&(b.button=b.button.call(a)),is_string(b.button)&&(b.button=$(b.button)),is_boolean(b.play)||(b.play=!0),is_number(b.delay)||(b.delay=0),is_undefined(b.pauseOnEvent)&&(b.pauseOnEvent=!0),is_boolean(b.pauseOnResize)||(b.pauseOnResize=!0),is_number(b.timeoutDuration)||(b.timeoutDuration=10>b.duration?2500:5*b.duration),b.progress&&(is_function(b.progress.bar)&&(b.progress.bar=b.progress.bar.call(a)),is_string(b.progress.bar)&&(b.progress.bar=$(b.progress.bar)),b.progress.bar?(is_function(b.progress.updater)||(b.progress.updater=$.fn.carouFredSel.progressbarUpdater),is_number(b.progress.interval)||(b.progress.interval=50)):b.progress=!1),b}function go_getPrevNextObject(a,b){return b=go_getNaviObject(a,b),is_jquery(b)?b={button:b}:is_number(b)&&(b={key:b}),b}function go_complementPrevNextObject(a,b){return is_function(b.button)&&(b.button=b.button.call(a)),is_string(b.button)&&(b.button=$(b.button)),is_string(b.key)&&(b.key=cf_getKeyCode(b.key)),b}function go_getPaginationObject(a,b){return b=go_getNaviObject(a,b),is_jquery(b)?b={container:b}:is_boolean(b)&&(b={keys:b}),b}function go_complementPaginationObject(a,b){return is_function(b.container)&&(b.container=b.container.call(a)),is_string(b.container)&&(b.container=$(b.container)),is_number(b.items)||(b.items=!1),is_boolean(b.keys)||(b.keys=!1),is_function(b.anchorBuilder)||is_false(b.anchorBuilder)||(b.anchorBuilder=$.fn.carouFredSel.pageAnchorBuilder),is_number(b.deviation)||(b.deviation=0),b}function go_getSwipeObject(a,b){return is_function(b)&&(b=b.call(a)),is_undefined(b)&&(b={onTouch:!1}),is_true(b)?b={onTouch:b}:is_number(b)&&(b={items:b}),b}function go_complementSwipeObject(a,b){return is_boolean(b.onTouch)||(b.onTouch=!0),is_boolean(b.onMouse)||(b.onMouse=!1),is_object(b.options)||(b.options={}),is_boolean(b.options.triggerOnTouchEnd)||(b.options.triggerOnTouchEnd=!1),b}function go_getMousewheelObject(a,b){return is_function(b)&&(b=b.call(a)),is_true(b)?b={}:is_number(b)?b={items:b}:is_undefined(b)&&(b=!1),b}function go_complementMousewheelObject(a,b){return b}function gn_getItemIndex(a,b,c,d,e){if(is_string(a)&&(a=$(a,e)),is_object(a)&&(a=$(a,e)),is_jquery(a)?(a=e.children().index(a),is_boolean(c)||(c=!1)):is_boolean(c)||(c=!0),is_number(a)||(a=0),is_number(b)||(b=0),c&&(a+=d.first),a+=b,d.total>0){for(;a>=d.total;)a-=d.total;for(;0>a;)a+=d.total}return a}function gn_getVisibleItemsPrev(a,b,c){for(var d=0,e=0,f=c;f>=0;f--){var g=a.eq(f);if(d+=g.is(":visible")?g[b.d.outerWidth](!0):0,d>b.maxDimension)return e;0==f&&(f=a.length),e++}}function gn_getVisibleItemsPrevFilter(a,b,c){return gn_getItemsPrevFilter(a,b.items.filter,b.items.visibleConf.org,c)}function gn_getScrollItemsPrevFilter(a,b,c,d){return gn_getItemsPrevFilter(a,b.items.filter,d,c)}function gn_getItemsPrevFilter(a,b,c,d){for(var e=0,f=0,g=d,h=a.length;g>=0;g--){if(f++,f==h)return f;var i=a.eq(g);if(i.is(b)&&(e++,e==c))return f;0==g&&(g=h)}}function gn_getVisibleOrg(a,b){return b.items.visibleConf.org||a.children().slice(0,b.items.visible).filter(b.items.filter).length}function gn_getVisibleItemsNext(a,b,c){for(var d=0,e=0,f=c,g=a.length-1;g>=f;f++){var h=a.eq(f);if(d+=h.is(":visible")?h[b.d.outerWidth](!0):0,d>b.maxDimension)return e;if(e++,e==g+1)return e;f==g&&(f=-1)}}function gn_getVisibleItemsNextTestCircular(a,b,c,d){var e=gn_getVisibleItemsNext(a,b,c);return b.circular||c+e>d&&(e=d-c),e}function gn_getVisibleItemsNextFilter(a,b,c){return gn_getItemsNextFilter(a,b.items.filter,b.items.visibleConf.org,c,b.circular)}function gn_getScrollItemsNextFilter(a,b,c,d){return gn_getItemsNextFilter(a,b.items.filter,d+1,c,b.circular)-1}function gn_getItemsNextFilter(a,b,c,d){for(var f=0,g=0,h=d,i=a.length-1;i>=h;h++){if(g++,g>=i)return g;var j=a.eq(h);if(j.is(b)&&(f++,f==c))return g;h==i&&(h=-1)}}function gi_getCurrentItems(a,b){return a.slice(0,b.items.visible)}function gi_getOldItemsPrev(a,b,c){return a.slice(c,b.items.visibleConf.old+c)}function gi_getNewItemsPrev(a,b){return a.slice(0,b.items.visible)}function gi_getOldItemsNext(a,b){return a.slice(0,b.items.visibleConf.old)}function gi_getNewItemsNext(a,b,c){return a.slice(c,b.items.visible+c)}function sz_storeMargin(a,b,c){b.usePadding&&(is_string(c)||(c="_cfs_origCssMargin"),a.each(function(){var a=$(this),d=parseInt(a.css(b.d.marginRight),10);is_number(d)||(d=0),a.data(c,d)}))}function sz_resetMargin(a,b,c){if(b.usePadding){var d=is_boolean(c)?c:!1;is_number(c)||(c=0),sz_storeMargin(a,b,"_cfs_tempCssMargin"),a.each(function(){var a=$(this);a.css(b.d.marginRight,d?a.data("_cfs_tempCssMargin"):c+a.data("_cfs_origCssMargin"))})}}function sz_storeOrigCss(a){a.each(function(){var a=$(this);a.data("_cfs_origCss",a.attr("style")||"")})}function sz_restoreOrigCss(a){a.each(function(){var a=$(this);a.attr("style",a.data("_cfs_origCss")||"")})}function sz_setResponsiveSizes(a,b){var d=(a.items.visible,a.items[a.d.width]),e=a[a.d.height],f=is_percentage(e);b.each(function(){var b=$(this),c=d-ms_getPaddingBorderMargin(b,a,"Width");b[a.d.width](c),f&&b[a.d.height](ms_getPercentage(c,e))})}function sz_setSizes(a,b){var c=a.parent(),d=a.children(),e=gi_getCurrentItems(d,b),f=cf_mapWrapperSizes(ms_getSizes(e,b,!0),b,!1);if(c.css(f),b.usePadding){var g=b.padding,h=g[b.d[1]];b.align&&0>h&&(h=0);var i=e.last();i.css(b.d.marginRight,i.data("_cfs_origCssMargin")+h),a.css(b.d.top,g[b.d[0]]),a.css(b.d.left,g[b.d[3]])}return a.css(b.d.width,f[b.d.width]+2*ms_getTotalSize(d,b,"width")),a.css(b.d.height,ms_getLargestSize(d,b,"height")),f}function ms_getSizes(a,b,c){return[ms_getTotalSize(a,b,"width",c),ms_getLargestSize(a,b,"height",c)]}function ms_getLargestSize(a,b,c,d){return is_boolean(d)||(d=!1),is_number(b[b.d[c]])&&d?b[b.d[c]]:is_number(b.items[b.d[c]])?b.items[b.d[c]]:(c=c.toLowerCase().indexOf("width")>-1?"outerWidth":"outerHeight",ms_getTrueLargestSize(a,b,c))}function ms_getTrueLargestSize(a,b,c){for(var d=0,e=0,f=a.length;f>e;e++){var g=a.eq(e),h=g.is(":visible")?g[b.d[c]](!0):0;h>d&&(d=h)}return d}function ms_getTotalSize(a,b,c,d){if(is_boolean(d)||(d=!1),is_number(b[b.d[c]])&&d)return b[b.d[c]];if(is_number(b.items[b.d[c]]))return b.items[b.d[c]]*a.length;for(var e=c.toLowerCase().indexOf("width")>-1?"outerWidth":"outerHeight",f=0,g=0,h=a.length;h>g;g++){var i=a.eq(g);f+=i.is(":visible")?i[b.d[e]](!0):0}return f}function ms_getParentSize(a,b,c){var d=a.is(":visible");d&&a.hide();var e=a.parent()[b.d[c]]();return d&&a.show(),e}function ms_getMaxDimension(a,b){return is_number(a[a.d.width])?a[a.d.width]:b}function ms_hasVariableSizes(a,b,c){for(var d=!1,e=!1,f=0,g=a.length;g>f;f++){var h=a.eq(f),i=h.is(":visible")?h[b.d[c]](!0):0;d===!1?d=i:d!=i&&(e=!0),0==d&&(e=!0)}return e}function ms_getPaddingBorderMargin(a,b,c){return a[b.d["outer"+c]](!0)-a[b.d[c.toLowerCase()]]()}function ms_getPercentage(a,b){if(is_percentage(b)){if(b=parseInt(b.slice(0,-1),10),!is_number(b))return a;a*=b/100}return a}function cf_e(a,b,c,d,e){return is_boolean(c)||(c=!0),is_boolean(d)||(d=!0),is_boolean(e)||(e=!1),c&&(a=b.events.prefix+a),d&&(a=a+"."+b.events.namespace),d&&e&&(a+=b.serialNumber),a}function cf_c(a,b){return is_string(b.classnames[a])?b.classnames[a]:a}function cf_mapWrapperSizes(a,b,c){is_boolean(c)||(c=!0);var d=b.usePadding&&c?b.padding:[0,0,0,0],e={};return e[b.d.width]=a[0]+d[1]+d[3],e[b.d.height]=a[1]+d[0]+d[2],e}function cf_sortParams(a,b){for(var c=[],d=0,e=a.length;e>d;d++)for(var f=0,g=b.length;g>f;f++)if(b[f].indexOf(typeof a[d])>-1&&is_undefined(c[f])){c[f]=a[d];break}return c}function cf_getPadding(a){if(is_undefined(a))return[0,0,0,0];if(is_number(a))return[a,a,a,a];if(is_string(a)&&(a=a.split("px").join("").split("em").join("").split(" ")),!is_array(a))return[0,0,0,0];for(var b=0;4>b;b++)a[b]=parseInt(a[b],10);switch(a.length){case 0:return[0,0,0,0];case 1:return[a[0],a[0],a[0],a[0]];case 2:return[a[0],a[1],a[0],a[1]];case 3:return[a[0],a[1],a[2],a[1]];default:return[a[0],a[1],a[2],a[3]]}}function cf_getAlignPadding(a,b){var c=is_number(b[b.d.width])?Math.ceil(b[b.d.width]-ms_getTotalSize(a,b,"width")):0;switch(b.align){case"left":return[0,c];case"right":return[c,0];case"center":default:return[Math.ceil(c/2),Math.floor(c/2)]}}function cf_getDimensions(a){for(var b=[["width","innerWidth","outerWidth","height","innerHeight","outerHeight","left","top","marginRight",0,1,2,3],["height","innerHeight","outerHeight","width","innerWidth","outerWidth","top","left","marginBottom",3,2,1,0]],c=b[0].length,d="right"==a.direction||"left"==a.direction?0:1,e={},f=0;c>f;f++)e[b[0][f]]=b[d][f];return e}function cf_getAdjust(a,b,c,d){var e=a;if(is_function(c))e=c.call(d,e);else if(is_string(c)){var f=c.split("+"),g=c.split("-");if(g.length>f.length)var h=!0,i=g[0],j=g[1];else var h=!1,i=f[0],j=f[1];switch(i){case"even":e=1==a%2?a-1:a;break;case"odd":e=0==a%2?a-1:a;break;default:e=a}j=parseInt(j,10),is_number(j)&&(h&&(j=-j),e+=j)}return(!is_number(e)||1>e)&&(e=1),e}function cf_getItemsAdjust(a,b,c,d){return cf_getItemAdjustMinMax(cf_getAdjust(a,b,c,d),b.items.visibleConf)}function cf_getItemAdjustMinMax(a,b){return is_number(b.min)&&b.min>a&&(a=b.min),is_number(b.max)&&a>b.max&&(a=b.max),1>a&&(a=1),a}function cf_getSynchArr(a){is_array(a)||(a=[[a]]),is_array(a[0])||(a=[a]);for(var b=0,c=a.length;c>b;b++)is_string(a[b][0])&&(a[b][0]=$(a[b][0])),is_boolean(a[b][1])||(a[b][1]=!0),is_boolean(a[b][2])||(a[b][2]=!0),is_number(a[b][3])||(a[b][3]=0);return a}function cf_getKeyCode(a){return"right"==a?39:"left"==a?37:"up"==a?38:"down"==a?40:-1}function cf_setCookie(a,b,c){if(a){var d=b.triggerHandler(cf_e("currentPosition",c));$.fn.carouFredSel.cookie.set(a,d)}}function cf_getCookie(a){var b=$.fn.carouFredSel.cookie.get(a);return""==b?0:b}function in_mapCss(a,b){for(var c={},d=0,e=b.length;e>d;d++)c[b[d]]=a.css(b[d]);return c}function in_complementItems(a,b,c,d){return is_object(a.visibleConf)||(a.visibleConf={}),is_object(a.sizesConf)||(a.sizesConf={}),0==a.start&&is_number(d)&&(a.start=d),is_object(a.visible)?(a.visibleConf.min=a.visible.min,a.visibleConf.max=a.visible.max,a.visible=!1):is_string(a.visible)?("variable"==a.visible?a.visibleConf.variable=!0:a.visibleConf.adjust=a.visible,a.visible=!1):is_function(a.visible)&&(a.visibleConf.adjust=a.visible,a.visible=!1),is_string(a.filter)||(a.filter=c.filter(":hidden").length>0?":visible":"*"),a[b.d.width]||(b.responsive?(debug(!0,"Set a "+b.d.width+" for the items!"),a[b.d.width]=ms_getTrueLargestSize(c,b,"outerWidth")):a[b.d.width]=ms_hasVariableSizes(c,b,"outerWidth")?"variable":c[b.d.outerWidth](!0)),a[b.d.height]||(a[b.d.height]=ms_hasVariableSizes(c,b,"outerHeight")?"variable":c[b.d.outerHeight](!0)),a.sizesConf.width=a.width,a.sizesConf.height=a.height,a}function in_complementVisibleItems(a,b){return"variable"==a.items[a.d.width]&&(a.items.visibleConf.variable=!0),a.items.visibleConf.variable||(is_number(a[a.d.width])?a.items.visible=Math.floor(a[a.d.width]/a.items[a.d.width]):(a.items.visible=Math.floor(b/a.items[a.d.width]),a[a.d.width]=a.items.visible*a.items[a.d.width],a.items.visibleConf.adjust||(a.align=!1)),("Infinity"==a.items.visible||1>a.items.visible)&&(debug(!0,'Not a valid number of visible items: Set to "variable".'),a.items.visibleConf.variable=!0)),a}function in_complementPrimarySize(a,b,c){return"auto"==a&&(a=ms_getTrueLargestSize(c,b,"outerWidth")),a}function in_complementSecondarySize(a,b,c){return"auto"==a&&(a=ms_getTrueLargestSize(c,b,"outerHeight")),a||(a=b.items[b.d.height]),a}function in_getAlignPadding(a,b){var c=cf_getAlignPadding(gi_getCurrentItems(b,a),a);return a.padding[a.d[1]]=c[1],a.padding[a.d[3]]=c[0],a}function in_getResponsiveValues(a,b){var d=cf_getItemAdjustMinMax(Math.ceil(a[a.d.width]/a.items[a.d.width]),a.items.visibleConf);d>b.length&&(d=b.length);var e=Math.floor(a[a.d.width]/d);return a.items.visible=d,a.items[a.d.width]=e,a[a.d.width]=d*e,a}function bt_pauseOnHoverConfig(a){if(is_string(a))var b=a.indexOf("immediate")>-1?!0:!1,c=a.indexOf("resume")>-1?!0:!1;else var b=c=!1;return[b,c]}function bt_mousesheelNumber(a){return is_number(a)?a:null}function is_null(a){return null===a}function is_undefined(a){return is_null(a)||a===void 0||""===a||"undefined"===a}function is_array(a){return a instanceof Array}function is_jquery(a){return a instanceof jQuery}function is_object(a){return(a instanceof Object||"object"==typeof a)&&!is_null(a)&&!is_jquery(a)&&!is_array(a)&&!is_function(a)}function is_number(a){return(a instanceof Number||"number"==typeof a)&&!isNaN(a)}function is_string(a){return(a instanceof String||"string"==typeof a)&&!is_undefined(a)&&!is_true(a)&&!is_false(a)}function is_function(a){return a instanceof Function||"function"==typeof a}function is_boolean(a){return a instanceof Boolean||"boolean"==typeof a||is_true(a)||is_false(a)}function is_true(a){return a===!0||"true"===a}function is_false(a){return a===!1||"false"===a}function is_percentage(a){return is_string(a)&&"%"==a.slice(-1)}function getTime(){return(new Date).getTime()}function deprecated(a,b){debug(!0,a+" is DEPRECATED, support for it will be removed. Use "+b+" instead.")}function debug(a,b){if(!is_undefined(window.console)&&!is_undefined(window.console.log)){if(is_object(a)){var c=" ("+a.selector+")";a=a.debug}else var c="";if(!a)return!1;b=is_string(b)?"carouFredSel"+c+": "+b:["carouFredSel"+c+":",b],window.console.log(b)}return!1}$.fn.carouFredSel||($.fn.caroufredsel=$.fn.carouFredSel=function(options,configs){if(0==this.length)return debug(!0,'No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){$(this).carouFredSel(options,configs)});var $cfs=this,$tt0=this[0],starting_position=!1;$cfs.data("_cfs_isCarousel")&&(starting_position=$cfs.triggerHandler("_cfs_triggerEvent","currentPosition"),$cfs.trigger("_cfs_triggerEvent",["destroy",!0]));var FN={};FN._init=function(a,b,c){a=go_getObject($tt0,a),a.items=go_getItemsObject($tt0,a.items),a.scroll=go_getScrollObject($tt0,a.scroll),a.auto=go_getAutoObject($tt0,a.auto),a.prev=go_getPrevNextObject($tt0,a.prev),a.next=go_getPrevNextObject($tt0,a.next),a.pagination=go_getPaginationObject($tt0,a.pagination),a.swipe=go_getSwipeObject($tt0,a.swipe),a.mousewheel=go_getMousewheelObject($tt0,a.mousewheel),b&&(opts_orig=$.extend(!0,{},$.fn.carouFredSel.defaults,a)),opts=$.extend(!0,{},$.fn.carouFredSel.defaults,a),opts.d=cf_getDimensions(opts),crsl.direction="up"==opts.direction||"left"==opts.direction?"next":"prev";var d=$cfs.children(),e=ms_getParentSize($wrp,opts,"width");if(is_true(opts.cookie)&&(opts.cookie="caroufredsel_cookie_"+conf.serialNumber),opts.maxDimension=ms_getMaxDimension(opts,e),opts.items=in_complementItems(opts.items,opts,d,c),opts[opts.d.width]=in_complementPrimarySize(opts[opts.d.width],opts,d),opts[opts.d.height]=in_complementSecondarySize(opts[opts.d.height],opts,d),opts.responsive&&(is_percentage(opts[opts.d.width])||(opts[opts.d.width]="100%")),is_percentage(opts[opts.d.width])&&(crsl.upDateOnWindowResize=!0,crsl.primarySizePercentage=opts[opts.d.width],opts[opts.d.width]=ms_getPercentage(e,crsl.primarySizePercentage),opts.items.visible||(opts.items.visibleConf.variable=!0)),opts.responsive?(opts.usePadding=!1,opts.padding=[0,0,0,0],opts.align=!1,opts.items.visibleConf.variable=!1):(opts.items.visible||(opts=in_complementVisibleItems(opts,e)),opts[opts.d.width]||(!opts.items.visibleConf.variable&&is_number(opts.items[opts.d.width])&&"*"==opts.items.filter?(opts[opts.d.width]=opts.items.visible*opts.items[opts.d.width],opts.align=!1):opts[opts.d.width]="variable"),is_undefined(opts.align)&&(opts.align=is_number(opts[opts.d.width])?"center":!1),opts.items.visibleConf.variable&&(opts.items.visible=gn_getVisibleItemsNext(d,opts,0))),"*"==opts.items.filter||opts.items.visibleConf.variable||(opts.items.visibleConf.org=opts.items.visible,opts.items.visible=gn_getVisibleItemsNextFilter(d,opts,0)),opts.items.visible=cf_getItemsAdjust(opts.items.visible,opts,opts.items.visibleConf.adjust,$tt0),opts.items.visibleConf.old=opts.items.visible,opts.responsive)opts.items.visibleConf.min||(opts.items.visibleConf.min=opts.items.visible),opts.items.visibleConf.max||(opts.items.visibleConf.max=opts.items.visible),opts=in_getResponsiveValues(opts,d,e);else switch(opts.padding=cf_getPadding(opts.padding),"top"==opts.align?opts.align="left":"bottom"==opts.align&&(opts.align="right"),opts.align){case"center":case"left":case"right":"variable"!=opts[opts.d.width]&&(opts=in_getAlignPadding(opts,d),opts.usePadding=!0);break;default:opts.align=!1,opts.usePadding=0==opts.padding[0]&&0==opts.padding[1]&&0==opts.padding[2]&&0==opts.padding[3]?!1:!0}is_number(opts.scroll.duration)||(opts.scroll.duration=500),is_undefined(opts.scroll.items)&&(opts.scroll.items=opts.responsive||opts.items.visibleConf.variable||"*"!=opts.items.filter?"visible":opts.items.visible),opts.auto=$.extend(!0,{},opts.scroll,opts.auto),opts.prev=$.extend(!0,{},opts.scroll,opts.prev),opts.next=$.extend(!0,{},opts.scroll,opts.next),opts.pagination=$.extend(!0,{},opts.scroll,opts.pagination),opts.auto=go_complementAutoObject($tt0,opts.auto),opts.prev=go_complementPrevNextObject($tt0,opts.prev),opts.next=go_complementPrevNextObject($tt0,opts.next),opts.pagination=go_complementPaginationObject($tt0,opts.pagination),opts.swipe=go_complementSwipeObject($tt0,opts.swipe),opts.mousewheel=go_complementMousewheelObject($tt0,opts.mousewheel),opts.synchronise&&(opts.synchronise=cf_getSynchArr(opts.synchronise)),opts.auto.onPauseStart&&(opts.auto.onTimeoutStart=opts.auto.onPauseStart,deprecated("auto.onPauseStart","auto.onTimeoutStart")),opts.auto.onPausePause&&(opts.auto.onTimeoutPause=opts.auto.onPausePause,deprecated("auto.onPausePause","auto.onTimeoutPause")),opts.auto.onPauseEnd&&(opts.auto.onTimeoutEnd=opts.auto.onPauseEnd,deprecated("auto.onPauseEnd","auto.onTimeoutEnd")),opts.auto.pauseDuration&&(opts.auto.timeoutDuration=opts.auto.pauseDuration,deprecated("auto.pauseDuration","auto.timeoutDuration"))},FN._build=function(){$cfs.data("_cfs_isCarousel",!0);var a=$cfs.children(),b=in_mapCss($cfs,["textAlign","float","position","top","right","bottom","left","zIndex","width","height","marginTop","marginRight","marginBottom","marginLeft"]),c="relative";switch(b.position){case"absolute":case"fixed":c=b.position}"parent"==conf.wrapper?sz_storeOrigCss($wrp):$wrp.css(b),$wrp.css({overflow:"hidden",position:c}),sz_storeOrigCss($cfs),$cfs.data("_cfs_origCssZindex",b.zIndex),$cfs.css({textAlign:"left","float":"none",position:"absolute",top:0,right:"auto",bottom:"auto",left:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0}),sz_storeMargin(a,opts),sz_storeOrigCss(a),opts.responsive&&sz_setResponsiveSizes(opts,a)},FN._bind_events=function(){FN._unbind_events(),$cfs.bind(cf_e("stop",conf),function(a,b){return a.stopPropagation(),crsl.isStopped||opts.auto.button&&opts.auto.button.addClass(cf_c("stopped",conf)),crsl.isStopped=!0,opts.auto.play&&(opts.auto.play=!1,$cfs.trigger(cf_e("pause",conf),b)),!0}),$cfs.bind(cf_e("finish",conf),function(a){return a.stopPropagation(),crsl.isScrolling&&sc_stopScroll(scrl),!0}),$cfs.bind(cf_e("pause",conf),function(a,b,c){if(a.stopPropagation(),tmrs=sc_clearTimers(tmrs),b&&crsl.isScrolling){scrl.isStopped=!0;var d=getTime()-scrl.startTime;scrl.duration-=d,scrl.pre&&(scrl.pre.duration-=d),scrl.post&&(scrl.post.duration-=d),sc_stopScroll(scrl,!1)}if(crsl.isPaused||crsl.isScrolling||c&&(tmrs.timePassed+=getTime()-tmrs.startTime),crsl.isPaused||opts.auto.button&&opts.auto.button.addClass(cf_c("paused",conf)),crsl.isPaused=!0,opts.auto.onTimeoutPause){var e=opts.auto.timeoutDuration-tmrs.timePassed,f=100-Math.ceil(100*e/opts.auto.timeoutDuration);opts.auto.onTimeoutPause.call($tt0,f,e)}return!0}),$cfs.bind(cf_e("play",conf),function(a,b,c,d){a.stopPropagation(),tmrs=sc_clearTimers(tmrs);var e=[b,c,d],f=["string","number","boolean"],g=cf_sortParams(e,f);if(b=g[0],c=g[1],d=g[2],"prev"!=b&&"next"!=b&&(b=crsl.direction),is_number(c)||(c=0),is_boolean(d)||(d=!1),d&&(crsl.isStopped=!1,opts.auto.play=!0),!opts.auto.play)return a.stopImmediatePropagation(),debug(conf,"Carousel stopped: Not scrolling.");crsl.isPaused&&opts.auto.button&&(opts.auto.button.removeClass(cf_c("stopped",conf)),opts.auto.button.removeClass(cf_c("paused",conf))),crsl.isPaused=!1,tmrs.startTime=getTime();var h=opts.auto.timeoutDuration+c;return dur2=h-tmrs.timePassed,perc=100-Math.ceil(100*dur2/h),opts.auto.progress&&(tmrs.progress=setInterval(function(){var a=getTime()-tmrs.startTime+tmrs.timePassed,b=Math.ceil(100*a/h);opts.auto.progress.updater.call(opts.auto.progress.bar[0],b)},opts.auto.progress.interval)),tmrs.auto=setTimeout(function(){opts.auto.progress&&opts.auto.progress.updater.call(opts.auto.progress.bar[0],100),opts.auto.onTimeoutEnd&&opts.auto.onTimeoutEnd.call($tt0,perc,dur2),crsl.isScrolling?$cfs.trigger(cf_e("play",conf),b):$cfs.trigger(cf_e(b,conf),opts.auto)},dur2),opts.auto.onTimeoutStart&&opts.auto.onTimeoutStart.call($tt0,perc,dur2),!0}),$cfs.bind(cf_e("resume",conf),function(a){return a.stopPropagation(),scrl.isStopped?(scrl.isStopped=!1,crsl.isPaused=!1,crsl.isScrolling=!0,scrl.startTime=getTime(),sc_startScroll(scrl,conf)):$cfs.trigger(cf_e("play",conf)),!0}),$cfs.bind(cf_e("prev",conf)+" "+cf_e("next",conf),function(a,b,c,d,e){if(a.stopPropagation(),crsl.isStopped||$cfs.is(":hidden"))return a.stopImmediatePropagation(),debug(conf,"Carousel stopped or hidden: Not scrolling.");var f=is_number(opts.items.minimum)?opts.items.minimum:opts.items.visible+1;if(f>itms.total)return a.stopImmediatePropagation(),debug(conf,"Not enough items ("+itms.total+" total, "+f+" needed): Not scrolling.");var g=[b,c,d,e],h=["object","number/string","function","boolean"],i=cf_sortParams(g,h);b=i[0],c=i[1],d=i[2],e=i[3];var j=a.type.slice(conf.events.prefix.length);if(is_object(b)||(b={}),is_function(d)&&(b.onAfter=d),is_boolean(e)&&(b.queue=e),b=$.extend(!0,{},opts[j],b),b.conditions&&!b.conditions.call($tt0,j))return a.stopImmediatePropagation(),debug(conf,'Callback "conditions" returned false.');if(!is_number(c)){if("*"!=opts.items.filter)c="visible";else for(var k=[c,b.items,opts[j].items],i=0,l=k.length;l>i;i++)if(is_number(k[i])||"page"==k[i]||"visible"==k[i]){c=k[i];break}switch(c){case"page":return a.stopImmediatePropagation(),$cfs.triggerHandler(cf_e(j+"Page",conf),[b,d]);case"visible":opts.items.visibleConf.variable||"*"!=opts.items.filter||(c=opts.items.visible)}}if(scrl.isStopped)return $cfs.trigger(cf_e("resume",conf)),$cfs.trigger(cf_e("queue",conf),[j,[b,c,d]]),a.stopImmediatePropagation(),debug(conf,"Carousel resumed scrolling.");if(b.duration>0&&crsl.isScrolling)return b.queue&&("last"==b.queue&&(queu=[]),("first"!=b.queue||0==queu.length)&&$cfs.trigger(cf_e("queue",conf),[j,[b,c,d]])),a.stopImmediatePropagation(),debug(conf,"Carousel currently scrolling.");if(tmrs.timePassed=0,$cfs.trigger(cf_e("slide_"+j,conf),[b,c]),opts.synchronise)for(var m=opts.synchronise,n=[b,c],o=0,l=m.length;l>o;o++){var p=j;m[o][2]||(p="prev"==p?"next":"prev"),m[o][1]||(n[0]=m[o][0].triggerHandler("_cfs_triggerEvent",["configuration",p])),n[1]=c+m[o][3],m[o][0].trigger("_cfs_triggerEvent",["slide_"+p,n])}return!0}),$cfs.bind(cf_e("slide_prev",conf),function(a,b,c){a.stopPropagation();var d=$cfs.children();if(!opts.circular&&0==itms.first)return opts.infinite&&$cfs.trigger(cf_e("next",conf),itms.total-1),a.stopImmediatePropagation();if(sz_resetMargin(d,opts),!is_number(c)){if(opts.items.visibleConf.variable)c=gn_getVisibleItemsPrev(d,opts,itms.total-1);else if("*"!=opts.items.filter){var e=is_number(b.items)?b.items:gn_getVisibleOrg($cfs,opts);c=gn_getScrollItemsPrevFilter(d,opts,itms.total-1,e)}else c=opts.items.visible;c=cf_getAdjust(c,opts,b.items,$tt0)}if(opts.circular||itms.total-c=opts.items.visible+c&&itms.total>c&&(c++,f=cf_getItemsAdjust(gn_getVisibleItemsNext(d,opts,itms.total-c),opts,opts.items.visibleConf.adjust,$tt0)),opts.items.visible=f}else if("*"!=opts.items.filter){var f=gn_getVisibleItemsNextFilter(d,opts,itms.total-c);opts.items.visible=cf_getItemsAdjust(f,opts,opts.items.visibleConf.adjust,$tt0)}if(sz_resetMargin(d,opts,!0),0==c)return a.stopImmediatePropagation(),debug(conf,"0 items to scroll: Not scrolling.");for(debug(conf,"Scrolling "+c+" items backward."),itms.first+=c;itms.first>=itms.total;)itms.first-=itms.total;opts.circular||(0==itms.first&&b.onEnd&&b.onEnd.call($tt0,"prev"),opts.infinite||nv_enableNavi(opts,itms.first,conf)),$cfs.children().slice(itms.total-c,itms.total).prependTo($cfs),itms.totall?opts.padding[opts.d[3]]:0,p=!1,q=$();if(c>opts.items.visible&&(q=d.slice(opts.items.visibleConf.old,c),"directscroll"==b.fx)){var r=opts.items[opts.d.width];p=q,i=k,sc_hideHiddenItems(p),opts.items[opts.d.width]="variable"}var s=!1,t=ms_getTotalSize(d.slice(0,c),opts,"width"),u=cf_mapWrapperSizes(ms_getSizes(h,opts,!0),opts,!opts.usePadding),v=0,w={},x={},y={},z={},A={},B={},C={},D=sc_getDuration(b,opts,c,t);switch(b.fx){case"cover":case"cover-fade":v=ms_getTotalSize(d.slice(0,opts.items.visible),opts,"width")}p&&(opts.items[opts.d.width]=r),sz_resetMargin(d,opts,!0),m>=0&&sz_resetMargin(j,opts,opts.padding[opts.d[1]]),l>=0&&sz_resetMargin(i,opts,opts.padding[opts.d[3]]),opts.align&&(opts.padding[opts.d[1]]=m,opts.padding[opts.d[3]]=l),B[opts.d.left]=-(t-o),C[opts.d.left]=-(v-o),x[opts.d.left]=u[opts.d.width];var E=function(){},F=function(){},G=function(){},H=function(){},I=function(){},J=function(){},K=function(){},L=function(){},M=function(){},N=function(){},O=function(){};switch(b.fx){case"crossfade":case"cover":case"cover-fade":case"uncover":case"uncover-fade":s=$cfs.clone(!0).appendTo($wrp)}switch(b.fx){case"crossfade":case"uncover":case"uncover-fade":s.children().slice(0,c).remove(),s.children().slice(opts.items.visibleConf.old).remove();break;case"cover":case"cover-fade":s.children().slice(opts.items.visible).remove(),s.css(C)}if($cfs.css(B),scrl=sc_setScroll(D,b.easing,conf),w[opts.d.left]=opts.usePadding?opts.padding[opts.d[3]]:0,("variable"==opts[opts.d.width]||"variable"==opts[opts.d.height])&&(E=function(){$wrp.css(u)},F=function(){scrl.anims.push([$wrp,u])}),opts.usePadding){switch(k.not(i).length&&(y[opts.d.marginRight]=i.data("_cfs_origCssMargin"),0>l?i.css(y):(K=function(){i.css(y)},L=function(){scrl.anims.push([i,y])})),b.fx){case"cover":case"cover-fade":s.children().eq(c-1).css(y)}k.not(j).length&&(z[opts.d.marginRight]=j.data("_cfs_origCssMargin"),G=function(){j.css(z)},H=function(){scrl.anims.push([j,z])}),m>=0&&(A[opts.d.marginRight]=k.data("_cfs_origCssMargin")+opts.padding[opts.d[1]],I=function(){k.css(A)},J=function(){scrl.anims.push([k,A])})}O=function(){$cfs.css(w)};var P=opts.items.visible+c-itms.total;N=function(){if(P>0&&($cfs.children().slice(itms.total).remove(),g=$($cfs.children().slice(itms.total-(opts.items.visible-P)).get().concat($cfs.children().slice(0,P).get()))),sc_showHiddenItems(p),opts.usePadding){var a=$cfs.children().eq(opts.items.visible+c-1);a.css(opts.d.marginRight,a.data("_cfs_origCssMargin"))}};var Q=sc_mapCallbackArguments(g,q,h,c,"prev",D,u);switch(M=function(){sc_afterScroll($cfs,s,b),crsl.isScrolling=!1,clbk.onAfter=sc_fireCallbacks($tt0,b,"onAfter",Q,clbk),queu=sc_fireQueue($cfs,queu,conf),crsl.isPaused||$cfs.trigger(cf_e("play",conf))},crsl.isScrolling=!0,tmrs=sc_clearTimers(tmrs),clbk.onBefore=sc_fireCallbacks($tt0,b,"onBefore",Q,clbk),b.fx){case"none":$cfs.css(w),E(),G(),I(),K(),O(),N(),M();break;case"fade":scrl.anims.push([$cfs,{opacity:0},function(){E(),G(),I(),K(),O(),N(),scrl=sc_setScroll(D,b.easing,conf),scrl.anims.push([$cfs,{opacity:1},M]),sc_startScroll(scrl,conf)}]);break;case"crossfade":$cfs.css({opacity:0}),scrl.anims.push([s,{opacity:0}]),scrl.anims.push([$cfs,{opacity:1},M]),F(),G(),I(),K(),O(),N();break;case"cover":scrl.anims.push([s,w,function(){G(),I(),K(),O(),N(),M()}]),F();break;case"cover-fade":scrl.anims.push([$cfs,{opacity:0}]),scrl.anims.push([s,w,function(){G(),I(),K(),O(),N(),M()}]),F();break;case"uncover":scrl.anims.push([s,x,M]),F(),G(),I(),K(),O(),N();break;case"uncover-fade":$cfs.css({opacity:0}),scrl.anims.push([$cfs,{opacity:1}]),scrl.anims.push([s,x,M]),F(),G(),I(),K(),O(),N();break;default:scrl.anims.push([$cfs,w,function(){N(),M()}]),F(),H(),J(),L()}return sc_startScroll(scrl,conf),cf_setCookie(opts.cookie,$cfs,conf),$cfs.trigger(cf_e("updatePageStatus",conf),[!1,u]),!0 //}),$cfs.bind(cf_e("slide_next",conf),function(a,b,c){a.stopPropagation();var d=$cfs.children();if(!opts.circular&&itms.first==opts.items.visible)return opts.infinite&&$cfs.trigger(cf_e("prev",conf),itms.total-1),a.stopImmediatePropagation();if(sz_resetMargin(d,opts),!is_number(c)){if("*"!=opts.items.filter){var e=is_number(b.items)?b.items:gn_getVisibleOrg($cfs,opts);c=gn_getScrollItemsNextFilter(d,opts,0,e)}else c=opts.items.visible;c=cf_getAdjust(c,opts,b.items,$tt0)}var f=0==itms.first?itms.total:itms.first;if(!opts.circular){if(opts.items.visibleConf.variable)var g=gn_getVisibleItemsNext(d,opts,c),e=gn_getVisibleItemsPrev(d,opts,f-1);else var g=opts.items.visible,e=opts.items.visible;c+g>f&&(c=f-e)}if(opts.items.visibleConf.old=opts.items.visible,opts.items.visibleConf.variable){for(var g=cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(d,opts,c,f),opts,opts.items.visibleConf.adjust,$tt0);opts.items.visible-c>=g&&itms.total>c;)c++,g=cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(d,opts,c,f),opts,opts.items.visibleConf.adjust,$tt0);opts.items.visible=g}else if("*"!=opts.items.filter){var g=gn_getVisibleItemsNextFilter(d,opts,c);opts.items.visible=cf_getItemsAdjust(g,opts,opts.items.visibleConf.adjust,$tt0)}if(sz_resetMargin(d,opts,!0),0==c)return a.stopImmediatePropagation(),debug(conf,"0 items to scroll: Not scrolling.");for(debug(conf,"Scrolling "+c+" items forward."),itms.first-=c;0>itms.first;)itms.first+=itms.total;opts.circular||(itms.first==opts.items.visible&&b.onEnd&&b.onEnd.call($tt0,"next"),opts.infinite||nv_enableNavi(opts,itms.first,conf)),itms.totalopts.items.visibleConf.old&&(q=d.slice(opts.items.visibleConf.old,c),"directscroll"==b.fx)){var r=opts.items[opts.d.width];p=q,j=k,sc_hideHiddenItems(p),opts.items[opts.d.width]="variable"}var s=!1,t=ms_getTotalSize(d.slice(0,c),opts,"width"),u=cf_mapWrapperSizes(ms_getSizes(i,opts,!0),opts,!opts.usePadding),v=0,w={},x={},y={},z={},A={},B=sc_getDuration(b,opts,c,t);switch(b.fx){case"uncover":case"uncover-fade":v=ms_getTotalSize(d.slice(0,opts.items.visibleConf.old),opts,"width")}p&&(opts.items[opts.d.width]=r),opts.align&&0>opts.padding[opts.d[1]]&&(opts.padding[opts.d[1]]=0),sz_resetMargin(d,opts,!0),sz_resetMargin(k,opts,opts.padding[opts.d[1]]),opts.align&&(opts.padding[opts.d[1]]=n,opts.padding[opts.d[3]]=m),A[opts.d.left]=opts.usePadding?opts.padding[opts.d[3]]:0;var C=function(){},D=function(){},E=function(){},F=function(){},G=function(){},H=function(){},I=function(){},J=function(){},K=function(){};switch(b.fx){case"crossfade":case"cover":case"cover-fade":case"uncover":case"uncover-fade":s=$cfs.clone(!0).appendTo($wrp),s.children().slice(opts.items.visibleConf.old).remove()}switch(b.fx){case"crossfade":case"cover":case"cover-fade":$cfs.css("zIndex",1),s.css("zIndex",0)}if(scrl=sc_setScroll(B,b.easing,conf),w[opts.d.left]=-t,x[opts.d.left]=-v,0>m&&(w[opts.d.left]+=m),("variable"==opts[opts.d.width]||"variable"==opts[opts.d.height])&&(C=function(){$wrp.css(u)},D=function(){scrl.anims.push([$wrp,u])}),opts.usePadding){var L=l.data("_cfs_origCssMargin");n>=0&&(L+=opts.padding[opts.d[1]]),l.css(opts.d.marginRight,L),j.not(k).length&&(z[opts.d.marginRight]=k.data("_cfs_origCssMargin")),E=function(){k.css(z)},F=function(){scrl.anims.push([k,z])};var M=j.data("_cfs_origCssMargin");m>0&&(M+=opts.padding[opts.d[3]]),y[opts.d.marginRight]=M,G=function(){j.css(y)},H=function(){scrl.anims.push([j,y])}}K=function(){$cfs.css(A)};var N=opts.items.visible+c-itms.total;J=function(){N>0&&$cfs.children().slice(itms.total).remove();var a=$cfs.children().slice(0,c).appendTo($cfs).last();if(N>0&&(i=gi_getCurrentItems(d,opts)),sc_showHiddenItems(p),opts.usePadding){if(itms.total=b?"next":"prev":0==itms.first||itms.first>b?"next":"prev"),"prev"==f&&(b=itms.total-b),$cfs.trigger(cf_e(f,conf),[e,b,g]),!0)}),$cfs.bind(cf_e("prevPage",conf),function(a,b,c){a.stopPropagation();var d=$cfs.triggerHandler(cf_e("currentPage",conf));return $cfs.triggerHandler(cf_e("slideToPage",conf),[d-1,b,"prev",c])}),$cfs.bind(cf_e("nextPage",conf),function(a,b,c){a.stopPropagation();var d=$cfs.triggerHandler(cf_e("currentPage",conf));return $cfs.triggerHandler(cf_e("slideToPage",conf),[d+1,b,"next",c])}),$cfs.bind(cf_e("slideToPage",conf),function(a,b,c,d,e){a.stopPropagation(),is_number(b)||(b=$cfs.triggerHandler(cf_e("currentPage",conf)));var f=opts.pagination.items||opts.items.visible,g=Math.ceil(itms.total/f)-1;return 0>b&&(b=g),b>g&&(b=0),$cfs.triggerHandler(cf_e("slideTo",conf),[b*f,0,!0,c,d,e])}),$cfs.bind(cf_e("jumpToStart",conf),function(a,b){if(a.stopPropagation(),b=b?gn_getItemIndex(b,0,!0,itms,$cfs):0,b+=itms.first,0!=b){if(itms.total>0)for(;b>itms.total;)b-=itms.total;$cfs.prepend($cfs.children().slice(b,itms.total))}return!0}),$cfs.bind(cf_e("synchronise",conf),function(a,b){if(a.stopPropagation(),b)b=cf_getSynchArr(b);else{if(!opts.synchronise)return debug(conf,"No carousel to synchronise.");b=opts.synchronise}for(var c=$cfs.triggerHandler(cf_e("currentPosition",conf)),d=!0,e=0,f=b.length;f>e;e++)b[e][0].triggerHandler(cf_e("slideTo",conf),[c,b[e][3],!0])||(d=!1);return d}),$cfs.bind(cf_e("queue",conf),function(a,b,c){return a.stopPropagation(),is_function(b)?b.call($tt0,queu):is_array(b)?queu=b:is_undefined(b)||queu.push([b,c]),queu}),$cfs.bind(cf_e("insertItem",conf),function(a,b,c,d,e){a.stopPropagation();var f=[b,c,d,e],g=["string/object","string/number/object","boolean","number"],h=cf_sortParams(f,g);if(b=h[0],c=h[1],d=h[2],e=h[3],is_object(b)&&!is_jquery(b)?b=$(b):is_string(b)&&(b=$(b)),!is_jquery(b)||0==b.length)return debug(conf,"Not a valid object.");is_undefined(c)&&(c="end"),sz_storeMargin(b,opts),sz_storeOrigCss(b);var i=c,j="before";"end"==c?d?(0==itms.first?(c=itms.total-1,j="after"):(c=itms.first,itms.first+=b.length),0>c&&(c=0)):(c=itms.total-1,j="after"):c=gn_getItemIndex(c,e,d,itms,$cfs);var k=$cfs.children().eq(c);return k.length?k[j](b):(debug(conf,"Correct insert-position not found! Appending item to the end."),$cfs.append(b)),"end"==i||d||itms.first>c&&(itms.first+=b.length),itms.total=$cfs.children().length,itms.first>=itms.total&&(itms.first-=itms.total),$cfs.trigger(cf_e("updateSizes",conf)),$cfs.trigger(cf_e("linkAnchors",conf)),!0}),$cfs.bind(cf_e("removeItem",conf),function(a,b,c,d){a.stopPropagation();var e=[b,c,d],f=["string/number/object","boolean","number"],g=cf_sortParams(e,f);if(b=g[0],c=g[1],d=g[2],b instanceof $&&b.length>1)return i=$(),b.each(function(){var e=$cfs.trigger(cf_e("removeItem",conf),[$(this),c,d]);e&&(i=i.add(e))}),i;if(is_undefined(b)||"end"==b)i=$cfs.children().last();else{b=gn_getItemIndex(b,d,c,itms,$cfs);var i=$cfs.children().eq(b);i.length&&itms.first>b&&(itms.first-=i.length)}return i&&i.length&&(i.detach(),itms.total=$cfs.children().length,$cfs.trigger(cf_e("updateSizes",conf))),i}),$cfs.bind(cf_e("onBefore",conf)+" "+cf_e("onAfter",conf),function(a,b){a.stopPropagation();var c=a.type.slice(conf.events.prefix.length);return is_array(b)&&(clbk[c]=b),is_function(b)&&clbk[c].push(b),clbk[c]}),$cfs.bind(cf_e("currentPosition",conf),function(a,b){if(a.stopPropagation(),0==itms.first)var c=0;else var c=itms.total-itms.first;return is_function(b)&&b.call($tt0,c),c}),$cfs.bind(cf_e("currentPage",conf),function(a,b){a.stopPropagation();var e,c=opts.pagination.items||opts.items.visible,d=Math.ceil(itms.total/c-1);return e=0==itms.first?0:itms.firste&&(e=0),e>d&&(e=d),is_function(b)&&b.call($tt0,e),e}),$cfs.bind(cf_e("currentVisible",conf),function(a,b){a.stopPropagation();var c=gi_getCurrentItems($cfs.children(),opts);return is_function(b)&&b.call($tt0,c),c}),$cfs.bind(cf_e("slice",conf),function(a,b,c,d){if(a.stopPropagation(),0==itms.total)return!1;var e=[b,c,d],f=["number","number","function"],g=cf_sortParams(e,f);if(b=is_number(g[0])?g[0]:0,c=is_number(g[1])?g[1]:itms.total,d=g[2],b+=itms.first,c+=itms.first,items.total>0){for(;b>itms.total;)b-=itms.total;for(;c>itms.total;)c-=itms.total;for(;0>b;)b+=itms.total;for(;0>c;)c+=itms.total}var i,h=$cfs.children();return i=c>b?h.slice(b,c):$(h.slice(b,itms.total).get().concat(h.slice(0,c).get())),is_function(d)&&d.call($tt0,i),i}),$cfs.bind(cf_e("isPaused",conf)+" "+cf_e("isStopped",conf)+" "+cf_e("isScrolling",conf),function(a,b){a.stopPropagation();var c=a.type.slice(conf.events.prefix.length),d=crsl[c];return is_function(b)&&b.call($tt0,d),d}),$cfs.bind(cf_e("configuration",conf),function(e,a,b,c){e.stopPropagation();var reInit=!1;if(is_function(a))a.call($tt0,opts);else if(is_object(a))opts_orig=$.extend(!0,{},opts_orig,a),b!==!1?reInit=!0:opts=$.extend(!0,{},opts,a);else if(!is_undefined(a))if(is_function(b)){var val=eval("opts."+a);is_undefined(val)&&(val=""),b.call($tt0,val)}else{if(is_undefined(b))return eval("opts."+a);"boolean"!=typeof c&&(c=!0),eval("opts_orig."+a+" = b"),c!==!1?reInit=!0:eval("opts."+a+" = b")}if(reInit){sz_resetMargin($cfs.children(),opts),FN._init(opts_orig),FN._bind_buttons();var sz=sz_setSizes($cfs,opts);$cfs.trigger(cf_e("updatePageStatus",conf),[!0,sz])}return opts}),$cfs.bind(cf_e("linkAnchors",conf),function(a,b,c){return a.stopPropagation(),is_undefined(b)?b=$("body"):is_string(b)&&(b=$(b)),is_jquery(b)&&0!=b.length?(is_string(c)||(c="a.caroufredsel"),b.find(c).each(function(){var a=this.hash||"";a.length>0&&-1!=$cfs.children().index($(a))&&$(this).unbind("click").click(function(b){b.preventDefault(),$cfs.trigger(cf_e("slideTo",conf),a)})}),!0):debug(conf,"Not a valid object.")}),$cfs.bind(cf_e("updatePageStatus",conf),function(a,b){if(a.stopPropagation(),opts.pagination.container){var d=opts.pagination.items||opts.items.visible,e=Math.ceil(itms.total/d);b&&(opts.pagination.anchorBuilder&&(opts.pagination.container.children().remove(),opts.pagination.container.each(function(){for(var a=0;e>a;a++){var b=$cfs.children().eq(gn_getItemIndex(a*d,0,!0,itms,$cfs));$(this).append(opts.pagination.anchorBuilder.call(b[0],a+1))}})),opts.pagination.container.each(function(){$(this).children().unbind(opts.pagination.event).each(function(a){$(this).bind(opts.pagination.event,function(b){b.preventDefault(),$cfs.trigger(cf_e("slideTo",conf),[a*d,-opts.pagination.deviation,!0,opts.pagination])})})}));var f=$cfs.triggerHandler(cf_e("currentPage",conf))+opts.pagination.deviation;return f>=e&&(f=0),0>f&&(f=e-1),opts.pagination.container.each(function(){$(this).children().removeClass(cf_c("selected",conf)).eq(f).addClass(cf_c("selected",conf))}),!0}}),$cfs.bind(cf_e("updateSizes",conf),function(){var b=opts.items.visible,c=$cfs.children(),d=ms_getParentSize($wrp,opts,"width");if(itms.total=c.length,crsl.primarySizePercentage?(opts.maxDimension=d,opts[opts.d.width]=ms_getPercentage(d,crsl.primarySizePercentage)):opts.maxDimension=ms_getMaxDimension(opts,d),opts.responsive?(opts.items.width=opts.items.sizesConf.width,opts.items.height=opts.items.sizesConf.height,opts=in_getResponsiveValues(opts,c,d),b=opts.items.visible,sz_setResponsiveSizes(opts,c)):opts.items.visibleConf.variable?b=gn_getVisibleItemsNext(c,opts,0):"*"!=opts.items.filter&&(b=gn_getVisibleItemsNextFilter(c,opts,0)),!opts.circular&&0!=itms.first&&b>itms.first){if(opts.items.visibleConf.variable)var e=gn_getVisibleItemsPrev(c,opts,itms.first)-itms.first;else if("*"!=opts.items.filter)var e=gn_getVisibleItemsPrevFilter(c,opts,itms.first)-itms.first;else var e=opts.items.visible-itms.first;debug(conf,"Preventing non-circular: sliding "+e+" items backward."),$cfs.trigger(cf_e("prev",conf),e)}opts.items.visible=cf_getItemsAdjust(b,opts,opts.items.visibleConf.adjust,$tt0),opts.items.visibleConf.old=opts.items.visible,opts=in_getAlignPadding(opts,c);var f=sz_setSizes($cfs,opts);return $cfs.trigger(cf_e("updatePageStatus",conf),[!0,f]),nv_showNavi(opts,itms.total,conf),nv_enableNavi(opts,itms.first,conf),f}),$cfs.bind(cf_e("destroy",conf),function(a,b){return a.stopPropagation(),tmrs=sc_clearTimers(tmrs),$cfs.data("_cfs_isCarousel",!1),$cfs.trigger(cf_e("finish",conf)),b&&$cfs.trigger(cf_e("jumpToStart",conf)),sz_restoreOrigCss($cfs.children()),sz_restoreOrigCss($cfs),FN._unbind_events(),FN._unbind_buttons(),"parent"==conf.wrapper?sz_restoreOrigCss($wrp):$wrp.replaceWith($cfs),!0}),$cfs.bind(cf_e("debug",conf),function(){return debug(conf,"Carousel width: "+opts.width),debug(conf,"Carousel height: "+opts.height),debug(conf,"Item widths: "+opts.items.width),debug(conf,"Item heights: "+opts.items.height),debug(conf,"Number of items visible: "+opts.items.visible),opts.auto.play&&debug(conf,"Number of items scrolled automatically: "+opts.auto.items),opts.prev.button&&debug(conf,"Number of items scrolled backward: "+opts.prev.items),opts.next.button&&debug(conf,"Number of items scrolled forward: "+opts.next.items),conf.debug}),$cfs.bind("_cfs_triggerEvent",function(a,b,c){return a.stopPropagation(),$cfs.triggerHandler(cf_e(b,conf),c)})},FN._unbind_events=function(){$cfs.unbind(cf_e("",conf)),$cfs.unbind(cf_e("",conf,!1)),$cfs.unbind("_cfs_triggerEvent")},FN._bind_buttons=function(){if(FN._unbind_buttons(),nv_showNavi(opts,itms.total,conf),nv_enableNavi(opts,itms.first,conf),opts.auto.pauseOnHover){var a=bt_pauseOnHoverConfig(opts.auto.pauseOnHover);$wrp.bind(cf_e("mouseenter",conf,!1),function(){$cfs.trigger(cf_e("pause",conf),a)}).bind(cf_e("mouseleave",conf,!1),function(){$cfs.trigger(cf_e("resume",conf))})}if(opts.auto.button&&opts.auto.button.bind(cf_e(opts.auto.event,conf,!1),function(a){a.preventDefault();var b=!1,c=null;crsl.isPaused?b="play":opts.auto.pauseOnEvent&&(b="pause",c=bt_pauseOnHoverConfig(opts.auto.pauseOnEvent)),b&&$cfs.trigger(cf_e(b,conf),c)}),opts.prev.button&&(opts.prev.button.bind(cf_e(opts.prev.event,conf,!1),function(a){a.preventDefault(),$cfs.trigger(cf_e("prev",conf))}),opts.prev.pauseOnHover)){var a=bt_pauseOnHoverConfig(opts.prev.pauseOnHover);opts.prev.button.bind(cf_e("mouseenter",conf,!1),function(){$cfs.trigger(cf_e("pause",conf),a)}).bind(cf_e("mouseleave",conf,!1),function(){$cfs.trigger(cf_e("resume",conf))})}if(opts.next.button&&(opts.next.button.bind(cf_e(opts.next.event,conf,!1),function(a){a.preventDefault(),$cfs.trigger(cf_e("next",conf))}),opts.next.pauseOnHover)){var a=bt_pauseOnHoverConfig(opts.next.pauseOnHover);opts.next.button.bind(cf_e("mouseenter",conf,!1),function(){$cfs.trigger(cf_e("pause",conf),a)}).bind(cf_e("mouseleave",conf,!1),function(){$cfs.trigger(cf_e("resume",conf))})}if(opts.pagination.container&&opts.pagination.pauseOnHover){var a=bt_pauseOnHoverConfig(opts.pagination.pauseOnHover);opts.pagination.container.bind(cf_e("mouseenter",conf,!1),function(){$cfs.trigger(cf_e("pause",conf),a)}).bind(cf_e("mouseleave",conf,!1),function(){$cfs.trigger(cf_e("resume",conf))})}if((opts.prev.key||opts.next.key)&&$(document).bind(cf_e("keyup",conf,!1,!0,!0),function(a){var b=a.keyCode;b==opts.next.key&&(a.preventDefault(),$cfs.trigger(cf_e("next",conf))),b==opts.prev.key&&(a.preventDefault(),$cfs.trigger(cf_e("prev",conf)))}),opts.pagination.keys&&$(document).bind(cf_e("keyup",conf,!1,!0,!0),function(a){var b=a.keyCode;b>=49&&58>b&&(b=(b-49)*opts.items.visible,itms.total>=b&&(a.preventDefault(),$cfs.trigger(cf_e("slideTo",conf),[b,0,!0,opts.pagination])))}),$.fn.swipe){var b="ontouchstart"in window;if(b&&opts.swipe.onTouch||!b&&opts.swipe.onMouse){var c=$.extend(!0,{},opts.prev,opts.swipe),d=$.extend(!0,{},opts.next,opts.swipe),e=function(){$cfs.trigger(cf_e("prev",conf),[c])},f=function(){$cfs.trigger(cf_e("next",conf),[d])};switch(opts.direction){case"up":case"down":opts.swipe.options.swipeUp=f,opts.swipe.options.swipeDown=e;break;default:opts.swipe.options.swipeLeft=f,opts.swipe.options.swipeRight=e}crsl.swipe&&$cfs.swipe("destroy"),$wrp.swipe(opts.swipe.options),$wrp.css("cursor","move"),crsl.swipe=!0}}if($.fn.mousewheel&&opts.mousewheel){var g=$.extend(!0,{},opts.prev,opts.mousewheel),h=$.extend(!0,{},opts.next,opts.mousewheel);crsl.mousewheel&&$wrp.unbind(cf_e("mousewheel",conf,!1)),$wrp.bind(cf_e("mousewheel",conf,!1),function(a,b){a.preventDefault(),b>0?$cfs.trigger(cf_e("prev",conf),[g]):$cfs.trigger(cf_e("next",conf),[h])}),crsl.mousewheel=!0}if(opts.auto.play&&$cfs.trigger(cf_e("play",conf),opts.auto.delay),crsl.upDateOnWindowResize){var i=function(){$cfs.trigger(cf_e("finish",conf)),opts.auto.pauseOnResize&&!crsl.isPaused&&$cfs.trigger(cf_e("play",conf)),sz_resetMargin($cfs.children(),opts),$cfs.trigger(cf_e("updateSizes",conf))},j=$(window),k=null;if($.debounce&&"debounce"==conf.onWindowResize)k=$.debounce(200,i);else if($.throttle&&"throttle"==conf.onWindowResize)k=$.throttle(300,i);else{var l=0,m=0;k=function(){var a=j.width(),b=j.height();(a!=l||b!=m)&&(i(),l=a,m=b)}}j.bind(cf_e("resize",conf,!1,!0,!0),k)}},FN._unbind_buttons=function(){var b=(cf_e("",conf),cf_e("",conf,!1));ns3=cf_e("",conf,!1,!0,!0),$(document).unbind(ns3),$(window).unbind(ns3),$wrp.unbind(b),opts.auto.button&&opts.auto.button.unbind(b),opts.prev.button&&opts.prev.button.unbind(b),opts.next.button&&opts.next.button.unbind(b),opts.pagination.container&&(opts.pagination.container.unbind(b),opts.pagination.anchorBuilder&&opts.pagination.container.children().remove()),crsl.swipe&&($cfs.swipe("destroy"),$wrp.css("cursor","default"),crsl.swipe=!1),crsl.mousewheel&&(crsl.mousewheel=!1),nv_showNavi(opts,"hide",conf),nv_enableNavi(opts,"removeClass",conf)},is_boolean(configs)&&(configs={debug:configs});var crsl={direction:"next",isPaused:!0,isScrolling:!1,isStopped:!1,mousewheel:!1,swipe:!1},itms={total:$cfs.children().length,first:0},tmrs={auto:null,progress:null,startTime:getTime(),timePassed:0},scrl={isStopped:!1,duration:0,startTime:0,easing:"",anims:[]},clbk={onBefore:[],onAfter:[]},queu=[],conf=$.extend(!0,{},$.fn.carouFredSel.configs,configs),opts={},opts_orig=$.extend(!0,{},options),$wrp="parent"==conf.wrapper?$cfs.parent():$cfs.wrap("<"+conf.wrapper.element+' class="'+conf.wrapper.classname+'" />').parent();if(conf.selector=$cfs.selector,conf.serialNumber=$.fn.carouFredSel.serialNumber++,conf.transition=conf.transition&&$.fn.transition?"transition":"animate",FN._init(opts_orig,!0,starting_position),FN._build(),FN._bind_events(),FN._bind_buttons(),is_array(opts.items.start))var start_arr=opts.items.start;else{var start_arr=[];0!=opts.items.start&&start_arr.push(opts.items.start)}if(opts.cookie&&start_arr.unshift(parseInt(cf_getCookie(opts.cookie),10)),start_arr.length>0)for(var a=0,l=start_arr.length;l>a;a++){var s=start_arr[a];if(0!=s){if(s===!0){if(s=window.location.hash,1>s.length)continue}else"random"===s&&(s=Math.floor(Math.random()*itms.total));if($cfs.triggerHandler(cf_e("slideTo",conf),[s,0,!0,{fx:"none"}]))break}}var siz=sz_setSizes($cfs,opts),itm=gi_getCurrentItems($cfs.children(),opts);return opts.onCreate&&opts.onCreate.call($tt0,{width:siz.width,height:siz.height,items:itm}),$cfs.trigger(cf_e("updatePageStatus",conf),[!0,siz]),$cfs.trigger(cf_e("linkAnchors",conf)),conf.debug&&$cfs.trigger(cf_e("debug",conf)),$cfs},$.fn.carouFredSel.serialNumber=1,$.fn.carouFredSel.defaults={synchronise:!1,infinite:!0,circular:!0,responsive:!1,direction:"left",items:{start:0},scroll:{easing:"swing",duration:500,pauseOnHover:!1,event:"click",queue:!1}},$.fn.carouFredSel.configs={debug:!1,transition:!1,onWindowResize:"throttle",events:{prefix:"",namespace:"cfs"},wrapper:{element:"div",classname:"caroufredsel_wrapper"},classnames:{}},$.fn.carouFredSel.pageAnchorBuilder=function(a){return''+a+""},$.fn.carouFredSel.progressbarUpdater=function(a){$(this).css("width",a+"%")},$.fn.carouFredSel.cookie={get:function(a){a+="=";for(var b=document.cookie.split(";"),c=0,d=b.length;d>c;c++){for(var e=b[c];" "==e.charAt(0);)e=e.slice(1);if(0==e.indexOf(a))return e.slice(a.length)}return 0},set:function(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+1e3*60*60*24*c),d="; expires="+e.toGMTString()}document.cookie=a+"="+b+d+"; path=/"},remove:function(a){$.fn.carouFredSel.cookie.set(a,"",-1)}},$.extend($.easing,{quadratic:function(a){var b=a*a;return a*(-b*a+4*b-6*a+4)},cubic:function(a){return a*(4*a*a-9*a+6)},elastic:function(a){var b=a*a;return a*(33*b*b-106*b*a+126*b-67*a+15)}}))})(jQuery); //*/ ///*! // * imagesLoaded PACKAGED v3.1.8 // * JavaScript is all like "You images are done yet or what?" // * MIT License // */ //(function () { function e() { } function t(e, t) { for (var n = e.length; n--;)if (e[n].listener === t) return n; return -1 } function n(e) { return function () { return this[e].apply(this, arguments) } } var i = e.prototype, r = this, o = r.EventEmitter; i.getListeners = function (e) { var t, n, i = this._getEvents(); if ("object" == typeof e) { t = {}; for (n in i) i.hasOwnProperty(n) && e.test(n) && (t[n] = i[n]) } else t = i[e] || (i[e] = []); return t }, i.flattenListeners = function (e) { var t, n = []; for (t = 0; e.length > t; t += 1)n.push(e[t].listener); return n }, i.getListenersAsObject = function (e) { var t, n = this.getListeners(e); return n instanceof Array && (t = {}, t[e] = n), t || n }, i.addListener = function (e, n) { var i, r = this.getListenersAsObject(e), o = "object" == typeof n; for (i in r) r.hasOwnProperty(i) && -1 === t(r[i], n) && r[i].push(o ? n : { listener: n, once: !1 }); return this }, i.on = n("addListener"), i.addOnceListener = function (e, t) { return this.addListener(e, { listener: t, once: !0 }) }, i.once = n("addOnceListener"), i.defineEvent = function (e) { return this.getListeners(e), this }, i.defineEvents = function (e) { for (var t = 0; e.length > t; t += 1)this.defineEvent(e[t]); return this }, i.removeListener = function (e, n) { var i, r, o = this.getListenersAsObject(e); for (r in o) o.hasOwnProperty(r) && (i = t(o[r], n), -1 !== i && o[r].splice(i, 1)); return this }, i.off = n("removeListener"), i.addListeners = function (e, t) { return this.manipulateListeners(!1, e, t) }, i.removeListeners = function (e, t) { return this.manipulateListeners(!0, e, t) }, i.manipulateListeners = function (e, t, n) { var i, r, o = e ? this.removeListener : this.addListener, s = e ? this.removeListeners : this.addListeners; if ("object" != typeof t || t instanceof RegExp) for (i = n.length; i--;)o.call(this, t, n[i]); else for (i in t) t.hasOwnProperty(i) && (r = t[i]) && ("function" == typeof r ? o.call(this, i, r) : s.call(this, i, r)); return this }, i.removeEvent = function (e) { var t, n = typeof e, i = this._getEvents(); if ("string" === n) delete i[e]; else if ("object" === n) for (t in i) i.hasOwnProperty(t) && e.test(t) && delete i[t]; else delete this._events; return this }, i.removeAllListeners = n("removeEvent"), i.emitEvent = function (e, t) { var n, i, r, o, s = this.getListenersAsObject(e); for (r in s) if (s.hasOwnProperty(r)) for (i = s[r].length; i--;)n = s[r][i], n.once === !0 && this.removeListener(e, n.listener), o = n.listener.apply(this, t || []), o === this._getOnceReturnValue() && this.removeListener(e, n.listener); return this }, i.trigger = n("emitEvent"), i.emit = function (e) { var t = Array.prototype.slice.call(arguments, 1); return this.emitEvent(e, t) }, i.setOnceReturnValue = function (e) { return this._onceReturnValue = e, this }, i._getOnceReturnValue = function () { return this.hasOwnProperty("_onceReturnValue") ? this._onceReturnValue : !0 }, i._getEvents = function () { return this._events || (this._events = {}) }, e.noConflict = function () { return r.EventEmitter = o, e }, "function" == typeof define && define.amd ? define("eventEmitter/EventEmitter", [], function () { return e }) : "object" == typeof module && module.exports ? module.exports = e : this.EventEmitter = e }).call(this), function (e) { function t(t) { var n = e.event; return n.target = n.target || n.srcElement || t, n } var n = document.documentElement, i = function () { }; n.addEventListener ? i = function (e, t, n) { e.addEventListener(t, n, !1) } : n.attachEvent && (i = function (e, n, i) { e[n + i] = i.handleEvent ? function () { var n = t(e); i.handleEvent.call(i, n) } : function () { var n = t(e); i.call(e, n) }, e.attachEvent("on" + n, e[n + i]) }); var r = function () { }; n.removeEventListener ? r = function (e, t, n) { e.removeEventListener(t, n, !1) } : n.detachEvent && (r = function (e, t, n) { e.detachEvent("on" + t, e[t + n]); try { delete e[t + n] } catch (i) { e[t + n] = void 0 } }); var o = { bind: i, unbind: r }; "function" == typeof define && define.amd ? define("eventie/eventie", o) : e.eventie = o }(this), function (e, t) { "function" == typeof define && define.amd ? define(["eventEmitter/EventEmitter", "eventie/eventie"], function (n, i) { return t(e, n, i) }) : "object" == typeof exports ? module.exports = t(e, require("wolfy87-eventemitter"), require("eventie")) : e.imagesLoaded = t(e, e.EventEmitter, e.eventie) }(window, function (e, t, n) { function i(e, t) { for (var n in t) e[n] = t[n]; return e } function r(e) { return "[object Array]" === d.call(e) } function o(e) { var t = []; if (r(e)) t = e; else if ("number" == typeof e.length) for (var n = 0, i = e.length; i > n; n++)t.push(e[n]); else t.push(e); return t } function s(e, t, n) { if (!(this instanceof s)) return new s(e, t); "string" == typeof e && (e = document.querySelectorAll(e)), this.elements = o(e), this.options = i({}, this.options), "function" == typeof t ? n = t : i(this.options, t), n && this.on("always", n), this.getImages(), a && (this.jqDeferred = new a.Deferred); var r = this; setTimeout(function () { r.check() }) } function f(e) { this.img = e } function c(e) { this.src = e, v[e] = this } var a = e.jQuery, u = e.console, h = u !== void 0, d = Object.prototype.toString; s.prototype = new t, s.prototype.options = {}, s.prototype.getImages = function () { this.images = []; for (var e = 0, t = this.elements.length; t > e; e++) { var n = this.elements[e]; "IMG" === n.nodeName && this.addImage(n); var i = n.nodeType; if (i && (1 === i || 9 === i || 11 === i)) for (var r = n.querySelectorAll("img"), o = 0, s = r.length; s > o; o++) { var f = r[o]; this.addImage(f) } } }, s.prototype.addImage = function (e) { var t = new f(e); this.images.push(t) }, s.prototype.check = function () { function e(e, r) { return t.options.debug && h && u.log("confirm", e, r), t.progress(e), n++ , n === i && t.complete(), !0 } var t = this, n = 0, i = this.images.length; if (this.hasAnyBroken = !1, !i) return this.complete(), void 0; for (var r = 0; i > r; r++) { var o = this.images[r]; o.on("confirm", e), o.check() } }, s.prototype.progress = function (e) { this.hasAnyBroken = this.hasAnyBroken || !e.isLoaded; var t = this; setTimeout(function () { t.emit("progress", t, e), t.jqDeferred && t.jqDeferred.notify && t.jqDeferred.notify(t, e) }) }, s.prototype.complete = function () { var e = this.hasAnyBroken ? "fail" : "done"; this.isComplete = !0; var t = this; setTimeout(function () { if (t.emit(e, t), t.emit("always", t), t.jqDeferred) { var n = t.hasAnyBroken ? "reject" : "resolve"; t.jqDeferred[n](t) } }) }, a && (a.fn.imagesLoaded = function (e, t) { var n = new s(this, e, t); return n.jqDeferred.promise(a(this)) }), f.prototype = new t, f.prototype.check = function () { var e = v[this.img.src] || new c(this.img.src); if (e.isConfirmed) return this.confirm(e.isLoaded, "cached was confirmed"), void 0; if (this.img.complete && void 0 !== this.img.naturalWidth) return this.confirm(0 !== this.img.naturalWidth, "naturalWidth"), void 0; var t = this; e.on("confirm", function (e, n) { return t.confirm(e.isLoaded, n), !0 }), e.check() }, f.prototype.confirm = function (e, t) { this.isLoaded = e, this.emit("confirm", this, t) }; var v = {}; return c.prototype = new t, c.prototype.check = function () { if (!this.isChecked) { var e = new Image; n.bind(e, "load", this), n.bind(e, "error", this), e.src = this.src, this.isChecked = !0 } }, c.prototype.handleEvent = function (e) { var t = "on" + e.type; this[t] && this[t](e) }, c.prototype.onload = function (e) { this.confirm(!0, "onload"), this.unbindProxyEvents(e) }, c.prototype.onerror = function (e) { this.confirm(!1, "onerror"), this.unbindProxyEvents(e) }, c.prototype.confirm = function (e, t) { this.isConfirmed = !0, this.isLoaded = e, this.emit("confirm", this, t) }, c.prototype.unbindProxyEvents = function (e) { n.unbind(e.target, "load", this), n.unbind(e.target, "error", this) }, s }); ///** // * BxSlider v4.0 - Fully loaded, responsive content slider // * http://bxslider.com // * // * Copyright 2012, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com // * Written while drinking Belgian ales and listening to jazz // * // * Released under the WTFPL license - http://sam.zoy.org/wtfpl/ // */ //(function (t) { var e = {}, n = { mode: "horizontal", slideSelector: "", infiniteLoop: !0, hideControlOnEnd: !1, speed: 500, easing: null, slideMargin: 0, startSlide: 0, randomStart: !1, captions: !1, ticker: !1, tickerHover: !1, adaptiveHeight: !1, adaptiveHeightSpeed: 500, touchEnabled: !0, swipeThreshold: 50, video: !1, useCSS: !0, pager: !0, pagerType: "full", pagerShortSeparator: " / ", pagerSelector: null, buildPager: null, pagerCustom: null, controls: !0, nextText: "Next", prevText: "Prev", nextSelector: null, prevSelector: null, autoControls: !1, startText: "Start", stopText: "Stop", autoControlsCombine: !1, autoControlsSelector: null, auto: !1, pause: 4e3, autoStart: !0, autoDirection: "next", autoHover: !1, autoDelay: 0, minSlides: 1, maxSlides: 1, moveSlides: 0, slideWidth: 0, onSliderLoad: function () { }, onSlideBefore: function () { }, onSlideAfter: function () { }, onSlideNext: function () { }, onSlidePrev: function () { } }; t.fn.bxSlider = function (s) { if (0 != this.length) { if (this.length > 1) return this.each(function () { t(this).bxSlider(s) }), this; var o = {}, r = this; e.el = this; var a = t(window).width(), l = t(window).height(), d = function () { o.settings = t.extend({}, n, s), o.children = r.children(o.settings.slideSelector), o.children.length < o.settings.minSlides && (o.settings.minSlides = o.children.length), o.children.length < o.settings.maxSlides && (o.settings.maxSlides = o.children.length), o.settings.randomStart && (o.settings.startSlide = Math.floor(Math.random() * o.children.length)), o.active = { index: o.settings.startSlide }, o.carousel = o.settings.minSlides > 1 || o.settings.maxSlides > 1, o.minThreshold = o.settings.minSlides * o.settings.slideWidth + (o.settings.minSlides - 1) * o.settings.slideMargin, o.maxThreshold = o.settings.maxSlides * o.settings.slideWidth + (o.settings.maxSlides - 1) * o.settings.slideMargin, o.working = !1, o.controls = {}, o.interval = null, o.animProp = "vertical" == o.settings.mode ? "top" : "left", o.usingCSS = o.settings.useCSS && "fade" != o.settings.mode && function () { var t = document.createElement("div"), e = ["WebkitPerspective", "MozPerspective", "OPerspective", "msPerspective"]; for (var i in e) if (void 0 !== t.style[e[i]]) return o.cssPrefix = e[i].replace("Perspective", "").toLowerCase(), o.animProp = "-" + o.cssPrefix + "-transform", !0; return !1 }(), "vertical" == o.settings.mode && (o.settings.maxSlides = o.settings.minSlides), c() }, c = function () { if (r.wrap('

'), o.viewport = r.parent(), o.loader = t('
'), o.viewport.prepend(o.loader), r.css({ width: "horizontal" == o.settings.mode ? 215 * o.children.length + "%" : "auto", position: "relative" }), o.usingCSS && o.settings.easing ? r.css("-" + o.cssPrefix + "-transition-timing-function", o.settings.easing) : o.settings.easing || (o.settings.easing = "swing"), o.viewport.css({ width: "100%", overflow: "hidden", position: "relative" }), o.children.css({ "float": "horizontal" == o.settings.mode ? "left" : "none", listStyle: "none", position: "relative" }), o.children.width(h()), "horizontal" == o.settings.mode && o.settings.slideMargin > 0 && o.children.css("marginRight", o.settings.slideMargin), "vertical" == o.settings.mode && o.settings.slideMargin > 0 && o.children.css("marginBottom", o.settings.slideMargin), "fade" == o.settings.mode && (o.children.css({ position: "absolute", zIndex: 0, display: "none" }), o.children.eq(o.settings.startSlide).css({ zIndex: 50, display: "block" })), o.controls.el = t('
'), o.settings.captions && T(), o.settings.infiniteLoop && "fade" != o.settings.mode && !o.settings.ticker) { var e = "vertical" == o.settings.mode ? o.settings.minSlides : o.settings.maxSlides, i = o.children.slice(0, e).clone().addClass("bx-clone"), n = o.children.slice(-e).clone().addClass("bx-clone"); r.append(i).prepend(n) } o.active.last = o.settings.startSlide == v() - 1, o.settings.video && r.fitVids(), o.settings.ticker || (o.settings.pager && S(), o.settings.controls && b(), o.settings.auto && o.settings.autoControls && w(), (o.settings.controls || o.settings.autoControls || o.settings.pager) && o.viewport.after(o.controls.el)), r.children().imagesLoaded(function () { o.loader.remove(), f(), "vertical" == o.settings.mode && (o.settings.adaptiveHeight = !0), o.viewport.height(g()), o.settings.onSliderLoad(o.active.index), o.initialized = !0, t(window).bind("resize", O), o.settings.auto && o.settings.autoStart && L(), o.settings.ticker && D(), o.settings.pager && y(o.settings.startSlide), o.settings.controls && q(), o.settings.touchEnabled && !o.settings.ticker && H() }) }, g = function () { var e = 0, n = t(); if ("vertical" == o.settings.mode || o.settings.adaptiveHeight) if (o.carousel) { var s = 1 == o.settings.moveSlides ? o.active.index : o.active.index * p(); for (n = o.children.eq(s), i = 1; o.settings.maxSlides - 1 >= i; i++)n = s + i >= o.children.length ? n.add(o.children.eq(i - 1)) : n.add(o.children.eq(s + i)) } else n = o.children.eq(o.active.index); else n = o.children; return "vertical" == o.settings.mode ? (n.each(function () { e += t(this).outerHeight() }), o.settings.slideMargin > 0 && (e += o.settings.slideMargin * (o.settings.minSlides - 1))) : e = Math.max.apply(Math, n.map(function () { return t(this).outerHeight(!1) }).get()), e }, h = function () { var t = o.settings.slideWidth, e = o.viewport.width(); return 0 == o.settings.slideWidth ? t = e : e > o.maxThreshold ? t = (e - o.settings.slideMargin * (o.settings.maxSlides - 1)) / o.settings.maxSlides : o.minThreshold > e && (t = (e - o.settings.slideMargin * (o.settings.minSlides - 1)) / o.settings.minSlides), t }, u = function () { var t = 1; if ("horizontal" == o.settings.mode) if (o.viewport.width() < o.minThreshold) t = o.settings.minSlides; else if (o.viewport.width() > o.maxThreshold) t = o.settings.maxSlides; else { var e = o.children.first().width(); t = Math.floor(o.viewport.width() / e) } else "vertical" == o.settings.mode && (t = o.settings.minSlides); return t }, v = function () { var t = 0; if (o.settings.moveSlides > 0) if (o.settings.infiniteLoop) t = o.children.length / p(); else for (var e = 0, i = 0; o.children.length > e;)++t, e = i + u(), i += o.settings.moveSlides <= u() ? o.settings.moveSlides : u(); else t = Math.ceil(o.children.length / u()); return t }, p = function () { return o.settings.moveSlides > 0 && o.settings.moveSlides <= u() ? o.settings.moveSlides : u() }, f = function () { if (o.active.last && !o.settings.infiniteLoop) { if ("horizontal" == o.settings.mode) { var t = o.children.last(), e = t.position(); x(-(e.left - (o.viewport.width() - t.width())), "reset", 0) } else if ("vertical" == o.settings.mode) { var i = o.children.length - o.settings.minSlides, e = o.children.eq(i).position(); x(-e.top, "reset", 0) } } else { var e = o.children.eq(o.active.index * p()).position(); o.active.index == v() - 1 && (o.active.last = !0), void 0 != e && ("horizontal" == o.settings.mode ? x(-e.left, "reset", 0) : "vertical" == o.settings.mode && x(-e.top, "reset", 0)) } }, x = function (t, e, i, n) { if (o.usingCSS) { var s = "vertical" == o.settings.mode ? "translate3d(0, " + t + "px, 0)" : "translate3d(" + t + "px, 0, 0)"; r.css("-" + o.cssPrefix + "-transition-duration", i / 1e3 + "s"), "slide" == e ? (r.css(o.animProp, s), r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function () { r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"), z() })) : "reset" == e ? r.css(o.animProp, s) : "ticker" == e && (r.css("-" + o.cssPrefix + "-transition-timing-function", "linear"), r.css(o.animProp, s), r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function () { r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"), x(n.resetValue, "reset", 0), I() })) } else { var a = {}; a[o.animProp] = t, "slide" == e ? r.animate(a, i, o.settings.easing, function () { z() }) : "reset" == e ? r.css(o.animProp, t) : "ticker" == e && r.animate(a, speed, "linear", function () { x(n.resetValue, "reset", 0), I() }) } }, m = function () { var e = ""; pagerQty = v(); for (var i = 0; pagerQty > i; i++) { var n = ""; o.settings.buildPager && t.isFunction(o.settings.buildPager) ? (n = o.settings.buildPager(i), o.pagerEl.addClass("bx-custom-pager")) : (n = i + 1, o.pagerEl.addClass("bx-default-pager")), e += '" } o.pagerEl.html(e) }, S = function () { o.settings.pagerCustom ? o.pagerEl = t(o.settings.pagerCustom) : (o.pagerEl = t('
'), o.settings.pagerSelector ? t(o.settings.pagerSelector).html(o.pagerEl) : o.controls.el.addClass("bx-has-pager").append(o.pagerEl), m()), o.pagerEl.delegate("a", "click", k) }, b = function () { o.controls.next = t('' + o.settings.nextText + ""), o.controls.prev = t('' + o.settings.prevText + ""), o.controls.next.bind("click", C), o.controls.prev.bind("click", E), o.settings.nextSelector && t(o.settings.nextSelector).append(o.controls.next), o.settings.prevSelector && t(o.settings.prevSelector).append(o.controls.prev), o.settings.nextSelector || o.settings.prevSelector || (o.controls.directionEl = t('
'), o.controls.directionEl.append(o.controls.prev).append(o.controls.next), o.controls.el.addClass("bx-has-controls-direction").append(o.controls.directionEl)) }, w = function () { o.controls.start = t('"), o.controls.stop = t('"), o.controls.autoEl = t('
'), o.controls.autoEl.delegate(".bx-start", "click", A), o.controls.autoEl.delegate(".bx-stop", "click", P), o.settings.autoControlsCombine ? o.controls.autoEl.append(o.controls.start) : o.controls.autoEl.append(o.controls.start).append(o.controls.stop), o.settings.autoControlsSelector ? t(o.settings.autoControlsSelector).html(o.controls.autoEl) : o.controls.el.addClass("bx-has-controls-auto").append(o.controls.autoEl), M(o.settings.autoStart ? "stop" : "start") }, T = function () { o.children.each(function () { var e = t(this).find("img:first").attr("title"); void 0 != e && t(this).append('
' + e + "
") }) }, C = function (t) { o.settings.auto && r.stopAuto(), r.goToNextSlide(), t.preventDefault() }, E = function (t) { o.settings.auto && r.stopAuto(), r.goToPrevSlide(), t.preventDefault() }, A = function (t) { r.startAuto(), t.preventDefault() }, P = function (t) { r.stopAuto(), t.preventDefault() }, k = function (e) { o.settings.auto && r.stopAuto(); var i = t(e.currentTarget), n = parseInt(i.attr("data-slide-index")); n != o.active.index && r.goToSlide(n), e.preventDefault() }, y = function (e) { return "short" == o.settings.pagerType ? (o.pagerEl.html(e + 1 + o.settings.pagerShortSeparator + o.children.length), void 0) : (o.pagerEl.find("a").removeClass("active"), o.pagerEl.each(function (i, n) { t(n).find("a").eq(e).addClass("active") }), void 0) }, z = function () { if (o.settings.infiniteLoop) { var t = ""; 0 == o.active.index ? t = o.children.eq(0).position() : o.active.index == v() - 1 && o.carousel ? t = o.children.eq((v() - 1) * p()).position() : o.active.index == o.children.length - 1 && (t = o.children.eq(o.children.length - 1).position()), "horizontal" == o.settings.mode ? x(-t.left, "reset", 0) : "vertical" == o.settings.mode && x(-t.top, "reset", 0) } o.working = !1, o.settings.onSlideAfter(o.children.eq(o.active.index), o.oldIndex, o.active.index) }, M = function (t) { o.settings.autoControlsCombine ? o.controls.autoEl.html(o.controls[t]) : (o.controls.autoEl.find("a").removeClass("active"), o.controls.autoEl.find("a:not(.bx-" + t + ")").addClass("active")) }, q = function () { !o.settings.infiniteLoop && o.settings.hideControlOnEnd && (0 == o.active.index ? (o.controls.prev.addClass("disabled"), o.controls.next.removeClass("disabled")) : o.active.index == v() - 1 ? (o.controls.next.addClass("disabled"), o.controls.prev.removeClass("disabled")) : (o.controls.prev.removeClass("disabled"), o.controls.next.removeClass("disabled"))) }, L = function () { o.settings.autoDelay > 0 ? setTimeout(r.startAuto, o.settings.autoDelay) : r.startAuto(), o.settings.autoHover && r.hover(function () { o.interval && (r.stopAuto(!0), o.autoPaused = !0) }, function () { o.autoPaused && (r.startAuto(!0), o.autoPaused = null) }) }, D = function () { var e = 0; if ("next" == o.settings.autoDirection) r.append(o.children.clone().addClass("bx-clone")); else { r.prepend(o.children.clone().addClass("bx-clone")); var i = o.children.first().position(); e = "horizontal" == o.settings.mode ? -i.left : -i.top } x(e, "reset", 0), o.settings.pager = !1, o.settings.controls = !1, o.settings.autoControls = !1, o.settings.tickerHover && !o.usingCSS && o.viewport.hover(function () { r.stop() }, function () { var e = 0; o.children.each(function () { e += "horizontal" == o.settings.mode ? t(this).outerWidth(!0) : t(this).outerHeight(!0) }); var i = o.settings.speed / e, n = "horizontal" == o.settings.mode ? "left" : "top", s = i * (e - Math.abs(parseInt(r.css(n)))); I(s) }), I() }, I = function (t) { speed = t ? t : o.settings.speed; var e = { left: 0, top: 0 }, i = { left: 0, top: 0 }; "next" == o.settings.autoDirection ? e = r.find(".bx-clone").first().position() : i = o.children.first().position(); var n = "horizontal" == o.settings.mode ? -e.left : -e.top, s = "horizontal" == o.settings.mode ? -i.left : -i.top, a = { resetValue: s }; x(n, "ticker", speed, a) }, H = function () { o.touch = { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } }, o.viewport.bind("touchstart", W) }, W = function (t) { if (o.working) t.preventDefault(); else { o.touch.originalPos = r.position(); var e = t.originalEvent; o.touch.start.x = e.changedTouches[0].pageX, o.touch.start.y = e.changedTouches[0].pageY, o.viewport.bind("touchmove", N), o.viewport.bind("touchend", B) } }, N = function (t) { if (t.preventDefault(), "fade" != o.settings.mode) { var e = t.originalEvent, i = 0; if ("horizontal" == o.settings.mode) { var n = e.changedTouches[0].pageX - o.touch.start.x; i = o.touch.originalPos.left + n } else { var n = e.changedTouches[0].pageY - o.touch.start.y; i = o.touch.originalPos.top + n } x(i, "reset", 0) } }, B = function (t) { o.viewport.unbind("touchmove", N); var e = t.originalEvent, i = 0; if (o.touch.end.x = e.changedTouches[0].pageX, o.touch.end.y = e.changedTouches[0].pageY, "fade" == o.settings.mode) { var n = Math.abs(o.touch.start.x - o.touch.end.x); n >= o.settings.swipeThreshold && (o.touch.start.x > o.touch.end.x ? r.goToNextSlide() : r.goToPrevSlide(), r.stopAuto()) } else { var n = 0; "horizontal" == o.settings.mode ? (n = o.touch.end.x - o.touch.start.x, i = o.touch.originalPos.left) : (n = o.touch.end.y - o.touch.start.y, i = o.touch.originalPos.top), !o.settings.infiniteLoop && (0 == o.active.index && n > 0 || o.active.last && 0 > n) ? x(i, "reset", 200) : Math.abs(n) >= o.settings.swipeThreshold ? (0 > n ? r.goToNextSlide() : r.goToPrevSlide(), r.stopAuto()) : x(i, "reset", 200) } o.viewport.unbind("touchend", B) }, O = function () { var e = t(window).width(), i = t(window).height(); (a != e || l != i) && (a = e, l = i, o.children.add(r.find(".bx-clone")).width(h()), o.viewport.css("height", g()), o.active.last && (o.active.index = v() - 1), o.active.index >= v() && (o.active.last = !0), o.settings.pager && !o.settings.pagerCustom && (m(), y(o.active.index)), o.settings.ticker || f()) }; return r.goToSlide = function (e, i) { if (!o.working && o.active.index != e) if (o.working = !0, o.oldIndex = o.active.index, o.active.index = 0 > e ? v() - 1 : e >= v() ? 0 : e, o.settings.onSlideBefore(o.children.eq(o.active.index), o.oldIndex, o.active.index), "next" == i ? o.settings.onSlideNext(o.children.eq(o.active.index), o.oldIndex, o.active.index) : "prev" == i && o.settings.onSlidePrev(o.children.eq(o.active.index), o.oldIndex, o.active.index), o.active.last = o.active.index >= v() - 1, o.settings.pager && y(o.active.index), o.settings.controls && q(), "fade" == o.settings.mode) o.settings.adaptiveHeight && o.viewport.height() != g() && o.viewport.animate({ height: g() }, o.settings.adaptiveHeightSpeed), o.children.filter(":visible").fadeOut(o.settings.speed).css({ zIndex: 0 }), o.children.eq(o.active.index).css("zIndex", 51).fadeIn(o.settings.speed, function () { t(this).css("zIndex", 50), z() }); else { o.settings.adaptiveHeight && o.viewport.height() != g() && o.viewport.animate({ height: g() }, o.settings.adaptiveHeightSpeed); var n = 0, s = { left: 0, top: 0 }; if (!o.settings.infiniteLoop && o.carousel && o.active.last) if ("horizontal" == o.settings.mode) { var a = o.children.eq(o.children.length - 1); s = a.position(), n = o.viewport.width() - a.width() } else { var l = o.children.length - o.settings.minSlides; s = o.children.eq(l).position() } else if (o.carousel && o.active.last && "prev" == i) { var d = 1 == o.settings.moveSlides ? o.settings.maxSlides - p() : (v() - 1) * p() - (o.children.length - o.settings.maxSlides), a = r.children(".bx-clone").eq(d); s = a.position() } else if ("next" == i && 0 == o.active.index) s = r.find(".bx-clone").eq(o.settings.maxSlides).position(), o.active.last = !1; else if (e >= 0) { var c = e * p(); s = o.children.eq(c).position() } var h = "horizontal" == o.settings.mode ? -(s.left - n) : -s.top; x(h, "slide", o.settings.speed) } }, r.goToNextSlide = function () { if (o.settings.infiniteLoop || !o.active.last) { var t = o.active.index + 1; r.goToSlide(t, "next") } }, r.goToPrevSlide = function () { if (o.settings.infiniteLoop || 0 != o.active.index) { var t = o.active.index - 1; r.goToSlide(t, "prev") } }, r.startAuto = function (t) { o.interval || (o.interval = setInterval(function () { "next" == o.settings.autoDirection ? r.goToNextSlide() : r.goToPrevSlide() }, o.settings.pause), o.settings.autoControls && 1 != t && M("stop")) }, r.stopAuto = function (t) { o.interval && (clearInterval(o.interval), o.interval = null, o.settings.autoControls && 1 != t && M("start")) }, r.getCurrentSlide = function () { return o.active.index }, r.getSlideCount = function () { return o.children.length }, r.destroySlider = function () { o.initialized && (o.initialized = !1, t(".bx-clone", this).remove(), o.children.removeAttr("style"), this.removeAttr("style").unwrap().unwrap(), o.controls.el && o.controls.el.remove(), o.controls.next && o.controls.next.remove(), o.controls.prev && o.controls.prev.remove(), o.pagerEl && o.pagerEl.remove(), t(".bx-caption", this).remove(), o.controls.autoEl && o.controls.autoEl.remove(), clearInterval(o.interval), t(window).unbind("resize", O)) }, r.reloadSlider = function (t) { void 0 != t && (s = t), r.destroySlider(), d() }, d(), this } } })(jQuery), function (t, e) { var i = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; t.fn.imagesLoaded = function (n) { function s() { var e = t(g), i = t(h); a && (h.length ? a.reject(d, e, i) : a.resolve(d)), t.isFunction(n) && n.call(r, d, e, i) } function o(e, n) { e.src === i || -1 !== t.inArray(e, c) || (c.push(e), n ? h.push(e) : g.push(e), t.data(e, "imagesLoaded", { isBroken: n, src: e.src }), l && a.notifyWith(t(e), [n, d, t(g), t(h)]), d.length === c.length && (setTimeout(s), d.unbind(".imagesLoaded"))) } var r = this, a = t.isFunction(t.Deferred) ? t.Deferred() : 0, l = t.isFunction(a.notify), d = r.find("img").add(r.filter("img")), c = [], g = [], h = []; return t.isPlainObject(n) && t.each(n, function (t, e) { "callback" === t ? n = e : a && a[t](e) }), d.length ? d.bind("load.imagesLoaded error.imagesLoaded", function (t) { o(t.target, "error" === t.type) }).each(function (n, s) { var r = s.src, a = t.data(s, "imagesLoaded"); a && a.src === r ? o(s, a.isBroken) : s.complete && s.naturalWidth !== e ? o(s, 0 === s.naturalWidth || 0 === s.naturalHeight) : (s.readyState || s.complete) && (s.src = i, s.src = r) }) : s(), a ? a.promise(r) : r } }(jQuery); ///*! // Flowplayer Commercial v5.5.2 (Thursday, 16. October 2014 08:20PM) | flowplayer.org/license //*/ //!function ($) { // /* // jQuery.browser for 1.9+ // We all love feature detection but that's sometimes not enough. // @author Tero Piirainen // */ // !function ($) { // if (!$.browser) { // var b = $.browser = {}, // ua = navigator.userAgent.toLowerCase(), // match = /(chrome)[ \/]([\w.]+)/.exec(ua) || // /(safari)[ \/]([\w.]+)/.exec(ua) || // /(webkit)[ \/]([\w.]+)/.exec(ua) || // /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || // /(msie) ([\w.]+)/.exec(ua) || // ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; // if (match[1]) { // b[match[1]] = true; // b.version = match[2] || "0"; // } // } // }(jQuery); // // auto-install (any video tag with parent .flowplayer) // $(function () { // if (typeof $.fn.flowplayer == 'function') { // $("video").parent(".flowplayer").flowplayer(); // } // }); // var instances = [], // extensions = [], // UA = window.navigator.userAgent; // /* flowplayer() */ // window.flowplayer = function (fn) { // return $.isFunction(fn) ? extensions.push(fn) : // typeof fn == 'number' || fn === undefined ? instances[fn || 0] : // $(fn).data("flowplayer"); // }; // $(window).on('beforeunload', function () { // $.each(instances, function (i, api) { // if (api.conf.splash) { // api.unload(); // } else { // api.bind("error", function () { // $(".flowplayer.is-error .fp-message").remove(); // }); // } // }); // }); // var supportLocalStorage = false; // try { // if (typeof window.localStorage == "object") { // window.localStorage.flowplayerTestStorage = "test"; // supportLocalStorage = true; // } // } catch (ignored) { } // var isSafari = /Safari/.exec(navigator.userAgent) && !/Chrome/.exec(navigator.userAgent); // m = /(\d+\.\d+) Safari/.exec(navigator.userAgent), // safariVersion = m ? Number(m[1]) : 100; // $.extend(flowplayer, { // version: '5.5.2', // engine: {}, // conf: {}, // support: {}, // defaults: { // debug: false, // // true = forced playback // disabled: false, // // first engine to try // engine: 'html5', // fullscreen: window == window.top, // // keyboard shortcuts // keyboard: true, // // default aspect ratio // ratio: 9 / 16, // adaptiveRatio: false, // // scale flash object to video's aspect ratio in normal mode? // flashfit: false, // rtmp: 0, // splash: false, // live: false, // swf: "//releases.flowplayer.org/5.5.2/commercial/flowplayer.swf", // speeds: [0.25, 0.5, 1, 1.5, 2], // tooltip: true, // // initial volume level // volume: !supportLocalStorage ? 1 : localStorage.muted == "true" ? 0 : !isNaN(localStorage.volume) ? localStorage.volume || 1 : 1, // // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#error-codes // errors: [ // // video exceptions // '', // 'Video loading aborted', // 'Network error', // 'Video not properly encoded', // 'Video file not found', // // player exceptions // 'Unsupported video', // 'Skin not found', // 'SWF file not found', // 'Subtitles not found', // 'Invalid RTMP URL', // 'Unsupported video format. Try installing Adobe Flash.' // ], // errorUrls: ['', '', '', '', '', '', '', '', '', '', // 'http://get.adobe.com/flashplayer/' // ], // playlist: [], // hlsFix: isSafari && safariVersion < 8 // } // }); // // keep track of players // var playerCount = 1; // // jQuery plugin // $.fn.flowplayer = function (opts, callback) { // if (typeof opts == 'string') opts = { swf: opts } // if ($.isFunction(opts)) { callback = opts; opts = {} } // return !opts && this.data("flowplayer") || this.each(function () { // // private variables // var root = $(this).addClass("is-loading"), // conf = $.extend({}, flowplayer.defaults, flowplayer.conf, opts, root.data()), // videoTag = $("video", root).addClass("fp-engine").removeAttr("controls"), // urlResolver = videoTag.length ? new URLResolver(videoTag) : null, // storage = {}, // lastSeekPosition, // engine; // if (conf.playlist.length) { // Create initial video tag if called without // var preload = conf.preload || videoTag.attr('preload'), placeHolder; // if (videoTag.length) videoTag.replaceWith(placeHolder = $('

')); // videoTag = $('

")[0]; // for (var i = 0; i < vendors.length; i++) { // if (el.style[vendors[i] + 'AnimationName'] !== 'undefined') return true; // } // })(); // }(); // /* The most minimal Flash embedding */ // // movie required in opts // function embed(swf, flashvars, wmode) { // wmode = wmode || "transparent"; // var id = "obj" + ("" + Math.random()).slice(2, 15), // tag = '' : // ' data="' + swf + '" type="application/x-shockwave-flash">'; // var opts = { // width: "100%", // height: "100%", // allowscriptaccess: "always", // wmode: wmode, // quality: "high", // flashvars: "", // // https://github.com/flowplayer/flowplayer/issues/13#issuecomment-9369919 // movie: swf + ($.browser.msie ? "?" + id : ""), // name: id // }; // // flashvars // $.each(flashvars, function (key, value) { // opts.flashvars += key + "=" + value + "&"; // }); // // parameters // $.each(opts, function (key, value) { // tag += ''; // }); // tag += ""; // return $(tag); // } // // Flash is buggy allover // if (window.attachEvent) { // window.attachEvent("onbeforeunload", function () { // __flash_savedUnloadHandler = __flash_unloadHandler = function () { }; // }); // } // flowplayer.engine.flash = function (player, root) { // var conf = player.conf, // video = player.video, // callbackId, // objectTag, // api; // var win = $(window); // var readyCallback = function () { // // write out video url to handle fullscreen toggle and api load // // in WebKit and Safari - see also fsResume // if (VENDOR == "webkit" || IS_SAFARI) { // var flashvars = $("object param[name='flashvars']", root), // flashprops = (flashvars.attr("value") || '').split("&"); // $.each(flashprops, function (i, prop) { // prop = prop.split("="); // if (prop[0] == "url" && prop[1] != player.video.url) { // flashprops[i] = "url=" + player.video.url; // flashvars.attr({ value: flashprops.join("&") }); // return false; // } // }); // } // }; // var fullscreenCallback = function (e) { // // handle Flash object aspect ratio // var origH = root.height(), // origW = root.width(); // if (player.conf.flashfit || /full/.test(e.type)) { // var fs = player.isFullscreen, // truefs = fs && FS_SUPPORT, // ie7 = !flowplayer.support.inlineBlock, // screenW = fs ? (truefs ? screen.width : win.width()) : origW, // screenH = fs ? (truefs ? screen.height : win.height()) : origH, // // default values for fullscreen-exit without flashfit // hmargin = 0, // vmargin = 0, // objwidth = ie7 ? origW : '', // objheight = ie7 ? origH : '', // aspectratio, dataratio; // if (player.conf.flashfit || e.type === "fullscreen") { // aspectratio = player.video.width / player.video.height, // dataratio = player.video.height / player.video.width, // objheight = Math.max(dataratio * screenW), // objwidth = Math.max(aspectratio * screenH); // objheight = objheight > screenH ? objwidth * dataratio : objheight; // objheight = Math.min(Math.round(objheight), screenH); // objwidth = objwidth > screenW ? objheight * aspectratio : objwidth; // objwidth = Math.min(Math.round(objwidth), screenW); // vmargin = Math.max(Math.round((screenH + vmargin - objheight) / 2), 0); // hmargin = Math.max(Math.round((screenW + hmargin - objwidth) / 2), 0); // } // $("object", root).css({ // width: objwidth, // height: objheight, // marginTop: vmargin, // marginLeft: hmargin // }); // } // }; // var engine = { // pick: function (sources) { // if (flowplayer.support.flashVideo) { // // always pick video/flash first // var flash = $.grep(sources, function (source) { return source.type == 'flash'; })[0]; // if (flash) return flash; // for (var i = 0, source; i < sources.length; i++) { // source = sources[i]; // if (/mp4|flv/i.test(source.type)) return source; // } // } // }, // load: function (video) { // function escapeURL(url) { // return url.replace(/&/g, '%26').replace(/&/g, '%26').replace(/=/g, '%3D'); // } // var html5Tag = $("video", root), // url = escapeURL(video.src); // is_absolute = /^https?:/.test(url); // var removeTag = function () { // html5Tag.remove(); // }; // var hasSupportedSource = function (sources) { // return $.grep(sources, function (src) { // return !!html5Tag[0].canPlayType('video/' + src.type); // }).length > 0; // }; // if (flowplayer.support.video && // html5Tag.prop('autoplay') && // hasSupportedSource(video.sources)) html5Tag.one('timeupdate', removeTag); // else removeTag(); // // convert to absolute // if (!is_absolute && !conf.rtmp) url = $("").attr("src", url)[0].src; // if (api) { // api.__play(url); // } else { // player.bind('ready', readyCallback) // .bind("ready fullscreen fullscreen-exit", fullscreenCallback); // callbackId = "fp" + ("" + Math.random()).slice(3, 15); // var opts = { // hostname: conf.embedded ? conf.hostname : location.hostname, // url: url, // callback: "jQuery." + callbackId // }; // if (root.data("origin")) { // opts.origin = root.data("origin"); // } // if (is_absolute) delete conf.rtmp; // // optional conf // $.each(['key', 'autoplay', 'preload', 'rtmp', 'subscribe', 'live', 'loop', 'debug', 'splash', 'poster', 'rtmpt'], function (i, key) { // if (conf.hasOwnProperty(key)) opts[key] = conf[key]; // }); // // bufferTime might be 0 // if (conf.bufferTime !== undefined) opts.bufferTime = conf.bufferTime; // // issues #376 // if (opts.rtmp) { // opts.rtmp = escapeURL(opts.rtmp); // } // // issues #387 // opts.initialVolume = player.volumeLevel; // objectTag = embed(conf.swf, opts, conf.wmode); // objectTag.prependTo(root); // api = objectTag[0]; // // throw error if no loading occurs // setTimeout(function () { // try { // if (!api.PercentLoaded()) { // return root.trigger("error", [player, { code: 7, url: conf.swf }]); // } // } catch (e) { } // }, 5000); // // detect disabled flash // setTimeout(function () { // if (typeof api.PercentLoaded === 'undefined') { // root.trigger('flashdisabled', [player]); // } // }, 1000); // api.pollInterval = setInterval(function () { // if (!api) return; // var status = api.__status ? api.__status() : null; // if (!status) return; // player.trigger("progress", status.time); // video.buffer = status.buffer / video.bytes * video.duration; // player.trigger("buffer", video.buffer); // if (!video.buffered && status.time > 0) { // video.buffered = true; // player.trigger("buffered"); // } // }, 250); // // listen // $[callbackId] = function (type, arg) { // if (conf.debug) console.log("--", type, arg); // var event = $.Event(type); // switch (type) { // // RTMP sends a lot of finish events in vain // // case "finish": if (conf.rtmp) return; // case "ready": arg = $.extend(video, arg); break; // case "click": event.flash = true; break; // case "keydown": event.which = arg; break; // case "seek": video.time = arg; break; // } // if (type != 'buffered') { // // add some delay so that player is truly ready after an event // setTimeout(function () { player.trigger(event, arg); }, 1) // } // }; // } // }, // // not supported yet // speed: $.noop, // unload: function () { // api && api.__unload && api.__unload(); // delete $[callbackId]; // $("object", root).remove(); // api = 0; // player.unbind('ready', readyCallback).unbind('ready fullscreen fullscreen-exit', fullscreenCallback); // clearInterval(api.pollInterval); // } // }; // $.each("pause,resume,seek,volume".split(","), function (i, name) { // engine[name] = function (arg) { // try { // if (player.ready) { // if (name == 'seek' && player.video.time && !player.paused) { // player.trigger("beforeseek"); // } // if (arg === undefined) { // api["__" + name](); // } else { // api["__" + name](arg); // } // } // } catch (e) { // if (typeof api["__" + name] === 'undefined') { //flash lost it's methods // return root.trigger('flashdisabled', [player]); // } // throw e; // } // }; // }); // return engine; // }; // var VIDEO = $('

\ //
\ //
\ // \ // \ //

\ //

\ // \ //
\ //
\ //
\ //
\ //
\ // \ //
\ //
\ //
\ //
\ //
\ //
\ // 00:00\ // \ // 00:00\ //
\ //

\ //
'.replace(/class="/g, 'class="fp-') // ); // function find(klass) { // return $(".fp-" + klass, root); // } // // widgets // var progress = find("progress"), // buffer = find("buffer"), // elapsed = find("elapsed"), // remaining = find("remaining"), // waiting = find("waiting"), // ratio = find("ratio"), // speed = find("speed"), // durationEl = find("duration"), // origRatio = ratio.css("paddingTop"), // // sliders // timeline = find("timeline").slider2(api.rtl), // timelineApi = timeline.data("api"), // volume = find("volume"), // fullscreen = find("fullscreen"), // volumeSlider = find("volumeslider").slider2(api.rtl), // volumeApi = volumeSlider.data("api"), // noToggle = root.is(".fixed-controls, .no-toggle"); // timelineApi.disableAnimation(root.hasClass('is-touch')); // // aspect ratio // function setRatio(val) { // if ((root.css('width') === '0px' || root.css('height') === '0px') || val !== flowplayer.defaults.ratio) { // if (!parseInt(origRatio, 10)) ratio.css("paddingTop", val * 100 + "%"); // } // if (!support.inlineBlock) $("object", root).height(root.height()); // } // function hover(flag) { // root.toggleClass("is-mouseover", flag).toggleClass("is-mouseout", !flag); // } // // loading... // if (!support.animation) waiting.html("

loading …

"); // setRatio(conf.ratio); // // no fullscreen in IFRAME // try { // if (!conf.fullscreen) fullscreen.remove(); // } catch (e) { // fullscreen.remove(); // } // api.bind("ready", function () { // var duration = api.video.duration; // timelineApi.disable(api.disabled || !duration); // conf.adaptiveRatio && setRatio(api.video.height / api.video.width); // // initial time & volume // durationEl.add(remaining).html(format(duration)); // // do we need additional space for showing hour // ((duration >= 3600) && root.addClass('is-long')) || root.removeClass('is-long'); // volumeApi.slide(api.volumeLevel); // if (api.engine === 'flash') timelineApi.disableAnimation(true, true); // }).bind("unload", function () { // if (!origRatio) ratio.css("paddingTop", ""); // // buffer // }).bind("buffer", function () { // var video = api.video, // max = video.buffer / video.duration; // if (!video.seekable && support.seekable) timelineApi.max(max); // if (max < 1) buffer.css("width", (max * 100) + "%"); // else buffer.css({ width: '100%' }); // }).bind("speed", function (e, api, val) { // speed.text(val + "x").addClass("fp-hilite"); // setTimeout(function () { speed.removeClass("fp-hilite") }, 1000); // }).bind("buffered", function () { // buffer.css({ width: '100%' }); // timelineApi.max(1); // // progress // }).bind("progress", function () { // var time = api.video.time, // duration = api.video.duration; // if (!timelineApi.dragging) { // timelineApi.slide(time / duration, api.seeking ? 0 : 250); // } // elapsed.html(format(time)); // remaining.html("-" + format(duration - time)); // }).bind("finish resume seek", function (e) { // root.toggleClass("is-finished", e.type == "finish"); // }).bind("stop", function () { // elapsed.html(format(0)); // timelineApi.slide(0, 100); // }).bind("finish", function () { // elapsed.html(format(api.video.duration)); // timelineApi.slide(1, 100); // root.removeClass("is-seeking"); // // misc // }).bind("beforeseek", function () { // progress.stop(); // }).bind("volume", function () { // volumeApi.slide(api.volumeLevel); // }).bind("disable", function () { // var flag = api.disabled; // timelineApi.disable(flag); // volumeApi.disable(flag); // root.toggleClass("is-disabled", api.disabled); // }).bind("mute", function (e, api, flag) { // root.toggleClass("is-muted", flag); // }).bind("error", function (e, api, error) { // root.removeClass("is-loading").addClass("is-error"); // if (error) { // error.message = conf.errors[error.code]; // api.error = true; // var el = $(".fp-message", root); // $("h2", el).text((api.engine || 'html5') + ": " + error.message); // $("p", el).text(error.url || api.video.url || api.video.src || conf.errorUrls[error.code]); // root.unbind("mouseenter click").removeClass("is-mouseover"); // } // // hover // }).bind("mouseenter mouseleave", function (e) { // if (noToggle) return; // var is_over = e.type == "mouseenter", // lastMove; // // is-mouseover/out // hover(is_over); // if (is_over) { // root.bind("pause.x mousemove.x volume.x", function () { // hover(true); // lastMove = new Date; // }); // hovertimer = setInterval(function () { // if (new Date - lastMove > 5000) { // hover(false) // lastMove = new Date; // } // }, 100); // } else { // root.unbind(".x"); // clearInterval(hovertimer); // } // // allow dragging over the player edge // }).bind("mouseleave", function () { // if (timelineApi.dragging || volumeApi.dragging) { // root.addClass("is-mouseover").removeClass("is-mouseout"); // } // // click // }).bind("click.player", function (e) { // if ($(e.target).is(".fp-ui, .fp-engine") || e.flash) { // e.preventDefault(); // return api.toggle(); // } // }).bind('contextmenu', function (ev) { // ev.preventDefault(); // var o = root.offset(), // w = $(window), // left = ev.clientX - o.left, // t = ev.clientY - o.top + w.scrollTop(); // var menu = root.find('.fp-context-menu').css({ // left: left + 'px', // top: t + 'px', // display: 'block' // }).on('click', function (ev) { // ev.stopPropagation(); // }); // $('html').on('click.outsidemenu', function (ev) { // menu.hide(); // $('html').off('click.outsidemenu'); // }); // }).bind('flashdisabled', function () { // root.addClass('is-flash-disabled').one('ready', function () { // root.removeClass('is-flash-disabled').find('.fp-flash-disabled').remove(); // }).append('
Adobe Flash is disabled for this page, click player area to enable.
'); // }); // // poster -> background image // if (conf.poster) root.css("backgroundImage", "url(" + conf.poster + ")"); // var bc = root.css("backgroundColor"), // has_bg = root.css("backgroundImage") != "none" || bc && bc != "rgba(0, 0, 0, 0)" && bc != "transparent"; // // is-poster class // if (has_bg && !conf.splash && !conf.autoplay) { // api.bind("ready stop", function () { // root.addClass("is-poster").one("progress", function () { // root.removeClass("is-poster"); // }); // }); // } // // default background color if not present // if (!has_bg && api.forcedSplash) { // root.css("backgroundColor", "#555"); // } // $(".fp-toggle, .fp-play", root).click(api.toggle); // /* controlbar elements */ // $.each(['mute', 'fullscreen', 'unload'], function (i, key) { // find(key).click(function () { // api[key](); // }); // }); // timeline.bind("slide", function (e, val) { // api.seeking = true; // api.seek(val * api.video.duration); // }); // volumeSlider.bind("slide", function (e, val) { // api.volume(val); // }); // // times // find("time").click(function (e) { // $(this).toggleClass("is-inverted"); // }); // hover(noToggle); // }); // var focused, // focusedRoot, // IS_HELP = "is-help"; // // keyboard. single global listener // $(document).bind("keydown.fp", function (e) { // var el = focused, // metaKeyPressed = e.ctrlKey || e.metaKey || e.altKey, // key = e.which, // conf = el && el.conf; // if (!el || !conf.keyboard || el.disabled) return; // // help dialog (shift key not truly required) // if ($.inArray(key, [63, 187, 191]) != -1) { // focusedRoot.toggleClass(IS_HELP); // return false; // } // // close help / unload // if (key == 27 && focusedRoot.hasClass(IS_HELP)) { // focusedRoot.toggleClass(IS_HELP); // return false; // } // if (!metaKeyPressed && el.ready) { // e.preventDefault(); // // slow motion / fast forward // if (e.shiftKey) { // if (key == 39) el.speed(true); // else if (key == 37) el.speed(false); // return; // } // // 1, 2, 3, 4 .. // if (key < 58 && key > 47) return el.seekTo(key - 48); // switch (key) { // case 38: case 75: el.volume(el.volumeLevel + 0.15); break; // volume up // case 40: case 74: el.volume(el.volumeLevel - 0.15); break; // volume down // case 39: case 76: el.seeking = true; el.seek(true); break; // forward // case 37: case 72: el.seeking = true; el.seek(false); break; // backward // case 190: el.seekTo(); break; // to last seek position // case 32: el.toggle(); break; // spacebar // case 70: conf.fullscreen && el.fullscreen(); break; // toggle fullscreen // case 77: el.mute(); break; // mute // case 81: el.unload(); break; // unload/stop // } // } // }); // flowplayer(function (api, root) { // // no keyboard configured // if (!api.conf.keyboard) return; // // hover // root.bind("mouseenter mouseleave", function (e) { // focused = !api.disabled && e.type == 'mouseenter' ? api : 0; // if (focused) focusedRoot = root; // }); // var speedhelp = flowplayer.support.video && api.conf.engine !== "flash" && // !!$("