diff --git a/README.md b/README.md index 1fe25597..a7e44327 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This is an overview of the custom widgets, plugins and various features it inclu - [Quick start](#quick-start) - [Bugs and feature requests](#bugs-and-feature-requests) +- [Quicklinks](#quicklinks) - [Widgets](#widgets) - [UW Blogroll](#uw-blogroll) - [UW Campus Map](#uw-campus-map) @@ -55,6 +56,23 @@ Download the [UW 2014 theme](https://github.com/uweb/uw-2014/archive/master.zip) All bugs and feature requests can be issued at the [UW Web Team's GitHub account](https://github.com/uweb/uw-2014/issues) or emailed directly to the UW web team at [uweb@uw.edu](mailto:uweb@uw.edu). +## Quicklinks ## + +Default quicklinks are provided in the theme if you would like them to be consistent with what is on the https://uw.edu website. To customize them, just create a menu in the **Quick Links** location. *Note: For multisites, Quick Links location will only appear on blog/site 1 and populate all other sites*. + +Links that have a class set containing an icon will appear at the top formatted as a larger link with an icon. Links without an icon will appear under the "Helpful Links" section. + +Icon class options: +``` +icon-map +icon-directories +icon-calendar +icon-libraries +icon-medicine +icon-myuw +icon-uwtoday +``` + ## Widgets ## - - - @@ -223,6 +241,26 @@ All bugs and feature requests can be issued at the [UW Web Team's GitHub account [blogroll number=3 trim=true readmore='off'] ``` +### Google Apps/Calendar shortcode ### + +> The `[googleapps]` shortcode has be deprecated. Please use the `[iframe]` shortcode instead. + +> To migrate from the `[googleapps]` calendar shortcode to the `[iframe]` shortcode, you will need to update as follows. + +> Your old Google Calendar `[googleapps]` shortcode looks like this: + +``` + [googleapps domain="www" dir="calendar/embed" query="src=somenetid%40uw.edu&ctz=America%2FLos_Angeles" width="500" height="500"] + +``` + +> Update it to: + +``` + [iframe src="https://calendar.google.com/calendar/embed?src=somenetid%40uw.edu&ctz=America%2FLos_Angeles" height="500" width="500"] + +``` + ### iFrame ### > Embed iframes into your post or page content without adjusting WordPress privileges. @@ -353,18 +391,7 @@ Each tile is setup as a series of shortcodes wrapped in `[box]` shortcode. ### YouTube ### -> Embed a YouTube video or playlist into your post content. You will need to obtain a [Youtube API key](https://developers.google.com/youtube/registering_an_application) to use this feature. You can acquire one from YouTube using your UW GSuite account or get in touch with us [uweb@uw.edu](mailto:uweb@uw.edu) for assistance. - -> Attributes: - -> - **type** : Pick whether to display a single video or playlist. Options: **single**, **playlist**. (_Default: None_) -> - **id** : The youtube video or playlist id (_Default: None_) -> - **max-results** (**OPTIONAL**): The maximum number of results to return for a playlist (_Default: None_) - -> Example: -``` - [youtube type='playlist' id='PLgNkGpnjFWo9CN_HeVtujhMnUXK05iwgZ' max-results='10'] -``` +> This shortcode has been deprecated. To embed a youtube video, Simply copy and paste the YouTube video URL to embed videos and playlists. ### Slideshow ### @@ -410,7 +437,7 @@ Each tile is setup as a series of shortcodes wrapped in `[box]` shortcode. [section title='Example'] Section[/section] [/accordion] ``` - +> You can link to and automatically open individual sections of the accordion by adding them them the url. Example: http://www.washington.edu/about/#ACCORDION_ID will link to and open the accordion section. Note: you will need to retrieve the accordion section ID from the code as this is automatically generated and cannot be set. ### Custom Menu ### > This shortcode pulls in a custom menu that can be created under _Dashboard > Appearance > Menus_. Icons can be added in the class field in the menu builder. View the [full set of icons](http://www.washington.edu/brand/web-2/html-web-components/web-icons/) for more information. diff --git a/gruntfile.js b/gruntfile.js index b8af8030..7351e1ba 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -23,7 +23,6 @@ module.exports = function(grunt) { "js/uw.search.js", "js/uw.quicklinks.js", "js/uw.slideshow.js", - "js/uw.youtube.js", "js/uw.vimeo.js", "js/uw.radio-checkbox.js", "js/uw.dropdowns.js", diff --git a/header.php b/header.php index 33f9bf3b..a35fad9d 100644 --- a/header.php +++ b/header.php @@ -32,6 +32,8 @@ Skip to main content
+ +
diff --git a/js/libraries/imagesloaded.pkgd.js b/js/libraries/imagesloaded.pkgd.js index 380c2ea8..9b75f616 100644 --- a/js/libraries/imagesloaded.pkgd.js +++ b/js/libraries/imagesloaded.pkgd.js @@ -1,893 +1,497 @@ /*! - * imagesLoaded PACKAGED v3.1.8 + * imagesLoaded PACKAGED v4.1.4 * JavaScript is all like "You images are done yet or what?" * MIT License */ - -/*! - * EventEmitter v4.2.6 - git.io/ee - * Oliver Caldwell - * MIT license - * @preserve +/** + * EvEmitter v1.1.0 + * Lil' event emitter + * MIT License */ -(function () { - - - /** - * Class for managing events. - * Can be extended to provide event functionality in other classes. - * - * @class EventEmitter Manages event registering and emitting. - */ - function EventEmitter() {} - - // Shortcuts to improve speed and size - var proto = EventEmitter.prototype; - var exports = this; - var originalGlobalValue = exports.EventEmitter; - - /** - * Finds the index of the listener for the event in it's storage array. - * - * @param {Function[]} listeners Array of listeners to search through. - * @param {Function} listener Method to look for. - * @return {Number} Index of the specified listener, -1 if not found - * @api private - */ - function indexOfListener(listeners, listener) { - var i = listeners.length; - while (i--) { - if (listeners[i].listener === listener) { - return i; - } - } - - return -1; +/* jshint unused: true, undef: true, strict: true */ + +( function( global, factory ) { + // universal module definition + /* jshint strict: false */ /* globals define, module, window */ + if ( typeof define == 'function' && define.amd ) { + // AMD - RequireJS + define( 'ev-emitter/ev-emitter',factory ); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS - Browserify, Webpack + module.exports = factory(); + } else { + // Browser globals + global.EvEmitter = factory(); } - - /** - * Alias a method while keeping the context correct, to allow for overwriting of target method. - * - * @param {String} name The name of the target method. - * @return {Function} The aliased method - * @api private - */ - function alias(name) { - return function aliasClosure() { - return this[name].apply(this, arguments); - }; + + }( typeof window != 'undefined' ? window : this, function() { + + + + function EvEmitter() {} + + var proto = EvEmitter.prototype; + + proto.on = function( eventName, listener ) { + if ( !eventName || !listener ) { + return; } - - /** - * Returns the listener array for the specified event. - * Will initialise the event object and listener arrays if required. - * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. - * Each property in the object response is an array of listener functions. - * - * @param {String|RegExp} evt Name of the event to return the listeners from. - * @return {Function[]|Object} All listener functions for the event. - */ - proto.getListeners = function getListeners(evt) { - var events = this._getEvents(); - var response; - var key; - - // Return a concatenated array of all matching events if - // the selector is a regular expression. - if (typeof evt === 'object') { - response = {}; - for (key in events) { - if (events.hasOwnProperty(key) && evt.test(key)) { - response[key] = events[key]; - } - } - } - else { - response = events[evt] || (events[evt] = []); - } - - return response; - }; - - /** - * Takes a list of listener objects and flattens it into a list of listener functions. - * - * @param {Object[]} listeners Raw listener objects. - * @return {Function[]} Just the listener functions. - */ - proto.flattenListeners = function flattenListeners(listeners) { - var flatListeners = []; - var i; - - for (i = 0; i < listeners.length; i += 1) { - flatListeners.push(listeners[i].listener); - } - - return flatListeners; - }; - - /** - * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. - * - * @param {String|RegExp} evt Name of the event to return the listeners from. - * @return {Object} All listener functions for an event in an object. - */ - proto.getListenersAsObject = function getListenersAsObject(evt) { - var listeners = this.getListeners(evt); - var response; - - if (listeners instanceof Array) { - response = {}; - response[evt] = listeners; - } - - return response || listeners; - }; - - /** - * Adds a listener function to the specified event. - * The listener will not be added if it is a duplicate. - * If the listener returns true then it will be removed after it is called. - * If you pass a regular expression as the event name then the listener will be added to all events that match it. - * - * @param {String|RegExp} evt Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addListener = function addListener(evt, listener) { - var listeners = this.getListenersAsObject(evt); - var listenerIsWrapped = typeof listener === 'object'; - var key; - - for (key in listeners) { - if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { - listeners[key].push(listenerIsWrapped ? listener : { - listener: listener, - once: false - }); - } - } - - return this; - }; - - /** - * Alias of addListener - */ - proto.on = alias('addListener'); - - /** - * Semi-alias of addListener. It will add a listener that will be - * automatically removed after it's first execution. - * - * @param {String|RegExp} evt Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addOnceListener = function addOnceListener(evt, listener) { - return this.addListener(evt, { - listener: listener, - once: true - }); - }; - - /** - * Alias of addOnceListener. - */ - proto.once = alias('addOnceListener'); - - /** - * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. - * You need to tell it what event names should be matched by a regex. - * - * @param {String} evt Name of the event to create. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.defineEvent = function defineEvent(evt) { - this.getListeners(evt); - return this; - }; - - /** - * Uses defineEvent to define multiple events. - * - * @param {String[]} evts An array of event names to define. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.defineEvents = function defineEvents(evts) { - for (var i = 0; i < evts.length; i += 1) { - this.defineEvent(evts[i]); - } - return this; - }; - - /** - * Removes a listener function from the specified event. - * When passed a regular expression as the event name, it will remove the listener from all events that match it. - * - * @param {String|RegExp} evt Name of the event to remove the listener from. - * @param {Function} listener Method to remove from the event. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeListener = function removeListener(evt, listener) { - var listeners = this.getListenersAsObject(evt); - var index; - var key; - - for (key in listeners) { - if (listeners.hasOwnProperty(key)) { - index = indexOfListener(listeners[key], listener); - - if (index !== -1) { - listeners[key].splice(index, 1); - } - } - } - - return this; - }; - - /** - * Alias of removeListener - */ - proto.off = alias('removeListener'); - - /** - * Adds listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. - * You can also pass it a regular expression to add the array of listeners to all events that match it. - * Yeah, this function does quite a bit. That's probably a bad thing. - * - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addListeners = function addListeners(evt, listeners) { - // Pass through to manipulateListeners - return this.manipulateListeners(false, evt, listeners); - }; - - /** - * Removes listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be removed. - * You can also pass it a regular expression to remove the listeners from all events that match it. - * - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to remove. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeListeners = function removeListeners(evt, listeners) { - // Pass through to manipulateListeners - return this.manipulateListeners(true, evt, listeners); - }; - - /** - * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. - * The first argument will determine if the listeners are removed (true) or added (false). - * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added/removed. - * You can also pass it a regular expression to manipulate the listeners of all events that match it. - * - * @param {Boolean} remove True if you want to remove listeners, false if you want to add. - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add/remove. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { - var i; - var value; - var single = remove ? this.removeListener : this.addListener; - var multiple = remove ? this.removeListeners : this.addListeners; - - // If evt is an object then pass each of it's properties to this method - if (typeof evt === 'object' && !(evt instanceof RegExp)) { - for (i in evt) { - if (evt.hasOwnProperty(i) && (value = evt[i])) { - // Pass the single listener straight through to the singular method - if (typeof value === 'function') { - single.call(this, i, value); - } - else { - // Otherwise pass back to the multiple function - multiple.call(this, i, value); - } - } - } - } - else { - // So evt must be a string - // And listeners must be an array of listeners - // Loop over it and pass each one to the multiple method - i = listeners.length; - while (i--) { - single.call(this, evt, listeners[i]); - } - } - - return this; - }; - - /** - * Removes all listeners from a specified event. - * If you do not specify an event then all listeners will be removed. - * That means every event will be emptied. - * You can also pass a regex to remove all events that match it. - * - * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeEvent = function removeEvent(evt) { - var type = typeof evt; - var events = this._getEvents(); - var key; - - // Remove different things depending on the state of evt - if (type === 'string') { - // Remove all listeners for the specified event - delete events[evt]; - } - else if (type === 'object') { - // Remove all events matching the regex. - for (key in events) { - if (events.hasOwnProperty(key) && evt.test(key)) { - delete events[key]; - } - } - } - else { - // Remove all listeners in all events - delete this._events; - } - - return this; - }; - - /** - * Alias of removeEvent. - * - * Added to mirror the node API. - */ - proto.removeAllListeners = alias('removeEvent'); - - /** - * Emits an event of your choice. - * When emitted, every listener attached to that event will be executed. - * If you pass the optional argument array then those arguments will be passed to every listener upon execution. - * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. - * So they will not arrive within the array on the other side, they will be separate. - * You can also pass a regular expression to emit to all events that match it. - * - * @param {String|RegExp} evt Name of the event to emit and execute listeners for. - * @param {Array} [args] Optional array of arguments to be passed to each listener. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.emitEvent = function emitEvent(evt, args) { - var listeners = this.getListenersAsObject(evt); - var listener; - var i; - var key; - var response; - - for (key in listeners) { - if (listeners.hasOwnProperty(key)) { - i = listeners[key].length; - - while (i--) { - // If the listener returns true then it shall be removed from the event - // The function is executed either with a basic call or an apply if there is an args array - listener = listeners[key][i]; - - if (listener.once === true) { - this.removeListener(evt, listener.listener); - } - - response = listener.listener.apply(this, args || []); - - if (response === this._getOnceReturnValue()) { - this.removeListener(evt, listener.listener); - } - } - } - } - - return this; - }; - - /** - * Alias of emitEvent - */ - proto.trigger = alias('emitEvent'); - - /** - * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. - * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. - * - * @param {String|RegExp} evt Name of the event to emit and execute listeners for. - * @param {...*} Optional additional arguments to be passed to each listener. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.emit = function emit(evt) { - var args = Array.prototype.slice.call(arguments, 1); - return this.emitEvent(evt, args); - }; - - /** - * Sets the current value to check against when executing listeners. If a - * listeners return value matches the one set here then it will be removed - * after execution. This value defaults to true. - * - * @param {*} value The new value to check for when executing listeners. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.setOnceReturnValue = function setOnceReturnValue(value) { - this._onceReturnValue = value; - return this; - }; - - /** - * Fetches the current value to check against when executing listeners. If - * the listeners return value matches this one then it should be removed - * automatically. It will return true by default. - * - * @return {*|Boolean} The current value to check for or the default, true. - * @api private - */ - proto._getOnceReturnValue = function _getOnceReturnValue() { - if (this.hasOwnProperty('_onceReturnValue')) { - return this._onceReturnValue; - } - else { - return true; - } - }; - - /** - * Fetches the events object and creates one if required. - * - * @return {Object} The events storage object. - * @api private - */ - proto._getEvents = function _getEvents() { - return this._events || (this._events = {}); - }; - - /** - * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. - * - * @return {Function} Non conflicting EventEmitter class. - */ - EventEmitter.noConflict = function noConflict() { - exports.EventEmitter = originalGlobalValue; - return EventEmitter; - }; - - // Expose the class either via AMD, CommonJS or the global object - if (typeof define === 'function' && define.amd) { - define('eventEmitter/EventEmitter',[],function () { - return EventEmitter; - }); - } - else if (typeof module === 'object' && module.exports){ - module.exports = EventEmitter; + // set events hash + var events = this._events = this._events || {}; + // set listeners array + var listeners = events[ eventName ] = events[ eventName ] || []; + // only add once + if ( listeners.indexOf( listener ) == -1 ) { + listeners.push( listener ); } - else { - this.EventEmitter = EventEmitter; + + return this; + }; + + proto.once = function( eventName, listener ) { + if ( !eventName || !listener ) { + return; } -}.call(this)); - -/*! - * eventie v1.0.4 - * event binding helper - * eventie.bind( elem, 'click', myFn ) - * eventie.unbind( elem, 'click', myFn ) - */ - -/*jshint browser: true, undef: true, unused: true */ -/*global define: false */ - -( function( window ) { - - - -var docElem = document.documentElement; - -var bind = function() {}; - -function getIEEvent( obj ) { - var event = window.event; - // add event.target - event.target = event.target || event.srcElement || obj; - return event; -} - -if ( docElem.addEventListener ) { - bind = function( obj, type, fn ) { - obj.addEventListener( type, fn, false ); + // add event + this.on( eventName, listener ); + // set once flag + // set onceEvents hash + var onceEvents = this._onceEvents = this._onceEvents || {}; + // set onceListeners object + var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; + // set flag + onceListeners[ listener ] = true; + + return this; }; -} else if ( docElem.attachEvent ) { - bind = function( obj, type, fn ) { - obj[ type + fn ] = fn.handleEvent ? - function() { - var event = getIEEvent( obj ); - fn.handleEvent.call( fn, event ); - } : - function() { - var event = getIEEvent( obj ); - fn.call( obj, event ); - }; - obj.attachEvent( "on" + type, obj[ type + fn ] ); + + proto.off = function( eventName, listener ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { + return; + } + var index = listeners.indexOf( listener ); + if ( index != -1 ) { + listeners.splice( index, 1 ); + } + + return this; }; -} - -var unbind = function() {}; - -if ( docElem.removeEventListener ) { - unbind = function( obj, type, fn ) { - obj.removeEventListener( type, fn, false ); + + proto.emitEvent = function( eventName, args ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { + return; + } + // copy over to avoid interference if .off() in listener + listeners = listeners.slice(0); + args = args || []; + // once stuff + var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; + + for ( var i=0; i < listeners.length; i++ ) { + var listener = listeners[i] + var isOnce = onceListeners && onceListeners[ listener ]; + if ( isOnce ) { + // remove listener + // remove before trigger to prevent recursion + this.off( eventName, listener ); + // unset once flag + delete onceListeners[ listener ]; + } + // trigger listener + listener.apply( this, args ); + } + + return this; }; -} else if ( docElem.detachEvent ) { - unbind = function( obj, type, fn ) { - obj.detachEvent( "on" + type, obj[ type + fn ] ); - try { - delete obj[ type + fn ]; - } catch ( err ) { - // can't delete window object properties - obj[ type + fn ] = undefined; - } + + proto.allOff = function() { + delete this._events; + delete this._onceEvents; }; -} - -var eventie = { - bind: bind, - unbind: unbind -}; - -// transport -if ( typeof define === 'function' && define.amd ) { - // AMD - define( 'eventie/eventie',eventie ); -} else { - // browser global - window.eventie = eventie; -} - -})( this ); - -/*! - * imagesLoaded v3.1.8 - * JavaScript is all like "You images are done yet or what?" - * MIT License - */ - -( function( window, factory ) { - // universal module definition - - /*global define: false, module: false, require: false */ - - if ( typeof define === 'function' && define.amd ) { - // AMD - define( [ - 'eventEmitter/EventEmitter', - 'eventie/eventie' - ], function( EventEmitter, eventie ) { - return factory( window, EventEmitter, eventie ); - }); - } else if ( typeof exports === 'object' ) { - // CommonJS - module.exports = factory( - window, - require('wolfy87-eventemitter'), - require('eventie') - ); - } else { - // browser global - window.imagesLoaded = factory( - window, - window.EventEmitter, - window.eventie - ); - } - -})( window, - -// -------------------------- factory -------------------------- // - -function factory( window, EventEmitter, eventie ) { - - - -var $ = window.jQuery; -var console = window.console; -var hasConsole = typeof console !== 'undefined'; - -// -------------------------- helpers -------------------------- // - -// extend objects -function extend( a, b ) { - for ( var prop in b ) { - a[ prop ] = b[ prop ]; + + return EvEmitter; + + })); + + /*! + * imagesLoaded v4.1.4 + * JavaScript is all like "You images are done yet or what?" + * MIT License + */ + + ( function( window, factory ) { 'use strict'; + // universal module definition + + /*global define: false, module: false, require: false */ + + if ( typeof define == 'function' && define.amd ) { + // AMD + define( [ + 'ev-emitter/ev-emitter' + ], function( EvEmitter ) { + return factory( window, EvEmitter ); + }); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS + module.exports = factory( + window, + require('ev-emitter') + ); + } else { + // browser global + window.imagesLoaded = factory( + window, + window.EvEmitter + ); + } + + })( typeof window !== 'undefined' ? window : this, + + // -------------------------- factory -------------------------- // + + function factory( window, EvEmitter ) { + + + + var $ = window.jQuery; + var console = window.console; + + // -------------------------- helpers -------------------------- // + + // extend objects + function extend( a, b ) { + for ( var prop in b ) { + a[ prop ] = b[ prop ]; + } + return a; } - return a; -} - -var objToString = Object.prototype.toString; -function isArray( obj ) { - return objToString.call( obj ) === '[object Array]'; -} - -// turn element or nodeList into an array -function makeArray( obj ) { - var ary = []; - if ( isArray( obj ) ) { - // use object if already an array - ary = obj; - } else if ( typeof obj.length === 'number' ) { - // convert nodeList to array - for ( var i=0, len = obj.length; i < len; i++ ) { - ary.push( obj[i] ); - } - } else { - // array of single index - ary.push( obj ); + + var arraySlice = Array.prototype.slice; + + // turn element or nodeList into an array + function makeArray( obj ) { + if ( Array.isArray( obj ) ) { + // use object if already an array + return obj; + } + + var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; + if ( isArrayLike ) { + // convert nodeList to array + return arraySlice.call( obj ); + } + + // array of single index + return [ obj ]; } - return ary; -} - + // -------------------------- imagesLoaded -------------------------- // - + /** * @param {Array, Element, NodeList, String} elem * @param {Object or Function} options - if function, use as callback * @param {Function} onAlways - callback function */ function ImagesLoaded( elem, options, onAlways ) { - // coerce ImagesLoaded() without new, to be new ImagesLoaded() - if ( !( this instanceof ImagesLoaded ) ) { - return new ImagesLoaded( elem, options ); - } - // use elem as selector string - if ( typeof elem === 'string' ) { - elem = document.querySelectorAll( elem ); - } - - this.elements = makeArray( elem ); - this.options = extend( {}, this.options ); - - if ( typeof options === 'function' ) { - onAlways = options; - } else { - extend( this.options, options ); - } - - if ( onAlways ) { - this.on( 'always', onAlways ); - } - - this.getImages(); - - if ( $ ) { - // add jQuery Deferred object - this.jqDeferred = new $.Deferred(); - } - - // HACK check async to allow time to bind listeners - var _this = this; - setTimeout( function() { - _this.check(); - }); + // coerce ImagesLoaded() without new, to be new ImagesLoaded() + if ( !( this instanceof ImagesLoaded ) ) { + return new ImagesLoaded( elem, options, onAlways ); + } + // use elem as selector string + var queryElem = elem; + if ( typeof elem == 'string' ) { + queryElem = document.querySelectorAll( elem ); + } + // bail if bad element + if ( !queryElem ) { + console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) ); + return; + } + + this.elements = makeArray( queryElem ); + this.options = extend( {}, this.options ); + // shift arguments if no options set + if ( typeof options == 'function' ) { + onAlways = options; + } else { + extend( this.options, options ); + } + + if ( onAlways ) { + this.on( 'always', onAlways ); + } + + this.getImages(); + + if ( $ ) { + // add jQuery Deferred object + this.jqDeferred = new $.Deferred(); + } + + // HACK check async to allow time to bind listeners + setTimeout( this.check.bind( this ) ); } - - ImagesLoaded.prototype = new EventEmitter(); - + + ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); + ImagesLoaded.prototype.options = {}; - + ImagesLoaded.prototype.getImages = function() { - this.images = []; - - // filter & find items if we have an item selector - for ( var i=0, len = this.elements.length; i < len; i++ ) { - var elem = this.elements[i]; - // filter siblings - if ( elem.nodeName === 'IMG' ) { - this.addImage( elem ); - } - // find children - // no non-element nodes, #143 - var nodeType = elem.nodeType; - if ( !nodeType || !( nodeType === 1 || nodeType === 9 || nodeType === 11 ) ) { - continue; - } - var childElems = elem.querySelectorAll('img'); - // concat childElems to filterFound array - for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { - var img = childElems[j]; - this.addImage( img ); - } - } + this.images = []; + + // filter & find items if we have an item selector + this.elements.forEach( this.addElementImages, this ); }; - + + /** + * @param {Node} element + */ + ImagesLoaded.prototype.addElementImages = function( elem ) { + // filter siblings + if ( elem.nodeName == 'IMG' ) { + this.addImage( elem ); + } + // get background image on element + if ( this.options.background === true ) { + this.addElementBackgroundImages( elem ); + } + + // find children + // no non-element nodes, #143 + var nodeType = elem.nodeType; + if ( !nodeType || !elementNodeTypes[ nodeType ] ) { + return; + } + var childImgs = elem.querySelectorAll('img'); + // concat childElems to filterFound array + for ( var i=0; i < childImgs.length; i++ ) { + var img = childImgs[i]; + this.addImage( img ); + } + + // get child background images + if ( typeof this.options.background == 'string' ) { + var children = elem.querySelectorAll( this.options.background ); + for ( i=0; i < children.length; i++ ) { + var child = children[i]; + this.addElementBackgroundImages( child ); + } + } + }; + + var elementNodeTypes = { + 1: true, + 9: true, + 11: true + }; + + ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { + var style = getComputedStyle( elem ); + if ( !style ) { + // Firefox returns null if in a hidden iframe https://bugzil.la/548397 + return; + } + // get url inside url("...") + var reURL = /url\((['"])?(.*?)\1\)/gi; + var matches = reURL.exec( style.backgroundImage ); + while ( matches !== null ) { + var url = matches && matches[2]; + if ( url ) { + this.addBackground( url, elem ); + } + matches = reURL.exec( style.backgroundImage ); + } + }; + /** * @param {Image} img */ ImagesLoaded.prototype.addImage = function( img ) { - var loadingImage = new LoadingImage( img ); - this.images.push( loadingImage ); + var loadingImage = new LoadingImage( img ); + this.images.push( loadingImage ); }; - + + ImagesLoaded.prototype.addBackground = function( url, elem ) { + var background = new Background( url, elem ); + this.images.push( background ); + }; + ImagesLoaded.prototype.check = function() { - var _this = this; - var checkedCount = 0; - var length = this.images.length; - this.hasAnyBroken = false; - // complete if no images - if ( !length ) { - this.complete(); - return; - } - - function onConfirm( image, message ) { - if ( _this.options.debug && hasConsole ) { - console.log( 'confirm', image, message ); - } - - _this.progress( image ); - checkedCount++; - if ( checkedCount === length ) { - _this.complete(); - } - return true; // bind once - } - - for ( var i=0; i < length; i++ ) { - var loadingImage = this.images[i]; - loadingImage.on( 'confirm', onConfirm ); - loadingImage.check(); - } + var _this = this; + this.progressedCount = 0; + this.hasAnyBroken = false; + // complete if no images + if ( !this.images.length ) { + this.complete(); + return; + } + + function onProgress( image, elem, message ) { + // HACK - Chrome triggers event before object properties have changed. #83 + setTimeout( function() { + _this.progress( image, elem, message ); + }); + } + + this.images.forEach( function( loadingImage ) { + loadingImage.once( 'progress', onProgress ); + loadingImage.check(); + }); }; - - ImagesLoaded.prototype.progress = function( image ) { - this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; - // HACK - Chrome triggers event before object properties have changed. #83 - var _this = this; - setTimeout( function() { - _this.emit( 'progress', _this, image ); - if ( _this.jqDeferred && _this.jqDeferred.notify ) { - _this.jqDeferred.notify( _this, image ); - } - }); + + ImagesLoaded.prototype.progress = function( image, elem, message ) { + this.progressedCount++; + this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; + // progress event + this.emitEvent( 'progress', [ this, image, elem ] ); + if ( this.jqDeferred && this.jqDeferred.notify ) { + this.jqDeferred.notify( this, image ); + } + // check if completed + if ( this.progressedCount == this.images.length ) { + this.complete(); + } + + if ( this.options.debug && console ) { + console.log( 'progress: ' + message, image, elem ); + } }; - + ImagesLoaded.prototype.complete = function() { - var eventName = this.hasAnyBroken ? 'fail' : 'done'; - this.isComplete = true; - var _this = this; - // HACK - another setTimeout so that confirm happens after progress - setTimeout( function() { - _this.emit( eventName, _this ); - _this.emit( 'always', _this ); - if ( _this.jqDeferred ) { - var jqMethod = _this.hasAnyBroken ? 'reject' : 'resolve'; - _this.jqDeferred[ jqMethod ]( _this ); - } - }); + var eventName = this.hasAnyBroken ? 'fail' : 'done'; + this.isComplete = true; + this.emitEvent( eventName, [ this ] ); + this.emitEvent( 'always', [ this ] ); + if ( this.jqDeferred ) { + var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; + this.jqDeferred[ jqMethod ]( this ); + } }; - - // -------------------------- jquery -------------------------- // - - if ( $ ) { - $.fn.imagesLoaded = function( options, callback ) { - var instance = new ImagesLoaded( this, options, callback ); - return instance.jqDeferred.promise( $(this) ); - }; - } - - + // -------------------------- -------------------------- // - + function LoadingImage( img ) { - this.img = img; + this.img = img; } - - LoadingImage.prototype = new EventEmitter(); - + + LoadingImage.prototype = Object.create( EvEmitter.prototype ); + LoadingImage.prototype.check = function() { - // first check cached any previous images that have same src - var resource = cache[ this.img.src ] || new Resource( this.img.src ); - if ( resource.isConfirmed ) { - this.confirm( resource.isLoaded, 'cached was confirmed' ); - return; - } - - // If complete is true and browser supports natural sizes, - // try to check for image status manually. - if ( this.img.complete && this.img.naturalWidth !== undefined ) { - // report based on naturalWidth - this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); - return; - } - - // If none of the checks above matched, simulate loading on detached element. - var _this = this; - resource.on( 'confirm', function( resrc, message ) { - _this.confirm( resrc.isLoaded, message ); - return true; - }); - - resource.check(); + // If complete is true and browser supports natural sizes, + // try to check for image status manually. + var isComplete = this.getIsImageComplete(); + if ( isComplete ) { + // report based on naturalWidth + this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); + return; + } + + // If none of the checks above matched, simulate loading on detached element. + this.proxyImage = new Image(); + this.proxyImage.addEventListener( 'load', this ); + this.proxyImage.addEventListener( 'error', this ); + // bind to image as well for Firefox. #191 + this.img.addEventListener( 'load', this ); + this.img.addEventListener( 'error', this ); + this.proxyImage.src = this.img.src; }; - - LoadingImage.prototype.confirm = function( isLoaded, message ) { - this.isLoaded = isLoaded; - this.emit( 'confirm', this, message ); + + LoadingImage.prototype.getIsImageComplete = function() { + // check for non-zero, non-undefined naturalWidth + // fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671 + return this.img.complete && this.img.naturalWidth; }; - - // -------------------------- Resource -------------------------- // - - // Resource checks each src, only once - // separate class from LoadingImage to prevent memory leaks. See #115 - - var cache = {}; - - function Resource( src ) { - this.src = src; - // add to cache - cache[ src ] = this; - } - - Resource.prototype = new EventEmitter(); - - Resource.prototype.check = function() { - // only trigger checking once - if ( this.isChecked ) { - return; - } - // simulate loading on detached element - var proxyImage = new Image(); - eventie.bind( proxyImage, 'load', this ); - eventie.bind( proxyImage, 'error', this ); - proxyImage.src = this.src; - // set flag - this.isChecked = true; + + LoadingImage.prototype.confirm = function( isLoaded, message ) { + this.isLoaded = isLoaded; + this.emitEvent( 'progress', [ this, this.img, message ] ); }; - + // ----- events ----- // - + // trigger specified handler for event type - Resource.prototype.handleEvent = function( event ) { - var method = 'on' + event.type; - if ( this[ method ] ) { - this[ method ]( event ); - } + LoadingImage.prototype.handleEvent = function( event ) { + var method = 'on' + event.type; + if ( this[ method ] ) { + this[ method ]( event ); + } }; - - Resource.prototype.onload = function( event ) { - this.confirm( true, 'onload' ); - this.unbindProxyEvents( event ); + + LoadingImage.prototype.onload = function() { + this.confirm( true, 'onload' ); + this.unbindEvents(); }; - - Resource.prototype.onerror = function( event ) { - this.confirm( false, 'onerror' ); - this.unbindProxyEvents( event ); + + LoadingImage.prototype.onerror = function() { + this.confirm( false, 'onerror' ); + this.unbindEvents(); }; - - // ----- confirm ----- // - - Resource.prototype.confirm = function( isLoaded, message ) { - this.isConfirmed = true; - this.isLoaded = isLoaded; - this.emit( 'confirm', this, message ); + + LoadingImage.prototype.unbindEvents = function() { + this.proxyImage.removeEventListener( 'load', this ); + this.proxyImage.removeEventListener( 'error', this ); + this.img.removeEventListener( 'load', this ); + this.img.removeEventListener( 'error', this ); }; - - Resource.prototype.unbindProxyEvents = function( event ) { - eventie.unbind( event.target, 'load', this ); - eventie.unbind( event.target, 'error', this ); + + // -------------------------- Background -------------------------- // + + function Background( url, element ) { + this.url = url; + this.element = element; + this.img = new Image(); + } + + // inherit LoadingImage prototype + Background.prototype = Object.create( LoadingImage.prototype ); + + Background.prototype.check = function() { + this.img.addEventListener( 'load', this ); + this.img.addEventListener( 'error', this ); + this.img.src = this.url; + // check if image is already complete + var isComplete = this.getIsImageComplete(); + if ( isComplete ) { + this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); + this.unbindEvents(); + } }; - - // ----- ----- // - + + Background.prototype.unbindEvents = function() { + this.img.removeEventListener( 'load', this ); + this.img.removeEventListener( 'error', this ); + }; + + Background.prototype.confirm = function( isLoaded, message ) { + this.isLoaded = isLoaded; + this.emitEvent( 'progress', [ this, this.element, message ] ); + }; + + // -------------------------- jQuery -------------------------- // + + ImagesLoaded.makeJQueryPlugin = function( jQuery ) { + jQuery = jQuery || window.jQuery; + if ( !jQuery ) { + return; + } + // set local variable + $ = jQuery; + // $().imagesLoaded() + $.fn.imagesLoaded = function( options, callback ) { + var instance = new ImagesLoaded( this, options, callback ); + return instance.jqDeferred.promise( $(this) ); + }; + }; + // try making plugin + ImagesLoaded.makeJQueryPlugin(); + + // -------------------------- -------------------------- // + return ImagesLoaded; - -}); + + }); + \ No newline at end of file diff --git a/js/site.dev.js b/js/site.dev.js index a5986e78..17172536 100644 --- a/js/site.dev.js +++ b/js/site.dev.js @@ -2,8 +2,8 @@ // uw.edu/marketing/web/ // A UW JavaScript library that implements various web components to any site // Includes hard dependencies jQuery (v2.1.1), Backbone (1.1.2), and Underscore (1.6.0) - -;(function () { +(function($){ + ;/* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * @@ -8501,899 +8501,502 @@ vjs.plugin = function(name, init){ vjs.Player.prototype[name] = init; }; ;/*! - * imagesLoaded PACKAGED v3.1.8 + * imagesLoaded PACKAGED v4.1.4 * JavaScript is all like "You images are done yet or what?" * MIT License */ +/** + * EvEmitter v1.1.0 + * Lil' event emitter + * MIT License + */ -/*! - * EventEmitter v4.2.6 - git.io/ee - * Oliver Caldwell - * MIT license - * @preserve - */ - -(function () { - - - /** - * Class for managing events. - * Can be extended to provide event functionality in other classes. - * - * @class EventEmitter Manages event registering and emitting. - */ - function EventEmitter() {} - - // Shortcuts to improve speed and size - var proto = EventEmitter.prototype; - var exports = this; - var originalGlobalValue = exports.EventEmitter; - - /** - * Finds the index of the listener for the event in it's storage array. - * - * @param {Function[]} listeners Array of listeners to search through. - * @param {Function} listener Method to look for. - * @return {Number} Index of the specified listener, -1 if not found - * @api private - */ - function indexOfListener(listeners, listener) { - var i = listeners.length; - while (i--) { - if (listeners[i].listener === listener) { - return i; - } - } - - return -1; - } - - /** - * Alias a method while keeping the context correct, to allow for overwriting of target method. - * - * @param {String} name The name of the target method. - * @return {Function} The aliased method - * @api private - */ - function alias(name) { - return function aliasClosure() { - return this[name].apply(this, arguments); - }; +/* jshint unused: true, undef: true, strict: true */ + +( function( global, factory ) { + // universal module definition + /* jshint strict: false */ /* globals define, module, window */ + if ( typeof define == 'function' && define.amd ) { + // AMD - RequireJS + define( 'ev-emitter/ev-emitter',factory ); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS - Browserify, Webpack + module.exports = factory(); + } else { + // Browser globals + global.EvEmitter = factory(); } - - /** - * Returns the listener array for the specified event. - * Will initialise the event object and listener arrays if required. - * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. - * Each property in the object response is an array of listener functions. - * - * @param {String|RegExp} evt Name of the event to return the listeners from. - * @return {Function[]|Object} All listener functions for the event. - */ - proto.getListeners = function getListeners(evt) { - var events = this._getEvents(); - var response; - var key; - - // Return a concatenated array of all matching events if - // the selector is a regular expression. - if (typeof evt === 'object') { - response = {}; - for (key in events) { - if (events.hasOwnProperty(key) && evt.test(key)) { - response[key] = events[key]; - } - } - } - else { - response = events[evt] || (events[evt] = []); - } - - return response; - }; - - /** - * Takes a list of listener objects and flattens it into a list of listener functions. - * - * @param {Object[]} listeners Raw listener objects. - * @return {Function[]} Just the listener functions. - */ - proto.flattenListeners = function flattenListeners(listeners) { - var flatListeners = []; - var i; - - for (i = 0; i < listeners.length; i += 1) { - flatListeners.push(listeners[i].listener); - } - - return flatListeners; - }; - - /** - * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. - * - * @param {String|RegExp} evt Name of the event to return the listeners from. - * @return {Object} All listener functions for an event in an object. - */ - proto.getListenersAsObject = function getListenersAsObject(evt) { - var listeners = this.getListeners(evt); - var response; - - if (listeners instanceof Array) { - response = {}; - response[evt] = listeners; - } - - return response || listeners; - }; - - /** - * Adds a listener function to the specified event. - * The listener will not be added if it is a duplicate. - * If the listener returns true then it will be removed after it is called. - * If you pass a regular expression as the event name then the listener will be added to all events that match it. - * - * @param {String|RegExp} evt Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addListener = function addListener(evt, listener) { - var listeners = this.getListenersAsObject(evt); - var listenerIsWrapped = typeof listener === 'object'; - var key; - - for (key in listeners) { - if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { - listeners[key].push(listenerIsWrapped ? listener : { - listener: listener, - once: false - }); - } - } - - return this; - }; - - /** - * Alias of addListener - */ - proto.on = alias('addListener'); - - /** - * Semi-alias of addListener. It will add a listener that will be - * automatically removed after it's first execution. - * - * @param {String|RegExp} evt Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addOnceListener = function addOnceListener(evt, listener) { - return this.addListener(evt, { - listener: listener, - once: true - }); - }; - - /** - * Alias of addOnceListener. - */ - proto.once = alias('addOnceListener'); - - /** - * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. - * You need to tell it what event names should be matched by a regex. - * - * @param {String} evt Name of the event to create. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.defineEvent = function defineEvent(evt) { - this.getListeners(evt); - return this; - }; - - /** - * Uses defineEvent to define multiple events. - * - * @param {String[]} evts An array of event names to define. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.defineEvents = function defineEvents(evts) { - for (var i = 0; i < evts.length; i += 1) { - this.defineEvent(evts[i]); - } - return this; - }; - - /** - * Removes a listener function from the specified event. - * When passed a regular expression as the event name, it will remove the listener from all events that match it. - * - * @param {String|RegExp} evt Name of the event to remove the listener from. - * @param {Function} listener Method to remove from the event. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeListener = function removeListener(evt, listener) { - var listeners = this.getListenersAsObject(evt); - var index; - var key; - - for (key in listeners) { - if (listeners.hasOwnProperty(key)) { - index = indexOfListener(listeners[key], listener); - - if (index !== -1) { - listeners[key].splice(index, 1); - } - } - } - - return this; - }; - - /** - * Alias of removeListener - */ - proto.off = alias('removeListener'); - - /** - * Adds listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. - * You can also pass it a regular expression to add the array of listeners to all events that match it. - * Yeah, this function does quite a bit. That's probably a bad thing. - * - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addListeners = function addListeners(evt, listeners) { - // Pass through to manipulateListeners - return this.manipulateListeners(false, evt, listeners); - }; - - /** - * Removes listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be removed. - * You can also pass it a regular expression to remove the listeners from all events that match it. - * - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to remove. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeListeners = function removeListeners(evt, listeners) { - // Pass through to manipulateListeners - return this.manipulateListeners(true, evt, listeners); - }; - - /** - * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. - * The first argument will determine if the listeners are removed (true) or added (false). - * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added/removed. - * You can also pass it a regular expression to manipulate the listeners of all events that match it. - * - * @param {Boolean} remove True if you want to remove listeners, false if you want to add. - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add/remove. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { - var i; - var value; - var single = remove ? this.removeListener : this.addListener; - var multiple = remove ? this.removeListeners : this.addListeners; - - // If evt is an object then pass each of it's properties to this method - if (typeof evt === 'object' && !(evt instanceof RegExp)) { - for (i in evt) { - if (evt.hasOwnProperty(i) && (value = evt[i])) { - // Pass the single listener straight through to the singular method - if (typeof value === 'function') { - single.call(this, i, value); - } - else { - // Otherwise pass back to the multiple function - multiple.call(this, i, value); - } - } - } - } - else { - // So evt must be a string - // And listeners must be an array of listeners - // Loop over it and pass each one to the multiple method - i = listeners.length; - while (i--) { - single.call(this, evt, listeners[i]); - } - } - - return this; - }; - - /** - * Removes all listeners from a specified event. - * If you do not specify an event then all listeners will be removed. - * That means every event will be emptied. - * You can also pass a regex to remove all events that match it. - * - * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeEvent = function removeEvent(evt) { - var type = typeof evt; - var events = this._getEvents(); - var key; - - // Remove different things depending on the state of evt - if (type === 'string') { - // Remove all listeners for the specified event - delete events[evt]; - } - else if (type === 'object') { - // Remove all events matching the regex. - for (key in events) { - if (events.hasOwnProperty(key) && evt.test(key)) { - delete events[key]; - } - } - } - else { - // Remove all listeners in all events - delete this._events; - } - - return this; - }; - - /** - * Alias of removeEvent. - * - * Added to mirror the node API. - */ - proto.removeAllListeners = alias('removeEvent'); - - /** - * Emits an event of your choice. - * When emitted, every listener attached to that event will be executed. - * If you pass the optional argument array then those arguments will be passed to every listener upon execution. - * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. - * So they will not arrive within the array on the other side, they will be separate. - * You can also pass a regular expression to emit to all events that match it. - * - * @param {String|RegExp} evt Name of the event to emit and execute listeners for. - * @param {Array} [args] Optional array of arguments to be passed to each listener. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.emitEvent = function emitEvent(evt, args) { - var listeners = this.getListenersAsObject(evt); - var listener; - var i; - var key; - var response; - - for (key in listeners) { - if (listeners.hasOwnProperty(key)) { - i = listeners[key].length; - - while (i--) { - // If the listener returns true then it shall be removed from the event - // The function is executed either with a basic call or an apply if there is an args array - listener = listeners[key][i]; - - if (listener.once === true) { - this.removeListener(evt, listener.listener); - } - - response = listener.listener.apply(this, args || []); - - if (response === this._getOnceReturnValue()) { - this.removeListener(evt, listener.listener); - } - } - } - } - - return this; - }; - - /** - * Alias of emitEvent - */ - proto.trigger = alias('emitEvent'); - - /** - * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. - * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. - * - * @param {String|RegExp} evt Name of the event to emit and execute listeners for. - * @param {...*} Optional additional arguments to be passed to each listener. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.emit = function emit(evt) { - var args = Array.prototype.slice.call(arguments, 1); - return this.emitEvent(evt, args); - }; - - /** - * Sets the current value to check against when executing listeners. If a - * listeners return value matches the one set here then it will be removed - * after execution. This value defaults to true. - * - * @param {*} value The new value to check for when executing listeners. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.setOnceReturnValue = function setOnceReturnValue(value) { - this._onceReturnValue = value; - return this; - }; - - /** - * Fetches the current value to check against when executing listeners. If - * the listeners return value matches this one then it should be removed - * automatically. It will return true by default. - * - * @return {*|Boolean} The current value to check for or the default, true. - * @api private - */ - proto._getOnceReturnValue = function _getOnceReturnValue() { - if (this.hasOwnProperty('_onceReturnValue')) { - return this._onceReturnValue; - } - else { - return true; - } - }; - - /** - * Fetches the events object and creates one if required. - * - * @return {Object} The events storage object. - * @api private - */ - proto._getEvents = function _getEvents() { - return this._events || (this._events = {}); - }; - - /** - * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. - * - * @return {Function} Non conflicting EventEmitter class. - */ - EventEmitter.noConflict = function noConflict() { - exports.EventEmitter = originalGlobalValue; - return EventEmitter; - }; - - // Expose the class either via AMD, CommonJS or the global object - if (typeof define === 'function' && define.amd) { - define('eventEmitter/EventEmitter',[],function () { - return EventEmitter; - }); + + }( typeof window != 'undefined' ? window : this, function() { + + + + function EvEmitter() {} + + var proto = EvEmitter.prototype; + + proto.on = function( eventName, listener ) { + if ( !eventName || !listener ) { + return; } - else if (typeof module === 'object' && module.exports){ - module.exports = EventEmitter; + // set events hash + var events = this._events = this._events || {}; + // set listeners array + var listeners = events[ eventName ] = events[ eventName ] || []; + // only add once + if ( listeners.indexOf( listener ) == -1 ) { + listeners.push( listener ); } - else { - this.EventEmitter = EventEmitter; + + return this; + }; + + proto.once = function( eventName, listener ) { + if ( !eventName || !listener ) { + return; } -}.call(this)); - -/*! - * eventie v1.0.4 - * event binding helper - * eventie.bind( elem, 'click', myFn ) - * eventie.unbind( elem, 'click', myFn ) - */ - -/*jshint browser: true, undef: true, unused: true */ -/*global define: false */ - -( function( window ) { - - - -var docElem = document.documentElement; - -var bind = function() {}; - -function getIEEvent( obj ) { - var event = window.event; - // add event.target - event.target = event.target || event.srcElement || obj; - return event; -} - -if ( docElem.addEventListener ) { - bind = function( obj, type, fn ) { - obj.addEventListener( type, fn, false ); + // add event + this.on( eventName, listener ); + // set once flag + // set onceEvents hash + var onceEvents = this._onceEvents = this._onceEvents || {}; + // set onceListeners object + var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; + // set flag + onceListeners[ listener ] = true; + + return this; }; -} else if ( docElem.attachEvent ) { - bind = function( obj, type, fn ) { - obj[ type + fn ] = fn.handleEvent ? - function() { - var event = getIEEvent( obj ); - fn.handleEvent.call( fn, event ); - } : - function() { - var event = getIEEvent( obj ); - fn.call( obj, event ); - }; - obj.attachEvent( "on" + type, obj[ type + fn ] ); + + proto.off = function( eventName, listener ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { + return; + } + var index = listeners.indexOf( listener ); + if ( index != -1 ) { + listeners.splice( index, 1 ); + } + + return this; }; -} - -var unbind = function() {}; - -if ( docElem.removeEventListener ) { - unbind = function( obj, type, fn ) { - obj.removeEventListener( type, fn, false ); + + proto.emitEvent = function( eventName, args ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { + return; + } + // copy over to avoid interference if .off() in listener + listeners = listeners.slice(0); + args = args || []; + // once stuff + var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; + + for ( var i=0; i < listeners.length; i++ ) { + var listener = listeners[i] + var isOnce = onceListeners && onceListeners[ listener ]; + if ( isOnce ) { + // remove listener + // remove before trigger to prevent recursion + this.off( eventName, listener ); + // unset once flag + delete onceListeners[ listener ]; + } + // trigger listener + listener.apply( this, args ); + } + + return this; }; -} else if ( docElem.detachEvent ) { - unbind = function( obj, type, fn ) { - obj.detachEvent( "on" + type, obj[ type + fn ] ); - try { - delete obj[ type + fn ]; - } catch ( err ) { - // can't delete window object properties - obj[ type + fn ] = undefined; - } + + proto.allOff = function() { + delete this._events; + delete this._onceEvents; }; -} - -var eventie = { - bind: bind, - unbind: unbind -}; - -// transport -if ( typeof define === 'function' && define.amd ) { - // AMD - define( 'eventie/eventie',eventie ); -} else { - // browser global - window.eventie = eventie; -} - -})( this ); - -/*! - * imagesLoaded v3.1.8 - * JavaScript is all like "You images are done yet or what?" - * MIT License - */ - -( function( window, factory ) { - // universal module definition - - /*global define: false, module: false, require: false */ - - if ( typeof define === 'function' && define.amd ) { - // AMD - define( [ - 'eventEmitter/EventEmitter', - 'eventie/eventie' - ], function( EventEmitter, eventie ) { - return factory( window, EventEmitter, eventie ); - }); - } else if ( typeof exports === 'object' ) { - // CommonJS - module.exports = factory( - window, - require('wolfy87-eventemitter'), - require('eventie') - ); - } else { - // browser global - window.imagesLoaded = factory( - window, - window.EventEmitter, - window.eventie - ); - } - -})( window, - -// -------------------------- factory -------------------------- // - -function factory( window, EventEmitter, eventie ) { - - - -var $ = window.jQuery; -var console = window.console; -var hasConsole = typeof console !== 'undefined'; - -// -------------------------- helpers -------------------------- // - -// extend objects -function extend( a, b ) { - for ( var prop in b ) { - a[ prop ] = b[ prop ]; + + return EvEmitter; + + })); + + /*! + * imagesLoaded v4.1.4 + * JavaScript is all like "You images are done yet or what?" + * MIT License + */ + + ( function( window, factory ) { 'use strict'; + // universal module definition + + /*global define: false, module: false, require: false */ + + if ( typeof define == 'function' && define.amd ) { + // AMD + define( [ + 'ev-emitter/ev-emitter' + ], function( EvEmitter ) { + return factory( window, EvEmitter ); + }); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS + module.exports = factory( + window, + require('ev-emitter') + ); + } else { + // browser global + window.imagesLoaded = factory( + window, + window.EvEmitter + ); + } + + })( typeof window !== 'undefined' ? window : this, + + // -------------------------- factory -------------------------- // + + function factory( window, EvEmitter ) { + + + + var $ = window.jQuery; + var console = window.console; + + // -------------------------- helpers -------------------------- // + + // extend objects + function extend( a, b ) { + for ( var prop in b ) { + a[ prop ] = b[ prop ]; + } + return a; } - return a; -} - -var objToString = Object.prototype.toString; -function isArray( obj ) { - return objToString.call( obj ) === '[object Array]'; -} - -// turn element or nodeList into an array -function makeArray( obj ) { - var ary = []; - if ( isArray( obj ) ) { - // use object if already an array - ary = obj; - } else if ( typeof obj.length === 'number' ) { - // convert nodeList to array - for ( var i=0, len = obj.length; i < len; i++ ) { - ary.push( obj[i] ); - } - } else { - // array of single index - ary.push( obj ); + + var arraySlice = Array.prototype.slice; + + // turn element or nodeList into an array + function makeArray( obj ) { + if ( Array.isArray( obj ) ) { + // use object if already an array + return obj; + } + + var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; + if ( isArrayLike ) { + // convert nodeList to array + return arraySlice.call( obj ); + } + + // array of single index + return [ obj ]; } - return ary; -} - + // -------------------------- imagesLoaded -------------------------- // - + /** * @param {Array, Element, NodeList, String} elem * @param {Object or Function} options - if function, use as callback * @param {Function} onAlways - callback function */ function ImagesLoaded( elem, options, onAlways ) { - // coerce ImagesLoaded() without new, to be new ImagesLoaded() - if ( !( this instanceof ImagesLoaded ) ) { - return new ImagesLoaded( elem, options ); - } - // use elem as selector string - if ( typeof elem === 'string' ) { - elem = document.querySelectorAll( elem ); - } - - this.elements = makeArray( elem ); - this.options = extend( {}, this.options ); - - if ( typeof options === 'function' ) { - onAlways = options; - } else { - extend( this.options, options ); - } - - if ( onAlways ) { - this.on( 'always', onAlways ); - } - - this.getImages(); - - if ( $ ) { - // add jQuery Deferred object - this.jqDeferred = new $.Deferred(); - } - - // HACK check async to allow time to bind listeners - var _this = this; - setTimeout( function() { - _this.check(); - }); + // coerce ImagesLoaded() without new, to be new ImagesLoaded() + if ( !( this instanceof ImagesLoaded ) ) { + return new ImagesLoaded( elem, options, onAlways ); + } + // use elem as selector string + var queryElem = elem; + if ( typeof elem == 'string' ) { + queryElem = document.querySelectorAll( elem ); + } + // bail if bad element + if ( !queryElem ) { + console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) ); + return; + } + + this.elements = makeArray( queryElem ); + this.options = extend( {}, this.options ); + // shift arguments if no options set + if ( typeof options == 'function' ) { + onAlways = options; + } else { + extend( this.options, options ); + } + + if ( onAlways ) { + this.on( 'always', onAlways ); + } + + this.getImages(); + + if ( $ ) { + // add jQuery Deferred object + this.jqDeferred = new $.Deferred(); + } + + // HACK check async to allow time to bind listeners + setTimeout( this.check.bind( this ) ); } - - ImagesLoaded.prototype = new EventEmitter(); - + + ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); + ImagesLoaded.prototype.options = {}; - + ImagesLoaded.prototype.getImages = function() { - this.images = []; - - // filter & find items if we have an item selector - for ( var i=0, len = this.elements.length; i < len; i++ ) { - var elem = this.elements[i]; - // filter siblings - if ( elem.nodeName === 'IMG' ) { - this.addImage( elem ); - } - // find children - // no non-element nodes, #143 - var nodeType = elem.nodeType; - if ( !nodeType || !( nodeType === 1 || nodeType === 9 || nodeType === 11 ) ) { - continue; - } - var childElems = elem.querySelectorAll('img'); - // concat childElems to filterFound array - for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { - var img = childElems[j]; - this.addImage( img ); - } - } + this.images = []; + + // filter & find items if we have an item selector + this.elements.forEach( this.addElementImages, this ); }; - + + /** + * @param {Node} element + */ + ImagesLoaded.prototype.addElementImages = function( elem ) { + // filter siblings + if ( elem.nodeName == 'IMG' ) { + this.addImage( elem ); + } + // get background image on element + if ( this.options.background === true ) { + this.addElementBackgroundImages( elem ); + } + + // find children + // no non-element nodes, #143 + var nodeType = elem.nodeType; + if ( !nodeType || !elementNodeTypes[ nodeType ] ) { + return; + } + var childImgs = elem.querySelectorAll('img'); + // concat childElems to filterFound array + for ( var i=0; i < childImgs.length; i++ ) { + var img = childImgs[i]; + this.addImage( img ); + } + + // get child background images + if ( typeof this.options.background == 'string' ) { + var children = elem.querySelectorAll( this.options.background ); + for ( i=0; i < children.length; i++ ) { + var child = children[i]; + this.addElementBackgroundImages( child ); + } + } + }; + + var elementNodeTypes = { + 1: true, + 9: true, + 11: true + }; + + ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { + var style = getComputedStyle( elem ); + if ( !style ) { + // Firefox returns null if in a hidden iframe https://bugzil.la/548397 + return; + } + // get url inside url("...") + var reURL = /url\((['"])?(.*?)\1\)/gi; + var matches = reURL.exec( style.backgroundImage ); + while ( matches !== null ) { + var url = matches && matches[2]; + if ( url ) { + this.addBackground( url, elem ); + } + matches = reURL.exec( style.backgroundImage ); + } + }; + /** * @param {Image} img */ ImagesLoaded.prototype.addImage = function( img ) { - var loadingImage = new LoadingImage( img ); - this.images.push( loadingImage ); + var loadingImage = new LoadingImage( img ); + this.images.push( loadingImage ); }; - + + ImagesLoaded.prototype.addBackground = function( url, elem ) { + var background = new Background( url, elem ); + this.images.push( background ); + }; + ImagesLoaded.prototype.check = function() { - var _this = this; - var checkedCount = 0; - var length = this.images.length; - this.hasAnyBroken = false; - // complete if no images - if ( !length ) { - this.complete(); - return; - } - - function onConfirm( image, message ) { - if ( _this.options.debug && hasConsole ) { - console.log( 'confirm', image, message ); - } - - _this.progress( image ); - checkedCount++; - if ( checkedCount === length ) { - _this.complete(); - } - return true; // bind once - } - - for ( var i=0; i < length; i++ ) { - var loadingImage = this.images[i]; - loadingImage.on( 'confirm', onConfirm ); - loadingImage.check(); - } + var _this = this; + this.progressedCount = 0; + this.hasAnyBroken = false; + // complete if no images + if ( !this.images.length ) { + this.complete(); + return; + } + + function onProgress( image, elem, message ) { + // HACK - Chrome triggers event before object properties have changed. #83 + setTimeout( function() { + _this.progress( image, elem, message ); + }); + } + + this.images.forEach( function( loadingImage ) { + loadingImage.once( 'progress', onProgress ); + loadingImage.check(); + }); }; - - ImagesLoaded.prototype.progress = function( image ) { - this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; - // HACK - Chrome triggers event before object properties have changed. #83 - var _this = this; - setTimeout( function() { - _this.emit( 'progress', _this, image ); - if ( _this.jqDeferred && _this.jqDeferred.notify ) { - _this.jqDeferred.notify( _this, image ); - } - }); + + ImagesLoaded.prototype.progress = function( image, elem, message ) { + this.progressedCount++; + this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; + // progress event + this.emitEvent( 'progress', [ this, image, elem ] ); + if ( this.jqDeferred && this.jqDeferred.notify ) { + this.jqDeferred.notify( this, image ); + } + // check if completed + if ( this.progressedCount == this.images.length ) { + this.complete(); + } + + if ( this.options.debug && console ) { + console.log( 'progress: ' + message, image, elem ); + } }; - + ImagesLoaded.prototype.complete = function() { - var eventName = this.hasAnyBroken ? 'fail' : 'done'; - this.isComplete = true; - var _this = this; - // HACK - another setTimeout so that confirm happens after progress - setTimeout( function() { - _this.emit( eventName, _this ); - _this.emit( 'always', _this ); - if ( _this.jqDeferred ) { - var jqMethod = _this.hasAnyBroken ? 'reject' : 'resolve'; - _this.jqDeferred[ jqMethod ]( _this ); - } - }); + var eventName = this.hasAnyBroken ? 'fail' : 'done'; + this.isComplete = true; + this.emitEvent( eventName, [ this ] ); + this.emitEvent( 'always', [ this ] ); + if ( this.jqDeferred ) { + var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; + this.jqDeferred[ jqMethod ]( this ); + } }; - - // -------------------------- jquery -------------------------- // - - if ( $ ) { - $.fn.imagesLoaded = function( options, callback ) { - var instance = new ImagesLoaded( this, options, callback ); - return instance.jqDeferred.promise( $(this) ); - }; - } - - + // -------------------------- -------------------------- // - + function LoadingImage( img ) { - this.img = img; + this.img = img; } - - LoadingImage.prototype = new EventEmitter(); - + + LoadingImage.prototype = Object.create( EvEmitter.prototype ); + LoadingImage.prototype.check = function() { - // first check cached any previous images that have same src - var resource = cache[ this.img.src ] || new Resource( this.img.src ); - if ( resource.isConfirmed ) { - this.confirm( resource.isLoaded, 'cached was confirmed' ); - return; - } - - // If complete is true and browser supports natural sizes, - // try to check for image status manually. - if ( this.img.complete && this.img.naturalWidth !== undefined ) { - // report based on naturalWidth - this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); - return; - } - - // If none of the checks above matched, simulate loading on detached element. - var _this = this; - resource.on( 'confirm', function( resrc, message ) { - _this.confirm( resrc.isLoaded, message ); - return true; - }); - - resource.check(); + // If complete is true and browser supports natural sizes, + // try to check for image status manually. + var isComplete = this.getIsImageComplete(); + if ( isComplete ) { + // report based on naturalWidth + this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); + return; + } + + // If none of the checks above matched, simulate loading on detached element. + this.proxyImage = new Image(); + this.proxyImage.addEventListener( 'load', this ); + this.proxyImage.addEventListener( 'error', this ); + // bind to image as well for Firefox. #191 + this.img.addEventListener( 'load', this ); + this.img.addEventListener( 'error', this ); + this.proxyImage.src = this.img.src; }; - - LoadingImage.prototype.confirm = function( isLoaded, message ) { - this.isLoaded = isLoaded; - this.emit( 'confirm', this, message ); + + LoadingImage.prototype.getIsImageComplete = function() { + // check for non-zero, non-undefined naturalWidth + // fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671 + return this.img.complete && this.img.naturalWidth; }; - - // -------------------------- Resource -------------------------- // - - // Resource checks each src, only once - // separate class from LoadingImage to prevent memory leaks. See #115 - - var cache = {}; - - function Resource( src ) { - this.src = src; - // add to cache - cache[ src ] = this; - } - - Resource.prototype = new EventEmitter(); - - Resource.prototype.check = function() { - // only trigger checking once - if ( this.isChecked ) { - return; - } - // simulate loading on detached element - var proxyImage = new Image(); - eventie.bind( proxyImage, 'load', this ); - eventie.bind( proxyImage, 'error', this ); - proxyImage.src = this.src; - // set flag - this.isChecked = true; + + LoadingImage.prototype.confirm = function( isLoaded, message ) { + this.isLoaded = isLoaded; + this.emitEvent( 'progress', [ this, this.img, message ] ); }; - + // ----- events ----- // - + // trigger specified handler for event type - Resource.prototype.handleEvent = function( event ) { - var method = 'on' + event.type; - if ( this[ method ] ) { - this[ method ]( event ); - } + LoadingImage.prototype.handleEvent = function( event ) { + var method = 'on' + event.type; + if ( this[ method ] ) { + this[ method ]( event ); + } }; - - Resource.prototype.onload = function( event ) { - this.confirm( true, 'onload' ); - this.unbindProxyEvents( event ); + + LoadingImage.prototype.onload = function() { + this.confirm( true, 'onload' ); + this.unbindEvents(); }; - - Resource.prototype.onerror = function( event ) { - this.confirm( false, 'onerror' ); - this.unbindProxyEvents( event ); + + LoadingImage.prototype.onerror = function() { + this.confirm( false, 'onerror' ); + this.unbindEvents(); }; - - // ----- confirm ----- // - - Resource.prototype.confirm = function( isLoaded, message ) { - this.isConfirmed = true; - this.isLoaded = isLoaded; - this.emit( 'confirm', this, message ); + + LoadingImage.prototype.unbindEvents = function() { + this.proxyImage.removeEventListener( 'load', this ); + this.proxyImage.removeEventListener( 'error', this ); + this.img.removeEventListener( 'load', this ); + this.img.removeEventListener( 'error', this ); }; - - Resource.prototype.unbindProxyEvents = function( event ) { - eventie.unbind( event.target, 'load', this ); - eventie.unbind( event.target, 'error', this ); + + // -------------------------- Background -------------------------- // + + function Background( url, element ) { + this.url = url; + this.element = element; + this.img = new Image(); + } + + // inherit LoadingImage prototype + Background.prototype = Object.create( LoadingImage.prototype ); + + Background.prototype.check = function() { + this.img.addEventListener( 'load', this ); + this.img.addEventListener( 'error', this ); + this.img.src = this.url; + // check if image is already complete + var isComplete = this.getIsImageComplete(); + if ( isComplete ) { + this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); + this.unbindEvents(); + } }; - - // ----- ----- // - + + Background.prototype.unbindEvents = function() { + this.img.removeEventListener( 'load', this ); + this.img.removeEventListener( 'error', this ); + }; + + Background.prototype.confirm = function( isLoaded, message ) { + this.isLoaded = isLoaded; + this.emitEvent( 'progress', [ this, this.element, message ] ); + }; + + // -------------------------- jQuery -------------------------- // + + ImagesLoaded.makeJQueryPlugin = function( jQuery ) { + jQuery = jQuery || window.jQuery; + if ( !jQuery ) { + return; + } + // set local variable + $ = jQuery; + // $().imagesLoaded() + $.fn.imagesLoaded = function( options, callback ) { + var instance = new ImagesLoaded( this, options, callback ); + return instance.jqDeferred.promise( $(this) ); + }; + }; + // try making plugin + ImagesLoaded.makeJQueryPlugin(); + + // -------------------------- -------------------------- // + return ImagesLoaded; - -}); -; + + }); + ; jQuery(document).ready(function($) { // gallery faded layer and container elements @@ -10966,7 +10569,6 @@ UW.elements = { slideshow : '.uw-slideshow', social : '.uw-social', vimeo : '.uw-vimeo', - youtube : '.uw-youtube', // customlink : '.uw-custom-link' } @@ -10995,7 +10597,6 @@ UW.wpinstance = function(){ UW.sources = { // Note: style_dir is a variable created by the Wordpress' wp_localize_script in class.uw-scripts.php - quicklinks : typeof(style_dir) !== 'undefined' ? style_dir + '/wp-admin/admin-ajax.php?action=quicklinks' : UW.getBaseUrl() + 'wp-admin/admin-ajax.php?action=quicklinks', search : UW.getBaseUrl() + 'wp-admin/admin-ajax.php' } @@ -11010,7 +10611,7 @@ UW.initialize = function( $ ) // UW Utilities UW.dropdowns = _.map( $( UW.elements.dropdowns ), function( element ) { return new UW.Dropdowns({ el : element }) } ) UW.mobilemenu = _.map( $( UW.elements.mobilemenu ), function( element ) { return new UW.MobileMenu({ el : element }) } ) - UW.quicklinks = _.map( $( UW.elements.quicklinks ), function( element ) { return new UW.QuickLinks( { el : element, url : UW.sources.quicklinks }) } ) + UW.quicklinks = _.map( $( UW.elements.quicklinks ), function( element ) { return new UW.QuickLinks( { el : element }) } ) UW.search = _.map( $( UW.elements.search ), function( element ) { return new UW.Search( { el : element } ) } ) UW.images = _.map( $( UW.elements.images ), function( element ) { return new UW.Image({ el : element }) } ) @@ -11021,7 +10622,6 @@ UW.initialize = function( $ ) UW.slideshows = _.map( $( UW.elements.slideshow ), function( element ) { return new UW.Slideshow( { el : element }) } ) UW.social = _.map( $( UW.elements.social ), function( element ) { return new UW.Social({ el : element }) } ) UW.vimeo = _.map( $( UW.elements.vimeo ), function( element ) { return new UW.Vimeo({ el : element }) } ) - UW.youtube = _.map( $( UW.elements.youtube ), function( element ) { return new UW.YouTube.Collection({ el: element})}) // UW Components - These need to render after all other javascript elements are rendered on page @@ -11326,70 +10926,25 @@ UW.Search = Backbone.View.extend({ UW.QuickLinks = Backbone.View.extend({ - DELAY : 500, - - settings : {}, - - // todo: the default list and these elements could be put into the php templates container: '#uw-container', - template : '', - events: { - 'click' : 'animate', - 'touchstart' : 'animate', - 'keyup' : 'animate', - 'blur' : 'loop' + 'click' : 'animate', + 'touchstart' : 'animate', + 'keyup' : 'animate', + 'blur' : 'loop' }, initialize: function ( options ) { - _.bindAll( this, 'inner_keydown', 'render', 'renderDefault', 'animate', 'accessible', 'loop', 'transitionEnd' ); - - this.options = _.extend( {}, this.settings , options ) - - this.links = new UW.QuickLinks.Collection( this.options ) - - this.links.on( 'sync', this.render ) - - this.links.on( 'error', this.renderDefault ) - - this.links.fetch() - }, - - renderDefault : function () - { - this.defaultLinks = this.links.defaults - this.render() + _.bindAll( this, 'inner_keydown', 'render', 'animate', 'accessible', 'loop', 'transitionEnd' ); + + this.render(); }, render : function( ) { - this.defaultLinks = this.links.defaults - this.quicklinks = $( _.template( this.template )({ links : this.links.toJSON().length == 0 ? this.defaultLinks : this.links.toJSON() }) ); - this.$container = $(this.container); - this.$container.prepend( this.quicklinks ); + this.quicklinks = $( '#quicklinks' ); + this.$container = $( this.container ); this.$el.attr( 'aria-controls', 'quicklinks' ).attr( 'aria-owns', 'quicklinks' ); UW.$body.on( 'keydown', '#quicklinks a:first', this.inner_keydown ); UW.$body.on( 'keyup', '#quicklinks a', this.animate ); @@ -11455,78 +11010,6 @@ UW.QuickLinks = Backbone.View.extend({ } } -}); - -UW.QuickLinks.Model = Backbone.Model.extend({}); - -UW.QuickLinks.Collection = Backbone.Collection.extend({ - - model: UW.QuickLinks.Model, - - initialize: function ( options ) - { - this.url = options.url; - this.url = options.url.replace("www.washington.edu/cms/", "www.washington.edu/"); - }, - - defaults : [{ - "title": "MyUW", - "url": "https:\/\/my.uw.edu", - "classes": ["icon-myuw"] - }, { - "title": "Calendar", - "url": "https:\/\/uw.edu\/calendar", - "classes": ["icon-calendar"] - }, { - "title": "Directories", - "url": "https:\/\/directory.uw.edu\/", - "classes": ["icon-directories"] - }, { - "title": "Libraries", - "url": "https:\/\/www.lib.washington.edu\/", - "classes": ["icon-libraries"] - }, { - "title": "UW Medicine", - "url": "https:\/\/www.uwmedicine.org", - "classes": ['icon-medicine'] - }, { - "title": "Maps", - "url": "https:\/\/uw.edu\/maps", - "classes": ["icon-maps"] - }, { - "title": "UW News", - "url": "https:\/\/uw.edu\/news", - "classes": ["icon-uwtoday"] - }, { - "title": "Computing\/IT", - "url": "https:\/\/itconnect.uw.edu", - "classes": false - }, { - "title": "Workday\/ISC", - "url": "https:\/\/isc.uw.edu\/", - "classes": false - }, { - "title": "Husky Card", - "url": "https:\/\/hfs.uw.edu\/Husky-Card-Services\/", - "classes": false - }, { - "title": "UW Bothell", - "url": "https:\/\/www.uwb.edu\/", - "classes": false - }, { - "title": "UW Tacoma", - "url": "https:\/\/www.tacoma.uw.edu\/", - "classes": false - }, { - "title": "UW Facebook", - "url": "https:\/\/www.facebook.com\/UofWA", - "classes": false - }, { - "title": "UW Twitter", - "url": "https:\/\/twitter.com\/UW", - "classes": false - }] - }); ;// ### UW Slideshow @@ -11871,331 +11354,6 @@ UW.Slideshow = Backbone.View.extend({ }) -;// ### UW Youtube - -// This provides the structure and functionality of the UW Youtube player -// For usage please refer to the [UW Web Youtube Player](http://uw.edu/brand/web/#youtube) -// It can support a single youtube video or playlist embed -// options include max results for playlists, modest youtube branding and default resolution -// requires a unique id for each div.uw-youtube even if there is just one - -// Single:
-// Playlist:
- -UW.YouTube = {}; - -//the UW.YouTube.Collection object contains data in models that refer to youtube videos -//(alone or in a playlist) and has a view that renders the proper player with the data -UW.YouTube.Collection = Backbone.Collection.extend({ - - // Initialize the player embeds - // once the player type has been determined, get the associated data - initialize: function (options) { - _(this).bindAll('parse'); - this.el = options.el; - this.$el = $(this.el); - this.youtube_id = this.$el.data('uw-youtube'); - this.setup_for_type(); - this.make_view(); - this.fetch({success: this.view.onDataReady}); - }, - - // See if the div.uw-youtube is a playlist or single video - // setup the proper request and model type - // setup some other relative parameters - setup_for_type : function (youtube_id) { - this.type = this.$el.data('uw-youtube-type'); - this.modest = this.$el.data('modest'); - this.resolution = this.$el.data('resolution'); - var youtubeApiKey = apiKey.network ? apiKey.network : apiKey.local; - if (this.type == 'playlist'){ - this.max_results = 20; - var max_results_temp = parseInt(this.$el.data('max-results'), 10); - if (max_results_temp > 0) { - this.max_results = max_results_temp; - } - this.model = UW.YouTube.PlaylistItem; - this.url = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=' + this.youtube_id + '&key=' + youtubeApiKey + '&maxResults=' + this.max_results; - } - else if (this.type == 'single') { - this.model = UW.YouTube.Video; - this.url = 'https://www.googleapis.com/youtube/v3/videos?part=snippet&id=' + this.youtube_id + '&key=' + youtubeApiKey; - } - }, - - // organize useful information from the ajax request - parse: function (response) { - var type = this.type, youtube_id = this.youtube_id; - return _(response.items).map(function (item) { - if (type == 'single'){ - item.snippet.resourceId = {videoId: youtube_id}; - } - return item.snippet; - }); - }, - - // make the view at the proper time - make_view: function (type) { - this.view = new UW.YouTube.CollectionView({collection: this}); - }, - -}); - -// The CollectionView builds the html for the player and the control structure for the vidoes -UW.YouTube.CollectionView = Backbone.View.extend({ - - // template that all videos get - template : "
", - - // playist section html that only playlists get - playlist_section : "
    ", - - //event handlers for the templated html - events: { - 'click button': 'preview_clicked' - }, - - // set up the view for this collection - // add the youtube iframe api if necessary - // add the templates - initialize: function () { - _(this).bindAll('onReady', 'onDataReady', 'onStateChange', 'preview_clicked', 'resized'); - this.player_ready = false; - this.data_ready = false; - this.wrap(); - this.add_iFrame_api(); - if (this.collection.type == 'playlist'){ - this.$el.addClass('playlist'); - this.add_playlist_section(); - this.scrollbar_visible = false; - $(window).resize(this.resized); - } - }, - - // a resize handler for playlists. Handles the edge case of when a container - // is resized to be too small for the list and therefor requires a scrollbar - // when none is present or vice versa - resized: function() { - var viewport_new_width = this.$vidSmall.find('.viewport').width(); - if (viewport_new_width != this.$viewport_width){ - this.$viewport_width = viewport_new_width; - this.showTinyScrollbar(); - } - }, - - // wraps our collection in the main template and saves references to the container - wrap: function () { - this.collection.$el.wrap($(this.template)); - this.$el = this.collection.$el.parents('.nc-video-player'); //unattached jquery object won't wrap right if we add possible playlist section first - this.el = this.$el[0]; - }, - - // if we don't have a copy of the youtube iframe api yet. add it - add_iFrame_api: function () { - if (UW.$body.find('script#iFrame').length === 0){ - UW.$body.append(''); - this.add_iFrame_function(); - } - }, - - // at this point, all the collections should be created. - // Each gets a uwplayer variable that is a YT.Player corresponding to the collection - add_iFrame_function: function () { - window.onYouTubeIframeAPIReady = function() { - for (var i = 0, length = UW.youtube.length; i < length; i++){ - var collection = UW.youtube[i], player_vars = {}; - // if the collection desires no youtube branding, set these parameters - if (collection.modest) { - player_vars = { - 'rel' : 0, - 'controls' : 0, - 'modestbranding': 1, - } - } else { - player_vars = { - 'rel' : 0, - } - } - // if (collection.resolution !== 'undefined'){ - // player_vars.VQ = collection.resolution; - // } - //attach the YT.player to the relevant view, each view gets one - collection.view.uwplayer = new YT.Player(collection.$el.attr('id'), { - videoId: '', - playerVars: player_vars, - events: { - //these events will call functions in the relevant view - 'onReady': collection.view.onReady, - 'onStateChange': collection.view.onStateChange - } - }); - } - }; - }, - - // This function is called if the collection is a playlist - // adds the playlist section - add_playlist_section : function () { - this.$el.append(this.playlist_section); - this.$vidSmall = this.$el.find('.vidSmall'); - this.$vidContent = this.$el.find('.vidContent'); - this.scrollbar_visible = false; - }, - - // this is the callback for when the youtube iframe api is ready to go - // checks to see if the data is ready too - onReady: function () { - this.player_ready = true; - this.check_all_ready(); - }, - - // this is the callback for whne the data is loaded into the models - // preps the playlist area if its a playlist - // checks to see if the iframe api is ready - onDataReady: function () { - this.data_ready = true; - if (this.collection.type == 'playlist'){ - this.$vidContent_width = this.collection.models.length * 135 - this.$vidContent.width(this.$vidContent_width + 'px'); - this.$viewport_width = this.$vidSmall.find('.viewport').width(); - this.showTinyScrollbar(); - } - this.check_all_ready(); - }, - - // this function shows the tiny scrollbar. - showTinyScrollbar: function () { - if (this.$vidContent_width > this.$viewport_width){ - if (!this.scrollbar_visible) { - this.$vidSmall.find('.scrollbar').show(); - this.$vidSmall.tinyscrollbar({axis: 'x'}); - this.scrollbar_visible = true; - } - } - else if (this.scrollbar_visible){ - this.$vidSmall.find('.scrollbar').removeAttr('style'); - this.scrollbar_visible = false; - } - }, - - // this function checks the state of data/player to prevent a race case. - // Both the data and the player must be ready to go. Then we play the correct video - check_all_ready: function() { - if (this.data_ready && this.player_ready){ - this.play(this.collection.models[0].get('resourceId').videoId); - } - }, - - // when the player changes state, this is run. - // Currently stuff only happens if this is a playlist - // TODO: add a publicly visible event on video end for showcase pages - onStateChange: function (event) { - if (this.is_playlist) { - //event.data is 0 when a video finishes playing. Find out what video we just finished, then play the next one or loop back to the beginning of the playlist - if (event.data === 0) { - var video = this.$vidContent.find('.vid-active').attr('id'); - var index = this.video_ids.indexOf(video); - if (index < this.video_ids.length - 1) { - this.play(this.video_ids[index + 1]); - } - else { - this.play(this.video_ids[0]); - } - } - } - }, - - // play the video id passed. If 'playnow' not passed, assume false. - // If 'playnow' is true play the video, otherwise just cue it up - play: function (id, playnow){ - playnow = playnow || false; - if (playnow) { - this.uwplayer.loadVideoById(id); - this.$el.focus(); - } - else { - this.uwplayer.cueVideoById(id); - } - //If this is a playlist we must also manipulate the placeholder drawer. Move the selected video's placeholder to the front if we can, otherwise move the listas far as we can without creating whitespace. Then visually distinguish the selected video's placeholder - if (this.collection.type == 'playlist') { - this.$el.find('a.vid-active').removeClass('vid-active'); - var $small = $('#' + id); - $small.addClass('vid-active'); - this.$el.attr('aria-label', 'video: ' + $small.data('title')); - if (this.scrollbar_visible){ - var leftpos = $small.position().left; - if (this.$vidContent_width - leftpos < this.$viewport_width){ - leftpos = this.$vidContent_width - this.$viewport_width; - } - this.$vidContent.animate({left: -leftpos}, 500); - this.$vidSmall.data('plugin_tinyscrollbar').update(leftpos); - } - } - }, - - // this fires if a video preview in the playlist area is clicked - preview_clicked: function (event) { - this.play(event.currentTarget.id, true); - } -}); - - -// Video is a model for a single video -UW.YouTube.Video = Backbone.Model.extend({ - initialize: function () { - if (this.get('resourceId')){ - this.view = new UW.YouTube.VideoView({model: this}); - } - } -}); - -// Video View is a view for single video. Currently does nothing -UW.YouTube.VideoView = Backbone.View.extend({ - //template: underscore + html string here, - - initialize: function () { - this.render(); - }, - - render: function () { - this.model.collection.view.$el.attr('aria-label', 'video: ' + this.model.get('title')); - //var item = this.model.toJSON(); - //var small_vid = _.template(this.template, item); - //this.model.collection.view.$vidSmall.append(small_vid); - } -}); - -// PlaylistItem is the model for a video in a playlist -UW.YouTube.PlaylistItem = Backbone.Model.extend({ - - // if the video is a real video and not an error code, make a view - initialize: function () { - if (this.get('resourceId')){ - this.view = new UW.YouTube.PlaylistItemView({model:this}); - } - }, -}); - -// PlaylistItemView is the view for a playlist item -UW.YouTube.PlaylistItemView = Backbone.View.extend({ - - // this is the template for a playlist item preview - // goes inside the playlist section - template: "
  • ", - - // preps the $el and renders - initialize: function () { - this.$el = this.model.collection.view.$vidContent.find('ul'); - this.render(); - }, - - // gets the data ready, templates it, then appends to the playlist section - render: function () { - var item = this.model.toJSON(); - var small_vid = _.template(this.template)( item ); - this.$el.append(small_vid); - }, -}); ;// ### UW Vimeo // This function creates the UW Vimeo player @@ -13302,4 +12460,4 @@ UW.Social = Backbone.View.extend({ jQuery(document).ready(function($) { $("a.uw-custom-link").addClass("disable_a_href"); }); -;}).call(this) +;})(jQuery); diff --git a/js/site.js b/js/site.js index c7f461bc..e542c2c9 100644 --- a/js/site.js +++ b/js/site.js @@ -1 +1 @@ -(function(){var kc;jQuery.easing.jswing=jQuery.easing.swing,jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,t,s,i,n){return jQuery.easing[jQuery.easing.def](e,t,s,i,n)},easeInQuad:function(e,t,s,i,n){return i*(t/=n)*t+s},easeOutQuad:function(e,t,s,i,n){return-i*(t/=n)*(t-2)+s},easeInOutQuad:function(e,t,s,i,n){return(t/=n/2)<1?i/2*t*t+s:-i/2*(--t*(t-2)-1)+s},easeInCubic:function(e,t,s,i,n){return i*(t/=n)*t*t+s},easeOutCubic:function(e,t,s,i,n){return i*((t=t/n-1)*t*t+1)+s},easeInOutCubic:function(e,t,s,i,n){return(t/=n/2)<1?i/2*t*t*t+s:i/2*((t-=2)*t*t+2)+s},easeInQuart:function(e,t,s,i,n){return i*(t/=n)*t*t*t+s},easeOutQuart:function(e,t,s,i,n){return-i*((t=t/n-1)*t*t*t-1)+s},easeInOutQuart:function(e,t,s,i,n){return(t/=n/2)<1?i/2*t*t*t*t+s:-i/2*((t-=2)*t*t*t-2)+s},easeInQuint:function(e,t,s,i,n){return i*(t/=n)*t*t*t*t+s},easeOutQuint:function(e,t,s,i,n){return i*((t=t/n-1)*t*t*t*t+1)+s},easeInOutQuint:function(e,t,s,i,n){return(t/=n/2)<1?i/2*t*t*t*t*t+s:i/2*((t-=2)*t*t*t*t+2)+s},easeInSine:function(e,t,s,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+s},easeOutSine:function(e,t,s,i,n){return i*Math.sin(t/n*(Math.PI/2))+s},easeInOutSine:function(e,t,s,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+s},easeInExpo:function(e,t,s,i,n){return 0==t?s:i*Math.pow(2,10*(t/n-1))+s},easeOutExpo:function(e,t,s,i,n){return t==n?s+i:i*(1-Math.pow(2,-10*t/n))+s},easeInOutExpo:function(e,t,s,i,n){return 0==t?s:t==n?s+i:(t/=n/2)<1?i/2*Math.pow(2,10*(t-1))+s:i/2*(2-Math.pow(2,-10*--t))+s},easeInCirc:function(e,t,s,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+s},easeOutCirc:function(e,t,s,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+s},easeInOutCirc:function(e,t,s,i,n){return(t/=n/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+s:i/2*(Math.sqrt(1-(t-=2)*t)+1)+s},easeInElastic:function(e,t,s,i,n){var o=1.70158,r=0,a=i;if(0==t)return s;if(1==(t/=n))return s+i;if(r=r||.3*n,ax'}).firstChild.href),e},vjs.parseUrl=function(e){var t,s,i,n,o;n=["protocol","hostname","port","pathname","search","hash","host"],(i=""===(s=vjs.createEl("a",{href:e})).host&&"file:"!==s.protocol)&&((t=vjs.createEl("div")).innerHTML='',s=t.firstChild,t.setAttribute("style","display:none; position:absolute;"),document.body.appendChild(t)),o={};for(var r=0;r'+this.defaultValue+""},t),vjs.Component.prototype.createEl.call(this,"div",t)},vjs.Menu=vjs.Component.extend(),vjs.Menu.prototype.addItem=function(e){this.addChild(e),e.on("click",vjs.bind(this,function(){this.unlockShowing()}))},vjs.Menu.prototype.createEl=function(){var e=this.options().contentElType||"ul";this.contentEl_=vjs.createEl(e,{className:"vjs-menu-content"});var t=vjs.Component.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),vjs.on(t,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),t},vjs.MenuItem=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),this.selected(t.selected)}}),vjs.MenuItem.prototype.createEl=function(e,t){return vjs.Button.prototype.createEl.call(this,"li",vjs.obj.merge({className:"vjs-menu-item",innerHTML:this.options_.label},t))},vjs.MenuItem.prototype.onClick=function(){this.selected(!0)},vjs.MenuItem.prototype.selected=function(e){e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-selected",!0)):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-selected",!1))},vjs.MenuButton=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),this.menu=this.createMenu(),this.addChild(this.menu),this.items&&0===this.items.length&&this.hide(),this.on("keyup",this.onKeyPress),this.el_.setAttribute("aria-haspopup",!0),this.el_.setAttribute("role","button")}}),vjs.MenuButton.prototype.buttonPressed_=!1,vjs.MenuButton.prototype.createMenu=function(){var e=new vjs.Menu(this.player_);if(this.options().title&&e.contentEl().appendChild(vjs.createEl("li",{className:"vjs-menu-title",innerHTML:vjs.capitalize(this.options().title),tabindex:-1})),this.items=this.createItems(),this.items)for(var t=0;tStream Type LIVE',"aria-live":"off"}),e.appendChild(this.contentEl_),e},vjs.PlayToggle=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),e.on("play",vjs.bind(this,this.onPlay)),e.on("pause",vjs.bind(this,this.onPause))}}),vjs.PlayToggle.prototype.buttonText="Play",vjs.PlayToggle.prototype.buildCSSClass=function(){return"vjs-play-control "+vjs.Button.prototype.buildCSSClass.call(this)},vjs.PlayToggle.prototype.onClick=function(){this.player_.paused()?this.player_.play():this.player_.pause()},vjs.PlayToggle.prototype.onPlay=function(){vjs.removeClass(this.el_,"vjs-paused"),vjs.addClass(this.el_,"vjs-playing"),this.el_.children[0].children[0].innerHTML="Pause"},vjs.PlayToggle.prototype.onPause=function(){vjs.removeClass(this.el_,"vjs-playing"),vjs.addClass(this.el_,"vjs-paused"),this.el_.children[0].children[0].innerHTML="Play"},vjs.CurrentTimeDisplay=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),e.on("timeupdate",vjs.bind(this,this.updateContent))}}),vjs.CurrentTimeDisplay.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-current-time vjs-time-controls vjs-control"});return this.contentEl_=vjs.createEl("div",{className:"vjs-current-time-display",innerHTML:'Current Time 0:00',"aria-live":"off"}),e.appendChild(this.contentEl_),e},vjs.CurrentTimeDisplay.prototype.updateContent=function(){var e=this.player_.scrubbing?this.player_.getCache().currentTime:this.player_.currentTime();this.contentEl_.innerHTML='Current Time '+vjs.formatTime(e,this.player_.duration())},vjs.DurationDisplay=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),e.on("timeupdate",vjs.bind(this,this.updateContent))}}),vjs.DurationDisplay.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-duration vjs-time-controls vjs-control"});return this.contentEl_=vjs.createEl("div",{className:"vjs-duration-display",innerHTML:'Duration Time 0:00',"aria-live":"off"}),e.appendChild(this.contentEl_),e},vjs.DurationDisplay.prototype.updateContent=function(){var e=this.player_.duration();e&&(this.contentEl_.innerHTML='Duration Time '+vjs.formatTime(e))},vjs.TimeDivider=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.TimeDivider.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-time-divider",innerHTML:"
    /
    "})},vjs.RemainingTimeDisplay=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),e.on("timeupdate",vjs.bind(this,this.updateContent))}}),vjs.RemainingTimeDisplay.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});return this.contentEl_=vjs.createEl("div",{className:"vjs-remaining-time-display",innerHTML:'Remaining Time -0:00',"aria-live":"off"}),e.appendChild(this.contentEl_),e},vjs.RemainingTimeDisplay.prototype.updateContent=function(){this.player_.duration()&&(this.contentEl_.innerHTML='Remaining Time -'+vjs.formatTime(this.player_.remainingTime()))},vjs.FullscreenToggle=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t)}}),vjs.FullscreenToggle.prototype.buttonText="Fullscreen",vjs.FullscreenToggle.prototype.buildCSSClass=function(){return"vjs-fullscreen-control "+vjs.Button.prototype.buildCSSClass.call(this)},vjs.FullscreenToggle.prototype.onClick=function(){this.player_.isFullscreen()?(this.player_.exitFullscreen(),this.controlText_.innerHTML="Fullscreen"):(this.player_.requestFullscreen(),this.controlText_.innerHTML="Non-Fullscreen")},vjs.ProgressControl=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.ProgressControl.prototype.options_={children:{seekBar:{}}},vjs.ProgressControl.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},vjs.SeekBar=vjs.Slider.extend({init:function(e,t){vjs.Slider.call(this,e,t),e.on("timeupdate",vjs.bind(this,this.updateARIAAttributes)),e.ready(vjs.bind(this,this.updateARIAAttributes))}}),vjs.SeekBar.prototype.options_={children:{loadProgressBar:{},playProgressBar:{},seekHandle:{}},barName:"playProgressBar",handleName:"seekHandle"},vjs.SeekBar.prototype.playerEvent="timeupdate",vjs.SeekBar.prototype.createEl=function(){return vjs.Slider.prototype.createEl.call(this,"div",{className:"vjs-progress-holder","aria-label":"video progress bar"})},vjs.SeekBar.prototype.updateARIAAttributes=function(){var e=this.player_.scrubbing?this.player_.getCache().currentTime:this.player_.currentTime();this.el_.setAttribute("aria-valuenow",vjs.round(100*this.getPercent(),2)),this.el_.setAttribute("aria-valuetext",vjs.formatTime(e,this.player_.duration()))},vjs.SeekBar.prototype.getPercent=function(){return this.player_.currentTime()/this.player_.duration()},vjs.SeekBar.prototype.onMouseDown=function(e){vjs.Slider.prototype.onMouseDown.call(this,e),this.player_.scrubbing=!0,this.videoWasPlaying=!this.player_.paused(),this.player_.pause()},vjs.SeekBar.prototype.onMouseMove=function(e){var t=this.calculateDistance(e)*this.player_.duration();t==this.player_.duration()&&(t-=.1),this.player_.currentTime(t)},vjs.SeekBar.prototype.onMouseUp=function(e){vjs.Slider.prototype.onMouseUp.call(this,e),this.player_.scrubbing=!1,this.videoWasPlaying&&this.player_.play()},vjs.SeekBar.prototype.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},vjs.SeekBar.prototype.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},vjs.LoadProgressBar=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),e.on("progress",vjs.bind(this,this.update))}}),vjs.LoadProgressBar.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:'Loaded: 0%'})},vjs.LoadProgressBar.prototype.update=function(){this.el_.style&&(this.el_.style.width=vjs.round(100*this.player_.bufferedPercent(),2)+"%")},vjs.PlayProgressBar=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.PlayProgressBar.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-play-progress",innerHTML:'Progress: 0%'})},vjs.SeekHandle=vjs.SliderHandle.extend({init:function(e,t){vjs.SliderHandle.call(this,e,t),e.on("timeupdate",vjs.bind(this,this.updateContent))}}),vjs.SeekHandle.prototype.defaultValue="00:00",vjs.SeekHandle.prototype.createEl=function(){return vjs.SliderHandle.prototype.createEl.call(this,"div",{className:"vjs-seek-handle","aria-live":"off"})},vjs.SeekHandle.prototype.updateContent=function(){var e=this.player_.scrubbing?this.player_.getCache().currentTime:this.player_.currentTime();this.el_.innerHTML=''+vjs.formatTime(e,this.player_.duration())+""},vjs.VolumeControl=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),e.tech&&e.tech.features&&!1===e.tech.features.volumeControl&&this.addClass("vjs-hidden"),e.on("loadstart",vjs.bind(this,function(){e.tech.features&&!1===e.tech.features.volumeControl?this.addClass("vjs-hidden"):this.removeClass("vjs-hidden")}))}}),vjs.VolumeControl.prototype.options_={children:{volumeBar:{}}},vjs.VolumeControl.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control"})},vjs.VolumeBar=vjs.Slider.extend({init:function(e,t){vjs.Slider.call(this,e,t),e.on("volumechange",vjs.bind(this,this.updateARIAAttributes)),e.ready(vjs.bind(this,this.updateARIAAttributes))}}),vjs.VolumeBar.prototype.updateARIAAttributes=function(){this.el_.setAttribute("aria-valuenow",vjs.round(100*this.player_.volume(),2)),this.el_.setAttribute("aria-valuetext",vjs.round(100*this.player_.volume(),2)+"%")},vjs.VolumeBar.prototype.options_={children:{volumeLevel:{},volumeHandle:{}},barName:"volumeLevel",handleName:"volumeHandle"},vjs.VolumeBar.prototype.playerEvent="volumechange",vjs.VolumeBar.prototype.createEl=function(){return vjs.Slider.prototype.createEl.call(this,"div",{className:"vjs-volume-bar","aria-label":"volume level"})},vjs.VolumeBar.prototype.onMouseMove=function(e){this.player_.muted()&&this.player_.muted(!1),this.player_.volume(this.calculateDistance(e))},vjs.VolumeBar.prototype.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},vjs.VolumeBar.prototype.stepForward=function(){this.player_.volume(this.player_.volume()+.1)},vjs.VolumeBar.prototype.stepBack=function(){this.player_.volume(this.player_.volume()-.1)},vjs.VolumeLevel=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.VolumeLevel.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:''})},vjs.VolumeHandle=vjs.SliderHandle.extend(),vjs.VolumeHandle.prototype.defaultValue="00:00",vjs.VolumeHandle.prototype.createEl=function(){return vjs.SliderHandle.prototype.createEl.call(this,"div",{className:"vjs-volume-handle"})},vjs.MuteToggle=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),e.on("volumechange",vjs.bind(this,this.update)),e.tech&&e.tech.features&&!1===e.tech.features.volumeControl&&this.addClass("vjs-hidden"),e.on("loadstart",vjs.bind(this,function(){e.tech.features&&!1===e.tech.features.volumeControl?this.addClass("vjs-hidden"):this.removeClass("vjs-hidden")}))}}),vjs.MuteToggle.prototype.createEl=function(){return vjs.Button.prototype.createEl.call(this,"div",{className:"vjs-mute-control vjs-control",innerHTML:'
    Mute
    '})},vjs.MuteToggle.prototype.onClick=function(){this.player_.muted(!this.player_.muted())},vjs.MuteToggle.prototype.update=function(){var e=this.player_.volume(),t=3;0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2),this.player_.muted()?"Unmute"!=this.el_.children[0].children[0].innerHTML&&(this.el_.children[0].children[0].innerHTML="Unmute"):"Mute"!=this.el_.children[0].children[0].innerHTML&&(this.el_.children[0].children[0].innerHTML="Mute");for(var s=0;s<4;s++)vjs.removeClass(this.el_,"vjs-vol-"+s);vjs.addClass(this.el_,"vjs-vol-"+t)},vjs.VolumeMenuButton=vjs.MenuButton.extend({init:function(e,t){vjs.MenuButton.call(this,e,t),e.on("volumechange",vjs.bind(this,this.update)),e.tech&&e.tech.features&&!1===e.tech.features.volumeControl&&this.addClass("vjs-hidden"),e.on("loadstart",vjs.bind(this,function(){e.tech.features&&!1===e.tech.features.volumeControl?this.addClass("vjs-hidden"):this.removeClass("vjs-hidden")})),this.addClass("vjs-menu-button")}}),vjs.VolumeMenuButton.prototype.createMenu=function(){var e=new vjs.Menu(this.player_,{contentElType:"div"}),t=new vjs.VolumeBar(this.player_,vjs.obj.merge({vertical:!0},this.options_.volumeBar));return e.addChild(t),e},vjs.VolumeMenuButton.prototype.onClick=function(){vjs.MuteToggle.prototype.onClick.call(this),vjs.MenuButton.prototype.onClick.call(this)},vjs.VolumeMenuButton.prototype.createEl=function(){return vjs.Button.prototype.createEl.call(this,"div",{className:"vjs-volume-menu-button vjs-menu-button vjs-control",innerHTML:'
    Mute
    '})},vjs.VolumeMenuButton.prototype.update=vjs.MuteToggle.prototype.update,vjs.PlaybackRateMenuButton=vjs.MenuButton.extend({init:function(e,t){vjs.MenuButton.call(this,e,t),this.updateVisibility(),this.updateLabel(),e.on("loadstart",vjs.bind(this,this.updateVisibility)),e.on("ratechange",vjs.bind(this,this.updateLabel))}}),vjs.PlaybackRateMenuButton.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-playback-rate vjs-menu-button vjs-control",innerHTML:'
    Playback Rate
    '});return this.labelEl_=vjs.createEl("div",{className:"vjs-playback-rate-value",innerHTML:1}),e.appendChild(this.labelEl_),e},vjs.PlaybackRateMenuButton.prototype.createMenu=function(){var e=new vjs.Menu(this.player()),t=this.player().options().playbackRates;if(t)for(var s=t.length-1;0<=s;s--)e.addChild(new vjs.PlaybackRateMenuItem(this.player(),{rate:t[s]+"x"}));return e},vjs.PlaybackRateMenuButton.prototype.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},vjs.PlaybackRateMenuButton.prototype.onClick=function(){for(var e=this.player().playbackRate(),t=this.player().options().playbackRates,s=t[0],i=0;ie){s=t[i];break}this.player().playbackRate(s)},vjs.PlaybackRateMenuButton.prototype.playbackRateSupported=function(){return this.player().tech&&this.player().tech.features.playbackRate&&this.player().options().playbackRates&&0
    ").addClass("jp-carousel-overlay").css({position:"absolute",top:0,right:0,bottom:0,left:0});var e=''+jetpackCarouselStrings.comment+"";jetpackCarouselStrings.is_logged_in,e=j('"),p=j("

    "),l=j('').append(p),imageMeta=j("
    ").addClass("jp-carousel-image-meta").css({float:"right","margin-top":"20px",width:"250px"}),imageMeta.append(e).append("").append("").append(""),titleAndDescription=j("
    ").addClass("jp-carousel-titleanddesc").css({width:"100%","margin-top":imageMeta.css("margin-top")});var t='").css({width:"100%","margin-top":"20px",color:"#999"}),n=j("
    ").addClass("jp-carousel-comments").css({width:"100%",bottom:"10px","margin-top":"20px"}),commentsLoading=j('").css({width:"100%",bottom:"10px","margin-top":"20px"}),leftWidth=j(window).width()-2*c-(imageMeta.width()+40),leftWidth+="px",leftColWrapper=j("
    ").addClass("jp-carousel-left-column-wrapper").css({width:Math.floor(leftWidth)}).append(titleAndDescription).append(commentForm).append(n).append(commentsLoading),fadeaway=j("
    ").addClass("jp-carousel-fadeaway"),h=j("
    ").addClass("jp-carousel-info").css({top:Math.floor(j(window).height()/100*85),left:c,right:c}).append(l).append(imageMeta),window.innerWidth<=760?(l.remove().insertAfter(titleAndDescription),h.prepend(leftColWrapper)):h.append(leftColWrapper),targetBottomPos=j(window).height()-parseInt(h.css("top"),10)+"px",o=j("
    ").addClass("jp-carousel-next-button").css({right:"15px"}),r=j("
    ").addClass("jp-carousel-previous-button").css({left:0}),o.add(r).css({position:"fixed",top:"40px",bottom:targetBottomPos,width:c}),b=j("
    ").addClass("jp-carousel").css({position:"absolute",top:0,bottom:targetBottomPos,left:0,right:0}),v=j('').css({position:"fixed"}),d=j("
    ").addClass("jp-carousel-wrap").addClass("jp-carousel-transitions"),"white"==jetpackCarouselStrings.background_color&&d.addClass("jp-carousel-light"),d.css({position:"fixed",top:0,right:0,bottom:0,left:0,"z-index":2147483647,"overflow-x":"hidden","overflow-y":"auto",direction:"ltr"}).hide().append(i).append(b).append(fadeaway).append(h).append(o).append(r).append(v).appendTo(j("body")).click(function(e){var t=j(e.target),s=t.parents("div.jp-carousel-wrap"),i=s.data("carousel-extra"),n=s.find("div.selected").data("attachment-id");if(i=i||[],t.is(b)||t.parents().add(t).is(v))d.jp_carousel("close");else if(t.hasClass("jp-carousel-commentlink"))e.preventDefault(),e.stopPropagation(),j(window).unbind("keydown",g),d.animate({scrollTop:parseInt(h.position().top,10)},"fast"),j("#jp-carousel-comment-form-submit-and-info-wrapper").slideDown("fast"),j("#jp-carousel-comment-form-comment-field").focus();else if(t.hasClass("jp-carousel-comment-login")){var o=jetpackCarouselStrings.login_url+"%23jp-carousel-"+n;window.location.href=o}else if(t.parents("#jp-carousel-comment-form-container").length){var r=j("#jp-carousel-comment-form-comment-field").blur(function(){j(window).bind("keydown",g)}).focus(function(){j(window).unbind("keydown",g)}),a=j("#jp-carousel-comment-form-email-field").blur(function(){j(window).bind("keydown",g)}).focus(function(){j(window).unbind("keydown",g)}),l=j("#jp-carousel-comment-form-author-field").blur(function(){j(window).bind("keydown",g)}).focus(function(){j(window).unbind("keydown",g)}),c=j("#jp-carousel-comment-form-url-field").blur(function(){j(window).bind("keydown",g)}).focus(function(){j(window).unbind("keydown",g)});if(r&&r.attr("id")==t.attr("id"))j(window).unbind("keydown",g),j("#jp-carousel-comment-form-submit-and-info-wrapper").slideDown("fast");else if(t.is('input[type="submit"]')){e.preventDefault(),e.stopPropagation(),j("#jp-carousel-comment-form-spinner").spin("small","white");var u={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:i.blog_id,id:n,comment:r.val()};if(!u.comment.length)return void b.jp_carousel("postCommentError",{field:"jp-carousel-comment-form-comment-field",error:jetpackCarouselStrings.no_comment_text});if(1!=jetpackCarouselStrings.is_logged_in&&(u.email=a.val(),u.author=l.val(),u.url=c.val(),1==jetpackCarouselStrings.require_name_email)){if(!u.email.length||!u.email.match("@"))return void b.jp_carousel("postCommentError",{field:"jp-carousel-comment-form-email-field",error:jetpackCarouselStrings.no_comment_email});if(!u.author.length)return void b.jp_carousel("postCommentError",{field:"jp-carousel-comment-form-author-field",error:jetpackCarouselStrings.no_comment_author})}j.ajax({type:"POST",url:jetpackCarouselStrings.ajaxurl,data:u,dataType:"json",success:function(e,t,s){"approved"==e.comment_status?j("#jp-carousel-comment-post-results").slideUp("fast").html(''+jetpackCarouselStrings.comment_approved+"").slideDown("fast"):"unapproved"==e.comment_status?j("#jp-carousel-comment-post-results").slideUp("fast").html(''+jetpackCarouselStrings.comment_unapproved+"").slideDown("fast"):j("#jp-carousel-comment-post-results").slideUp("fast").html(''+jetpackCarouselStrings.comment_post_error+"").slideDown("fast"),b.jp_carousel("clearCommentTextAreaValue"),b.jp_carousel("getComments",{attachment_id:n,offset:0,clear:!0}),j("#jp-carousel-comment-form-button-submit").val(jetpackCarouselStrings.post_comment),j("#jp-carousel-comment-form-spinner").spin(!1)},error:function(e,t,s){b.jp_carousel("postCommentError",{field:"jp-carousel-comment-form-comment-field",error:jetpackCarouselStrings.comment_post_error})}})}}else t.parents(".jp-carousel-info").length||d.jp_carousel("next")}).bind("jp_carousel.afterOpen",function(){j(window).bind("keydown",g),j(window).bind("resize",w),b.opened=!0,w()}).bind("jp_carousel.beforeClose",function(){var e=j(window).scrollTop();j(window).unbind("keydown",g),j(window).unbind("resize",w),j(window).scrollTop(e)}).bind("jp_carousel.afterClose",function(){history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):(y="",window.location.hash=""),b.opened=!1}).on("transitionend.jp-carousel ",".jp-carousel-slide",function(e){if("transform"==e.originalEvent.propertyName){var t=(Date.now()-a)/1e3/e.originalEvent.elapsedTime;d.off("transitionend.jp-carousel"),2<=t&&j(".jp-carousel-transitions").removeClass("jp-carousel-transitions")}}),j(".jp-carousel-wrap").touchwipe({wipeLeft:function(e){e.preventDefault(),b.jp_carousel("next")},wipeRight:function(e){e.preventDefault(),b.jp_carousel("previous")},preventDefaultEvents:!1}),j(".jetpack-likes-widget-unloaded").each(function(){jetpackLikesWidgetQueue.push(this.id)}),o.add(r).click(function(e){e.preventDefault(),e.stopPropagation(),o.is(this)?b.jp_carousel("next"):b.jp_carousel("previous")})}}(),!b.jp_carousel("testIfOpened")))return u=j("body").css("overflow"),j("body").css("overflow","hidden"),f=j("html").css("overflow"),j("html").css("overflow","hidden"),jQuery(".slim-likes-widget").find("iframe").css("display","inline-block").css("width","60px"),d.data("carousel-extra",e),this.each(function(){var e=j(this);t&&j.extend(s,t),-1==s.start_index&&(s.start_index=0),d.trigger("jp_carousel.beforeOpen").fadeIn("fast",function(){d.trigger("jp_carousel.afterOpen"),b.jp_carousel("initSlides",e.find(s.items_selector),s.start_index).jp_carousel("selectSlideAtIndex",s.start_index)}),b.html("")})},selectSlideAtIndex:function(e){var t=this.jp_carousel("slides"),s=t.eq(e);return 0===s.length&&(s=t.eq(0)),b.jp_carousel("selectSlide",s,!1),this},close:function(){return j("body").css("overflow",u),j("html").css("overflow",f),d.trigger("jp_carousel.beforeClose").fadeOut("fast",function(){d.trigger("jp_carousel.afterClose")})},next:function(){var e=b.jp_carousel("nextSlide");d.animate({scrollTop:0},"fast"),e&&this.jp_carousel("selectSlide",e)},previous:function(){var e=b.jp_carousel("prevSlide");d.animate({scrollTop:0},"fast"),e&&this.jp_carousel("selectSlide",e)},resetButtons:function(e){e.data("liked")?j(".jp-carousel-buttons a.jp-carousel-like").addClass("liked").text(jetpackCarouselStrings.unlike):j(".jp-carousel-buttons a.jp-carousel-like").removeClass("liked").text(jetpackCarouselStrings.like)},selectedSlide:function(){return this.find(".selected")},setSlidePosition:function(e){return a=Date.now(),this.css({"-webkit-transform":"translate3d("+e+"px,0,0)","-moz-transform":"translate3d("+e+"px,0,0)","-ms-transform":"translate("+e+"px,0)","-o-transform":"translate("+e+"px,0)",transform:"translate3d("+e+"px,0,0)"})},updateSlidePositions:function(e){var t=this.jp_carousel("selectedSlide"),s=b.width(),i=t.width(),n=b.jp_carousel("prevSlide"),o=b.jp_carousel("nextSlide"),r=n.prev(),a=o.next(),l=Math.floor(.5*(s-i));t.jp_carousel("setSlidePosition",l).show(),b.jp_carousel("fitInfo",e),1==(m.is(t.prevAll())?1:-1)?(a.is(n)||a.jp_carousel("setSlidePosition",s+o.width()).show(),r.is(o)||r.jp_carousel("setSlidePosition",-r.width()-i).show()):a.is(n)||a.jp_carousel("setSlidePosition",s+i).show(),n.jp_carousel("setSlidePosition",Math.floor(-n.width()+.75*c)).show(),o.jp_carousel("setSlidePosition",Math.ceil(s-.75*c)).show()},selectSlide:function(e,t){m=this.find(".selected").removeClass("selected");var s,i,n=b.jp_carousel("slides").css({position:"fixed"}),o=j(e).addClass("selected").css({position:"relative"}),r=o.data("attachment-id"),a=b.jp_carousel("prevSlide"),l=b.jp_carousel("nextSlide"),c=a.prev(),u=l.next();b.jp_carousel("loadFullImage",o),p.hide(),0==l.length&&n.length<=2?j(".jp-carousel-next-button").hide():j(".jp-carousel-next-button").show(),0==a.length&&n.length<=2?j(".jp-carousel-previous-button").hide():j(".jp-carousel-previous-button").show(),s=o.add(a).add(c).add(l).add(u).jp_carousel("loadSlide"),n.not(s).hide(),b.jp_carousel("updateSlidePositions",t),b.jp_carousel("resetButtons",o),d.trigger("jp_carousel.selectSlide",[o]),b.jp_carousel("getTitleDesc",{title:o.data("title"),desc:o.data("desc")}),b.jp_carousel("loadLikes",r),b.jp_carousel("updateLikesWidgetVisibility",r),0").text(o.data("caption")).html())==j("
    ").text(o.data("title")).html()&&j(".jp-carousel-titleanddesc-title").fadeOut("fast").empty(),i==j("
    ").text(o.data("desc")).html()&&j(".jp-carousel-titleanddesc-desc").fadeOut("fast").empty(),p.html(o.data("caption")).fadeIn("slow")):p.fadeOut("fast").empty(),j(l).add(a).each(function(){b.jp_carousel("loadFullImage",j(this))}),window.location.hash=y="#jp-carousel-"+r},slides:function(){return this.find(".jp-carousel-slide")},slideDimensions:function(){return{width:j(window).width()-2*c,height:Math.floor(j(window).height()/100*85-60)}},loadSlide:function(){return this.each(function(){var e=j(this);e.find("img").one("load",function(){e.jp_carousel("fitSlide",!1)})})},bestFit:function(){var e=b.jp_carousel("slideDimensions"),t=this.jp_carousel("originalDimensions"),s=t.width/t.height,i=1,n=1;return t.width>e.width&&(i=e.width/t.width),t.height>e.height&&(n=e.height/t.height),i")[0].src=j(e[y]).data("gallery-src"));var g=0").attr("src","data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7").css("width","100%").css("height","100%"),f=j('').hide().css({left:e=e.max_width||l>=e.max_height?e.large_file:i>=e.max_width||n>=e.max_height?e.medium_file:e.orig_file},originalDimensions:function(){var e=j(this).data("orig-size").split(",");return{width:parseInt(e[0],10),height:parseInt(e[1],10)}},format:function(s){if("object"!=typeof s&&(s={}),s.text&&void 0!==s.text)return s.replacements&&void 0!==s.replacements?s.text.replace(/{(\d+)}/g,function(e,t){return void 0!==s.replacements[t]?s.replacements[t]:e}):s.text},shutterSpeed:function(e){if(1<=e)return Math.round(e)+"s";for(var t=1,s=1,i=1,n=1e3;t!=e&&0").text(i).html()==j("
    ").text(t).html()&&(i=""),n=i.length?'":"",n+=t.length?'":"",s.html(n).fadeIn("slow")),j("div#jp-carousel-comment-form-container").css("margin-top","20px"),j("div#jp-carousel-comments-loading").css("margin-top","20px")},updateLikesWidgetVisibility:function(t){"undefined"!=typeof jetpackLikesWidgetQueue&&j(".jp-carousel-buttons .jetpack-likes-widget-wrapper").css("display","none").each(function(){var e=j(this);if(e.attr("data-attachment-id")==t)return e.css("display","inline-block"),!1})},loadLikes:function(e){var t=j(".jp-carousel-wrap").data("carousel-extra"),s=t.likes_blog_id;if(0==j("#like-post-wrapper-"+s+"-"+e).length){var i="http",n="http://wordpress.com";if(t.permalink.length){"http"!=(i=t.permalink.split(":")[0])&&"https"!=i&&(i="http");var o=t.permalink.split("/");2<=o.length&&(n=i+"://"+o[2])}var r=i+"://widgets.wp.com/likes/#blog_id="+encodeURIComponent(s)+"&post_id="+encodeURIComponent(e)+"&slim=1&origin="+encodeURIComponent(n);"en"!==jetpackCarouselStrings.lang&&(r+="&lang="+encodeURIComponent(jetpackCarouselStrings.lang));var a=j("").attr("name","like-post-frame-"+s+"-"+e).attr("src",r).css("display","inline-block"),l=j("
    ").addClass("jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded slim-likes-widget").attr("id","like-post-wrapper-"+s+"-"+e).attr("data-src",r).attr("data-name","like-post-frame-"+s+"-"+e).attr("data-attachment-id",e).css("display","none").css("vertical-align","middle").append(a).append("
    ");j(".jp-carousel-buttons").append(l)}},updateExif:function(e){if(!e||1!=jetpackCarouselStrings.display_exif)return!1;var s=j("");j.each(e,function(e,t){if(0!==parseFloat(t)&&t.length&&-1!==j.inArray(e,["camera","aperture","shutter_speed","focal_length"])){switch(e){case"focal_length":t+="mm";break;case"shutter_speed":t=b.jp_carousel("shutterSpeed",t);break;case"aperture":t="f/"+t}s.append("
  • "+jetpackCarouselStrings[e]+"
    "+t+"
  • ")}}),j("div.jp-carousel-image-meta ul.jp-carousel-image-exif").replaceWith(s)},updateFullSizeLink:function(e){if(!e||!e.data)return!1;var t=e.data("orig-file").replace(/\?.+$/,""),s=e.data("orig-size").split(","),i=j(""+b.jp_carousel("format",{text:jetpackCarouselStrings.download_original,replacements:s})+"").addClass("jp-carousel-image-download").attr("href",t).attr("target","_blank");j("div.jp-carousel-image-meta a.jp-carousel-image-download").replaceWith(i)},updateMap:function(e){if(e.latitude&&e.longitude&&1==jetpackCarouselStrings.display_geo){var t=e.latitude,s=e.longitude,i=j("div.jp-carousel-image-meta","div.jp-carousel-wrap"),n="&scale=2&style=feature:all|element:all|invert_lightness:true|hue:0x0077FF|saturation:-50|lightness:-5|gamma:0.91";j("
    ").addClass("jp-carousel-image-map").html('\t\t\t\t\t\t\t\t\t\t\t\t\t
    \t\t\t\t\t\t\t\t\t\t\t\t\t').prependTo(i)}},testCommentsOpened:function(e){1==parseInt(e,10)?(j(".jp-carousel-buttons").fadeIn("fast"),commentForm.fadeIn("fast")):(j(".jp-carousel-buttons").fadeOut("fast"),commentForm.fadeOut("fast"))},getComments:function(e){return!1},postCommentError:function(e){"object"!=typeof e&&(e={}),e.field&&void 0!==e.field&&e.error&&void 0!==e.error&&(j("#jp-carousel-comment-post-results").slideUp("fast").html('").slideDown("fast"),j("#jp-carousel-comment-form-spinner").spin(!1))},setCommentIframeSrc:function(e){var t=j("#jp-carousel-comment-iframe");t&&t.length&&(t.attr("src",t.attr("src").replace(/(postid=)\d+/,"$1"+e)),t.attr("src",t.attr("src").replace(/(%23.+)?$/,"%23jp-carousel-"+e)))},clearCommentTextAreaValue:function(){var e=j("#jp-carousel-comment-form-comment-field");e&&e.val("")},nextSlide:function(){var e=this.jp_carousel("slides"),t=this.jp_carousel("selectedSlide");return 0==t.length||2e.data("thumb-size").width?t.attr("src",t.closest(".jp-carousel-slide").data("src")):t.attr("src",e.data("preview-image")),t.data("loaded",1))}};j.fn.jp_carousel=function(e){return s[e]?s[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void j.error("Method "+e+" does not exist on jQuery.jp_carousel"):s.open.apply(this,arguments)},j(document.body).on("click","div.gallery,div.tiled-gallery",function(e){j(this).jp_carousel("testForData",e.currentTarget)&&(j(e.target).parent().hasClass("gallery-caption")||(e.preventDefault(),j(this).jp_carousel("open",{start_index:j(this).find(".gallery-item, .tiled-gallery-item").index(j(e.target).parents(".gallery-item, .tiled-gallery-item"))})))}),j(window).on("hashchange",function(){if(window.location.hash&&window.location.hash.match(/jp-carousel-(\d+)/)&&window.location.hash!=y){y=window.location.hash;var e=j("div.gallery, div.tiled-gallery"),s=-1,i=window.location.hash.match(/jp-carousel-(\d+)/);j(this).jp_carousel("testForData",e)&&(i=parseInt(i[1],10),e.find("img").each(function(e,t){if(i&&j(t).data("attachment-id")==i)return s=e,!1}),-1!=s&&e.jp_carousel("openOrSelectSlide",s))}}),window.location.hash&&j(window).trigger("hashchange")}),mx=jQuery,mx.fn.touchwipe=function(e){var c={min_move_x:20,min_move_y:20,wipeLeft:function(e){},wipeRight:function(e){},wipeUp:function(e){},wipeDown:function(e){},preventDefaultEvents:!0};return e&&mx.extend(c,e),this.each(function(){var o,r,a=!1;function l(){this.removeEventListener("touchmove",t),o=null,a=!1}function t(e){if(c.preventDefaultEvents&&e.preventDefault(),a){var t=e.touches[0].pageX,s=e.touches[0].pageY,i=o-t,n=r-s;Math.abs(i)>=c.min_move_x?(l(),0=c.min_move_y&&(l(),0o[0]&&(o[1]+1>o[0]&&s.push("-"),s.push(c(o[1])));return s.push("]"),s.join("")}function t(e){for(var t=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),s=t.length,i=[],n=0,o=0;n/,q])):t.push(["com",/^#[^\n\r]*/,q,"#"])),e.cStyleComments&&(s.push(["com",/^\/\/[^\n\r]*/,q]),s.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q])),e.regexLiterals&&s.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]),(i=e.types)&&s.push(["typ",i]),(e=(""+e.keywords).replace(/^ | $/g,"")).length&&s.push(["kwd",RegExp("^(?:"+e.replace(/[\s,]+/g,"|")+")\\b"),q]),t.push(["pln",/^\s+/,q," \r\n\t "]),s.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]),Ix(t,s)}function Kx(e,t){function n(e){switch(e.nodeType){case 1:if(r.test(e.className))break;if("BR"===e.nodeName)o(e),e.parentNode&&e.parentNode.removeChild(e);else for(e=e.firstChild;e;e=e.nextSibling)n(e);break;case 3:case 4:if(c){var t=e.nodeValue,s=t.match(a);if(s){var i=t.substring(0,s.index);e.nodeValue=i,(t=t.substring(s.index+s[0].length))&&e.parentNode.insertBefore(l.createTextNode(t),e.nextSibling),o(e),i||e.parentNode.removeChild(e)}}}}function o(e){for(;!e.nextSibling;)if(!(e=e.parentNode))return;var t;for(e=function e(t,s){var i=s?t.cloneNode(!1):t;if(n=t.parentNode){var n=e(n,1),o=t.nextSibling;n.appendChild(i);for(var r=o;r;r=o)o=r.nextSibling,n.appendChild(r)}return i}(e.nextSibling,0);(t=e.parentNode)&&1===t.nodeType;)e=t;i.push(e)}var s,r=/(?:^|\s)nocode(?:\s|$)/,a=/\r\n?|\n/,l=e.ownerDocument;e.currentStyle?s=e.currentStyle.whiteSpace:window.getComputedStyle&&(s=l.defaultView.getComputedStyle(e,q).getPropertyValue("white-space"));var c=s&&"pre"===s.substring(0,3);for(s=l.createElement("LI");e.firstChild;)s.appendChild(e.firstChild);for(var i=[s],u=0;u]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Lx(Ix([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]),Lx(Ix([],[["atv",/^[\S\s]+/]]),["uq.val"]),Lx(Jx({keywords:Qx,hashComments:!0,cStyleComments:!0,types:Vx}),["c","cc","cpp","cxx","cyc","m"]),Lx(Jx({keywords:"null,true,false"}),["json"]),Lx(Jx({keywords:Sx,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:Vx}),["cs"]),Lx(Jx({keywords:Rx,cStyleComments:!0}),["java"]),Lx(Jx({keywords:Ox,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]),Lx(Jx({keywords:Tx,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]),Lx(Jx({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]),Lx(Jx({keywords:Ux,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]),Lx(Jx({keywords:Px,cStyleComments:!0,regexLiterals:!0}),["js"]),Lx(Jx({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Lx(Ix([],[["str",/^[\S\s]+/]]),["regex"]),window.prettyPrintOne=function(e,t,s){var i=document.createElement("PRE");return i.innerHTML=e,s&&Kx(i,s),Nx({g:t,i:s,h:i}),i.innerHTML},window.prettyPrint=function(c){for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],u=[],t=0;t img",mobilemenu:"#mobile-relative",togglemobile:"#mobile-sidebar",radio:":radio",checkbox:":checkbox",search:"#uwsearcharea",select:".uw-select",quicklinks:".uw-quicklinks",slideshow:".uw-slideshow",social:".uw-social",vimeo:".uw-vimeo",youtube:".uw-youtube"},UW.getBaseUrl=function(){var e=_.first(_.compact(Backbone.history.location.pathname.split("/")));return Backbone.history.location.origin||(Backbone.history.location.origin=Backbone.history.location.protocol+"//"+Backbone.history.location.hostname+(Backbone.history.location.port?":"+Backbone.history.location.port:"")),-1!=Backbone.history.location.origin.indexOf("www.washington.edu")?Backbone.history.location.origin+(e?"/"+e:"")+"/":-1!=Backbone.history.location.origin.indexOf("depts.washington.edu")?Backbone.history.location.origin+(e?"/"+e:"")+"/":Backbone.history.location.origin+"/"},UW.wpinstance=function(){return Backbone.history.location.pathname?Backbone.history.location.pathname:""},UW.sources={quicklinks:"undefined"!=typeof style_dir?style_dir+"/wp-admin/admin-ajax.php?action=quicklinks":UW.getBaseUrl()+"wp-admin/admin-ajax.php?action=quicklinks",search:UW.getBaseUrl()+"wp-admin/admin-ajax.php"},UW.initialize=function(e){UW.$body=e("body"),UW.$window=e(window),UW.baseUrl=UW.getBaseUrl(),UW.dropdowns=_.map(e(UW.elements.dropdowns),function(e){return new UW.Dropdowns({el:e})}),UW.mobilemenu=_.map(e(UW.elements.mobilemenu),function(e){return new UW.MobileMenu({el:e})}),UW.quicklinks=_.map(e(UW.elements.quicklinks),function(e){return new UW.QuickLinks({el:e,url:UW.sources.quicklinks})}),UW.search=_.map(e(UW.elements.search),function(e){return new UW.Search({el:e})}),UW.images=_.map(e(UW.elements.images),function(e){return new UW.Image({el:e})}),UW.togglemobile=_.map(e(UW.elements.togglemobile),function(e){return new UW.ToggleSidebarMenu({el:e})}),UW.slideshows=_.map(e(UW.elements.slideshow),function(e){return new UW.Slideshow({el:e})}),UW.social=_.map(e(UW.elements.social),function(e){return new UW.Social({el:e})}),UW.vimeo=_.map(e(UW.elements.vimeo),function(e){return new UW.Vimeo({el:e})}),UW.youtube=_.map(e(UW.elements.youtube),function(e){return new UW.YouTube.Collection({el:e})}),UW.accordion=_.map(e(UW.elements.accordion),function(e){return new UW.Accordion({el:e})}),UW.radio=_.map(e(UW.elements.radio),function(e){return new UW.Radio({el:e})}),UW.checkbox=_.map(e(UW.elements.checkbox),function(e){return new UW.Radio({el:e})}),UW.select=_.map(e(UW.elements.select),function(e){return new UW.Select({el:e})}),UW.alert=new UW.Alert({after:UW.elements.alert,model:new UW.Alert.Model}),e("table").addClass("table table-striped").attr("border",1),e("pre").addClass("prettyprint"),window.prettyPrint&&prettyPrint()},jQuery(document).ready(function(){UW.initialize(jQuery)}),UW.Alert=Backbone.View.extend({alert:"#uwalert-alert-message",events:{"click .close":"hide"},template:'
    Close

    <%= title %>

    <%= excerpt %>More info

    ',initialize:function(e){_.bindAll(this,"render","hide"),this.options=_.extend({},e),this.model.on("sync",this.render)},render:function(){this.model.get("title")&&($(this.options.after).after(_.template(this.template)(this.model.toJSON())),this.setElement($(this.alert)))},hide:function(){this.$el.remove()}}),UW.Alert.Model=Backbone.Model.extend({alerts:["red-alert-urgent","orange-alert","steel-alert-fyis"],data:{c:"?",test:!0,number:1,type:"post",status:"publish",dataType:"json"},url:"https://public-api.wordpress.com/rest/v1/sites/uwemergency.wordpress.com/posts/",initialize:function(){this.fetch({data:this.data})},parse:function(e){var t=_.first(e.posts);if(_.extend(t.categories,{alert:{slug:window.location.hash.replace("#","")}}),_.intersection(_.pluck(t.categories,"slug"),this.alerts).length||-1!==t.categories.alert.slug.indexOf("uwalert"))return t}}),UW.SearchToggle=Backbone.View.extend({el:"button.uw-search",events:{click:"toggleSearchBar"},settings:{isOpen:!1},initialize:function(){},toggleSearchBar:function(){return this.settings.isOpen=!this.settings.isOpen,this.trigger("open"),UW.$body.toggleClass("search-open"),this.settings.isOpen?(this.$el.attr("aria-label","close search area"),this.$el.attr("aria-expanded","true")):(this.$el.attr("aria-label","open search area"),this.$el.attr("aria-expanded","false")),!1}}),UW.Search=Backbone.View.extend({searchFeatures:{uw:"uw",site:"site"},searchbar:'',defaults:{},events:{"click label.radio":"toggleSearchFeature","change select":"toggleSearchFeature","click .search":"submitForm","submit form":"submitSearch",keydown:"handleKeyDown","focus input":"skipToContentIfHidden"},initialize:function(e){this.settings=_.extend({},this.defaults,this.$el.data(),e),this.render(),this.toggle=new UW.SearchToggle,this.toggle.on("open",this.toggleBlur,this),this.searchFeature=this.$el.find(":radio:checked").val()},render:function(){this.$el.html(_.template(this.searchbar)(this.settings))},toggleBlur:function(){this.toggle.settings.isOpen?(this.$el.find("#uw-search-bar").focus(),this.$el.attr("aria-hidden","false").attr("role","search")):this.$el.attr("aria-hidden","true").removeAttr("role")},handleKeyDown:function(e){switch(e.keyCode){case UW.KEYCODES.TAB:return $(e.target)[0]!=$("input.search")[0]||$(e)[0].shiftKey||$("#search-labels").addClass("focused"),$(e.target)[0]!=$("input.search")[0]&&$("#search-labels").hasClass("focused")&&$("#search-labels").removeClass("focused"),!($(e.target)[0]==$("input.radiobtn")[0]&&!$(e)[0].shiftKey)||(this.toggle.$el.focus(),!1);case UW.KEYCODES.ESC:return e.stopPropagation(),this.toggle.toggleSearchBar(),this.toggle.$el.focus(),!1;default:return!0}},toggleSearchFeature:function(e){var t="";t="none"==$("#mobile-search-select.visible-xs").css("display")?$(e.currentTarget).find("input").val():$(e.currentTarget).val(),this.searchFeature=t},skipToContentIfHidden:function(){this.toggle.settings.isOpen||$("#main-content").focus()},submitSearch:function(e){switch(this.$el.find("input.radiobtn").attr("disabled","disabled"),this.searchFeature){case this.searchFeatures.uw:return this.$el.find("#uw-search-bar").attr("name","q"),this.$el.find("form").attr("action",Backbone.history.location.protocol+"//uw.edu/search/"),!0;case this.searchFeatures.site:return!0;default:return!1}},submitForm:function(){return this.$el.find("form").submit(),!1}}),UW.QuickLinks=Backbone.View.extend({DELAY:500,settings:{},container:"#uw-container",template:'',events:{click:"animate",touchstart:"animate",keyup:"animate",blur:"loop"},initialize:function(e){_.bindAll(this,"inner_keydown","render","renderDefault","animate","accessible","loop","transitionEnd"),this.options=_.extend({},this.settings,e),this.links=new UW.QuickLinks.Collection(this.options),this.links.on("sync",this.render),this.links.on("error",this.renderDefault),this.links.fetch()},renderDefault:function(){this.defaultLinks=this.links.defaults,this.render()},render:function(){this.defaultLinks=this.links.defaults,this.quicklinks=$(_.template(this.template)({links:0==this.links.toJSON().length?this.defaultLinks:this.links.toJSON()})),this.$container=$(this.container),this.$container.prepend(this.quicklinks),this.$el.attr("aria-controls","quicklinks").attr("aria-owns","quicklinks"),UW.$body.on("keydown","#quicklinks a:first",this.inner_keydown),UW.$body.on("keyup","#quicklinks a",this.animate),this.quicklinks.on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",this.transitionEnd)},transitionEnd:function(e){this.open&&e.target==this.quicklinks[0]&&this.accessible()},inner_keydown:function(e){if(9==e.keyCode&&e.shiftKey)return this.$el.focus(),!1},animate:function(e){if(e.preventDefault(),e.keyCode&&27!=e.keyCode&&(e.keyCode&&13!=e.keyCode||e.keyCode&&32!=e.keyCode))return!1;this.$container.toggleClass("open"),this.quicklinks.toggleClass("open"),this.open=this.quicklinks.hasClass("open"),this.open||this.accessible()},accessible:function(e){this.$el.attr("aria-expanded",this.open),this.quicklinks.attr("aria-hidden",(!this.open).toString()),this.open?(this.$el.attr("aria-label","Close quick links"),this.quicklinks.find("a").attr("tabindex",0).first().focus(),$("#uw-container-inner").attr("aria-hidden",!0),$(".screen-reader-shortcut").attr("aria-hidden",!0)):(this.$el.attr("aria-label","Open quick links"),this.quicklinks.find("a").attr("tabindex",-1),this.$el.focus(),$("#uw-container-inner").attr("aria-hidden",!1),$(".screen-reader-shortcut").attr("aria-hidden",!1))},loop:function(e){this.open&&this.quicklinks.find("li a").first().focus()}}),UW.QuickLinks.Model=Backbone.Model.extend({}),UW.QuickLinks.Collection=Backbone.Collection.extend({model:UW.QuickLinks.Model,initialize:function(e){this.url=e.url,this.url=e.url.replace("www.washington.edu/cms/","www.washington.edu/")},defaults:[{title:"MyUW",url:"https://my.uw.edu",classes:["icon-myuw"]},{title:"Calendar",url:"https://uw.edu/calendar",classes:["icon-calendar"]},{title:"Directories",url:"https://directory.uw.edu/",classes:["icon-directories"]},{title:"Libraries",url:"https://www.lib.washington.edu/",classes:["icon-libraries"]},{title:"UW Medicine",url:"https://www.uwmedicine.org",classes:["icon-medicine"]},{title:"Maps",url:"https://uw.edu/maps",classes:["icon-maps"]},{title:"UW News",url:"https://uw.edu/news",classes:["icon-uwtoday"]},{title:"Computing/IT",url:"https://itconnect.uw.edu",classes:!1},{title:"Workday/ISC",url:"https://isc.uw.edu/",classes:!1},{title:"Husky Card",url:"https://hfs.uw.edu/Husky-Card-Services/",classes:!1},{title:"UW Bothell",url:"https://www.uwb.edu/",classes:!1},{title:"UW Tacoma",url:"https://www.tacoma.uw.edu/",classes:!1},{title:"UW Facebook",url:"https://www.facebook.com/UofWA",classes:!1},{title:"UW Twitter",url:"https://twitter.com/UW",classes:!1}]}),UW.Slideshow=Backbone.View.extend({el:".uw-slideshow",current:0,controls:'',animation:{},settings:{slideclass:".slide",controlclasses:{base:"uw-slideshow-controls",lastNext:"last-next",lastPrev:"last-previous"},animationOptions:{easing:"easeOutQuint",duration:1200,queue:!1}},events:{"click .previous":"animateIn","click .next":"animateOut","click .slider-dots li":"dotsAnimate","click .fullscreen":"goFullscreen"},initialize:function(e){this.options=_.extend({},this.settings,e),_.bindAll(this,"animateIn","animateOut","addControls","zIndex","moveDots","goFullscreen"),this.controls=_.template(this.controls)({classname:this.options.controlclasses.base}),this.numberOfSlides=this.$el.find(".slide").length-1,this.photoSlider=this.$el.hasClass("photo-slider"),this.organizeSlideshow(),this.addControls(),this.photoSlideshow(),this.mobileSizing(),this.focusControls(this)},organizeSlideshow:function(){_.each(this.$(".slide").get(),this.zIndex)},mobileSizing:function(){function e(){var e=$(".uw-slideshow"),t=$(".uw-slideshow img:first").height()+50,s=e.find(".slider-dots");windowsize=$(window).width(),windowsize<768&&(e.css("height",t),s.css("marginTop",t-40))}this.photoSlider&&(e(),$(window).resize(e))},photoSlideshow:function(){if(this.photoSlider){for($("."+this.el.classList[2]).append('
      ','Fullscreen'),i=0;i");$(".slider-dots-"+this.el.classList[2]+" li:nth-child(1)").addClass("select-dot")}},goFullscreen:function(e){$("body").toggleClass("activeFullscreen"),event.preventDefault()},moveDots:function(){$(".slider-dots-"+this.el.classList[2]+" li").removeClass("select-dot"),$(".slider-dots-"+this.el.classList[2]+" li:nth-child("+(this.current+1)+")").addClass("select-dot")},dotsAnimate:function(e){var t=$(".slider-dots-"+this.el.classList[2]+" li").index(e.target);if(this.moveDots(),t>this.current)for(i=this.current+1;i<=t;i++)this.animateOut();else if(t
      ",playlist_section:"
        ",events:{"click button":"preview_clicked"},initialize:function(){_(this).bindAll("onReady","onDataReady","onStateChange","preview_clicked","resized"),this.player_ready=!1,this.data_ready=!1,this.wrap(),this.add_iFrame_api(),"playlist"==this.collection.type&&(this.$el.addClass("playlist"),this.add_playlist_section(),this.scrollbar_visible=!1,$(window).resize(this.resized))},resized:function(){var e=this.$vidSmall.find(".viewport").width();e!=this.$viewport_width&&(this.$viewport_width=e,this.showTinyScrollbar())},wrap:function(){this.collection.$el.wrap($(this.template)),this.$el=this.collection.$el.parents(".nc-video-player"),this.el=this.$el[0]},add_iFrame_api:function(){0===UW.$body.find("script#iFrame").length&&(UW.$body.append(''); - this.add_iFrame_function(); - } - }, - - // at this point, all the collections should be created. - // Each gets a uwplayer variable that is a YT.Player corresponding to the collection - add_iFrame_function: function () { - window.onYouTubeIframeAPIReady = function() { - for (var i = 0, length = UW.youtube.length; i < length; i++){ - var collection = UW.youtube[i], player_vars = {}; - // if the collection desires no youtube branding, set these parameters - if (collection.modest) { - player_vars = { - 'rel' : 0, - 'controls' : 0, - 'modestbranding': 1, - } - } else { - player_vars = { - 'rel' : 0, - } - } - // if (collection.resolution !== 'undefined'){ - // player_vars.VQ = collection.resolution; - // } - //attach the YT.player to the relevant view, each view gets one - collection.view.uwplayer = new YT.Player(collection.$el.attr('id'), { - videoId: '', - playerVars: player_vars, - events: { - //these events will call functions in the relevant view - 'onReady': collection.view.onReady, - 'onStateChange': collection.view.onStateChange - } - }); - } - }; - }, - - // This function is called if the collection is a playlist - // adds the playlist section - add_playlist_section : function () { - this.$el.append(this.playlist_section); - this.$vidSmall = this.$el.find('.vidSmall'); - this.$vidContent = this.$el.find('.vidContent'); - this.scrollbar_visible = false; - }, - - // this is the callback for when the youtube iframe api is ready to go - // checks to see if the data is ready too - onReady: function () { - this.player_ready = true; - this.check_all_ready(); - }, - - // this is the callback for whne the data is loaded into the models - // preps the playlist area if its a playlist - // checks to see if the iframe api is ready - onDataReady: function () { - this.data_ready = true; - if (this.collection.type == 'playlist'){ - this.$vidContent_width = this.collection.models.length * 135 - this.$vidContent.width(this.$vidContent_width + 'px'); - this.$viewport_width = this.$vidSmall.find('.viewport').width(); - this.showTinyScrollbar(); - } - this.check_all_ready(); - }, - - // this function shows the tiny scrollbar. - showTinyScrollbar: function () { - if (this.$vidContent_width > this.$viewport_width){ - if (!this.scrollbar_visible) { - this.$vidSmall.find('.scrollbar').show(); - this.$vidSmall.tinyscrollbar({axis: 'x'}); - this.scrollbar_visible = true; - } - } - else if (this.scrollbar_visible){ - this.$vidSmall.find('.scrollbar').removeAttr('style'); - this.scrollbar_visible = false; - } - }, - - // this function checks the state of data/player to prevent a race case. - // Both the data and the player must be ready to go. Then we play the correct video - check_all_ready: function() { - if (this.data_ready && this.player_ready){ - this.play(this.collection.models[0].get('resourceId').videoId); - } - }, - - // when the player changes state, this is run. - // Currently stuff only happens if this is a playlist - // TODO: add a publicly visible event on video end for showcase pages - onStateChange: function (event) { - if (this.is_playlist) { - //event.data is 0 when a video finishes playing. Find out what video we just finished, then play the next one or loop back to the beginning of the playlist - if (event.data === 0) { - var video = this.$vidContent.find('.vid-active').attr('id'); - var index = this.video_ids.indexOf(video); - if (index < this.video_ids.length - 1) { - this.play(this.video_ids[index + 1]); - } - else { - this.play(this.video_ids[0]); - } - } - } - }, - - // play the video id passed. If 'playnow' not passed, assume false. - // If 'playnow' is true play the video, otherwise just cue it up - play: function (id, playnow){ - playnow = playnow || false; - if (playnow) { - this.uwplayer.loadVideoById(id); - this.$el.focus(); - } - else { - this.uwplayer.cueVideoById(id); - } - //If this is a playlist we must also manipulate the placeholder drawer. Move the selected video's placeholder to the front if we can, otherwise move the listas far as we can without creating whitespace. Then visually distinguish the selected video's placeholder - if (this.collection.type == 'playlist') { - this.$el.find('a.vid-active').removeClass('vid-active'); - var $small = $('#' + id); - $small.addClass('vid-active'); - this.$el.attr('aria-label', 'video: ' + $small.data('title')); - if (this.scrollbar_visible){ - var leftpos = $small.position().left; - if (this.$vidContent_width - leftpos < this.$viewport_width){ - leftpos = this.$vidContent_width - this.$viewport_width; - } - this.$vidContent.animate({left: -leftpos}, 500); - this.$vidSmall.data('plugin_tinyscrollbar').update(leftpos); - } - } - }, - - // this fires if a video preview in the playlist area is clicked - preview_clicked: function (event) { - this.play(event.currentTarget.id, true); - } -}); - - -// Video is a model for a single video -UW.YouTube.Video = Backbone.Model.extend({ - initialize: function () { - if (this.get('resourceId')){ - this.view = new UW.YouTube.VideoView({model: this}); - } - } -}); - -// Video View is a view for single video. Currently does nothing -UW.YouTube.VideoView = Backbone.View.extend({ - //template: underscore + html string here, - - initialize: function () { - this.render(); - }, - - render: function () { - this.model.collection.view.$el.attr('aria-label', 'video: ' + this.model.get('title')); - //var item = this.model.toJSON(); - //var small_vid = _.template(this.template, item); - //this.model.collection.view.$vidSmall.append(small_vid); - } -}); - -// PlaylistItem is the model for a video in a playlist -UW.YouTube.PlaylistItem = Backbone.Model.extend({ - - // if the video is a real video and not an error code, make a view - initialize: function () { - if (this.get('resourceId')){ - this.view = new UW.YouTube.PlaylistItemView({model:this}); - } - }, -}); - -// PlaylistItemView is the view for a playlist item -UW.YouTube.PlaylistItemView = Backbone.View.extend({ - - // this is the template for a playlist item preview - // goes inside the playlist section - template: "
      • ", - - // preps the $el and renders - initialize: function () { - this.$el = this.model.collection.view.$vidContent.find('ul'); - this.render(); - }, - - // gets the data ready, templates it, then appends to the playlist section - render: function () { - var item = this.model.toJSON(); - var small_vid = _.template(this.template)( item ); - this.$el.append(small_vid); - }, -}); diff --git a/less/style.less b/less/style.less index 3a1f0c0d..9f107686 100644 --- a/less/style.less +++ b/less/style.less @@ -54,7 +54,6 @@ GitHub Theme URI: https://github.com/uweb/uw-2014 @import "less/uw.boxes.less"; @import "less/uw.tables.less"; @import "less/uw.player.less"; -@import "less/uw.youtube.less"; @import "less/uw.blogroll.less"; @import "less/uw.custom-link.less"; diff --git a/less/uw.breadcrumbs.less b/less/uw.breadcrumbs.less index 0c05b8a5..9c0ae881 100644 --- a/less/uw.breadcrumbs.less +++ b/less/uw.breadcrumbs.less @@ -20,6 +20,8 @@ width: 25px; padding: 5px 0 5px 0; margin-right: 25px; + transition: none; + margin-bottom: 0; &:before { right: -18px; } @@ -28,6 +30,7 @@ &:hover { border-bottom: 1px solid @darkgold; margin-bottom: -1px; + transition: none; } } &:after { diff --git a/less/uw.select.less b/less/uw.select.less index 176949f9..b74501ab 100644 --- a/less/uw.select.less +++ b/less/uw.select.less @@ -9,7 +9,7 @@ ul.uw-select { &.open { background-color: #F7F7F7; outline: 1px solid #F7F7F7; - overflow: scroll; + overflow: auto; height: 355px; outline: 1px solid #C4C4C4; z-index:9999; diff --git a/menu-quicklinks.php b/menu-quicklinks.php new file mode 100644 index 00000000..bbb833f3 --- /dev/null +++ b/menu-quicklinks.php @@ -0,0 +1,27 @@ + diff --git a/setup/class.accordion-shortcode.php b/setup/class.accordion-shortcode.php index d398b3a8..2061721f 100644 --- a/setup/class.accordion-shortcode.php +++ b/setup/class.accordion-shortcode.php @@ -34,9 +34,14 @@ function accordion_handler( $atts, $content ) if ( empty( $content ) ) return 'No content inside the accordion element. Make sure your close your accordion element. Required stucture: [accordion][section]content[/section][/accordion]'; - + + + $parent = get_template(); + $parent_version = wp_get_theme($parent)->get('Version'); + wp_enqueue_script( 'uw-accordionmodule', get_template_directory_uri() . '/js/uw.accordionmodule.js', array( 'jquery' ), $parent_version, true ); $output = do_shortcode( $content ); - return sprintf( '

        %s

        %s
        ', $accordion_atts['name'], $output ); + $name = !empty( $accordion_atts['name'] ) ? '

        ' . $accordion_atts['name'] . '

        ' : ''; + return sprintf( '
        %s
        %s
        ', $name, $output ); } function section_handler( $atts, $content ) @@ -53,7 +58,7 @@ function section_handler( $atts, $content ) $class = 'data-accordion-opened="true"'; } $output = do_shortcode( $content ); - return sprintf( '

        %s

        %s
        ', $section_atts['title'], $class, apply_filters( 'the_content', $output ) ); + return sprintf( '

        %s

        %s
        ', $class, $section_atts['title'], apply_filters( 'the_content', $output ) ); } function subsection_handler( $atts, $content ) diff --git a/setup/class.googleapps.php b/setup/class.googleapps.php index 10978d1d..200c03a6 100644 --- a/setup/class.googleapps.php +++ b/setup/class.googleapps.php @@ -37,7 +37,7 @@ function uw_google_calendar_embed_to_shortcode( $content ) return $content; - if ( false === strpos( $content, '").attr("name","like-post-frame-"+s+"-"+e).attr("src",r).css("display","inline-block"),l=j("
        ").addClass("jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded slim-likes-widget").attr("id","like-post-wrapper-"+s+"-"+e).attr("data-src",r).attr("data-name","like-post-frame-"+s+"-"+e).attr("data-attachment-id",e).css("display","none").css("vertical-align","middle").append(a).append("
        ");j(".jp-carousel-buttons").append(l)}},updateExif:function(e){if(!e||1!=jetpackCarouselStrings.display_exif)return!1;var s=j("");j.each(e,function(e,t){if(0!==parseFloat(t)&&t.length&&-1!==j.inArray(e,["camera","aperture","shutter_speed","focal_length"])){switch(e){case"focal_length":t+="mm";break;case"shutter_speed":t=b.jp_carousel("shutterSpeed",t);break;case"aperture":t="f/"+t}s.append("
      • "+jetpackCarouselStrings[e]+"
        "+t+"
      • ")}}),j("div.jp-carousel-image-meta ul.jp-carousel-image-exif").replaceWith(s)},updateFullSizeLink:function(e){if(!e||!e.data)return!1;var t=e.data("orig-file").replace(/\?.+$/,""),s=e.data("orig-size").split(","),i=j(""+b.jp_carousel("format",{text:jetpackCarouselStrings.download_original,replacements:s})+"").addClass("jp-carousel-image-download").attr("href",t).attr("target","_blank");j("div.jp-carousel-image-meta a.jp-carousel-image-download").replaceWith(i)},updateMap:function(e){if(e.latitude&&e.longitude&&1==jetpackCarouselStrings.display_geo){var t=e.latitude,s=e.longitude,i=j("div.jp-carousel-image-meta","div.jp-carousel-wrap"),n="&scale=2&style=feature:all|element:all|invert_lightness:true|hue:0x0077FF|saturation:-50|lightness:-5|gamma:0.91";j("
        ").addClass("jp-carousel-image-map").html('\t\t\t\t\t\t\t\t\t\t\t\t\t
        \t\t\t\t\t\t\t\t\t\t\t\t\t').prependTo(i)}},testCommentsOpened:function(e){1==parseInt(e,10)?(j(".jp-carousel-buttons").fadeIn("fast"),commentForm.fadeIn("fast")):(j(".jp-carousel-buttons").fadeOut("fast"),commentForm.fadeOut("fast"))},getComments:function(e){return!1},postCommentError:function(e){"object"!=typeof e&&(e={}),e.field&&void 0!==e.field&&e.error&&void 0!==e.error&&(j("#jp-carousel-comment-post-results").slideUp("fast").html('").slideDown("fast"),j("#jp-carousel-comment-form-spinner").spin(!1))},setCommentIframeSrc:function(e){var t=j("#jp-carousel-comment-iframe");t&&t.length&&(t.attr("src",t.attr("src").replace(/(postid=)\d+/,"$1"+e)),t.attr("src",t.attr("src").replace(/(%23.+)?$/,"%23jp-carousel-"+e)))},clearCommentTextAreaValue:function(){var e=j("#jp-carousel-comment-form-comment-field");e&&e.val("")},nextSlide:function(){var e=this.jp_carousel("slides"),t=this.jp_carousel("selectedSlide");return 0==t.length||2e.data("thumb-size").width?t.attr("src",t.closest(".jp-carousel-slide").data("src")):t.attr("src",e.data("preview-image")),t.data("loaded",1))}};j.fn.jp_carousel=function(e){return s[e]?s[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void j.error("Method "+e+" does not exist on jQuery.jp_carousel"):s.open.apply(this,arguments)},j(document.body).on("click","div.gallery,div.tiled-gallery",function(e){j(this).jp_carousel("testForData",e.currentTarget)&&(j(e.target).parent().hasClass("gallery-caption")||(e.preventDefault(),j(this).jp_carousel("open",{start_index:j(this).find(".gallery-item, .tiled-gallery-item").index(j(e.target).parents(".gallery-item, .tiled-gallery-item"))})))}),j(window).on("hashchange",function(){if(window.location.hash&&window.location.hash.match(/jp-carousel-(\d+)/)&&window.location.hash!=y){y=window.location.hash;var e=j("div.gallery, div.tiled-gallery"),s=-1,i=window.location.hash.match(/jp-carousel-(\d+)/);j(this).jp_carousel("testForData",e)&&(i=parseInt(i[1],10),e.find("img").each(function(e,t){if(i&&j(t).data("attachment-id")==i)return s=e,!1}),-1!=s&&e.jp_carousel("openOrSelectSlide",s))}}),window.location.hash&&j(window).trigger("hashchange")}),mx=jQuery,mx.fn.touchwipe=function(e){var c={min_move_x:20,min_move_y:20,wipeLeft:function(e){},wipeRight:function(e){},wipeUp:function(e){},wipeDown:function(e){},preventDefaultEvents:!0};return e&&mx.extend(c,e),this.each(function(){var o,r,a=!1;function l(){this.removeEventListener("touchmove",t),o=null,a=!1}function t(e){if(c.preventDefaultEvents&&e.preventDefault(),a){var t=e.touches[0].pageX,s=e.touches[0].pageY,i=o-t,n=r-s;Math.abs(i)>=c.min_move_x?(l(),0=c.min_move_y&&(l(),0o[0]&&(o[1]+1>o[0]&&s.push("-"),s.push(c(o[1])));return s.push("]"),s.join("")}function t(e){for(var t=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),s=t.length,i=[],n=0,o=0;n/,q])):t.push(["com",/^#[^\n\r]*/,q,"#"])),e.cStyleComments&&(s.push(["com",/^\/\/[^\n\r]*/,q]),s.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q])),e.regexLiterals&&s.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]),(i=e.types)&&s.push(["typ",i]),(e=(""+e.keywords).replace(/^ | $/g,"")).length&&s.push(["kwd",RegExp("^(?:"+e.replace(/[\s,]+/g,"|")+")\\b"),q]),t.push(["pln",/^\s+/,q," \r\n\t "]),s.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]),Ix(t,s)}function Kx(e,t){function n(e){switch(e.nodeType){case 1:if(r.test(e.className))break;if("BR"===e.nodeName)o(e),e.parentNode&&e.parentNode.removeChild(e);else for(e=e.firstChild;e;e=e.nextSibling)n(e);break;case 3:case 4:if(c){var t=e.nodeValue,s=t.match(a);if(s){var i=t.substring(0,s.index);e.nodeValue=i,(t=t.substring(s.index+s[0].length))&&e.parentNode.insertBefore(l.createTextNode(t),e.nextSibling),o(e),i||e.parentNode.removeChild(e)}}}}function o(e){for(;!e.nextSibling;)if(!(e=e.parentNode))return;var t;for(e=function e(t,s){var i=s?t.cloneNode(!1):t;if(n=t.parentNode){var n=e(n,1),o=t.nextSibling;n.appendChild(i);for(var r=o;r;r=o)o=r.nextSibling,n.appendChild(r)}return i}(e.nextSibling,0);(t=e.parentNode)&&1===t.nodeType;)e=t;i.push(e)}var s,r=/(?:^|\s)nocode(?:\s|$)/,a=/\r\n?|\n/,l=e.ownerDocument;e.currentStyle?s=e.currentStyle.whiteSpace:window.getComputedStyle&&(s=l.defaultView.getComputedStyle(e,q).getPropertyValue("white-space"));var c=s&&"pre"===s.substring(0,3);for(s=l.createElement("LI");e.firstChild;)s.appendChild(e.firstChild);for(var i=[s],u=0;u]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Lx(Ix([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]),Lx(Ix([],[["atv",/^[\S\s]+/]]),["uq.val"]),Lx(Jx({keywords:Qx,hashComments:!0,cStyleComments:!0,types:Vx}),["c","cc","cpp","cxx","cyc","m"]),Lx(Jx({keywords:"null,true,false"}),["json"]),Lx(Jx({keywords:Sx,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:Vx}),["cs"]),Lx(Jx({keywords:Rx,cStyleComments:!0}),["java"]),Lx(Jx({keywords:Ox,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]),Lx(Jx({keywords:Tx,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]),Lx(Jx({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]),Lx(Jx({keywords:Ux,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]),Lx(Jx({keywords:Px,cStyleComments:!0,regexLiterals:!0}),["js"]),Lx(Jx({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Lx(Ix([],[["str",/^[\S\s]+/]]),["regex"]),window.prettyPrintOne=function(e,t,s){var i=document.createElement("PRE");return i.innerHTML=e,s&&Kx(i,s),Nx({g:t,i:s,h:i}),i.innerHTML},window.prettyPrint=function(c){for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],u=[],t=0;t img",mobilemenu:"#mobile-relative",togglemobile:"#mobile-sidebar",radio:":radio",checkbox:":checkbox",search:"#uwsearcharea",select:".uw-select",quicklinks:".uw-quicklinks",slideshow:".uw-slideshow",social:".uw-social",vimeo:".uw-vimeo",youtube:".uw-youtube"},UW.getBaseUrl=function(){var e=_.first(_.compact(Backbone.history.location.pathname.split("/")));return Backbone.history.location.origin||(Backbone.history.location.origin=Backbone.history.location.protocol+"//"+Backbone.history.location.hostname+(Backbone.history.location.port?":"+Backbone.history.location.port:"")),-1!=Backbone.history.location.origin.indexOf("www.washington.edu")?Backbone.history.location.origin+(e?"/"+e:"")+"/":-1!=Backbone.history.location.origin.indexOf("depts.washington.edu")?Backbone.history.location.origin+(e?"/"+e:"")+"/":Backbone.history.location.origin+"/"},UW.wpinstance=function(){return Backbone.history.location.pathname?Backbone.history.location.pathname:""},UW.sources={quicklinks:"undefined"!=typeof style_dir?style_dir+"/wp-admin/admin-ajax.php?action=quicklinks":UW.getBaseUrl()+"wp-admin/admin-ajax.php?action=quicklinks",search:UW.getBaseUrl()+"wp-admin/admin-ajax.php"},UW.initialize=function(e){UW.$body=e("body"),UW.$window=e(window),UW.baseUrl=UW.getBaseUrl(),UW.dropdowns=_.map(e(UW.elements.dropdowns),function(e){return new UW.Dropdowns({el:e})}),UW.mobilemenu=_.map(e(UW.elements.mobilemenu),function(e){return new UW.MobileMenu({el:e})}),UW.quicklinks=_.map(e(UW.elements.quicklinks),function(e){return new UW.QuickLinks({el:e,url:UW.sources.quicklinks})}),UW.search=_.map(e(UW.elements.search),function(e){return new UW.Search({el:e})}),UW.images=_.map(e(UW.elements.images),function(e){return new UW.Image({el:e})}),UW.togglemobile=_.map(e(UW.elements.togglemobile),function(e){return new UW.ToggleSidebarMenu({el:e})}),UW.slideshows=_.map(e(UW.elements.slideshow),function(e){return new UW.Slideshow({el:e})}),UW.social=_.map(e(UW.elements.social),function(e){return new UW.Social({el:e})}),UW.vimeo=_.map(e(UW.elements.vimeo),function(e){return new UW.Vimeo({el:e})}),UW.youtube=_.map(e(UW.elements.youtube),function(e){return new UW.YouTube.Collection({el:e})}),UW.accordion=_.map(e(UW.elements.accordion),function(e){return new UW.Accordion({el:e})}),UW.radio=_.map(e(UW.elements.radio),function(e){return new UW.Radio({el:e})}),UW.checkbox=_.map(e(UW.elements.checkbox),function(e){return new UW.Radio({el:e})}),UW.select=_.map(e(UW.elements.select),function(e){return new UW.Select({el:e})}),UW.alert=new UW.Alert({after:UW.elements.alert,model:new UW.Alert.Model}),e("table").addClass("table table-striped").attr("border",1),e("pre").addClass("prettyprint"),window.prettyPrint&&prettyPrint()},jQuery(document).ready(function(){UW.initialize(jQuery)}),UW.Alert=Backbone.View.extend({alert:"#uwalert-alert-message",events:{"click .close":"hide"},template:'
        Close

        <%= title %>

        <%= excerpt %>More info

        ',initialize:function(e){_.bindAll(this,"render","hide"),this.options=_.extend({},e),this.model.on("sync",this.render)},render:function(){this.model.get("title")&&($(this.options.after).after(_.template(this.template)(this.model.toJSON())),this.setElement($(this.alert)))},hide:function(){this.$el.remove()}}),UW.Alert.Model=Backbone.Model.extend({alerts:["red-alert-urgent","orange-alert","steel-alert-fyis"],data:{c:"?",test:!0,number:1,type:"post",status:"publish",dataType:"json"},url:"https://public-api.wordpress.com/rest/v1/sites/uwemergency.wordpress.com/posts/",initialize:function(){this.fetch({data:this.data})},parse:function(e){var t=_.first(e.posts);if(_.extend(t.categories,{alert:{slug:window.location.hash.replace("#","")}}),_.intersection(_.pluck(t.categories,"slug"),this.alerts).length||-1!==t.categories.alert.slug.indexOf("uwalert"))return t}}),UW.SearchToggle=Backbone.View.extend({el:"button.uw-search",events:{click:"toggleSearchBar"},settings:{isOpen:!1},initialize:function(){},toggleSearchBar:function(){return this.settings.isOpen=!this.settings.isOpen,this.trigger("open"),UW.$body.toggleClass("search-open"),this.settings.isOpen?(this.$el.attr("aria-label","close search area"),this.$el.attr("aria-expanded","true")):(this.$el.attr("aria-label","open search area"),this.$el.attr("aria-expanded","false")),!1}}),UW.Search=Backbone.View.extend({searchFeatures:{uw:"uw",site:"site"},searchbar:'',defaults:{},events:{"click label.radio":"toggleSearchFeature","change select":"toggleSearchFeature","click .search":"submitForm","submit form":"submitSearch",keydown:"handleKeyDown","focus input":"skipToContentIfHidden"},initialize:function(e){this.settings=_.extend({},this.defaults,this.$el.data(),e),this.render(),this.toggle=new UW.SearchToggle,this.toggle.on("open",this.toggleBlur,this),this.searchFeature=this.$el.find(":radio:checked").val()},render:function(){this.$el.html(_.template(this.searchbar)(this.settings))},toggleBlur:function(){this.toggle.settings.isOpen?(this.$el.find("#uw-search-bar").focus(),this.$el.attr("aria-hidden","false").attr("role","search")):this.$el.attr("aria-hidden","true").removeAttr("role")},handleKeyDown:function(e){switch(e.keyCode){case UW.KEYCODES.TAB:return $(e.target)[0]!=$("input.search")[0]||$(e)[0].shiftKey||$("#search-labels").addClass("focused"),$(e.target)[0]!=$("input.search")[0]&&$("#search-labels").hasClass("focused")&&$("#search-labels").removeClass("focused"),!($(e.target)[0]==$("input.radiobtn")[0]&&!$(e)[0].shiftKey)||(this.toggle.$el.focus(),!1);case UW.KEYCODES.ESC:return e.stopPropagation(),this.toggle.toggleSearchBar(),this.toggle.$el.focus(),!1;default:return!0}},toggleSearchFeature:function(e){var t="";t="none"==$("#mobile-search-select.visible-xs").css("display")?$(e.currentTarget).find("input").val():$(e.currentTarget).val(),this.searchFeature=t},skipToContentIfHidden:function(){this.toggle.settings.isOpen||$("#main-content").focus()},submitSearch:function(e){switch(this.$el.find("input.radiobtn").attr("disabled","disabled"),this.searchFeature){case this.searchFeatures.uw:return this.$el.find("#uw-search-bar").attr("name","q"),this.$el.find("form").attr("action",Backbone.history.location.protocol+"//uw.edu/search/"),!0;case this.searchFeatures.site:return!0;default:return!1}},submitForm:function(){return this.$el.find("form").submit(),!1}}),UW.QuickLinks=Backbone.View.extend({DELAY:500,settings:{},container:"#uw-container",template:'',events:{click:"animate",touchstart:"animate",keyup:"animate",blur:"loop"},initialize:function(e){_.bindAll(this,"inner_keydown","render","renderDefault","animate","accessible","loop","transitionEnd"),this.options=_.extend({},this.settings,e),this.links=new UW.QuickLinks.Collection(this.options),this.links.on("sync",this.render),this.links.on("error",this.renderDefault),this.links.fetch()},renderDefault:function(){this.defaultLinks=this.links.defaults,this.render()},render:function(){this.defaultLinks=this.links.defaults,this.quicklinks=$(_.template(this.template)({links:0==this.links.toJSON().length?this.defaultLinks:this.links.toJSON()})),this.$container=$(this.container),this.$container.prepend(this.quicklinks),this.$el.attr("aria-controls","quicklinks").attr("aria-owns","quicklinks"),UW.$body.on("keydown","#quicklinks a:first",this.inner_keydown),UW.$body.on("keyup","#quicklinks a",this.animate),this.quicklinks.on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",this.transitionEnd)},transitionEnd:function(e){this.open&&e.target==this.quicklinks[0]&&this.accessible()},inner_keydown:function(e){if(9==e.keyCode&&e.shiftKey)return this.$el.focus(),!1},animate:function(e){if(e.preventDefault(),e.keyCode&&27!=e.keyCode&&(e.keyCode&&13!=e.keyCode||e.keyCode&&32!=e.keyCode))return!1;this.$container.toggleClass("open"),this.quicklinks.toggleClass("open"),this.open=this.quicklinks.hasClass("open"),this.open||this.accessible()},accessible:function(e){this.$el.attr("aria-expanded",this.open),this.quicklinks.attr("aria-hidden",(!this.open).toString()),this.open?(this.$el.attr("aria-label","Close quick links"),this.quicklinks.find("a").attr("tabindex",0).first().focus(),$("#uw-container-inner").attr("aria-hidden",!0),$(".screen-reader-shortcut").attr("aria-hidden",!0)):(this.$el.attr("aria-label","Open quick links"),this.quicklinks.find("a").attr("tabindex",-1),this.$el.focus(),$("#uw-container-inner").attr("aria-hidden",!1),$(".screen-reader-shortcut").attr("aria-hidden",!1))},loop:function(e){this.open&&this.quicklinks.find("li a").first().focus()}}),UW.QuickLinks.Model=Backbone.Model.extend({}),UW.QuickLinks.Collection=Backbone.Collection.extend({model:UW.QuickLinks.Model,initialize:function(e){this.url=e.url,this.url=e.url.replace("www.washington.edu/cms/","www.washington.edu/")},defaults:[{title:"MyUW",url:"https://my.uw.edu",classes:["icon-myuw"]},{title:"Calendar",url:"https://uw.edu/calendar",classes:["icon-calendar"]},{title:"Directories",url:"https://directory.uw.edu/",classes:["icon-directories"]},{title:"Libraries",url:"https://www.lib.washington.edu/",classes:["icon-libraries"]},{title:"UW Medicine",url:"https://www.uwmedicine.org",classes:["icon-medicine"]},{title:"Maps",url:"https://uw.edu/maps",classes:["icon-maps"]},{title:"UW News",url:"https://uw.edu/news",classes:["icon-uwtoday"]},{title:"Computing/IT",url:"https://itconnect.uw.edu",classes:!1},{title:"Workday/ISC",url:"https://isc.uw.edu/",classes:!1},{title:"Husky Card",url:"https://hfs.uw.edu/Husky-Card-Services/",classes:!1},{title:"UW Bothell",url:"https://www.uwb.edu/",classes:!1},{title:"UW Tacoma",url:"https://www.tacoma.uw.edu/",classes:!1},{title:"UW Facebook",url:"https://www.facebook.com/UofWA",classes:!1},{title:"UW Twitter",url:"https://twitter.com/UW",classes:!1}]}),UW.Slideshow=Backbone.View.extend({el:".uw-slideshow",current:0,controls:'',animation:{},settings:{slideclass:".slide",controlclasses:{base:"uw-slideshow-controls",lastNext:"last-next",lastPrev:"last-previous"},animationOptions:{easing:"easeOutQuint",duration:1200,queue:!1}},events:{"click .previous":"animateIn","click .next":"animateOut","click .slider-dots li":"dotsAnimate","click .fullscreen":"goFullscreen"},initialize:function(e){this.options=_.extend({},this.settings,e),_.bindAll(this,"animateIn","animateOut","addControls","zIndex","moveDots","goFullscreen"),this.controls=_.template(this.controls)({classname:this.options.controlclasses.base}),this.numberOfSlides=this.$el.find(".slide").length-1,this.photoSlider=this.$el.hasClass("photo-slider"),this.organizeSlideshow(),this.addControls(),this.photoSlideshow(),this.mobileSizing(),this.focusControls(this)},organizeSlideshow:function(){_.each(this.$(".slide").get(),this.zIndex)},mobileSizing:function(){function e(){var e=$(".uw-slideshow"),t=$(".uw-slideshow img:first").height()+50,s=e.find(".slider-dots");windowsize=$(window).width(),windowsize<768&&(e.css("height",t),s.css("marginTop",t-40))}this.photoSlider&&(e(),$(window).resize(e))},photoSlideshow:function(){if(this.photoSlider){for($("."+this.el.classList[2]).append('
          ','Fullscreen'),i=0;i");$(".slider-dots-"+this.el.classList[2]+" li:nth-child(1)").addClass("select-dot")}},goFullscreen:function(e){$("body").toggleClass("activeFullscreen"),event.preventDefault()},moveDots:function(){$(".slider-dots-"+this.el.classList[2]+" li").removeClass("select-dot"),$(".slider-dots-"+this.el.classList[2]+" li:nth-child("+(this.current+1)+")").addClass("select-dot")},dotsAnimate:function(e){var t=$(".slider-dots-"+this.el.classList[2]+" li").index(e.target);if(this.moveDots(),t>this.current)for(i=this.current+1;i<=t;i++)this.animateOut();else if(t
          ",playlist_section:"
            ",events:{"click button":"preview_clicked"},initialize:function(){_(this).bindAll("onReady","onDataReady","onStateChange","preview_clicked","resized"),this.player_ready=!1,this.data_ready=!1,this.wrap(),this.add_iFrame_api(),"playlist"==this.collection.type&&(this.$el.addClass("playlist"),this.add_playlist_section(),this.scrollbar_visible=!1,$(window).resize(this.resized))},resized:function(){var e=this.$vidSmall.find(".viewport").width();e!=this.$viewport_width&&(this.$viewport_width=e,this.showTinyScrollbar())},wrap:function(){this.collection.$el.wrap($(this.template)),this.$el=this.collection.$el.parents(".nc-video-player"),this.el=this.$el[0]},add_iFrame_api:function(){0===UW.$body.find("script#iFrame").length&&(UW.$body.append('