mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-12-22 21:23:48 +01:00
- new libs and files for the in-app help
- moved some uncompressed js libs to js_src/libs
This commit is contained in:
parent
476e7d3e2d
commit
cda7b43163
836
js_src/libs/imagesloaded.pkgd.js
Normal file
836
js_src/libs/imagesloaded.pkgd.js
Normal file
@ -0,0 +1,836 @@
|
||||
/*!
|
||||
* imagesLoaded PACKAGED v3.0.4
|
||||
* JavaScript is all like "You images are done yet or what?"
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
/*!
|
||||
* EventEmitter v4.2.4 - git.io/ee
|
||||
* Oliver Caldwell
|
||||
* MIT license
|
||||
* @preserve
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
// Easy access to the prototype
|
||||
var proto = EventEmitter.prototype;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = {});
|
||||
};
|
||||
|
||||
// Expose the class either via AMD, CommonJS or the global object
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return EventEmitter;
|
||||
});
|
||||
}
|
||||
else if (typeof module === 'object' && module.exports){
|
||||
module.exports = EventEmitter;
|
||||
}
|
||||
else {
|
||||
this.EventEmitter = EventEmitter;
|
||||
}
|
||||
}.call(this));
|
||||
|
||||
/*!
|
||||
* eventie v1.0.3
|
||||
* 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 ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var docElem = document.documentElement;
|
||||
|
||||
var bind = function() {};
|
||||
|
||||
if ( docElem.addEventListener ) {
|
||||
bind = function( obj, type, fn ) {
|
||||
obj.addEventListener( type, fn, false );
|
||||
};
|
||||
} else if ( docElem.attachEvent ) {
|
||||
bind = function( obj, type, fn ) {
|
||||
obj[ type + fn ] = fn.handleEvent ?
|
||||
function() {
|
||||
var event = window.event;
|
||||
// add event.target
|
||||
event.target = event.target || event.srcElement;
|
||||
fn.handleEvent.call( fn, event );
|
||||
} :
|
||||
function() {
|
||||
var event = window.event;
|
||||
// add event.target
|
||||
event.target = event.target || event.srcElement;
|
||||
fn.call( obj, event );
|
||||
};
|
||||
obj.attachEvent( "on" + type, obj[ type + fn ] );
|
||||
};
|
||||
}
|
||||
|
||||
var unbind = function() {};
|
||||
|
||||
if ( docElem.removeEventListener ) {
|
||||
unbind = function( obj, type, fn ) {
|
||||
obj.removeEventListener( type, fn, false );
|
||||
};
|
||||
} 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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var eventie = {
|
||||
bind: bind,
|
||||
unbind: unbind
|
||||
};
|
||||
|
||||
// transport
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( eventie );
|
||||
} else {
|
||||
// browser global
|
||||
window.eventie = eventie;
|
||||
}
|
||||
|
||||
})( this );
|
||||
|
||||
/*!
|
||||
* imagesLoaded v3.0.4
|
||||
* JavaScript is all like "You images are done yet or what?"
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
( function( window ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
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 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 );
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
function defineImagesLoaded( EventEmitter, eventie ) {
|
||||
|
||||
/**
|
||||
* @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();
|
||||
});
|
||||
}
|
||||
|
||||
ImagesLoaded.prototype = new EventEmitter();
|
||||
|
||||
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
|
||||
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 );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Image} img
|
||||
*/
|
||||
ImagesLoaded.prototype.addImage = function( img ) {
|
||||
var loadingImage = new LoadingImage( img );
|
||||
this.images.push( loadingImage );
|
||||
};
|
||||
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
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, image );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
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 );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// -------------------------- jquery -------------------------- //
|
||||
|
||||
if ( $ ) {
|
||||
$.fn.imagesLoaded = function( options, callback ) {
|
||||
var instance = new ImagesLoaded( this, options, callback );
|
||||
return instance.jqDeferred.promise( $(this) );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
var cache = {};
|
||||
|
||||
function LoadingImage( img ) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
LoadingImage.prototype = new EventEmitter();
|
||||
|
||||
LoadingImage.prototype.check = function() {
|
||||
// first check cached any previous images that have same src
|
||||
var cached = cache[ this.img.src ];
|
||||
if ( cached ) {
|
||||
this.useCached( cached );
|
||||
return;
|
||||
}
|
||||
// add this to cache
|
||||
cache[ this.img.src ] = this;
|
||||
|
||||
// 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 proxyImage = this.proxyImage = new Image();
|
||||
eventie.bind( proxyImage, 'load', this );
|
||||
eventie.bind( proxyImage, 'error', this );
|
||||
proxyImage.src = this.img.src;
|
||||
};
|
||||
|
||||
LoadingImage.prototype.useCached = function( cached ) {
|
||||
if ( cached.isConfirmed ) {
|
||||
this.confirm( cached.isLoaded, 'cached was confirmed' );
|
||||
} else {
|
||||
var _this = this;
|
||||
cached.on( 'confirm', function( image ) {
|
||||
_this.confirm( image.isLoaded, 'cache emitted confirmed' );
|
||||
return true; // bind once
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
LoadingImage.prototype.confirm = function( isLoaded, message ) {
|
||||
this.isConfirmed = true;
|
||||
this.isLoaded = isLoaded;
|
||||
this.emit( 'confirm', this, message );
|
||||
};
|
||||
|
||||
// trigger specified handler for event type
|
||||
LoadingImage.prototype.handleEvent = function( event ) {
|
||||
var method = 'on' + event.type;
|
||||
if ( this[ method ] ) {
|
||||
this[ method ]( event );
|
||||
}
|
||||
};
|
||||
|
||||
LoadingImage.prototype.onload = function() {
|
||||
this.confirm( true, 'onload' );
|
||||
this.unbindProxyEvents();
|
||||
};
|
||||
|
||||
LoadingImage.prototype.onerror = function() {
|
||||
this.confirm( false, 'onerror' );
|
||||
this.unbindProxyEvents();
|
||||
};
|
||||
|
||||
LoadingImage.prototype.unbindProxyEvents = function() {
|
||||
eventie.unbind( this.proxyImage, 'load', this );
|
||||
eventie.unbind( this.proxyImage, 'error', this );
|
||||
};
|
||||
|
||||
// ----- ----- //
|
||||
|
||||
return ImagesLoaded;
|
||||
}
|
||||
|
||||
// -------------------------- transport -------------------------- //
|
||||
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( [
|
||||
'eventEmitter/EventEmitter',
|
||||
'eventie/eventie'
|
||||
],
|
||||
defineImagesLoaded );
|
||||
} else {
|
||||
// browser global
|
||||
window.imagesLoaded = defineImagesLoaded(
|
||||
window.EventEmitter,
|
||||
window.eventie
|
||||
);
|
||||
}
|
||||
|
||||
})( window );
|
539
js_src/libs/jquery-tourbus.js
vendored
Normal file
539
js_src/libs/jquery-tourbus.js
vendored
Normal file
@ -0,0 +1,539 @@
|
||||
(function() {
|
||||
var __slice = [].slice;
|
||||
|
||||
(function($) {
|
||||
var Bus, Leg, methods, tourbus, uniqueId, _addRule, _assemble, _busses, _dataProp, _include, _tours;
|
||||
tourbus = $.tourbus = function() {
|
||||
var args, method;
|
||||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
method = args[0];
|
||||
if (methods.hasOwnProperty(method)) {
|
||||
args = args.slice(1);
|
||||
} else if (method instanceof $) {
|
||||
method = 'build';
|
||||
} else if (typeof method === 'string') {
|
||||
method = 'build';
|
||||
args[0] = $(args[0]);
|
||||
} else {
|
||||
$.error("Unknown method of $.tourbus --", args);
|
||||
}
|
||||
return methods[method].apply(this, args);
|
||||
};
|
||||
$.fn.tourbus = function() {
|
||||
var args;
|
||||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
return this.each(function() {
|
||||
args.unshift($(this));
|
||||
tourbus.apply(null, ['build'].concat(__slice.call(args)));
|
||||
return this;
|
||||
});
|
||||
};
|
||||
methods = {
|
||||
build: function(el, options) {
|
||||
var built;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
options = $.extend(true, {}, tourbus.defaults, options);
|
||||
built = [];
|
||||
if (!(el instanceof $)) {
|
||||
el = $(el);
|
||||
}
|
||||
el.each(function() {
|
||||
return built.push(_assemble(this, options));
|
||||
});
|
||||
if (built.length === 0) {
|
||||
$.error("" + el.selector + " was not found!");
|
||||
}
|
||||
if (built.length === 1) {
|
||||
return built[0];
|
||||
}
|
||||
return built;
|
||||
},
|
||||
destroyAll: function() {
|
||||
var bus, index, _results;
|
||||
_results = [];
|
||||
for (index in _busses) {
|
||||
bus = _busses[index];
|
||||
_results.push(bus.destroy());
|
||||
}
|
||||
return _results;
|
||||
},
|
||||
expose: function(global) {
|
||||
return global.tourbus = {
|
||||
Bus: Bus,
|
||||
Leg: Leg
|
||||
};
|
||||
}
|
||||
};
|
||||
tourbus.defaults = {
|
||||
debug: false,
|
||||
autoDepart: false,
|
||||
target: 'body',
|
||||
startAt: 0,
|
||||
onDepart: function() {
|
||||
return null;
|
||||
},
|
||||
onStop: function() {
|
||||
return null;
|
||||
},
|
||||
onLegStart: function() {
|
||||
return null;
|
||||
},
|
||||
onLegEnd: function() {
|
||||
return null;
|
||||
},
|
||||
leg: {
|
||||
scrollTo: null,
|
||||
scrollSpeed: 150,
|
||||
scrollContext: 100,
|
||||
orientation: 'bottom',
|
||||
align: 'left',
|
||||
width: 'auto',
|
||||
margin: 10,
|
||||
top: null,
|
||||
left: null,
|
||||
arrow: "35%"
|
||||
}
|
||||
};
|
||||
/* Internal
|
||||
*/
|
||||
|
||||
Bus = (function() {
|
||||
|
||||
function Bus(el, options) {
|
||||
this.id = uniqueId();
|
||||
this.$target = $(options.target);
|
||||
this.$el = $(el);
|
||||
this.$el.data({
|
||||
tourbus: this
|
||||
});
|
||||
this.options = options;
|
||||
this.currentLegIndex = null;
|
||||
this.legs = null;
|
||||
this.legEls = this.$el.children('li');
|
||||
this.totalLegs = this.legEls.length;
|
||||
this._setupEvents();
|
||||
if (this.options.autoDepart) {
|
||||
this.$el.trigger('depart.tourbus');
|
||||
}
|
||||
this._log('built tourbus with el', el.toString(), 'and options', this.options);
|
||||
}
|
||||
|
||||
Bus.prototype.depart = function() {
|
||||
this.running = true;
|
||||
this.options.onDepart(this);
|
||||
this._log('departing', this);
|
||||
this.legs = this._buildLegs();
|
||||
this.currentLegIndex = this.options.startAt;
|
||||
return this.showLeg();
|
||||
};
|
||||
|
||||
Bus.prototype.stop = function() {
|
||||
if (!this.running) {
|
||||
return;
|
||||
}
|
||||
if (this.legs) {
|
||||
$.each(this.legs, $.proxy(this.hideLeg, this));
|
||||
}
|
||||
this.currentLegIndex = this.options.startAt;
|
||||
this.options.onStop(this);
|
||||
return this.running = false;
|
||||
};
|
||||
|
||||
Bus.prototype.on = function(event, selector, fn) {
|
||||
return this.$target.on(event, selector, fn);
|
||||
};
|
||||
|
||||
Bus.prototype.currentLeg = function() {
|
||||
if (this.currentLegIndex === null) {
|
||||
return null;
|
||||
}
|
||||
return this.legs[this.currentLegIndex];
|
||||
};
|
||||
|
||||
Bus.prototype.showLeg = function(index) {
|
||||
var leg, preventDefault;
|
||||
if (index == null) {
|
||||
index = this.currentLegIndex;
|
||||
}
|
||||
leg = this.legs[index];
|
||||
this._log('showLeg:', leg);
|
||||
preventDefault = this.options.onLegStart(leg, this);
|
||||
if (preventDefault !== false) {
|
||||
return leg.show();
|
||||
}
|
||||
};
|
||||
|
||||
Bus.prototype.hideLeg = function(index) {
|
||||
var leg, preventDefault;
|
||||
if (index == null) {
|
||||
index = this.currentLegIndex;
|
||||
}
|
||||
leg = this.legs[index];
|
||||
this._log('hideLeg:', leg);
|
||||
preventDefault = this.options.onLegEnd(leg, this);
|
||||
if (preventDefault !== false) {
|
||||
return leg.hide();
|
||||
}
|
||||
};
|
||||
|
||||
Bus.prototype.repositionLegs = function() {
|
||||
if (this.legs) {
|
||||
return $.each(this.legs, function() {
|
||||
return this.reposition();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Bus.prototype.next = function() {
|
||||
this.hideLeg();
|
||||
this.currentLegIndex++;
|
||||
if (this.currentLegIndex > this.totalLegs - 1) {
|
||||
return this.stop();
|
||||
}
|
||||
return this.showLeg();
|
||||
};
|
||||
|
||||
Bus.prototype.prev = function(cb) {
|
||||
this.hideLeg();
|
||||
this.currentLegIndex--;
|
||||
if (this.currentLegIndex < 0) {
|
||||
return this.stop();
|
||||
}
|
||||
return this.showLeg();
|
||||
};
|
||||
|
||||
Bus.prototype.destroy = function() {
|
||||
if (this.legs) {
|
||||
$.each(this.legs, function() {
|
||||
return this.destroy();
|
||||
});
|
||||
}
|
||||
this.legs = null;
|
||||
delete _busses[this.id];
|
||||
return this._teardownEvents();
|
||||
};
|
||||
|
||||
Bus.prototype._buildLegs = function() {
|
||||
var _this = this;
|
||||
if (this.legs) {
|
||||
$.each(this.legs, function(_, leg) {
|
||||
return leg.destroy();
|
||||
});
|
||||
}
|
||||
return $.map(this.legEls, function(legEl, i) {
|
||||
var $legEl, data, leg;
|
||||
$legEl = $(legEl);
|
||||
data = $legEl.data();
|
||||
leg = new Leg({
|
||||
content: $legEl.html(),
|
||||
target: data.el || 'body',
|
||||
bus: _this,
|
||||
index: i,
|
||||
rawData: data
|
||||
});
|
||||
leg.render();
|
||||
_this.$target.append(leg.$el);
|
||||
leg._position();
|
||||
leg.hide();
|
||||
return leg;
|
||||
});
|
||||
};
|
||||
|
||||
Bus.prototype._log = function() {
|
||||
if (!this.options.debug) {
|
||||
return;
|
||||
}
|
||||
return console.log.apply(console, ["TOURBUS " + this.id + ":"].concat(__slice.call(arguments)));
|
||||
};
|
||||
|
||||
Bus.prototype._setupEvents = function() {
|
||||
this.$el.on('depart.tourbus', $.proxy(this.depart, this));
|
||||
this.$el.on('stop.tourbus', $.proxy(this.stop, this));
|
||||
this.$el.on('next.tourbus', $.proxy(this.next, this));
|
||||
return this.$el.on('prev.tourbus', $.proxy(this.prev, this));
|
||||
};
|
||||
|
||||
Bus.prototype._teardownEvents = function() {
|
||||
return this.$el.off('.tourbus');
|
||||
};
|
||||
|
||||
return Bus;
|
||||
|
||||
})();
|
||||
Leg = (function() {
|
||||
|
||||
function Leg(options) {
|
||||
this.bus = options.bus;
|
||||
this.rawData = options.rawData;
|
||||
this.content = options.content;
|
||||
this.index = options.index;
|
||||
this.options = options;
|
||||
this.$target = $(options.target);
|
||||
if (this.$target.length === 0) {
|
||||
throw "" + this.$target.selector + " is not an element!";
|
||||
}
|
||||
this._setupOptions();
|
||||
this._configureElement();
|
||||
this._configureTarget();
|
||||
this._configureScroll();
|
||||
this._setupEvents();
|
||||
this.bus._log("leg " + this.index + " made with options", this.options);
|
||||
}
|
||||
|
||||
Leg.prototype.render = function() {
|
||||
var arrowClass, html;
|
||||
arrowClass = this.options.orientation === 'centered' ? '' : 'tourbus-arrow';
|
||||
this.$el.addClass(" " + arrowClass + " tourbus-arrow-" + this.options.orientation + " ");
|
||||
html = "<div class='tourbus-leg-inner'>\n " + this.content + "\n</div>";
|
||||
this.$el.css({
|
||||
width: this.options.width
|
||||
}).html(html);
|
||||
return this;
|
||||
};
|
||||
|
||||
Leg.prototype.destroy = function() {
|
||||
this.$el.remove();
|
||||
return this._teardownEvents();
|
||||
};
|
||||
|
||||
Leg.prototype.reposition = function() {
|
||||
this._configureTarget();
|
||||
return this._position();
|
||||
};
|
||||
|
||||
Leg.prototype._position = function() {
|
||||
var css, keys, rule, selector;
|
||||
if (this.options.orientation !== 'centered') {
|
||||
rule = {};
|
||||
keys = {
|
||||
top: 'left',
|
||||
bottom: 'left',
|
||||
left: 'top',
|
||||
right: 'top'
|
||||
};
|
||||
if (typeof this.options.arrow === 'number') {
|
||||
this.options.arrow += 'px';
|
||||
}
|
||||
rule[keys[this.options.orientation]] = this.options.arrow;
|
||||
selector = "#" + this.id + ".tourbus-arrow";
|
||||
this.bus._log("adding rule for " + this.id, rule);
|
||||
_addRule("" + selector + ":before, " + selector + ":after", rule);
|
||||
}
|
||||
css = this._offsets();
|
||||
this.bus._log('setting offsets on leg', css);
|
||||
return this.$el.css(css);
|
||||
};
|
||||
|
||||
Leg.prototype.show = function() {
|
||||
this.$el.css({
|
||||
visibility: 'visible',
|
||||
opacity: 1.0,
|
||||
zIndex: 9999
|
||||
});
|
||||
return this.scrollIntoView();
|
||||
};
|
||||
|
||||
Leg.prototype.hide = function() {
|
||||
if (this.bus.options.debug) {
|
||||
return this.$el.css({
|
||||
visibility: 'visible',
|
||||
opacity: 0.4,
|
||||
zIndex: 0
|
||||
});
|
||||
} else {
|
||||
return this.$el.css({
|
||||
visibility: 'hidden'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Leg.prototype.scrollIntoView = function() {
|
||||
var scrollTarget;
|
||||
if (!this.willScroll) {
|
||||
return;
|
||||
}
|
||||
scrollTarget = _dataProp(this.options.scrollTo, this.$el);
|
||||
this.bus._log('scrolling to', scrollTarget, this.scrollSettings);
|
||||
return $.scrollTo(scrollTarget, this.scrollSettings);
|
||||
};
|
||||
|
||||
Leg.prototype._setupOptions = function() {
|
||||
var globalOptions;
|
||||
globalOptions = this.bus.options.leg;
|
||||
this.options.top = _dataProp(this.rawData.top, globalOptions.top);
|
||||
this.options.left = _dataProp(this.rawData.left, globalOptions.left);
|
||||
this.options.scrollTo = _dataProp(this.rawData.scrollTo, globalOptions.scrollTo);
|
||||
this.options.scrollSpeed = _dataProp(this.rawData.scrollSpeed, globalOptions.scrollSpeed);
|
||||
this.options.scrollContext = _dataProp(this.rawData.scrollContext, globalOptions.scrollContext);
|
||||
this.options.margin = _dataProp(this.rawData.margin, globalOptions.margin);
|
||||
this.options.arrow = this.rawData.arrow || globalOptions.arrow;
|
||||
this.options.align = this.rawData.align || globalOptions.align;
|
||||
this.options.width = this.rawData.width || globalOptions.width;
|
||||
return this.options.orientation = this.rawData.orientation || globalOptions.orientation;
|
||||
};
|
||||
|
||||
Leg.prototype._configureElement = function() {
|
||||
this.id = "tourbus-leg-id-" + this.bus.id + "-" + this.options.index;
|
||||
this.$el = $("<div class='tourbus-leg'></div>");
|
||||
this.el = this.$el[0];
|
||||
this.$el.attr({
|
||||
id: this.id
|
||||
});
|
||||
return this.$el.css({
|
||||
zIndex: 9999
|
||||
});
|
||||
};
|
||||
|
||||
Leg.prototype._setupEvents = function() {
|
||||
this.$el.on('click', '.tourbus-next', $.proxy(this.bus.next, this.bus));
|
||||
this.$el.on('click', '.tourbus-prev', $.proxy(this.bus.prev, this.bus));
|
||||
return this.$el.on('click', '.tourbus-stop', $.proxy(this.bus.stop, this.bus));
|
||||
};
|
||||
|
||||
Leg.prototype._teardownEvents = function() {
|
||||
return this.$el.off('click');
|
||||
};
|
||||
|
||||
Leg.prototype._configureTarget = function() {
|
||||
this.targetOffset = this.$target.offset();
|
||||
if (_dataProp(this.options.top, false)) {
|
||||
this.targetOffset.top = this.options.top;
|
||||
}
|
||||
if (_dataProp(this.options.left, false)) {
|
||||
this.targetOffset.left = this.options.left;
|
||||
}
|
||||
this.targetWidth = this.$target.outerWidth();
|
||||
return this.targetHeight = this.$target.outerHeight();
|
||||
};
|
||||
|
||||
Leg.prototype._configureScroll = function() {
|
||||
this.willScroll = $.fn.scrollTo && this.options.scrollTo !== false;
|
||||
return this.scrollSettings = {
|
||||
offset: -this.options.scrollContext,
|
||||
easing: 'linear',
|
||||
axis: 'y',
|
||||
duration: this.options.scrollSpeed
|
||||
};
|
||||
};
|
||||
|
||||
Leg.prototype._offsets = function() {
|
||||
var dimension, elHalf, elHeight, elWidth, offsets, targetHalf, targetHeightOverride, validOrientations;
|
||||
elHeight = this.$el.height();
|
||||
elWidth = this.$el.width();
|
||||
offsets = {};
|
||||
switch (this.options.orientation) {
|
||||
case 'centered':
|
||||
targetHeightOverride = $(window).height();
|
||||
offsets.top = this.options.top;
|
||||
if (!_dataProp(offsets.top, false)) {
|
||||
offsets.top = (targetHeightOverride / 2) - (elHeight / 2);
|
||||
}
|
||||
offsets.left = (this.targetWidth / 2) - (elWidth / 2);
|
||||
break;
|
||||
case 'left':
|
||||
offsets.top = this.targetOffset.top;
|
||||
offsets.left = this.targetOffset.left - elWidth - this.options.margin;
|
||||
break;
|
||||
case 'right':
|
||||
offsets.top = this.targetOffset.top;
|
||||
offsets.left = this.targetOffset.left + this.targetWidth + this.options.margin;
|
||||
break;
|
||||
case 'top':
|
||||
offsets.top = this.targetOffset.top - elHeight - this.options.margin;
|
||||
offsets.left = this.targetOffset.left;
|
||||
break;
|
||||
case 'bottom':
|
||||
offsets.top = this.targetOffset.top + this.targetHeight + this.options.margin;
|
||||
offsets.left = this.targetOffset.left;
|
||||
}
|
||||
validOrientations = {
|
||||
top: ['left', 'right'],
|
||||
bottom: ['left', 'right'],
|
||||
left: ['top', 'bottom'],
|
||||
right: ['top', 'bottom']
|
||||
};
|
||||
if (_include(this.options.orientation, validOrientations[this.options.align])) {
|
||||
switch (this.options.align) {
|
||||
case 'right':
|
||||
offsets.left += this.targetWidth - elWidth;
|
||||
break;
|
||||
case 'bottom':
|
||||
offsets.top += this.targetHeight - elHeight;
|
||||
}
|
||||
} else if (this.options.align === 'center') {
|
||||
if (_include(this.options.orientation, validOrientations.left)) {
|
||||
targetHalf = this.targetWidth / 2;
|
||||
elHalf = elWidth / 2;
|
||||
dimension = 'left';
|
||||
} else {
|
||||
targetHalf = this.targetHeight / 2;
|
||||
elHalf = elHeight / 2;
|
||||
dimension = 'top';
|
||||
}
|
||||
if (targetHalf > elHalf) {
|
||||
offsets[dimension] += targetHalf - elHalf;
|
||||
} else {
|
||||
offsets[dimension] -= elHalf - targetHalf;
|
||||
}
|
||||
}
|
||||
return offsets;
|
||||
};
|
||||
|
||||
return Leg;
|
||||
|
||||
})();
|
||||
_tours = 0;
|
||||
uniqueId = function() {
|
||||
return _tours++;
|
||||
};
|
||||
_busses = {};
|
||||
_assemble = function() {
|
||||
var bus;
|
||||
bus = (function(func, args, ctor) {
|
||||
ctor.prototype = func.prototype;
|
||||
var child = new ctor, result = func.apply(child, args);
|
||||
return Object(result) === result ? result : child;
|
||||
})(Bus, arguments, function(){});
|
||||
_busses[bus.id] = bus;
|
||||
return bus;
|
||||
};
|
||||
_dataProp = function(possiblyFalsy, alternative) {
|
||||
if (possiblyFalsy === null || typeof possiblyFalsy === 'undefined') {
|
||||
return alternative;
|
||||
}
|
||||
return possiblyFalsy;
|
||||
};
|
||||
_include = function(value, array) {
|
||||
return $.inArray(value, array || []) !== -1;
|
||||
};
|
||||
return _addRule = (function(styleTag) {
|
||||
var sheet;
|
||||
styleTag.type = 'text/css';
|
||||
document.getElementsByTagName('head')[0].appendChild(styleTag);
|
||||
sheet = document.styleSheets[document.styleSheets.length - 1];
|
||||
return function(selector, css) {
|
||||
var key, propText;
|
||||
propText = $.map((function() {
|
||||
var _results;
|
||||
_results = [];
|
||||
for (key in css) {
|
||||
_results.push(key);
|
||||
}
|
||||
return _results;
|
||||
})(), function(p) {
|
||||
return "" + p + ":" + css[p];
|
||||
}).join(';');
|
||||
try {
|
||||
if (sheet.insertRule) {
|
||||
sheet.insertRule("" + selector + " { " + propText + " }", (sheet.cssRules || sheet.rules).length);
|
||||
} else {
|
||||
sheet.addRule(selector, propText);
|
||||
}
|
||||
} catch (_error) {}
|
||||
};
|
||||
})(document.createElement('style'));
|
||||
})(jQuery);
|
||||
|
||||
}).call(this);
|
94
www/helpcontent.html
Normal file
94
www/helpcontent.html
Normal file
@ -0,0 +1,94 @@
|
||||
<div class="my-tour-overlay"></div>
|
||||
|
||||
<ol class='tourbus-legs' id='tour1'>
|
||||
|
||||
<!-- FIRST WELCOME -->
|
||||
<li data-orientation='centered' data-highlight='true'>
|
||||
<h2>Welcome to Doodle3D</h2>
|
||||
<p>This is your first time starting the app. How about we show you around a bit?</p>
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Yes</a>
|
||||
<a href='javascript:void(0);' class='prevnextBtn endIntroTour'>No</a>
|
||||
</li>
|
||||
|
||||
<!-- LEFT PANEL -->
|
||||
<li data-el='.leftpanel' data-orientation='right' data-width='300' data-highlight='true'>
|
||||
<h2>Leftpanel</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.new' data-orientation='right' data-width='300'>
|
||||
<h2>New</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.prevnext' data-orientation='right' data-width='300'>
|
||||
<h2>PrevNext</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.save' data-orientation='right' data-width='300'>
|
||||
<h2>Save</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.oops' data-orientation='right' data-width='300'>
|
||||
<h2>Oops</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
|
||||
<!-- RIGHT PANEL -->
|
||||
<li data-el='.rightpanel' data-orientation='left' data-width='300' data-highlight='true'>
|
||||
<h2>Leftpanel</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.print' data-orientation='left' data-width='300'>
|
||||
<h2>print</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.stop' data-orientation='left' data-width='300'>
|
||||
<h2>stop</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.progress' data-orientation='left' data-width='300'>
|
||||
<h2>progress</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.thermo' data-orientation='left' data-width='300'>
|
||||
<h2>thermo</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-next'>Next...</a>
|
||||
</li>
|
||||
<li data-el='.info' data-orientation='left' data-width='300'>
|
||||
<h2>info</h2>
|
||||
<p>Random text which makes it all seem like there's something to say...</p>
|
||||
<!--<a href='javascript:void(0);' class='prevnextBtn tourbus-prev'>Previous...</a>-->
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-stop'>Got it...</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ol>
|
||||
<ol class='tourbus-legs' id='tour2'>
|
||||
|
||||
<li data-el='.info' data-orientation='left' data-width='200'>
|
||||
<h2>INFO</h2>
|
||||
<p>check out the info here anytime..</p>
|
||||
<a href='javascript:void(0);' class='prevnextBtn tourbus-stop'>Got it</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ol>
|
7
www/js/libs/imagesloaded.pkgd.min.js
vendored
Normal file
7
www/js/libs/imagesloaded.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
www/js/libs/jquery-tourbus.min.js
vendored
Normal file
1
www/js/libs/jquery-tourbus.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
72
www/js/libs/jquery.cookie.js
Executable file
72
www/js/libs/jquery.cookie.js
Executable file
@ -0,0 +1,72 @@
|
||||
/*jshint eqnull:true */
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.2
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2011, Klaus Hartl
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.opensource.org/licenses/GPL-2.0
|
||||
*/
|
||||
(function ($, document, undefined) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function raw(s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
function decoded(s) {
|
||||
return decodeURIComponent(s.replace(pluses, ' '));
|
||||
}
|
||||
|
||||
$.cookie = function (key, value, options) {
|
||||
|
||||
// key and at least value given, set cookie...
|
||||
if (value !== undefined && !/Object/.test(Object.prototype.toString.call(value))) {
|
||||
options = $.extend({}, $.cookie.defaults, options);
|
||||
|
||||
if (value === null) {
|
||||
options.expires = -1;
|
||||
}
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setDate(t.getDate() + days);
|
||||
}
|
||||
|
||||
value = String(value);
|
||||
|
||||
return (document.cookie = [
|
||||
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// key and possibly options given, get cookie...
|
||||
options = value || $.cookie.defaults || {};
|
||||
var decode = options.raw ? raw : decoded;
|
||||
var cookies = document.cookie.split('; ');
|
||||
for (var i = 0, parts; (parts = cookies[i] && cookies[i].split('=')); i++) {
|
||||
if (decode(parts.shift()) === key) {
|
||||
return decode(parts.join('='));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
$.cookie.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key, options) !== null) {
|
||||
$.cookie(key, null, options);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
Loading…
Reference in New Issue
Block a user