Version Description
- Few Security Issues Fixed.
- Isotope 2.2.2 Version used.
Download this release
Release Info
Developer | contact-banker |
Plugin | Gallery Bank: WordPress Photo Gallery Plugin |
Version | 3.0.330 |
Comparing to | |
See all releases |
Code changes from version 3.0.229 to 3.0.330
- assets/js/isotope.pkgd.js +12 -3843
- gallery-bank.php +1 -1
- lib/add-new-album-class.php +2 -2
- readme.txt +11 -6
- views/edit-album.php +5 -6
assets/js/isotope.pkgd.js
CHANGED
@@ -1,3843 +1,12 @@
|
|
1 |
-
/*!
|
2 |
-
* Isotope PACKAGED v2.
|
3 |
-
*
|
4 |
-
*
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
*/
|
12 |
-
|
13 |
-
( function( window ) {
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
// -------------------------- utils -------------------------- //
|
18 |
-
|
19 |
-
var slice = Array.prototype.slice;
|
20 |
-
|
21 |
-
function noop() {}
|
22 |
-
|
23 |
-
// -------------------------- definition -------------------------- //
|
24 |
-
|
25 |
-
function defineBridget( $ ) {
|
26 |
-
|
27 |
-
// bail if no jQuery
|
28 |
-
if ( !$ ) {
|
29 |
-
return;
|
30 |
-
}
|
31 |
-
|
32 |
-
// -------------------------- addOptionMethod -------------------------- //
|
33 |
-
|
34 |
-
/**
|
35 |
-
* adds option method -> $().plugin('option', {...})
|
36 |
-
* @param {Function} PluginClass - constructor class
|
37 |
-
*/
|
38 |
-
function addOptionMethod( PluginClass ) {
|
39 |
-
// don't overwrite original option method
|
40 |
-
if ( PluginClass.prototype.option ) {
|
41 |
-
return;
|
42 |
-
}
|
43 |
-
|
44 |
-
// option setter
|
45 |
-
PluginClass.prototype.option = function( opts ) {
|
46 |
-
// bail out if not an object
|
47 |
-
if ( !$.isPlainObject( opts ) ){
|
48 |
-
return;
|
49 |
-
}
|
50 |
-
this.options = $.extend( true, this.options, opts );
|
51 |
-
};
|
52 |
-
}
|
53 |
-
|
54 |
-
|
55 |
-
// -------------------------- plugin bridge -------------------------- //
|
56 |
-
|
57 |
-
// helper function for logging errors
|
58 |
-
// $.error breaks jQuery chaining
|
59 |
-
var logError = typeof console === 'undefined' ? noop :
|
60 |
-
function( message ) {
|
61 |
-
console.error( message );
|
62 |
-
};
|
63 |
-
|
64 |
-
/**
|
65 |
-
* jQuery plugin bridge, access methods like $elem.plugin('method')
|
66 |
-
* @param {String} namespace - plugin name
|
67 |
-
* @param {Function} PluginClass - constructor class
|
68 |
-
*/
|
69 |
-
function bridge( namespace, PluginClass ) {
|
70 |
-
// add to jQuery fn namespace
|
71 |
-
$.fn[ namespace ] = function( options ) {
|
72 |
-
if ( typeof options === 'string' ) {
|
73 |
-
// call plugin method when first argument is a string
|
74 |
-
// get arguments for method
|
75 |
-
var args = slice.call( arguments, 1 );
|
76 |
-
|
77 |
-
for ( var i=0, len = this.length; i < len; i++ ) {
|
78 |
-
var elem = this[i];
|
79 |
-
var instance = $.data( elem, namespace );
|
80 |
-
if ( !instance ) {
|
81 |
-
logError( "cannot call methods on " + namespace + " prior to initialization; " +
|
82 |
-
"attempted to call '" + options + "'" );
|
83 |
-
continue;
|
84 |
-
}
|
85 |
-
if ( !$.isFunction( instance[options] ) || options.charAt(0) === '_' ) {
|
86 |
-
logError( "no such method '" + options + "' for " + namespace + " instance" );
|
87 |
-
continue;
|
88 |
-
}
|
89 |
-
|
90 |
-
// trigger method with arguments
|
91 |
-
var returnValue = instance[ options ].apply( instance, args );
|
92 |
-
|
93 |
-
// break look and return first value if provided
|
94 |
-
if ( returnValue !== undefined ) {
|
95 |
-
return returnValue;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
// return this if no return value
|
99 |
-
return this;
|
100 |
-
} else {
|
101 |
-
return this.each( function() {
|
102 |
-
var instance = $.data( this, namespace );
|
103 |
-
if ( instance ) {
|
104 |
-
// apply options & init
|
105 |
-
instance.option( options );
|
106 |
-
instance._init();
|
107 |
-
} else {
|
108 |
-
// initialize new instance
|
109 |
-
instance = new PluginClass( this, options );
|
110 |
-
$.data( this, namespace, instance );
|
111 |
-
}
|
112 |
-
});
|
113 |
-
}
|
114 |
-
};
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
// -------------------------- bridget -------------------------- //
|
119 |
-
|
120 |
-
/**
|
121 |
-
* converts a Prototypical class into a proper jQuery plugin
|
122 |
-
* the class must have a ._init method
|
123 |
-
* @param {String} namespace - plugin name, used in $().pluginName
|
124 |
-
* @param {Function} PluginClass - constructor class
|
125 |
-
*/
|
126 |
-
$.bridget = function( namespace, PluginClass ) {
|
127 |
-
addOptionMethod( PluginClass );
|
128 |
-
bridge( namespace, PluginClass );
|
129 |
-
};
|
130 |
-
|
131 |
-
}
|
132 |
-
|
133 |
-
// transport
|
134 |
-
if ( typeof define === 'function' && define.amd ) {
|
135 |
-
// AMD
|
136 |
-
define( 'jquery-bridget/jquery.bridget',[ 'jquery' ], defineBridget );
|
137 |
-
} else {
|
138 |
-
// get jquery from browser global
|
139 |
-
defineBridget( window.jQuery );
|
140 |
-
}
|
141 |
-
|
142 |
-
})( window );
|
143 |
-
|
144 |
-
/*!
|
145 |
-
* eventie v1.0.3
|
146 |
-
* event binding helper
|
147 |
-
* eventie.bind( elem, 'click', myFn )
|
148 |
-
* eventie.unbind( elem, 'click', myFn )
|
149 |
-
*/
|
150 |
-
|
151 |
-
/*jshint browser: true, undef: true, unused: true */
|
152 |
-
/*global define: false */
|
153 |
-
|
154 |
-
( function( window ) {
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
var docElem = document.documentElement;
|
159 |
-
|
160 |
-
var bind = function() {};
|
161 |
-
|
162 |
-
if ( docElem.addEventListener ) {
|
163 |
-
bind = function( obj, type, fn ) {
|
164 |
-
obj.addEventListener( type, fn, false );
|
165 |
-
};
|
166 |
-
} else if ( docElem.attachEvent ) {
|
167 |
-
bind = function( obj, type, fn ) {
|
168 |
-
obj[ type + fn ] = fn.handleEvent ?
|
169 |
-
function() {
|
170 |
-
var event = window.event;
|
171 |
-
// add event.target
|
172 |
-
event.target = event.target || event.srcElement;
|
173 |
-
fn.handleEvent.call( fn, event );
|
174 |
-
} :
|
175 |
-
function() {
|
176 |
-
var event = window.event;
|
177 |
-
// add event.target
|
178 |
-
event.target = event.target || event.srcElement;
|
179 |
-
fn.call( obj, event );
|
180 |
-
};
|
181 |
-
obj.attachEvent( "on" + type, obj[ type + fn ] );
|
182 |
-
};
|
183 |
-
}
|
184 |
-
|
185 |
-
var unbind = function() {};
|
186 |
-
|
187 |
-
if ( docElem.removeEventListener ) {
|
188 |
-
unbind = function( obj, type, fn ) {
|
189 |
-
obj.removeEventListener( type, fn, false );
|
190 |
-
};
|
191 |
-
} else if ( docElem.detachEvent ) {
|
192 |
-
unbind = function( obj, type, fn ) {
|
193 |
-
obj.detachEvent( "on" + type, obj[ type + fn ] );
|
194 |
-
try {
|
195 |
-
delete obj[ type + fn ];
|
196 |
-
} catch ( err ) {
|
197 |
-
// can't delete window object properties
|
198 |
-
obj[ type + fn ] = undefined;
|
199 |
-
}
|
200 |
-
};
|
201 |
-
}
|
202 |
-
|
203 |
-
var eventie = {
|
204 |
-
bind: bind,
|
205 |
-
unbind: unbind
|
206 |
-
};
|
207 |
-
|
208 |
-
// transport
|
209 |
-
if ( typeof define === 'function' && define.amd ) {
|
210 |
-
// AMD
|
211 |
-
define( 'eventie/eventie',eventie );
|
212 |
-
} else {
|
213 |
-
// browser global
|
214 |
-
window.eventie = eventie;
|
215 |
-
}
|
216 |
-
|
217 |
-
})( this );
|
218 |
-
|
219 |
-
/*!
|
220 |
-
* docReady
|
221 |
-
* Cross browser DOMContentLoaded event emitter
|
222 |
-
*/
|
223 |
-
|
224 |
-
/*jshint browser: true, strict: true, undef: true, unused: true*/
|
225 |
-
/*global define: false */
|
226 |
-
|
227 |
-
( function( window ) {
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
var document = window.document;
|
232 |
-
// collection of functions to be triggered on ready
|
233 |
-
var queue = [];
|
234 |
-
|
235 |
-
function docReady( fn ) {
|
236 |
-
// throw out non-functions
|
237 |
-
if ( typeof fn !== 'function' ) {
|
238 |
-
return;
|
239 |
-
}
|
240 |
-
|
241 |
-
if ( docReady.isReady ) {
|
242 |
-
// ready now, hit it
|
243 |
-
fn();
|
244 |
-
} else {
|
245 |
-
// queue function when ready
|
246 |
-
queue.push( fn );
|
247 |
-
}
|
248 |
-
}
|
249 |
-
|
250 |
-
docReady.isReady = false;
|
251 |
-
|
252 |
-
// triggered on various doc ready events
|
253 |
-
function init( event ) {
|
254 |
-
// bail if IE8 document is not ready just yet
|
255 |
-
var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete';
|
256 |
-
if ( docReady.isReady || isIE8NotReady ) {
|
257 |
-
return;
|
258 |
-
}
|
259 |
-
docReady.isReady = true;
|
260 |
-
|
261 |
-
// process queue
|
262 |
-
for ( var i=0, len = queue.length; i < len; i++ ) {
|
263 |
-
var fn = queue[i];
|
264 |
-
fn();
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
function defineDocReady( eventie ) {
|
269 |
-
eventie.bind( document, 'DOMContentLoaded', init );
|
270 |
-
eventie.bind( document, 'readystatechange', init );
|
271 |
-
eventie.bind( window, 'load', init );
|
272 |
-
|
273 |
-
return docReady;
|
274 |
-
}
|
275 |
-
|
276 |
-
// transport
|
277 |
-
if ( typeof define === 'function' && define.amd ) {
|
278 |
-
// AMD
|
279 |
-
// if RequireJS, then doc is already ready
|
280 |
-
docReady.isReady = typeof requirejs === 'function';
|
281 |
-
define( 'doc-ready/doc-ready',[ 'eventie/eventie' ], defineDocReady );
|
282 |
-
} else {
|
283 |
-
// browser global
|
284 |
-
window.docReady = defineDocReady( window.eventie );
|
285 |
-
}
|
286 |
-
|
287 |
-
})( this );
|
288 |
-
|
289 |
-
/*!
|
290 |
-
* EventEmitter v4.2.4 - git.io/ee
|
291 |
-
* Oliver Caldwell
|
292 |
-
* MIT license
|
293 |
-
* @preserve
|
294 |
-
*/
|
295 |
-
|
296 |
-
(function () {
|
297 |
-
|
298 |
-
|
299 |
-
/**
|
300 |
-
* Class for managing events.
|
301 |
-
* Can be extended to provide event functionality in other classes.
|
302 |
-
*
|
303 |
-
* @class EventEmitter Manages event registering and emitting.
|
304 |
-
*/
|
305 |
-
function EventEmitter() {}
|
306 |
-
|
307 |
-
// Shortcuts to improve speed and size
|
308 |
-
|
309 |
-
// Easy access to the prototype
|
310 |
-
var proto = EventEmitter.prototype;
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Finds the index of the listener for the event in it's storage array.
|
314 |
-
*
|
315 |
-
* @param {Function[]} listeners Array of listeners to search through.
|
316 |
-
* @param {Function} listener Method to look for.
|
317 |
-
* @return {Number} Index of the specified listener, -1 if not found
|
318 |
-
* @api private
|
319 |
-
*/
|
320 |
-
function indexOfListener(listeners, listener) {
|
321 |
-
var i = listeners.length;
|
322 |
-
while (i--) {
|
323 |
-
if (listeners[i].listener === listener) {
|
324 |
-
return i;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
|
328 |
-
return -1;
|
329 |
-
}
|
330 |
-
|
331 |
-
/**
|
332 |
-
* Alias a method while keeping the context correct, to allow for overwriting of target method.
|
333 |
-
*
|
334 |
-
* @param {String} name The name of the target method.
|
335 |
-
* @return {Function} The aliased method
|
336 |
-
* @api private
|
337 |
-
*/
|
338 |
-
function alias(name) {
|
339 |
-
return function aliasClosure() {
|
340 |
-
return this[name].apply(this, arguments);
|
341 |
-
};
|
342 |
-
}
|
343 |
-
|
344 |
-
/**
|
345 |
-
* Returns the listener array for the specified event.
|
346 |
-
* Will initialise the event object and listener arrays if required.
|
347 |
-
* 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.
|
348 |
-
* Each property in the object response is an array of listener functions.
|
349 |
-
*
|
350 |
-
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
351 |
-
* @return {Function[]|Object} All listener functions for the event.
|
352 |
-
*/
|
353 |
-
proto.getListeners = function getListeners(evt) {
|
354 |
-
var events = this._getEvents();
|
355 |
-
var response;
|
356 |
-
var key;
|
357 |
-
|
358 |
-
// Return a concatenated array of all matching events if
|
359 |
-
// the selector is a regular expression.
|
360 |
-
if (typeof evt === 'object') {
|
361 |
-
response = {};
|
362 |
-
for (key in events) {
|
363 |
-
if (events.hasOwnProperty(key) && evt.test(key)) {
|
364 |
-
response[key] = events[key];
|
365 |
-
}
|
366 |
-
}
|
367 |
-
}
|
368 |
-
else {
|
369 |
-
response = events[evt] || (events[evt] = []);
|
370 |
-
}
|
371 |
-
|
372 |
-
return response;
|
373 |
-
};
|
374 |
-
|
375 |
-
/**
|
376 |
-
* Takes a list of listener objects and flattens it into a list of listener functions.
|
377 |
-
*
|
378 |
-
* @param {Object[]} listeners Raw listener objects.
|
379 |
-
* @return {Function[]} Just the listener functions.
|
380 |
-
*/
|
381 |
-
proto.flattenListeners = function flattenListeners(listeners) {
|
382 |
-
var flatListeners = [];
|
383 |
-
var i;
|
384 |
-
|
385 |
-
for (i = 0; i < listeners.length; i += 1) {
|
386 |
-
flatListeners.push(listeners[i].listener);
|
387 |
-
}
|
388 |
-
|
389 |
-
return flatListeners;
|
390 |
-
};
|
391 |
-
|
392 |
-
/**
|
393 |
-
* 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.
|
394 |
-
*
|
395 |
-
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
396 |
-
* @return {Object} All listener functions for an event in an object.
|
397 |
-
*/
|
398 |
-
proto.getListenersAsObject = function getListenersAsObject(evt) {
|
399 |
-
var listeners = this.getListeners(evt);
|
400 |
-
var response;
|
401 |
-
|
402 |
-
if (listeners instanceof Array) {
|
403 |
-
response = {};
|
404 |
-
response[evt] = listeners;
|
405 |
-
}
|
406 |
-
|
407 |
-
return response || listeners;
|
408 |
-
};
|
409 |
-
|
410 |
-
/**
|
411 |
-
* Adds a listener function to the specified event.
|
412 |
-
* The listener will not be added if it is a duplicate.
|
413 |
-
* If the listener returns true then it will be removed after it is called.
|
414 |
-
* If you pass a regular expression as the event name then the listener will be added to all events that match it.
|
415 |
-
*
|
416 |
-
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
417 |
-
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
418 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
419 |
-
*/
|
420 |
-
proto.addListener = function addListener(evt, listener) {
|
421 |
-
var listeners = this.getListenersAsObject(evt);
|
422 |
-
var listenerIsWrapped = typeof listener === 'object';
|
423 |
-
var key;
|
424 |
-
|
425 |
-
for (key in listeners) {
|
426 |
-
if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
|
427 |
-
listeners[key].push(listenerIsWrapped ? listener : {
|
428 |
-
listener: listener,
|
429 |
-
once: false
|
430 |
-
});
|
431 |
-
}
|
432 |
-
}
|
433 |
-
|
434 |
-
return this;
|
435 |
-
};
|
436 |
-
|
437 |
-
/**
|
438 |
-
* Alias of addListener
|
439 |
-
*/
|
440 |
-
proto.on = alias('addListener');
|
441 |
-
|
442 |
-
/**
|
443 |
-
* Semi-alias of addListener. It will add a listener that will be
|
444 |
-
* automatically removed after it's first execution.
|
445 |
-
*
|
446 |
-
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
447 |
-
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
448 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
449 |
-
*/
|
450 |
-
proto.addOnceListener = function addOnceListener(evt, listener) {
|
451 |
-
return this.addListener(evt, {
|
452 |
-
listener: listener,
|
453 |
-
once: true
|
454 |
-
});
|
455 |
-
};
|
456 |
-
|
457 |
-
/**
|
458 |
-
* Alias of addOnceListener.
|
459 |
-
*/
|
460 |
-
proto.once = alias('addOnceListener');
|
461 |
-
|
462 |
-
/**
|
463 |
-
* 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.
|
464 |
-
* You need to tell it what event names should be matched by a regex.
|
465 |
-
*
|
466 |
-
* @param {String} evt Name of the event to create.
|
467 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
468 |
-
*/
|
469 |
-
proto.defineEvent = function defineEvent(evt) {
|
470 |
-
this.getListeners(evt);
|
471 |
-
return this;
|
472 |
-
};
|
473 |
-
|
474 |
-
/**
|
475 |
-
* Uses defineEvent to define multiple events.
|
476 |
-
*
|
477 |
-
* @param {String[]} evts An array of event names to define.
|
478 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
479 |
-
*/
|
480 |
-
proto.defineEvents = function defineEvents(evts) {
|
481 |
-
for (var i = 0; i < evts.length; i += 1) {
|
482 |
-
this.defineEvent(evts[i]);
|
483 |
-
}
|
484 |
-
return this;
|
485 |
-
};
|
486 |
-
|
487 |
-
/**
|
488 |
-
* Removes a listener function from the specified event.
|
489 |
-
* When passed a regular expression as the event name, it will remove the listener from all events that match it.
|
490 |
-
*
|
491 |
-
* @param {String|RegExp} evt Name of the event to remove the listener from.
|
492 |
-
* @param {Function} listener Method to remove from the event.
|
493 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
494 |
-
*/
|
495 |
-
proto.removeListener = function removeListener(evt, listener) {
|
496 |
-
var listeners = this.getListenersAsObject(evt);
|
497 |
-
var index;
|
498 |
-
var key;
|
499 |
-
|
500 |
-
for (key in listeners) {
|
501 |
-
if (listeners.hasOwnProperty(key)) {
|
502 |
-
index = indexOfListener(listeners[key], listener);
|
503 |
-
|
504 |
-
if (index !== -1) {
|
505 |
-
listeners[key].splice(index, 1);
|
506 |
-
}
|
507 |
-
}
|
508 |
-
}
|
509 |
-
|
510 |
-
return this;
|
511 |
-
};
|
512 |
-
|
513 |
-
/**
|
514 |
-
* Alias of removeListener
|
515 |
-
*/
|
516 |
-
proto.off = alias('removeListener');
|
517 |
-
|
518 |
-
/**
|
519 |
-
* Adds listeners in bulk using the manipulateListeners method.
|
520 |
-
* 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.
|
521 |
-
* You can also pass it a regular expression to add the array of listeners to all events that match it.
|
522 |
-
* Yeah, this function does quite a bit. That's probably a bad thing.
|
523 |
-
*
|
524 |
-
* @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.
|
525 |
-
* @param {Function[]} [listeners] An optional array of listener functions to add.
|
526 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
527 |
-
*/
|
528 |
-
proto.addListeners = function addListeners(evt, listeners) {
|
529 |
-
// Pass through to manipulateListeners
|
530 |
-
return this.manipulateListeners(false, evt, listeners);
|
531 |
-
};
|
532 |
-
|
533 |
-
/**
|
534 |
-
* Removes listeners in bulk using the manipulateListeners method.
|
535 |
-
* 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.
|
536 |
-
* You can also pass it an event name and an array of listeners to be removed.
|
537 |
-
* You can also pass it a regular expression to remove the listeners from all events that match it.
|
538 |
-
*
|
539 |
-
* @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.
|
540 |
-
* @param {Function[]} [listeners] An optional array of listener functions to remove.
|
541 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
542 |
-
*/
|
543 |
-
proto.removeListeners = function removeListeners(evt, listeners) {
|
544 |
-
// Pass through to manipulateListeners
|
545 |
-
return this.manipulateListeners(true, evt, listeners);
|
546 |
-
};
|
547 |
-
|
548 |
-
/**
|
549 |
-
* 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.
|
550 |
-
* The first argument will determine if the listeners are removed (true) or added (false).
|
551 |
-
* 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.
|
552 |
-
* You can also pass it an event name and an array of listeners to be added/removed.
|
553 |
-
* You can also pass it a regular expression to manipulate the listeners of all events that match it.
|
554 |
-
*
|
555 |
-
* @param {Boolean} remove True if you want to remove listeners, false if you want to add.
|
556 |
-
* @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.
|
557 |
-
* @param {Function[]} [listeners] An optional array of listener functions to add/remove.
|
558 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
559 |
-
*/
|
560 |
-
proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
561 |
-
var i;
|
562 |
-
var value;
|
563 |
-
var single = remove ? this.removeListener : this.addListener;
|
564 |
-
var multiple = remove ? this.removeListeners : this.addListeners;
|
565 |
-
|
566 |
-
// If evt is an object then pass each of it's properties to this method
|
567 |
-
if (typeof evt === 'object' && !(evt instanceof RegExp)) {
|
568 |
-
for (i in evt) {
|
569 |
-
if (evt.hasOwnProperty(i) && (value = evt[i])) {
|
570 |
-
// Pass the single listener straight through to the singular method
|
571 |
-
if (typeof value === 'function') {
|
572 |
-
single.call(this, i, value);
|
573 |
-
}
|
574 |
-
else {
|
575 |
-
// Otherwise pass back to the multiple function
|
576 |
-
multiple.call(this, i, value);
|
577 |
-
}
|
578 |
-
}
|
579 |
-
}
|
580 |
-
}
|
581 |
-
else {
|
582 |
-
// So evt must be a string
|
583 |
-
// And listeners must be an array of listeners
|
584 |
-
// Loop over it and pass each one to the multiple method
|
585 |
-
i = listeners.length;
|
586 |
-
while (i--) {
|
587 |
-
single.call(this, evt, listeners[i]);
|
588 |
-
}
|
589 |
-
}
|
590 |
-
|
591 |
-
return this;
|
592 |
-
};
|
593 |
-
|
594 |
-
/**
|
595 |
-
* Removes all listeners from a specified event.
|
596 |
-
* If you do not specify an event then all listeners will be removed.
|
597 |
-
* That means every event will be emptied.
|
598 |
-
* You can also pass a regex to remove all events that match it.
|
599 |
-
*
|
600 |
-
* @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
|
601 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
602 |
-
*/
|
603 |
-
proto.removeEvent = function removeEvent(evt) {
|
604 |
-
var type = typeof evt;
|
605 |
-
var events = this._getEvents();
|
606 |
-
var key;
|
607 |
-
|
608 |
-
// Remove different things depending on the state of evt
|
609 |
-
if (type === 'string') {
|
610 |
-
// Remove all listeners for the specified event
|
611 |
-
delete events[evt];
|
612 |
-
}
|
613 |
-
else if (type === 'object') {
|
614 |
-
// Remove all events matching the regex.
|
615 |
-
for (key in events) {
|
616 |
-
if (events.hasOwnProperty(key) && evt.test(key)) {
|
617 |
-
delete events[key];
|
618 |
-
}
|
619 |
-
}
|
620 |
-
}
|
621 |
-
else {
|
622 |
-
// Remove all listeners in all events
|
623 |
-
delete this._events;
|
624 |
-
}
|
625 |
-
|
626 |
-
return this;
|
627 |
-
};
|
628 |
-
|
629 |
-
/**
|
630 |
-
* Alias of removeEvent.
|
631 |
-
*
|
632 |
-
* Added to mirror the node API.
|
633 |
-
*/
|
634 |
-
proto.removeAllListeners = alias('removeEvent');
|
635 |
-
|
636 |
-
/**
|
637 |
-
* Emits an event of your choice.
|
638 |
-
* When emitted, every listener attached to that event will be executed.
|
639 |
-
* If you pass the optional argument array then those arguments will be passed to every listener upon execution.
|
640 |
-
* Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
|
641 |
-
* So they will not arrive within the array on the other side, they will be separate.
|
642 |
-
* You can also pass a regular expression to emit to all events that match it.
|
643 |
-
*
|
644 |
-
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
645 |
-
* @param {Array} [args] Optional array of arguments to be passed to each listener.
|
646 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
647 |
-
*/
|
648 |
-
proto.emitEvent = function emitEvent(evt, args) {
|
649 |
-
var listeners = this.getListenersAsObject(evt);
|
650 |
-
var listener;
|
651 |
-
var i;
|
652 |
-
var key;
|
653 |
-
var response;
|
654 |
-
|
655 |
-
for (key in listeners) {
|
656 |
-
if (listeners.hasOwnProperty(key)) {
|
657 |
-
i = listeners[key].length;
|
658 |
-
|
659 |
-
while (i--) {
|
660 |
-
// If the listener returns true then it shall be removed from the event
|
661 |
-
// The function is executed either with a basic call or an apply if there is an args array
|
662 |
-
listener = listeners[key][i];
|
663 |
-
|
664 |
-
if (listener.once === true) {
|
665 |
-
this.removeListener(evt, listener.listener);
|
666 |
-
}
|
667 |
-
|
668 |
-
response = listener.listener.apply(this, args || []);
|
669 |
-
|
670 |
-
if (response === this._getOnceReturnValue()) {
|
671 |
-
this.removeListener(evt, listener.listener);
|
672 |
-
}
|
673 |
-
}
|
674 |
-
}
|
675 |
-
}
|
676 |
-
|
677 |
-
return this;
|
678 |
-
};
|
679 |
-
|
680 |
-
/**
|
681 |
-
* Alias of emitEvent
|
682 |
-
*/
|
683 |
-
proto.trigger = alias('emitEvent');
|
684 |
-
|
685 |
-
/**
|
686 |
-
* 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.
|
687 |
-
* As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
|
688 |
-
*
|
689 |
-
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
690 |
-
* @param {...*} Optional additional arguments to be passed to each listener.
|
691 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
692 |
-
*/
|
693 |
-
proto.emit = function emit(evt) {
|
694 |
-
var args = Array.prototype.slice.call(arguments, 1);
|
695 |
-
return this.emitEvent(evt, args);
|
696 |
-
};
|
697 |
-
|
698 |
-
/**
|
699 |
-
* Sets the current value to check against when executing listeners. If a
|
700 |
-
* listeners return value matches the one set here then it will be removed
|
701 |
-
* after execution. This value defaults to true.
|
702 |
-
*
|
703 |
-
* @param {*} value The new value to check for when executing listeners.
|
704 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
705 |
-
*/
|
706 |
-
proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
707 |
-
this._onceReturnValue = value;
|
708 |
-
return this;
|
709 |
-
};
|
710 |
-
|
711 |
-
/**
|
712 |
-
* Fetches the current value to check against when executing listeners. If
|
713 |
-
* the listeners return value matches this one then it should be removed
|
714 |
-
* automatically. It will return true by default.
|
715 |
-
*
|
716 |
-
* @return {*|Boolean} The current value to check for or the default, true.
|
717 |
-
* @api private
|
718 |
-
*/
|
719 |
-
proto._getOnceReturnValue = function _getOnceReturnValue() {
|
720 |
-
if (this.hasOwnProperty('_onceReturnValue')) {
|
721 |
-
return this._onceReturnValue;
|
722 |
-
}
|
723 |
-
else {
|
724 |
-
return true;
|
725 |
-
}
|
726 |
-
};
|
727 |
-
|
728 |
-
/**
|
729 |
-
* Fetches the events object and creates one if required.
|
730 |
-
*
|
731 |
-
* @return {Object} The events storage object.
|
732 |
-
* @api private
|
733 |
-
*/
|
734 |
-
proto._getEvents = function _getEvents() {
|
735 |
-
return this._events || (this._events = {});
|
736 |
-
};
|
737 |
-
|
738 |
-
// Expose the class either via AMD, CommonJS or the global object
|
739 |
-
if (typeof define === 'function' && define.amd) {
|
740 |
-
define('eventEmitter/EventEmitter',[],function () {
|
741 |
-
return EventEmitter;
|
742 |
-
});
|
743 |
-
}
|
744 |
-
else if (typeof module === 'object' && module.exports){
|
745 |
-
module.exports = EventEmitter;
|
746 |
-
}
|
747 |
-
else {
|
748 |
-
this.EventEmitter = EventEmitter;
|
749 |
-
}
|
750 |
-
}.call(this));
|
751 |
-
|
752 |
-
/*!
|
753 |
-
* getStyleProperty by kangax
|
754 |
-
* http://perfectionkills.com/feature-testing-css-properties/
|
755 |
-
*/
|
756 |
-
|
757 |
-
/*jshint browser: true, strict: true, undef: true */
|
758 |
-
/*globals define: false */
|
759 |
-
|
760 |
-
( function( window ) {
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
var prefixes = 'Webkit Moz ms Ms O'.split(' ');
|
765 |
-
var docElemStyle = document.documentElement.style;
|
766 |
-
|
767 |
-
function getStyleProperty( propName ) {
|
768 |
-
if ( !propName ) {
|
769 |
-
return;
|
770 |
-
}
|
771 |
-
|
772 |
-
// test standard property first
|
773 |
-
if ( typeof docElemStyle[ propName ] === 'string' ) {
|
774 |
-
return propName;
|
775 |
-
}
|
776 |
-
|
777 |
-
// capitalize
|
778 |
-
propName = propName.charAt(0).toUpperCase() + propName.slice(1);
|
779 |
-
|
780 |
-
// test vendor specific properties
|
781 |
-
var prefixed;
|
782 |
-
for ( var i=0, len = prefixes.length; i < len; i++ ) {
|
783 |
-
prefixed = prefixes[i] + propName;
|
784 |
-
if ( typeof docElemStyle[ prefixed ] === 'string' ) {
|
785 |
-
return prefixed;
|
786 |
-
}
|
787 |
-
}
|
788 |
-
}
|
789 |
-
|
790 |
-
// transport
|
791 |
-
if ( typeof define === 'function' && define.amd ) {
|
792 |
-
// AMD
|
793 |
-
define( 'get-style-property/get-style-property',[],function() {
|
794 |
-
return getStyleProperty;
|
795 |
-
});
|
796 |
-
} else {
|
797 |
-
// browser global
|
798 |
-
window.getStyleProperty = getStyleProperty;
|
799 |
-
}
|
800 |
-
|
801 |
-
})( window );
|
802 |
-
|
803 |
-
/**
|
804 |
-
* getSize v1.1.6
|
805 |
-
* measure size of elements
|
806 |
-
*/
|
807 |
-
|
808 |
-
/*jshint browser: true, strict: true, undef: true, unused: true */
|
809 |
-
/*global define: false, exports: false, require: false, module: false */
|
810 |
-
|
811 |
-
( function( window, undefined ) {
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
// -------------------------- helpers -------------------------- //
|
816 |
-
|
817 |
-
var defView = document.defaultView;
|
818 |
-
var isComputedStyle = defView && defView.getComputedStyle;
|
819 |
-
|
820 |
-
var getStyle = isComputedStyle ?
|
821 |
-
function( elem ) {
|
822 |
-
return defView.getComputedStyle( elem, null );
|
823 |
-
} :
|
824 |
-
function( elem ) {
|
825 |
-
return elem.currentStyle;
|
826 |
-
};
|
827 |
-
|
828 |
-
// get a number from a string, not a percentage
|
829 |
-
function getStyleSize( value ) {
|
830 |
-
var num = parseFloat( value );
|
831 |
-
// not a percent like '100%', and a number
|
832 |
-
var isValid = value.indexOf('%') === -1 && !isNaN( num );
|
833 |
-
return isValid && num;
|
834 |
-
}
|
835 |
-
|
836 |
-
// -------------------------- measurements -------------------------- //
|
837 |
-
|
838 |
-
var measurements = [
|
839 |
-
'paddingLeft',
|
840 |
-
'paddingRight',
|
841 |
-
'paddingTop',
|
842 |
-
'paddingBottom',
|
843 |
-
'marginLeft',
|
844 |
-
'marginRight',
|
845 |
-
'marginTop',
|
846 |
-
'marginBottom',
|
847 |
-
'borderLeftWidth',
|
848 |
-
'borderRightWidth',
|
849 |
-
'borderTopWidth',
|
850 |
-
'borderBottomWidth'
|
851 |
-
];
|
852 |
-
|
853 |
-
function getZeroSize() {
|
854 |
-
var size = {
|
855 |
-
width: 0,
|
856 |
-
height: 0,
|
857 |
-
innerWidth: 0,
|
858 |
-
innerHeight: 0,
|
859 |
-
outerWidth: 0,
|
860 |
-
outerHeight: 0
|
861 |
-
};
|
862 |
-
for ( var i=0, len = measurements.length; i < len; i++ ) {
|
863 |
-
var measurement = measurements[i];
|
864 |
-
size[ measurement ] = 0;
|
865 |
-
}
|
866 |
-
return size;
|
867 |
-
}
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
function defineGetSize( getStyleProperty ) {
|
872 |
-
|
873 |
-
// -------------------------- box sizing -------------------------- //
|
874 |
-
|
875 |
-
var boxSizingProp = getStyleProperty('boxSizing');
|
876 |
-
var isBoxSizeOuter;
|
877 |
-
|
878 |
-
/**
|
879 |
-
* WebKit measures the outer-width on style.width on border-box elems
|
880 |
-
* IE & Firefox measures the inner-width
|
881 |
-
*/
|
882 |
-
( function() {
|
883 |
-
if ( !boxSizingProp ) {
|
884 |
-
return;
|
885 |
-
}
|
886 |
-
|
887 |
-
var div = document.createElement('div');
|
888 |
-
div.style.width = '200px';
|
889 |
-
div.style.padding = '1px 2px 3px 4px';
|
890 |
-
div.style.borderStyle = 'solid';
|
891 |
-
div.style.borderWidth = '1px 2px 3px 4px';
|
892 |
-
div.style[ boxSizingProp ] = 'border-box';
|
893 |
-
|
894 |
-
var body = document.body || document.documentElement;
|
895 |
-
body.appendChild( div );
|
896 |
-
var style = getStyle( div );
|
897 |
-
|
898 |
-
isBoxSizeOuter = getStyleSize( style.width ) === 200;
|
899 |
-
body.removeChild( div );
|
900 |
-
})();
|
901 |
-
|
902 |
-
|
903 |
-
// -------------------------- getSize -------------------------- //
|
904 |
-
|
905 |
-
function getSize( elem ) {
|
906 |
-
// use querySeletor if elem is string
|
907 |
-
if ( typeof elem === 'string' ) {
|
908 |
-
elem = document.querySelector( elem );
|
909 |
-
}
|
910 |
-
|
911 |
-
// do not proceed on non-objects
|
912 |
-
if ( !elem || typeof elem !== 'object' || !elem.nodeType ) {
|
913 |
-
return;
|
914 |
-
}
|
915 |
-
|
916 |
-
var style = getStyle( elem );
|
917 |
-
|
918 |
-
// if hidden, everything is 0
|
919 |
-
if ( style.display === 'none' ) {
|
920 |
-
return getZeroSize();
|
921 |
-
}
|
922 |
-
|
923 |
-
var size = {};
|
924 |
-
size.width = elem.offsetWidth;
|
925 |
-
size.height = elem.offsetHeight;
|
926 |
-
|
927 |
-
var isBorderBox = size.isBorderBox = !!( boxSizingProp &&
|
928 |
-
style[ boxSizingProp ] && style[ boxSizingProp ] === 'border-box' );
|
929 |
-
|
930 |
-
// get all measurements
|
931 |
-
for ( var i=0, len = measurements.length; i < len; i++ ) {
|
932 |
-
var measurement = measurements[i];
|
933 |
-
var value = style[ measurement ];
|
934 |
-
value = mungeNonPixel( elem, value );
|
935 |
-
var num = parseFloat( value );
|
936 |
-
// any 'auto', 'medium' value will be 0
|
937 |
-
size[ measurement ] = !isNaN( num ) ? num : 0;
|
938 |
-
}
|
939 |
-
|
940 |
-
var paddingWidth = size.paddingLeft + size.paddingRight;
|
941 |
-
var paddingHeight = size.paddingTop + size.paddingBottom;
|
942 |
-
var marginWidth = size.marginLeft + size.marginRight;
|
943 |
-
var marginHeight = size.marginTop + size.marginBottom;
|
944 |
-
var borderWidth = size.borderLeftWidth + size.borderRightWidth;
|
945 |
-
var borderHeight = size.borderTopWidth + size.borderBottomWidth;
|
946 |
-
|
947 |
-
var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
|
948 |
-
|
949 |
-
// overwrite width and height if we can get it from style
|
950 |
-
var styleWidth = getStyleSize( style.width );
|
951 |
-
if ( styleWidth !== false ) {
|
952 |
-
size.width = styleWidth +
|
953 |
-
// add padding and border unless it's already including it
|
954 |
-
( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
|
955 |
-
}
|
956 |
-
|
957 |
-
var styleHeight = getStyleSize( style.height );
|
958 |
-
if ( styleHeight !== false ) {
|
959 |
-
size.height = styleHeight +
|
960 |
-
// add padding and border unless it's already including it
|
961 |
-
( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
|
962 |
-
}
|
963 |
-
|
964 |
-
size.innerWidth = size.width - ( paddingWidth + borderWidth );
|
965 |
-
size.innerHeight = size.height - ( paddingHeight + borderHeight );
|
966 |
-
|
967 |
-
size.outerWidth = size.width + marginWidth;
|
968 |
-
size.outerHeight = size.height + marginHeight;
|
969 |
-
|
970 |
-
return size;
|
971 |
-
}
|
972 |
-
|
973 |
-
// IE8 returns percent values, not pixels
|
974 |
-
// taken from jQuery's curCSS
|
975 |
-
function mungeNonPixel( elem, value ) {
|
976 |
-
// IE8 and has percent value
|
977 |
-
if ( isComputedStyle || value.indexOf('%') === -1 ) {
|
978 |
-
return value;
|
979 |
-
}
|
980 |
-
var style = elem.style;
|
981 |
-
// Remember the original values
|
982 |
-
var left = style.left;
|
983 |
-
var rs = elem.runtimeStyle;
|
984 |
-
var rsLeft = rs && rs.left;
|
985 |
-
|
986 |
-
// Put in the new values to get a computed value out
|
987 |
-
if ( rsLeft ) {
|
988 |
-
rs.left = elem.currentStyle.left;
|
989 |
-
}
|
990 |
-
style.left = value;
|
991 |
-
value = style.pixelLeft;
|
992 |
-
|
993 |
-
// Revert the changed values
|
994 |
-
style.left = left;
|
995 |
-
if ( rsLeft ) {
|
996 |
-
rs.left = rsLeft;
|
997 |
-
}
|
998 |
-
|
999 |
-
return value;
|
1000 |
-
}
|
1001 |
-
|
1002 |
-
return getSize;
|
1003 |
-
|
1004 |
-
}
|
1005 |
-
|
1006 |
-
// transport
|
1007 |
-
if ( typeof define === 'function' && define.amd ) {
|
1008 |
-
// AMD for RequireJS
|
1009 |
-
define( 'get-size/get-size',[ 'get-style-property/get-style-property' ], defineGetSize );
|
1010 |
-
} else if ( typeof exports === 'object' ) {
|
1011 |
-
// CommonJS for Component
|
1012 |
-
module.exports = defineGetSize( require('get-style-property') );
|
1013 |
-
} else {
|
1014 |
-
// browser global
|
1015 |
-
window.getSize = defineGetSize( window.getStyleProperty );
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
})( window );
|
1019 |
-
|
1020 |
-
/**
|
1021 |
-
* matchesSelector helper v1.0.1
|
1022 |
-
*
|
1023 |
-
* @name matchesSelector
|
1024 |
-
* @param {Element} elem
|
1025 |
-
* @param {String} selector
|
1026 |
-
*/
|
1027 |
-
|
1028 |
-
/*jshint browser: true, strict: true, undef: true, unused: true */
|
1029 |
-
/*global define: false */
|
1030 |
-
|
1031 |
-
( function( global, ElemProto ) {
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
var matchesMethod = ( function() {
|
1036 |
-
// check un-prefixed
|
1037 |
-
if ( ElemProto.matchesSelector ) {
|
1038 |
-
return 'matchesSelector';
|
1039 |
-
}
|
1040 |
-
// check vendor prefixes
|
1041 |
-
var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];
|
1042 |
-
|
1043 |
-
for ( var i=0, len = prefixes.length; i < len; i++ ) {
|
1044 |
-
var prefix = prefixes[i];
|
1045 |
-
var method = prefix + 'MatchesSelector';
|
1046 |
-
if ( ElemProto[ method ] ) {
|
1047 |
-
return method;
|
1048 |
-
}
|
1049 |
-
}
|
1050 |
-
})();
|
1051 |
-
|
1052 |
-
// ----- match ----- //
|
1053 |
-
|
1054 |
-
function match( elem, selector ) {
|
1055 |
-
return elem[ matchesMethod ]( selector );
|
1056 |
-
}
|
1057 |
-
|
1058 |
-
// ----- appendToFragment ----- //
|
1059 |
-
|
1060 |
-
function checkParent( elem ) {
|
1061 |
-
// not needed if already has parent
|
1062 |
-
if ( elem.parentNode ) {
|
1063 |
-
return;
|
1064 |
-
}
|
1065 |
-
var fragment = document.createDocumentFragment();
|
1066 |
-
fragment.appendChild( elem );
|
1067 |
-
}
|
1068 |
-
|
1069 |
-
// ----- query ----- //
|
1070 |
-
|
1071 |
-
// fall back to using QSA
|
1072 |
-
// thx @jonathantneal https://gist.github.com/3062955
|
1073 |
-
function query( elem, selector ) {
|
1074 |
-
// append to fragment if no parent
|
1075 |
-
checkParent( elem );
|
1076 |
-
|
1077 |
-
// match elem with all selected elems of parent
|
1078 |
-
var elems = elem.parentNode.querySelectorAll( selector );
|
1079 |
-
for ( var i=0, len = elems.length; i < len; i++ ) {
|
1080 |
-
// return true if match
|
1081 |
-
if ( elems[i] === elem ) {
|
1082 |
-
return true;
|
1083 |
-
}
|
1084 |
-
}
|
1085 |
-
// otherwise return false
|
1086 |
-
return false;
|
1087 |
-
}
|
1088 |
-
|
1089 |
-
// ----- matchChild ----- //
|
1090 |
-
|
1091 |
-
function matchChild( elem, selector ) {
|
1092 |
-
checkParent( elem );
|
1093 |
-
return match( elem, selector );
|
1094 |
-
}
|
1095 |
-
|
1096 |
-
// ----- matchesSelector ----- //
|
1097 |
-
|
1098 |
-
var matchesSelector;
|
1099 |
-
|
1100 |
-
if ( matchesMethod ) {
|
1101 |
-
// IE9 supports matchesSelector, but doesn't work on orphaned elems
|
1102 |
-
// check for that
|
1103 |
-
var div = document.createElement('div');
|
1104 |
-
var supportsOrphans = match( div, 'div' );
|
1105 |
-
matchesSelector = supportsOrphans ? match : matchChild;
|
1106 |
-
} else {
|
1107 |
-
matchesSelector = query;
|
1108 |
-
}
|
1109 |
-
|
1110 |
-
// transport
|
1111 |
-
if ( typeof define === 'function' && define.amd ) {
|
1112 |
-
// AMD
|
1113 |
-
define( 'matches-selector/matches-selector',[],function() {
|
1114 |
-
return matchesSelector;
|
1115 |
-
});
|
1116 |
-
} else {
|
1117 |
-
// browser global
|
1118 |
-
window.matchesSelector = matchesSelector;
|
1119 |
-
}
|
1120 |
-
|
1121 |
-
})( this, Element.prototype );
|
1122 |
-
|
1123 |
-
/**
|
1124 |
-
* Outlayer Item
|
1125 |
-
**/
|
1126 |
-
|
1127 |
-
( function( window ) {
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
// ----- get style ----- //
|
1132 |
-
|
1133 |
-
var defView = document.defaultView;
|
1134 |
-
|
1135 |
-
var getStyle = defView && defView.getComputedStyle ?
|
1136 |
-
function( elem ) {
|
1137 |
-
return defView.getComputedStyle( elem, null );
|
1138 |
-
} :
|
1139 |
-
function( elem ) {
|
1140 |
-
return elem.currentStyle;
|
1141 |
-
};
|
1142 |
-
|
1143 |
-
|
1144 |
-
// extend objects
|
1145 |
-
function extend( a, b ) {
|
1146 |
-
for ( var prop in b ) {
|
1147 |
-
a[ prop ] = b[ prop ];
|
1148 |
-
}
|
1149 |
-
return a;
|
1150 |
-
}
|
1151 |
-
|
1152 |
-
function isEmptyObj( obj ) {
|
1153 |
-
for ( var prop in obj ) {
|
1154 |
-
return false;
|
1155 |
-
}
|
1156 |
-
prop = null;
|
1157 |
-
return true;
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
|
1161 |
-
function toDash( str ) {
|
1162 |
-
return str.replace( /([A-Z])/g, function( $1 ){
|
1163 |
-
return '-' + $1.toLowerCase();
|
1164 |
-
});
|
1165 |
-
}
|
1166 |
-
|
1167 |
-
// -------------------------- Outlayer definition -------------------------- //
|
1168 |
-
|
1169 |
-
function outlayerItemDefinition( EventEmitter, getSize, getStyleProperty ) {
|
1170 |
-
|
1171 |
-
// -------------------------- CSS3 support -------------------------- //
|
1172 |
-
|
1173 |
-
var transitionProperty = getStyleProperty('transition');
|
1174 |
-
var transformProperty = getStyleProperty('transform');
|
1175 |
-
var supportsCSS3 = transitionProperty && transformProperty;
|
1176 |
-
var is3d = !!getStyleProperty('perspective');
|
1177 |
-
|
1178 |
-
var transitionEndEvent = {
|
1179 |
-
WebkitTransition: 'webkitTransitionEnd',
|
1180 |
-
MozTransition: 'transitionend',
|
1181 |
-
OTransition: 'otransitionend',
|
1182 |
-
transition: 'transitionend'
|
1183 |
-
}[ transitionProperty ];
|
1184 |
-
|
1185 |
-
// properties that could have vendor prefix
|
1186 |
-
var prefixableProperties = [
|
1187 |
-
'transform',
|
1188 |
-
'transition',
|
1189 |
-
'transitionDuration',
|
1190 |
-
'transitionProperty'
|
1191 |
-
];
|
1192 |
-
|
1193 |
-
// cache all vendor properties
|
1194 |
-
var vendorProperties = ( function() {
|
1195 |
-
var cache = {};
|
1196 |
-
for ( var i=0, len = prefixableProperties.length; i < len; i++ ) {
|
1197 |
-
var prop = prefixableProperties[i];
|
1198 |
-
var supportedProp = getStyleProperty( prop );
|
1199 |
-
if ( supportedProp && supportedProp !== prop ) {
|
1200 |
-
cache[ prop ] = supportedProp;
|
1201 |
-
}
|
1202 |
-
}
|
1203 |
-
return cache;
|
1204 |
-
})();
|
1205 |
-
|
1206 |
-
// -------------------------- Item -------------------------- //
|
1207 |
-
|
1208 |
-
function Item( element, layout ) {
|
1209 |
-
if ( !element ) {
|
1210 |
-
return;
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
this.element = element;
|
1214 |
-
// parent layout class, i.e. Masonry, Isotope, or Packery
|
1215 |
-
this.layout = layout;
|
1216 |
-
this.position = {
|
1217 |
-
x: 0,
|
1218 |
-
y: 0
|
1219 |
-
};
|
1220 |
-
|
1221 |
-
this._create();
|
1222 |
-
}
|
1223 |
-
|
1224 |
-
// inherit EventEmitter
|
1225 |
-
extend( Item.prototype, EventEmitter.prototype );
|
1226 |
-
|
1227 |
-
Item.prototype._create = function() {
|
1228 |
-
// transition objects
|
1229 |
-
this._transition = {
|
1230 |
-
ingProperties: {},
|
1231 |
-
clean: {},
|
1232 |
-
onEnd: {}
|
1233 |
-
};
|
1234 |
-
|
1235 |
-
this.css({
|
1236 |
-
position: 'absolute'
|
1237 |
-
});
|
1238 |
-
};
|
1239 |
-
|
1240 |
-
// trigger specified handler for event type
|
1241 |
-
Item.prototype.handleEvent = function( event ) {
|
1242 |
-
var method = 'on' + event.type;
|
1243 |
-
if ( this[ method ] ) {
|
1244 |
-
this[ method ]( event );
|
1245 |
-
}
|
1246 |
-
};
|
1247 |
-
|
1248 |
-
Item.prototype.getSize = function() {
|
1249 |
-
this.size = getSize( this.element );
|
1250 |
-
};
|
1251 |
-
|
1252 |
-
/**
|
1253 |
-
* apply CSS styles to element
|
1254 |
-
* @param {Object} style
|
1255 |
-
*/
|
1256 |
-
Item.prototype.css = function( style ) {
|
1257 |
-
var elemStyle = this.element.style;
|
1258 |
-
|
1259 |
-
for ( var prop in style ) {
|
1260 |
-
// use vendor property if available
|
1261 |
-
var supportedProp = vendorProperties[ prop ] || prop;
|
1262 |
-
elemStyle[ supportedProp ] = style[ prop ];
|
1263 |
-
}
|
1264 |
-
};
|
1265 |
-
|
1266 |
-
// measure position, and sets it
|
1267 |
-
Item.prototype.getPosition = function() {
|
1268 |
-
var style = getStyle( this.element );
|
1269 |
-
var layoutOptions = this.layout.options;
|
1270 |
-
var isOriginLeft = layoutOptions.isOriginLeft;
|
1271 |
-
var isOriginTop = layoutOptions.isOriginTop;
|
1272 |
-
var x = parseInt( style[ isOriginLeft ? 'left' : 'right' ], 10 );
|
1273 |
-
var y = parseInt( style[ isOriginTop ? 'top' : 'bottom' ], 10 );
|
1274 |
-
|
1275 |
-
// clean up 'auto' or other non-integer values
|
1276 |
-
x = isNaN( x ) ? 0 : x;
|
1277 |
-
y = isNaN( y ) ? 0 : y;
|
1278 |
-
// remove padding from measurement
|
1279 |
-
var layoutSize = this.layout.size;
|
1280 |
-
x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight;
|
1281 |
-
y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom;
|
1282 |
-
|
1283 |
-
this.position.x = x;
|
1284 |
-
this.position.y = y;
|
1285 |
-
};
|
1286 |
-
|
1287 |
-
// set settled position, apply padding
|
1288 |
-
Item.prototype.layoutPosition = function() {
|
1289 |
-
var layoutSize = this.layout.size;
|
1290 |
-
var layoutOptions = this.layout.options;
|
1291 |
-
var style = {};
|
1292 |
-
|
1293 |
-
if ( layoutOptions.isOriginLeft ) {
|
1294 |
-
style.left = ( this.position.x + layoutSize.paddingLeft ) + 'px';
|
1295 |
-
// reset other property
|
1296 |
-
style.right = '';
|
1297 |
-
} else {
|
1298 |
-
style.right = ( this.position.x + layoutSize.paddingRight ) + 'px';
|
1299 |
-
style.left = '';
|
1300 |
-
}
|
1301 |
-
|
1302 |
-
if ( layoutOptions.isOriginTop ) {
|
1303 |
-
style.top = ( this.position.y + layoutSize.paddingTop ) + 'px';
|
1304 |
-
style.bottom = '';
|
1305 |
-
} else {
|
1306 |
-
style.bottom = ( this.position.y + layoutSize.paddingBottom ) + 'px';
|
1307 |
-
style.top = '';
|
1308 |
-
}
|
1309 |
-
|
1310 |
-
this.css( style );
|
1311 |
-
this.emitEvent( 'layout', [ this ] );
|
1312 |
-
};
|
1313 |
-
|
1314 |
-
|
1315 |
-
// transform translate function
|
1316 |
-
var translate = is3d ?
|
1317 |
-
function( x, y ) {
|
1318 |
-
return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
|
1319 |
-
} :
|
1320 |
-
function( x, y ) {
|
1321 |
-
return 'translate(' + x + 'px, ' + y + 'px)';
|
1322 |
-
};
|
1323 |
-
|
1324 |
-
|
1325 |
-
Item.prototype._transitionTo = function( x, y ) {
|
1326 |
-
this.getPosition();
|
1327 |
-
// get current x & y from top/left
|
1328 |
-
var curX = this.position.x;
|
1329 |
-
var curY = this.position.y;
|
1330 |
-
|
1331 |
-
var compareX = parseInt( x, 10 );
|
1332 |
-
var compareY = parseInt( y, 10 );
|
1333 |
-
var didNotMove = compareX === this.position.x && compareY === this.position.y;
|
1334 |
-
|
1335 |
-
// save end position
|
1336 |
-
this.setPosition( x, y );
|
1337 |
-
|
1338 |
-
// if did not move and not transitioning, just go to layout
|
1339 |
-
if ( didNotMove && !this.isTransitioning ) {
|
1340 |
-
this.layoutPosition();
|
1341 |
-
return;
|
1342 |
-
}
|
1343 |
-
|
1344 |
-
var transX = x - curX;
|
1345 |
-
var transY = y - curY;
|
1346 |
-
var transitionStyle = {};
|
1347 |
-
// flip cooridinates if origin on right or bottom
|
1348 |
-
var layoutOptions = this.layout.options;
|
1349 |
-
transX = layoutOptions.isOriginLeft ? transX : -transX;
|
1350 |
-
transY = layoutOptions.isOriginTop ? transY : -transY;
|
1351 |
-
transitionStyle.transform = translate( transX, transY );
|
1352 |
-
|
1353 |
-
this.transition({
|
1354 |
-
to: transitionStyle,
|
1355 |
-
onTransitionEnd: {
|
1356 |
-
transform: this.layoutPosition
|
1357 |
-
},
|
1358 |
-
isCleaning: true
|
1359 |
-
});
|
1360 |
-
};
|
1361 |
-
|
1362 |
-
// non transition + transform support
|
1363 |
-
Item.prototype.goTo = function( x, y ) {
|
1364 |
-
this.setPosition( x, y );
|
1365 |
-
this.layoutPosition();
|
1366 |
-
};
|
1367 |
-
|
1368 |
-
// use transition and transforms if supported
|
1369 |
-
Item.prototype.moveTo = supportsCSS3 ?
|
1370 |
-
Item.prototype._transitionTo : Item.prototype.goTo;
|
1371 |
-
|
1372 |
-
Item.prototype.setPosition = function( x, y ) {
|
1373 |
-
this.position.x = parseInt( x, 10 );
|
1374 |
-
this.position.y = parseInt( y, 10 );
|
1375 |
-
};
|
1376 |
-
|
1377 |
-
// ----- transition ----- //
|
1378 |
-
|
1379 |
-
/**
|
1380 |
-
* @param {Object} style - CSS
|
1381 |
-
* @param {Function} onTransitionEnd
|
1382 |
-
*/
|
1383 |
-
|
1384 |
-
// non transition, just trigger callback
|
1385 |
-
Item.prototype._nonTransition = function( args ) {
|
1386 |
-
this.css( args.to );
|
1387 |
-
if ( args.isCleaning ) {
|
1388 |
-
this._removeStyles( args.to );
|
1389 |
-
}
|
1390 |
-
for ( var prop in args.onTransitionEnd ) {
|
1391 |
-
args.onTransitionEnd[ prop ].call( this );
|
1392 |
-
}
|
1393 |
-
};
|
1394 |
-
|
1395 |
-
/**
|
1396 |
-
* proper transition
|
1397 |
-
* @param {Object} args - arguments
|
1398 |
-
* @param {Object} to - style to transition to
|
1399 |
-
* @param {Object} from - style to start transition from
|
1400 |
-
* @param {Boolean} isCleaning - removes transition styles after transition
|
1401 |
-
* @param {Function} onTransitionEnd - callback
|
1402 |
-
*/
|
1403 |
-
Item.prototype._transition = function( args ) {
|
1404 |
-
// redirect to nonTransition if no transition duration
|
1405 |
-
if ( !parseFloat( this.layout.options.transitionDuration ) ) {
|
1406 |
-
this._nonTransition( args );
|
1407 |
-
return;
|
1408 |
-
}
|
1409 |
-
|
1410 |
-
var _transition = this._transition;
|
1411 |
-
// keep track of onTransitionEnd callback by css property
|
1412 |
-
for ( var prop in args.onTransitionEnd ) {
|
1413 |
-
_transition.onEnd[ prop ] = args.onTransitionEnd[ prop ];
|
1414 |
-
}
|
1415 |
-
// keep track of properties that are transitioning
|
1416 |
-
for ( prop in args.to ) {
|
1417 |
-
_transition.ingProperties[ prop ] = true;
|
1418 |
-
// keep track of properties to clean up when transition is done
|
1419 |
-
if ( args.isCleaning ) {
|
1420 |
-
_transition.clean[ prop ] = true;
|
1421 |
-
}
|
1422 |
-
}
|
1423 |
-
|
1424 |
-
// set from styles
|
1425 |
-
if ( args.from ) {
|
1426 |
-
this.css( args.from );
|
1427 |
-
// force redraw. http://blog.alexmaccaw.com/css-transitions
|
1428 |
-
var h = this.element.offsetHeight;
|
1429 |
-
// hack for JSHint to hush about unused var
|
1430 |
-
h = null;
|
1431 |
-
}
|
1432 |
-
// enable transition
|
1433 |
-
this.enableTransition( args.to );
|
1434 |
-
// set styles that are transitioning
|
1435 |
-
this.css( args.to );
|
1436 |
-
|
1437 |
-
this.isTransitioning = true;
|
1438 |
-
|
1439 |
-
};
|
1440 |
-
|
1441 |
-
var itemTransitionProperties = transformProperty && ( toDash( transformProperty ) +
|
1442 |
-
',opacity' );
|
1443 |
-
|
1444 |
-
Item.prototype.enableTransition = function(/* style */) {
|
1445 |
-
// only enable if not already transitioning
|
1446 |
-
// bug in IE10 were re-setting transition style will prevent
|
1447 |
-
// transitionend event from triggering
|
1448 |
-
if ( this.isTransitioning ) {
|
1449 |
-
return;
|
1450 |
-
}
|
1451 |
-
|
1452 |
-
// make transition: foo, bar, baz from style object
|
1453 |
-
// TODO uncomment this bit when IE10 bug is resolved
|
1454 |
-
// var transitionValue = [];
|
1455 |
-
// for ( var prop in style ) {
|
1456 |
-
// // dash-ify camelCased properties like WebkitTransition
|
1457 |
-
// transitionValue.push( toDash( prop ) );
|
1458 |
-
// }
|
1459 |
-
// enable transition styles
|
1460 |
-
// HACK always enable transform,opacity for IE10
|
1461 |
-
this.css({
|
1462 |
-
transitionProperty: itemTransitionProperties,
|
1463 |
-
transitionDuration: this.layout.options.transitionDuration
|
1464 |
-
});
|
1465 |
-
// listen for transition end event
|
1466 |
-
this.element.addEventListener( transitionEndEvent, this, false );
|
1467 |
-
};
|
1468 |
-
|
1469 |
-
Item.prototype.transition = Item.prototype[ transitionProperty ? '_transition' : '_nonTransition' ];
|
1470 |
-
|
1471 |
-
// ----- events ----- //
|
1472 |
-
|
1473 |
-
Item.prototype.onwebkitTransitionEnd = function( event ) {
|
1474 |
-
this.ontransitionend( event );
|
1475 |
-
};
|
1476 |
-
|
1477 |
-
Item.prototype.onotransitionend = function( event ) {
|
1478 |
-
this.ontransitionend( event );
|
1479 |
-
};
|
1480 |
-
|
1481 |
-
// properties that I munge to make my life easier
|
1482 |
-
var dashedVendorProperties = {
|
1483 |
-
'-webkit-transform': 'transform',
|
1484 |
-
'-moz-transform': 'transform',
|
1485 |
-
'-o-transform': 'transform'
|
1486 |
-
};
|
1487 |
-
|
1488 |
-
Item.prototype.ontransitionend = function( event ) {
|
1489 |
-
// disregard bubbled events from children
|
1490 |
-
if ( event.target !== this.element ) {
|
1491 |
-
return;
|
1492 |
-
}
|
1493 |
-
var _transition = this._transition;
|
1494 |
-
// get property name of transitioned property, convert to prefix-free
|
1495 |
-
var propertyName = dashedVendorProperties[ event.propertyName ] || event.propertyName;
|
1496 |
-
|
1497 |
-
// remove property that has completed transitioning
|
1498 |
-
delete _transition.ingProperties[ propertyName ];
|
1499 |
-
// check if any properties are still transitioning
|
1500 |
-
if ( isEmptyObj( _transition.ingProperties ) ) {
|
1501 |
-
// all properties have completed transitioning
|
1502 |
-
this.disableTransition();
|
1503 |
-
}
|
1504 |
-
// clean style
|
1505 |
-
if ( propertyName in _transition.clean ) {
|
1506 |
-
// clean up style
|
1507 |
-
this.element.style[ event.propertyName ] = '';
|
1508 |
-
delete _transition.clean[ propertyName ];
|
1509 |
-
}
|
1510 |
-
// trigger onTransitionEnd callback
|
1511 |
-
if ( propertyName in _transition.onEnd ) {
|
1512 |
-
var onTransitionEnd = _transition.onEnd[ propertyName ];
|
1513 |
-
onTransitionEnd.call( this );
|
1514 |
-
delete _transition.onEnd[ propertyName ];
|
1515 |
-
}
|
1516 |
-
|
1517 |
-
this.emitEvent( 'transitionEnd', [ this ] );
|
1518 |
-
};
|
1519 |
-
|
1520 |
-
Item.prototype.disableTransition = function() {
|
1521 |
-
this.removeTransitionStyles();
|
1522 |
-
this.element.removeEventListener( transitionEndEvent, this, false );
|
1523 |
-
this.isTransitioning = false;
|
1524 |
-
};
|
1525 |
-
|
1526 |
-
/**
|
1527 |
-
* removes style property from element
|
1528 |
-
* @param {Object} style
|
1529 |
-
**/
|
1530 |
-
Item.prototype._removeStyles = function( style ) {
|
1531 |
-
// clean up transition styles
|
1532 |
-
var cleanStyle = {};
|
1533 |
-
for ( var prop in style ) {
|
1534 |
-
cleanStyle[ prop ] = '';
|
1535 |
-
}
|
1536 |
-
this.css( cleanStyle );
|
1537 |
-
};
|
1538 |
-
|
1539 |
-
var cleanTransitionStyle = {
|
1540 |
-
transitionProperty: '',
|
1541 |
-
transitionDuration: ''
|
1542 |
-
};
|
1543 |
-
|
1544 |
-
Item.prototype.removeTransitionStyles = function() {
|
1545 |
-
// remove transition
|
1546 |
-
this.css( cleanTransitionStyle );
|
1547 |
-
};
|
1548 |
-
|
1549 |
-
// ----- show/hide/remove ----- //
|
1550 |
-
|
1551 |
-
// remove element from DOM
|
1552 |
-
Item.prototype.removeElem = function() {
|
1553 |
-
this.element.parentNode.removeChild( this.element );
|
1554 |
-
this.emitEvent( 'remove', [ this ] );
|
1555 |
-
};
|
1556 |
-
|
1557 |
-
Item.prototype.remove = function() {
|
1558 |
-
// just remove element if no transition support or no transition
|
1559 |
-
if ( !transitionProperty || !parseFloat( this.layout.options.transitionDuration ) ) {
|
1560 |
-
this.removeElem();
|
1561 |
-
return;
|
1562 |
-
}
|
1563 |
-
|
1564 |
-
// start transition
|
1565 |
-
var _this = this;
|
1566 |
-
this.on( 'transitionEnd', function() {
|
1567 |
-
_this.removeElem();
|
1568 |
-
return true; // bind once
|
1569 |
-
});
|
1570 |
-
this.hide();
|
1571 |
-
};
|
1572 |
-
|
1573 |
-
Item.prototype.reveal = function() {
|
1574 |
-
delete this.isHidden;
|
1575 |
-
// remove display: none
|
1576 |
-
this.css({ display: '' });
|
1577 |
-
|
1578 |
-
var options = this.layout.options;
|
1579 |
-
this.transition({
|
1580 |
-
from: options.hiddenStyle,
|
1581 |
-
to: options.visibleStyle,
|
1582 |
-
isCleaning: true
|
1583 |
-
});
|
1584 |
-
};
|
1585 |
-
|
1586 |
-
Item.prototype.hide = function() {
|
1587 |
-
// set flag
|
1588 |
-
this.isHidden = true;
|
1589 |
-
// remove display: none
|
1590 |
-
this.css({ display: '' });
|
1591 |
-
|
1592 |
-
var options = this.layout.options;
|
1593 |
-
this.transition({
|
1594 |
-
from: options.visibleStyle,
|
1595 |
-
to: options.hiddenStyle,
|
1596 |
-
// keep hidden stuff hidden
|
1597 |
-
isCleaning: true,
|
1598 |
-
onTransitionEnd: {
|
1599 |
-
opacity: function() {
|
1600 |
-
// check if still hidden
|
1601 |
-
// during transition, item may have been un-hidden
|
1602 |
-
if ( this.isHidden ) {
|
1603 |
-
this.css({ display: 'none' });
|
1604 |
-
}
|
1605 |
-
}
|
1606 |
-
}
|
1607 |
-
});
|
1608 |
-
};
|
1609 |
-
|
1610 |
-
Item.prototype.destroy = function() {
|
1611 |
-
this.css({
|
1612 |
-
position: '',
|
1613 |
-
left: '',
|
1614 |
-
right: '',
|
1615 |
-
top: '',
|
1616 |
-
bottom: '',
|
1617 |
-
transition: '',
|
1618 |
-
transform: ''
|
1619 |
-
});
|
1620 |
-
};
|
1621 |
-
|
1622 |
-
return Item;
|
1623 |
-
|
1624 |
-
}
|
1625 |
-
|
1626 |
-
// -------------------------- transport -------------------------- //
|
1627 |
-
|
1628 |
-
if ( typeof define === 'function' && define.amd ) {
|
1629 |
-
// AMD
|
1630 |
-
define( 'outlayer/item',[
|
1631 |
-
'eventEmitter/EventEmitter',
|
1632 |
-
'get-size/get-size',
|
1633 |
-
'get-style-property/get-style-property'
|
1634 |
-
],
|
1635 |
-
outlayerItemDefinition );
|
1636 |
-
} else {
|
1637 |
-
// browser global
|
1638 |
-
window.Outlayer = {};
|
1639 |
-
window.Outlayer.Item = outlayerItemDefinition(
|
1640 |
-
window.EventEmitter,
|
1641 |
-
window.getSize,
|
1642 |
-
window.getStyleProperty
|
1643 |
-
);
|
1644 |
-
}
|
1645 |
-
|
1646 |
-
})( window );
|
1647 |
-
|
1648 |
-
/*!
|
1649 |
-
* Outlayer v1.1.9
|
1650 |
-
* the brains and guts of a layout library
|
1651 |
-
*/
|
1652 |
-
|
1653 |
-
( function( window ) {
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
// ----- vars ----- //
|
1658 |
-
|
1659 |
-
var document = window.document;
|
1660 |
-
var console = window.console;
|
1661 |
-
var jQuery = window.jQuery;
|
1662 |
-
|
1663 |
-
var noop = function() {};
|
1664 |
-
|
1665 |
-
// -------------------------- helpers -------------------------- //
|
1666 |
-
|
1667 |
-
// extend objects
|
1668 |
-
function extend( a, b ) {
|
1669 |
-
for ( var prop in b ) {
|
1670 |
-
a[ prop ] = b[ prop ];
|
1671 |
-
}
|
1672 |
-
return a;
|
1673 |
-
}
|
1674 |
-
|
1675 |
-
|
1676 |
-
var objToString = Object.prototype.toString;
|
1677 |
-
function isArray( obj ) {
|
1678 |
-
return objToString.call( obj ) === '[object Array]';
|
1679 |
-
}
|
1680 |
-
|
1681 |
-
// turn element or nodeList into an array
|
1682 |
-
function makeArray( obj ) {
|
1683 |
-
var ary = [];
|
1684 |
-
if ( isArray( obj ) ) {
|
1685 |
-
// use object if already an array
|
1686 |
-
ary = obj;
|
1687 |
-
} else if ( obj && typeof obj.length === 'number' ) {
|
1688 |
-
// convert nodeList to array
|
1689 |
-
for ( var i=0, len = obj.length; i < len; i++ ) {
|
1690 |
-
ary.push( obj[i] );
|
1691 |
-
}
|
1692 |
-
} else {
|
1693 |
-
// array of single index
|
1694 |
-
ary.push( obj );
|
1695 |
-
}
|
1696 |
-
return ary;
|
1697 |
-
}
|
1698 |
-
|
1699 |
-
// http://stackoverflow.com/a/384380/182183
|
1700 |
-
var isElement = ( typeof HTMLElement === 'object' ) ?
|
1701 |
-
function isElementDOM2( obj ) {
|
1702 |
-
return obj instanceof HTMLElement;
|
1703 |
-
} :
|
1704 |
-
function isElementQuirky( obj ) {
|
1705 |
-
return obj && typeof obj === 'object' &&
|
1706 |
-
obj.nodeType === 1 && typeof obj.nodeName === 'string';
|
1707 |
-
};
|
1708 |
-
|
1709 |
-
// index of helper cause IE8
|
1710 |
-
var indexOf = Array.prototype.indexOf ? function( ary, obj ) {
|
1711 |
-
return ary.indexOf( obj );
|
1712 |
-
} : function( ary, obj ) {
|
1713 |
-
for ( var i=0, len = ary.length; i < len; i++ ) {
|
1714 |
-
if ( ary[i] === obj ) {
|
1715 |
-
return i;
|
1716 |
-
}
|
1717 |
-
}
|
1718 |
-
return -1;
|
1719 |
-
};
|
1720 |
-
|
1721 |
-
function removeFrom( obj, ary ) {
|
1722 |
-
var index = indexOf( ary, obj );
|
1723 |
-
if ( index !== -1 ) {
|
1724 |
-
ary.splice( index, 1 );
|
1725 |
-
}
|
1726 |
-
}
|
1727 |
-
|
1728 |
-
// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
|
1729 |
-
function toDashed( str ) {
|
1730 |
-
return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
|
1731 |
-
return $1 + '-' + $2;
|
1732 |
-
}).toLowerCase();
|
1733 |
-
}
|
1734 |
-
|
1735 |
-
|
1736 |
-
function outlayerDefinition( eventie, docReady, EventEmitter, getSize, matchesSelector, Item ) {
|
1737 |
-
|
1738 |
-
// -------------------------- Outlayer -------------------------- //
|
1739 |
-
|
1740 |
-
// globally unique identifiers
|
1741 |
-
var GUID = 0;
|
1742 |
-
// internal store of all Outlayer intances
|
1743 |
-
var instances = {};
|
1744 |
-
|
1745 |
-
|
1746 |
-
/**
|
1747 |
-
* @param {Element, String} element
|
1748 |
-
* @param {Object} options
|
1749 |
-
* @constructor
|
1750 |
-
*/
|
1751 |
-
function Outlayer( element, options ) {
|
1752 |
-
// use element as selector string
|
1753 |
-
if ( typeof element === 'string' ) {
|
1754 |
-
element = document.querySelector( element );
|
1755 |
-
}
|
1756 |
-
|
1757 |
-
// bail out if not proper element
|
1758 |
-
if ( !element || !isElement( element ) ) {
|
1759 |
-
if ( console ) {
|
1760 |
-
console.error( 'Bad ' + this.settings.namespace + ' element: ' + element );
|
1761 |
-
}
|
1762 |
-
return;
|
1763 |
-
}
|
1764 |
-
|
1765 |
-
this.element = element;
|
1766 |
-
|
1767 |
-
// options
|
1768 |
-
this.options = extend( {}, this.options );
|
1769 |
-
this.option( options );
|
1770 |
-
|
1771 |
-
// add id for Outlayer.getFromElement
|
1772 |
-
var id = ++GUID;
|
1773 |
-
this.element.outlayerGUID = id; // expando
|
1774 |
-
instances[ id ] = this; // associate via id
|
1775 |
-
|
1776 |
-
// kick it off
|
1777 |
-
this._create();
|
1778 |
-
|
1779 |
-
if ( this.options.isInitLayout ) {
|
1780 |
-
this.layout();
|
1781 |
-
}
|
1782 |
-
}
|
1783 |
-
|
1784 |
-
// settings are for internal use only
|
1785 |
-
Outlayer.prototype.settings = {
|
1786 |
-
namespace: 'outlayer',
|
1787 |
-
item: Item
|
1788 |
-
};
|
1789 |
-
|
1790 |
-
// default options
|
1791 |
-
Outlayer.prototype.options = {
|
1792 |
-
containerStyle: {
|
1793 |
-
position: 'relative'
|
1794 |
-
},
|
1795 |
-
isInitLayout: true,
|
1796 |
-
isOriginLeft: true,
|
1797 |
-
isOriginTop: true,
|
1798 |
-
isResizeBound: true,
|
1799 |
-
// item options
|
1800 |
-
transitionDuration: '0.4s',
|
1801 |
-
hiddenStyle: {
|
1802 |
-
opacity: 0,
|
1803 |
-
transform: 'scale(0.001)'
|
1804 |
-
},
|
1805 |
-
visibleStyle: {
|
1806 |
-
opacity: 1,
|
1807 |
-
transform: 'scale(1)'
|
1808 |
-
}
|
1809 |
-
};
|
1810 |
-
|
1811 |
-
// inherit EventEmitter
|
1812 |
-
extend( Outlayer.prototype, EventEmitter.prototype );
|
1813 |
-
|
1814 |
-
/**
|
1815 |
-
* set options
|
1816 |
-
* @param {Object} opts
|
1817 |
-
*/
|
1818 |
-
Outlayer.prototype.option = function( opts ) {
|
1819 |
-
extend( this.options, opts );
|
1820 |
-
};
|
1821 |
-
|
1822 |
-
Outlayer.prototype._create = function() {
|
1823 |
-
// get items from children
|
1824 |
-
this.reloadItems();
|
1825 |
-
// elements that affect layout, but are not laid out
|
1826 |
-
this.stamps = [];
|
1827 |
-
this.stamp( this.options.stamp );
|
1828 |
-
// set container style
|
1829 |
-
extend( this.element.style, this.options.containerStyle );
|
1830 |
-
|
1831 |
-
// bind resize method
|
1832 |
-
if ( this.options.isResizeBound ) {
|
1833 |
-
this.bindResize();
|
1834 |
-
}
|
1835 |
-
};
|
1836 |
-
|
1837 |
-
// goes through all children again and gets bricks in proper order
|
1838 |
-
Outlayer.prototype.reloadItems = function() {
|
1839 |
-
// collection of item elements
|
1840 |
-
this.items = this._itemize( this.element.children );
|
1841 |
-
};
|
1842 |
-
|
1843 |
-
|
1844 |
-
/**
|
1845 |
-
* turn elements into Outlayer.Items to be used in layout
|
1846 |
-
* @param {Array or NodeList or HTMLElement} elems
|
1847 |
-
* @returns {Array} items - collection of new Outlayer Items
|
1848 |
-
*/
|
1849 |
-
Outlayer.prototype._itemize = function( elems ) {
|
1850 |
-
|
1851 |
-
var itemElems = this._filterFindItemElements( elems );
|
1852 |
-
var Item = this.settings.item;
|
1853 |
-
|
1854 |
-
// create new Outlayer Items for collection
|
1855 |
-
var items = [];
|
1856 |
-
for ( var i=0, len = itemElems.length; i < len; i++ ) {
|
1857 |
-
var elem = itemElems[i];
|
1858 |
-
var item = new Item( elem, this );
|
1859 |
-
items.push( item );
|
1860 |
-
}
|
1861 |
-
|
1862 |
-
return items;
|
1863 |
-
};
|
1864 |
-
|
1865 |
-
/**
|
1866 |
-
* get item elements to be used in layout
|
1867 |
-
* @param {Array or NodeList or HTMLElement} elems
|
1868 |
-
* @returns {Array} items - item elements
|
1869 |
-
*/
|
1870 |
-
Outlayer.prototype._filterFindItemElements = function( elems ) {
|
1871 |
-
// make array of elems
|
1872 |
-
elems = makeArray( elems );
|
1873 |
-
var itemSelector = this.options.itemSelector;
|
1874 |
-
var itemElems = [];
|
1875 |
-
|
1876 |
-
for ( var i=0, len = elems.length; i < len; i++ ) {
|
1877 |
-
var elem = elems[i];
|
1878 |
-
// check that elem is an actual element
|
1879 |
-
if ( !isElement( elem ) ) {
|
1880 |
-
continue;
|
1881 |
-
}
|
1882 |
-
// filter & find items if we have an item selector
|
1883 |
-
if ( itemSelector ) {
|
1884 |
-
// filter siblings
|
1885 |
-
if ( matchesSelector( elem, itemSelector ) ) {
|
1886 |
-
itemElems.push( elem );
|
1887 |
-
}
|
1888 |
-
// find children
|
1889 |
-
var childElems = elem.querySelectorAll( itemSelector );
|
1890 |
-
// concat childElems to filterFound array
|
1891 |
-
for ( var j=0, jLen = childElems.length; j < jLen; j++ ) {
|
1892 |
-
itemElems.push( childElems[j] );
|
1893 |
-
}
|
1894 |
-
} else {
|
1895 |
-
itemElems.push( elem );
|
1896 |
-
}
|
1897 |
-
}
|
1898 |
-
|
1899 |
-
return itemElems;
|
1900 |
-
};
|
1901 |
-
|
1902 |
-
/**
|
1903 |
-
* getter method for getting item elements
|
1904 |
-
* @returns {Array} elems - collection of item elements
|
1905 |
-
*/
|
1906 |
-
Outlayer.prototype.getItemElements = function() {
|
1907 |
-
var elems = [];
|
1908 |
-
for ( var i=0, len = this.items.length; i < len; i++ ) {
|
1909 |
-
elems.push( this.items[i].element );
|
1910 |
-
}
|
1911 |
-
return elems;
|
1912 |
-
};
|
1913 |
-
|
1914 |
-
// ----- init & layout ----- //
|
1915 |
-
|
1916 |
-
/**
|
1917 |
-
* lays out all items
|
1918 |
-
*/
|
1919 |
-
Outlayer.prototype.layout = function() {
|
1920 |
-
this._resetLayout();
|
1921 |
-
this._manageStamps();
|
1922 |
-
|
1923 |
-
// don't animate first layout
|
1924 |
-
var isInstant = this.options.isLayoutInstant !== undefined ?
|
1925 |
-
this.options.isLayoutInstant : !this._isLayoutInited;
|
1926 |
-
this.layoutItems( this.items, isInstant );
|
1927 |
-
|
1928 |
-
// flag for initalized
|
1929 |
-
this._isLayoutInited = true;
|
1930 |
-
};
|
1931 |
-
|
1932 |
-
// _init is alias for layout
|
1933 |
-
Outlayer.prototype._init = Outlayer.prototype.layout;
|
1934 |
-
|
1935 |
-
/**
|
1936 |
-
* logic before any new layout
|
1937 |
-
*/
|
1938 |
-
Outlayer.prototype._resetLayout = function() {
|
1939 |
-
this.getSize();
|
1940 |
-
};
|
1941 |
-
|
1942 |
-
|
1943 |
-
Outlayer.prototype.getSize = function() {
|
1944 |
-
this.size = getSize( this.element );
|
1945 |
-
};
|
1946 |
-
|
1947 |
-
/**
|
1948 |
-
* get measurement from option, for columnWidth, rowHeight, gutter
|
1949 |
-
* if option is String -> get element from selector string, & get size of element
|
1950 |
-
* if option is Element -> get size of element
|
1951 |
-
* else use option as a number
|
1952 |
-
*
|
1953 |
-
* @param {String} measurement
|
1954 |
-
* @param {String} size - width or height
|
1955 |
-
* @private
|
1956 |
-
*/
|
1957 |
-
Outlayer.prototype._getMeasurement = function( measurement, size ) {
|
1958 |
-
var option = this.options[ measurement ];
|
1959 |
-
var elem;
|
1960 |
-
if ( !option ) {
|
1961 |
-
// default to 0
|
1962 |
-
this[ measurement ] = 0;
|
1963 |
-
} else {
|
1964 |
-
if ( typeof option === 'string' ) {
|
1965 |
-
elem = this.element.querySelector( option );
|
1966 |
-
} else if ( isElement( option ) ) {
|
1967 |
-
elem = option;
|
1968 |
-
}
|
1969 |
-
// use size of element, if element
|
1970 |
-
this[ measurement ] = elem ? getSize( elem )[ size ] : option;
|
1971 |
-
}
|
1972 |
-
};
|
1973 |
-
|
1974 |
-
/**
|
1975 |
-
* layout a collection of item elements
|
1976 |
-
* @api public
|
1977 |
-
*/
|
1978 |
-
Outlayer.prototype.layoutItems = function( items, isInstant ) {
|
1979 |
-
items = this._getItemsForLayout( items );
|
1980 |
-
|
1981 |
-
this._layoutItems( items, isInstant );
|
1982 |
-
|
1983 |
-
this._postLayout();
|
1984 |
-
};
|
1985 |
-
|
1986 |
-
/**
|
1987 |
-
* get the items to be laid out
|
1988 |
-
* you may want to skip over some items
|
1989 |
-
* @param {Array} items
|
1990 |
-
* @returns {Array} items
|
1991 |
-
*/
|
1992 |
-
Outlayer.prototype._getItemsForLayout = function( items ) {
|
1993 |
-
var layoutItems = [];
|
1994 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
1995 |
-
var item = items[i];
|
1996 |
-
if ( !item.isIgnored ) {
|
1997 |
-
layoutItems.push( item );
|
1998 |
-
}
|
1999 |
-
}
|
2000 |
-
return layoutItems;
|
2001 |
-
};
|
2002 |
-
|
2003 |
-
/**
|
2004 |
-
* layout items
|
2005 |
-
* @param {Array} items
|
2006 |
-
* @param {Boolean} isInstant
|
2007 |
-
*/
|
2008 |
-
Outlayer.prototype._layoutItems = function( items, isInstant ) {
|
2009 |
-
if ( !items || !items.length ) {
|
2010 |
-
// no items, emit event with empty array
|
2011 |
-
this.emitEvent( 'layoutComplete', [ this, items ] );
|
2012 |
-
return;
|
2013 |
-
}
|
2014 |
-
|
2015 |
-
// emit layoutComplete when done
|
2016 |
-
this._itemsOn( items, 'layout', function onItemsLayout() {
|
2017 |
-
this.emitEvent( 'layoutComplete', [ this, items ] );
|
2018 |
-
});
|
2019 |
-
|
2020 |
-
var queue = [];
|
2021 |
-
|
2022 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
2023 |
-
var item = items[i];
|
2024 |
-
// get x/y object from method
|
2025 |
-
var position = this._getItemLayoutPosition( item );
|
2026 |
-
// enqueue
|
2027 |
-
position.item = item;
|
2028 |
-
position.isInstant = isInstant;
|
2029 |
-
queue.push( position );
|
2030 |
-
}
|
2031 |
-
|
2032 |
-
this._processLayoutQueue( queue );
|
2033 |
-
};
|
2034 |
-
|
2035 |
-
/**
|
2036 |
-
* get item layout position
|
2037 |
-
* @param {Outlayer.Item} item
|
2038 |
-
* @returns {Object} x and y position
|
2039 |
-
*/
|
2040 |
-
Outlayer.prototype._getItemLayoutPosition = function( /* item */ ) {
|
2041 |
-
return {
|
2042 |
-
x: 0,
|
2043 |
-
y: 0
|
2044 |
-
};
|
2045 |
-
};
|
2046 |
-
|
2047 |
-
/**
|
2048 |
-
* iterate over array and position each item
|
2049 |
-
* Reason being - separating this logic prevents 'layout invalidation'
|
2050 |
-
* thx @paul_irish
|
2051 |
-
* @param {Array} queue
|
2052 |
-
*/
|
2053 |
-
Outlayer.prototype._processLayoutQueue = function( queue ) {
|
2054 |
-
for ( var i=0, len = queue.length; i < len; i++ ) {
|
2055 |
-
var obj = queue[i];
|
2056 |
-
this._positionItem( obj.item, obj.x, obj.y, obj.isInstant );
|
2057 |
-
}
|
2058 |
-
};
|
2059 |
-
|
2060 |
-
/**
|
2061 |
-
* Sets position of item in DOM
|
2062 |
-
* @param {Outlayer.Item} item
|
2063 |
-
* @param {Number} x - horizontal position
|
2064 |
-
* @param {Number} y - vertical position
|
2065 |
-
* @param {Boolean} isInstant - disables transitions
|
2066 |
-
*/
|
2067 |
-
Outlayer.prototype._positionItem = function( item, x, y, isInstant ) {
|
2068 |
-
if ( isInstant ) {
|
2069 |
-
// if not transition, just set CSS
|
2070 |
-
item.goTo( x, y );
|
2071 |
-
} else {
|
2072 |
-
item.moveTo( x, y );
|
2073 |
-
}
|
2074 |
-
};
|
2075 |
-
|
2076 |
-
/**
|
2077 |
-
* Any logic you want to do after each layout,
|
2078 |
-
* i.e. size the container
|
2079 |
-
*/
|
2080 |
-
Outlayer.prototype._postLayout = function() {
|
2081 |
-
var size = this._getContainerSize();
|
2082 |
-
if ( size ) {
|
2083 |
-
this._setContainerMeasure( size.width, true );
|
2084 |
-
this._setContainerMeasure( size.height, false );
|
2085 |
-
}
|
2086 |
-
};
|
2087 |
-
|
2088 |
-
/**
|
2089 |
-
* @returns {Object} size
|
2090 |
-
* @param {Number} width
|
2091 |
-
* @param {Number} height
|
2092 |
-
*/
|
2093 |
-
Outlayer.prototype._getContainerSize = noop;
|
2094 |
-
|
2095 |
-
/**
|
2096 |
-
* @param {Number} measure - size of width or height
|
2097 |
-
* @param {Boolean} isWidth
|
2098 |
-
*/
|
2099 |
-
Outlayer.prototype._setContainerMeasure = function( measure, isWidth ) {
|
2100 |
-
if ( measure === undefined ) {
|
2101 |
-
return;
|
2102 |
-
}
|
2103 |
-
|
2104 |
-
var elemSize = this.size;
|
2105 |
-
// add padding and border width if border box
|
2106 |
-
if ( elemSize.isBorderBox ) {
|
2107 |
-
measure += isWidth ? elemSize.paddingLeft + elemSize.paddingRight +
|
2108 |
-
elemSize.borderLeftWidth + elemSize.borderRightWidth :
|
2109 |
-
elemSize.paddingBottom + elemSize.paddingTop +
|
2110 |
-
elemSize.borderTopWidth + elemSize.borderBottomWidth;
|
2111 |
-
}
|
2112 |
-
|
2113 |
-
measure = Math.max( measure, 0 );
|
2114 |
-
this.element.style[ isWidth ? 'width' : 'height' ] = measure + 'px';
|
2115 |
-
};
|
2116 |
-
|
2117 |
-
/**
|
2118 |
-
* trigger a callback for a collection of items events
|
2119 |
-
* @param {Array} items - Outlayer.Items
|
2120 |
-
* @param {String} eventName
|
2121 |
-
* @param {Function} callback
|
2122 |
-
*/
|
2123 |
-
Outlayer.prototype._itemsOn = function( items, eventName, callback ) {
|
2124 |
-
var doneCount = 0;
|
2125 |
-
var count = items.length;
|
2126 |
-
// event callback
|
2127 |
-
var _this = this;
|
2128 |
-
function tick() {
|
2129 |
-
doneCount++;
|
2130 |
-
if ( doneCount === count ) {
|
2131 |
-
callback.call( _this );
|
2132 |
-
}
|
2133 |
-
return true; // bind once
|
2134 |
-
}
|
2135 |
-
// bind callback
|
2136 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
2137 |
-
var item = items[i];
|
2138 |
-
item.on( eventName, tick );
|
2139 |
-
}
|
2140 |
-
};
|
2141 |
-
|
2142 |
-
// -------------------------- ignore & stamps -------------------------- //
|
2143 |
-
|
2144 |
-
|
2145 |
-
/**
|
2146 |
-
* keep item in collection, but do not lay it out
|
2147 |
-
* ignored items do not get skipped in layout
|
2148 |
-
* @param {Element} elem
|
2149 |
-
*/
|
2150 |
-
Outlayer.prototype.ignore = function( elem ) {
|
2151 |
-
var item = this.getItem( elem );
|
2152 |
-
if ( item ) {
|
2153 |
-
item.isIgnored = true;
|
2154 |
-
}
|
2155 |
-
};
|
2156 |
-
|
2157 |
-
/**
|
2158 |
-
* return item to layout collection
|
2159 |
-
* @param {Element} elem
|
2160 |
-
*/
|
2161 |
-
Outlayer.prototype.unignore = function( elem ) {
|
2162 |
-
var item = this.getItem( elem );
|
2163 |
-
if ( item ) {
|
2164 |
-
delete item.isIgnored;
|
2165 |
-
}
|
2166 |
-
};
|
2167 |
-
|
2168 |
-
/**
|
2169 |
-
* adds elements to stamps
|
2170 |
-
* @param {NodeList, Array, Element, or String} elems
|
2171 |
-
*/
|
2172 |
-
Outlayer.prototype.stamp = function( elems ) {
|
2173 |
-
elems = this._find( elems );
|
2174 |
-
if ( !elems ) {
|
2175 |
-
return;
|
2176 |
-
}
|
2177 |
-
|
2178 |
-
this.stamps = this.stamps.concat( elems );
|
2179 |
-
// ignore
|
2180 |
-
for ( var i=0, len = elems.length; i < len; i++ ) {
|
2181 |
-
var elem = elems[i];
|
2182 |
-
this.ignore( elem );
|
2183 |
-
}
|
2184 |
-
};
|
2185 |
-
|
2186 |
-
/**
|
2187 |
-
* removes elements to stamps
|
2188 |
-
* @param {NodeList, Array, or Element} elems
|
2189 |
-
*/
|
2190 |
-
Outlayer.prototype.unstamp = function( elems ) {
|
2191 |
-
elems = this._find( elems );
|
2192 |
-
if ( !elems ){
|
2193 |
-
return;
|
2194 |
-
}
|
2195 |
-
|
2196 |
-
for ( var i=0, len = elems.length; i < len; i++ ) {
|
2197 |
-
var elem = elems[i];
|
2198 |
-
// filter out removed stamp elements
|
2199 |
-
removeFrom( elem, this.stamps );
|
2200 |
-
this.unignore( elem );
|
2201 |
-
}
|
2202 |
-
|
2203 |
-
};
|
2204 |
-
|
2205 |
-
/**
|
2206 |
-
* finds child elements
|
2207 |
-
* @param {NodeList, Array, Element, or String} elems
|
2208 |
-
* @returns {Array} elems
|
2209 |
-
*/
|
2210 |
-
Outlayer.prototype._find = function( elems ) {
|
2211 |
-
if ( !elems ) {
|
2212 |
-
return;
|
2213 |
-
}
|
2214 |
-
// if string, use argument as selector string
|
2215 |
-
if ( typeof elems === 'string' ) {
|
2216 |
-
elems = this.element.querySelectorAll( elems );
|
2217 |
-
}
|
2218 |
-
elems = makeArray( elems );
|
2219 |
-
return elems;
|
2220 |
-
};
|
2221 |
-
|
2222 |
-
Outlayer.prototype._manageStamps = function() {
|
2223 |
-
if ( !this.stamps || !this.stamps.length ) {
|
2224 |
-
return;
|
2225 |
-
}
|
2226 |
-
|
2227 |
-
this._getBoundingRect();
|
2228 |
-
|
2229 |
-
for ( var i=0, len = this.stamps.length; i < len; i++ ) {
|
2230 |
-
var stamp = this.stamps[i];
|
2231 |
-
this._manageStamp( stamp );
|
2232 |
-
}
|
2233 |
-
};
|
2234 |
-
|
2235 |
-
// update boundingLeft / Top
|
2236 |
-
Outlayer.prototype._getBoundingRect = function() {
|
2237 |
-
// get bounding rect for container element
|
2238 |
-
var boundingRect = this.element.getBoundingClientRect();
|
2239 |
-
var size = this.size;
|
2240 |
-
this._boundingRect = {
|
2241 |
-
left: boundingRect.left + size.paddingLeft + size.borderLeftWidth,
|
2242 |
-
top: boundingRect.top + size.paddingTop + size.borderTopWidth,
|
2243 |
-
right: boundingRect.right - ( size.paddingRight + size.borderRightWidth ),
|
2244 |
-
bottom: boundingRect.bottom - ( size.paddingBottom + size.borderBottomWidth )
|
2245 |
-
};
|
2246 |
-
};
|
2247 |
-
|
2248 |
-
/**
|
2249 |
-
* @param {Element} stamp
|
2250 |
-
**/
|
2251 |
-
Outlayer.prototype._manageStamp = noop;
|
2252 |
-
|
2253 |
-
/**
|
2254 |
-
* get x/y position of element relative to container element
|
2255 |
-
* @param {Element} elem
|
2256 |
-
* @returns {Object} offset - has left, top, right, bottom
|
2257 |
-
*/
|
2258 |
-
Outlayer.prototype._getElementOffset = function( elem ) {
|
2259 |
-
var boundingRect = elem.getBoundingClientRect();
|
2260 |
-
var thisRect = this._boundingRect;
|
2261 |
-
var size = getSize( elem );
|
2262 |
-
var offset = {
|
2263 |
-
left: boundingRect.left - thisRect.left - size.marginLeft,
|
2264 |
-
top: boundingRect.top - thisRect.top - size.marginTop,
|
2265 |
-
right: thisRect.right - boundingRect.right - size.marginRight,
|
2266 |
-
bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom
|
2267 |
-
};
|
2268 |
-
return offset;
|
2269 |
-
};
|
2270 |
-
|
2271 |
-
// -------------------------- resize -------------------------- //
|
2272 |
-
|
2273 |
-
// enable event handlers for listeners
|
2274 |
-
// i.e. resize -> onresize
|
2275 |
-
Outlayer.prototype.handleEvent = function( event ) {
|
2276 |
-
var method = 'on' + event.type;
|
2277 |
-
if ( this[ method ] ) {
|
2278 |
-
this[ method ]( event );
|
2279 |
-
}
|
2280 |
-
};
|
2281 |
-
|
2282 |
-
/**
|
2283 |
-
* Bind layout to window resizing
|
2284 |
-
*/
|
2285 |
-
Outlayer.prototype.bindResize = function() {
|
2286 |
-
// bind just one listener
|
2287 |
-
if ( this.isResizeBound ) {
|
2288 |
-
return;
|
2289 |
-
}
|
2290 |
-
eventie.bind( window, 'resize', this );
|
2291 |
-
this.isResizeBound = true;
|
2292 |
-
};
|
2293 |
-
|
2294 |
-
/**
|
2295 |
-
* Unbind layout to window resizing
|
2296 |
-
*/
|
2297 |
-
Outlayer.prototype.unbindResize = function() {
|
2298 |
-
eventie.unbind( window, 'resize', this );
|
2299 |
-
this.isResizeBound = false;
|
2300 |
-
};
|
2301 |
-
|
2302 |
-
// original debounce by John Hann
|
2303 |
-
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
|
2304 |
-
|
2305 |
-
// this fires every resize
|
2306 |
-
Outlayer.prototype.onresize = function() {
|
2307 |
-
if ( this.resizeTimeout ) {
|
2308 |
-
clearTimeout( this.resizeTimeout );
|
2309 |
-
}
|
2310 |
-
|
2311 |
-
var _this = this;
|
2312 |
-
function delayed() {
|
2313 |
-
_this.resize();
|
2314 |
-
delete _this.resizeTimeout;
|
2315 |
-
}
|
2316 |
-
|
2317 |
-
this.resizeTimeout = setTimeout( delayed, 100 );
|
2318 |
-
};
|
2319 |
-
|
2320 |
-
// debounced, layout on resize
|
2321 |
-
Outlayer.prototype.resize = function() {
|
2322 |
-
// don't trigger if size did not change
|
2323 |
-
var size = getSize( this.element );
|
2324 |
-
// check that this.size and size are there
|
2325 |
-
// IE8 triggers resize on body size change, so they might not be
|
2326 |
-
var hasSizes = this.size && size;
|
2327 |
-
if ( hasSizes && size.innerWidth === this.size.innerWidth ) {
|
2328 |
-
return;
|
2329 |
-
}
|
2330 |
-
|
2331 |
-
this.layout();
|
2332 |
-
};
|
2333 |
-
|
2334 |
-
|
2335 |
-
// -------------------------- methods -------------------------- //
|
2336 |
-
|
2337 |
-
/**
|
2338 |
-
* add items to Outlayer instance
|
2339 |
-
* @param {Array or NodeList or Element} elems
|
2340 |
-
* @returns {Array} items - Outlayer.Items
|
2341 |
-
**/
|
2342 |
-
Outlayer.prototype.addItems = function( elems ) {
|
2343 |
-
var items = this._itemize( elems );
|
2344 |
-
// add items to collection
|
2345 |
-
if ( items.length ) {
|
2346 |
-
this.items = this.items.concat( items );
|
2347 |
-
}
|
2348 |
-
return items;
|
2349 |
-
};
|
2350 |
-
|
2351 |
-
/**
|
2352 |
-
* Layout newly-appended item elements
|
2353 |
-
* @param {Array or NodeList or Element} elems
|
2354 |
-
*/
|
2355 |
-
Outlayer.prototype.appended = function( elems ) {
|
2356 |
-
var items = this.addItems( elems );
|
2357 |
-
if ( !items.length ) {
|
2358 |
-
return;
|
2359 |
-
}
|
2360 |
-
// layout and reveal just the new items
|
2361 |
-
this.layoutItems( items, true );
|
2362 |
-
this.reveal( items );
|
2363 |
-
};
|
2364 |
-
|
2365 |
-
/**
|
2366 |
-
* Layout prepended elements
|
2367 |
-
* @param {Array or NodeList or Element} elems
|
2368 |
-
*/
|
2369 |
-
Outlayer.prototype.prepended = function( elems ) {
|
2370 |
-
var items = this._itemize( elems );
|
2371 |
-
if ( !items.length ) {
|
2372 |
-
return;
|
2373 |
-
}
|
2374 |
-
// add items to beginning of collection
|
2375 |
-
var previousItems = this.items.slice(0);
|
2376 |
-
this.items = items.concat( previousItems );
|
2377 |
-
// start new layout
|
2378 |
-
this._resetLayout();
|
2379 |
-
this._manageStamps();
|
2380 |
-
// layout new stuff without transition
|
2381 |
-
this.layoutItems( items, true );
|
2382 |
-
this.reveal( items );
|
2383 |
-
// layout previous items
|
2384 |
-
this.layoutItems( previousItems );
|
2385 |
-
};
|
2386 |
-
|
2387 |
-
/**
|
2388 |
-
* reveal a collection of items
|
2389 |
-
* @param {Array of Outlayer.Items} items
|
2390 |
-
*/
|
2391 |
-
Outlayer.prototype.reveal = function( items ) {
|
2392 |
-
if ( !items || !items.length ) {
|
2393 |
-
return;
|
2394 |
-
}
|
2395 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
2396 |
-
var item = items[i];
|
2397 |
-
item.reveal();
|
2398 |
-
}
|
2399 |
-
};
|
2400 |
-
|
2401 |
-
/**
|
2402 |
-
* hide a collection of items
|
2403 |
-
* @param {Array of Outlayer.Items} items
|
2404 |
-
*/
|
2405 |
-
Outlayer.prototype.hide = function( items ) {
|
2406 |
-
if ( !items || !items.length ) {
|
2407 |
-
return;
|
2408 |
-
}
|
2409 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
2410 |
-
var item = items[i];
|
2411 |
-
item.hide();
|
2412 |
-
}
|
2413 |
-
};
|
2414 |
-
|
2415 |
-
/**
|
2416 |
-
* get Outlayer.Item, given an Element
|
2417 |
-
* @param {Element} elem
|
2418 |
-
* @param {Function} callback
|
2419 |
-
* @returns {Outlayer.Item} item
|
2420 |
-
*/
|
2421 |
-
Outlayer.prototype.getItem = function( elem ) {
|
2422 |
-
// loop through items to get the one that matches
|
2423 |
-
for ( var i=0, len = this.items.length; i < len; i++ ) {
|
2424 |
-
var item = this.items[i];
|
2425 |
-
if ( item.element === elem ) {
|
2426 |
-
// return item
|
2427 |
-
return item;
|
2428 |
-
}
|
2429 |
-
}
|
2430 |
-
};
|
2431 |
-
|
2432 |
-
/**
|
2433 |
-
* get collection of Outlayer.Items, given Elements
|
2434 |
-
* @param {Array} elems
|
2435 |
-
* @returns {Array} items - Outlayer.Items
|
2436 |
-
*/
|
2437 |
-
Outlayer.prototype.getItems = function( elems ) {
|
2438 |
-
if ( !elems || !elems.length ) {
|
2439 |
-
return;
|
2440 |
-
}
|
2441 |
-
var items = [];
|
2442 |
-
for ( var i=0, len = elems.length; i < len; i++ ) {
|
2443 |
-
var elem = elems[i];
|
2444 |
-
var item = this.getItem( elem );
|
2445 |
-
if ( item ) {
|
2446 |
-
items.push( item );
|
2447 |
-
}
|
2448 |
-
}
|
2449 |
-
|
2450 |
-
return items;
|
2451 |
-
};
|
2452 |
-
|
2453 |
-
/**
|
2454 |
-
* remove element(s) from instance and DOM
|
2455 |
-
* @param {Array or NodeList or Element} elems
|
2456 |
-
*/
|
2457 |
-
Outlayer.prototype.remove = function( elems ) {
|
2458 |
-
elems = makeArray( elems );
|
2459 |
-
|
2460 |
-
var removeItems = this.getItems( elems );
|
2461 |
-
// bail if no items to remove
|
2462 |
-
if ( !removeItems || !removeItems.length ) {
|
2463 |
-
return;
|
2464 |
-
}
|
2465 |
-
|
2466 |
-
this._itemsOn( removeItems, 'remove', function() {
|
2467 |
-
this.emitEvent( 'removeComplete', [ this, removeItems ] );
|
2468 |
-
});
|
2469 |
-
|
2470 |
-
for ( var i=0, len = removeItems.length; i < len; i++ ) {
|
2471 |
-
var item = removeItems[i];
|
2472 |
-
item.remove();
|
2473 |
-
// remove item from collection
|
2474 |
-
removeFrom( item, this.items );
|
2475 |
-
}
|
2476 |
-
};
|
2477 |
-
|
2478 |
-
// ----- destroy ----- //
|
2479 |
-
|
2480 |
-
// remove and disable Outlayer instance
|
2481 |
-
Outlayer.prototype.destroy = function() {
|
2482 |
-
// clean up dynamic styles
|
2483 |
-
var style = this.element.style;
|
2484 |
-
style.height = '';
|
2485 |
-
style.position = '';
|
2486 |
-
style.width = '';
|
2487 |
-
// destroy items
|
2488 |
-
for ( var i=0, len = this.items.length; i < len; i++ ) {
|
2489 |
-
var item = this.items[i];
|
2490 |
-
item.destroy();
|
2491 |
-
}
|
2492 |
-
|
2493 |
-
this.unbindResize();
|
2494 |
-
|
2495 |
-
delete this.element.outlayerGUID;
|
2496 |
-
// remove data for jQuery
|
2497 |
-
if ( jQuery ) {
|
2498 |
-
jQuery.removeData( this.element, this.settings.namespace );
|
2499 |
-
}
|
2500 |
-
|
2501 |
-
};
|
2502 |
-
|
2503 |
-
// -------------------------- data -------------------------- //
|
2504 |
-
|
2505 |
-
/**
|
2506 |
-
* get Outlayer instance from element
|
2507 |
-
* @param {Element} elem
|
2508 |
-
* @returns {Outlayer}
|
2509 |
-
*/
|
2510 |
-
Outlayer.data = function( elem ) {
|
2511 |
-
var id = elem && elem.outlayerGUID;
|
2512 |
-
return id && instances[ id ];
|
2513 |
-
};
|
2514 |
-
|
2515 |
-
// -------------------------- -------------------------- //
|
2516 |
-
|
2517 |
-
// copy an object on the Outlayer prototype
|
2518 |
-
// used in options and settings
|
2519 |
-
function copyOutlayerProto( obj, property ) {
|
2520 |
-
obj.prototype[ property ] = extend( {}, Outlayer.prototype[ property ] );
|
2521 |
-
}
|
2522 |
-
|
2523 |
-
// -------------------------- create Outlayer class -------------------------- //
|
2524 |
-
|
2525 |
-
/**
|
2526 |
-
* create a layout class
|
2527 |
-
* @param {String} namespace
|
2528 |
-
*/
|
2529 |
-
Outlayer.create = function( namespace, options ) {
|
2530 |
-
// sub-class Outlayer
|
2531 |
-
function Layout() {
|
2532 |
-
Outlayer.apply( this, arguments );
|
2533 |
-
}
|
2534 |
-
|
2535 |
-
extend( Layout.prototype, Outlayer.prototype );
|
2536 |
-
|
2537 |
-
copyOutlayerProto( Layout, 'options' );
|
2538 |
-
copyOutlayerProto( Layout, 'settings' );
|
2539 |
-
|
2540 |
-
extend( Layout.prototype.options, options );
|
2541 |
-
|
2542 |
-
Layout.prototype.settings.namespace = namespace;
|
2543 |
-
|
2544 |
-
Layout.data = Outlayer.data;
|
2545 |
-
|
2546 |
-
// sub-class Item
|
2547 |
-
Layout.Item = function LayoutItem() {
|
2548 |
-
Item.apply( this, arguments );
|
2549 |
-
};
|
2550 |
-
|
2551 |
-
Layout.Item.prototype = new Item();
|
2552 |
-
|
2553 |
-
Layout.prototype.settings.item = Layout.Item;
|
2554 |
-
|
2555 |
-
// -------------------------- declarative -------------------------- //
|
2556 |
-
|
2557 |
-
/**
|
2558 |
-
* allow user to initialize Outlayer via .js-namespace class
|
2559 |
-
* options are parsed from data-namespace-option attribute
|
2560 |
-
*/
|
2561 |
-
docReady( function() {
|
2562 |
-
var dashedNamespace = toDashed( namespace );
|
2563 |
-
var elems = document.querySelectorAll( '.js-' + dashedNamespace );
|
2564 |
-
var dataAttr = 'data-' + dashedNamespace + '-options';
|
2565 |
-
|
2566 |
-
for ( var i=0, len = elems.length; i < len; i++ ) {
|
2567 |
-
var elem = elems[i];
|
2568 |
-
var attr = elem.getAttribute( dataAttr );
|
2569 |
-
var options;
|
2570 |
-
try {
|
2571 |
-
options = attr && JSON.parse( attr );
|
2572 |
-
} catch ( error ) {
|
2573 |
-
// log error, do not initialize
|
2574 |
-
if ( console ) {
|
2575 |
-
console.error( 'Error parsing ' + dataAttr + ' on ' +
|
2576 |
-
elem.nodeName.toLowerCase() + ( elem.id ? '#' + elem.id : '' ) + ': ' +
|
2577 |
-
error );
|
2578 |
-
}
|
2579 |
-
continue;
|
2580 |
-
}
|
2581 |
-
// initialize
|
2582 |
-
var instance = new Layout( elem, options );
|
2583 |
-
// make available via $().data('layoutname')
|
2584 |
-
if ( jQuery ) {
|
2585 |
-
jQuery.data( elem, namespace, instance );
|
2586 |
-
}
|
2587 |
-
}
|
2588 |
-
});
|
2589 |
-
|
2590 |
-
// -------------------------- jQuery bridge -------------------------- //
|
2591 |
-
|
2592 |
-
// make into jQuery plugin
|
2593 |
-
if ( jQuery && jQuery.bridget ) {
|
2594 |
-
jQuery.bridget( namespace, Layout );
|
2595 |
-
}
|
2596 |
-
|
2597 |
-
return Layout;
|
2598 |
-
};
|
2599 |
-
|
2600 |
-
// ----- fin ----- //
|
2601 |
-
|
2602 |
-
// back in global
|
2603 |
-
Outlayer.Item = Item;
|
2604 |
-
|
2605 |
-
return Outlayer;
|
2606 |
-
|
2607 |
-
}
|
2608 |
-
|
2609 |
-
// -------------------------- transport -------------------------- //
|
2610 |
-
|
2611 |
-
if ( typeof define === 'function' && define.amd ) {
|
2612 |
-
// AMD
|
2613 |
-
define( 'outlayer/outlayer',[
|
2614 |
-
'eventie/eventie',
|
2615 |
-
'doc-ready/doc-ready',
|
2616 |
-
'eventEmitter/EventEmitter',
|
2617 |
-
'get-size/get-size',
|
2618 |
-
'matches-selector/matches-selector',
|
2619 |
-
'./item'
|
2620 |
-
],
|
2621 |
-
outlayerDefinition );
|
2622 |
-
} else {
|
2623 |
-
// browser global
|
2624 |
-
window.Outlayer = outlayerDefinition(
|
2625 |
-
window.eventie,
|
2626 |
-
window.docReady,
|
2627 |
-
window.EventEmitter,
|
2628 |
-
window.getSize,
|
2629 |
-
window.matchesSelector,
|
2630 |
-
window.Outlayer.Item
|
2631 |
-
);
|
2632 |
-
}
|
2633 |
-
|
2634 |
-
})( window );
|
2635 |
-
|
2636 |
-
/**
|
2637 |
-
* Isotope Item
|
2638 |
-
**/
|
2639 |
-
|
2640 |
-
( function( window ) {
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
// -------------------------- Item -------------------------- //
|
2645 |
-
|
2646 |
-
function itemDefinition( Outlayer ) {
|
2647 |
-
|
2648 |
-
// sub-class Outlayer Item
|
2649 |
-
function Item() {
|
2650 |
-
Outlayer.Item.apply( this, arguments );
|
2651 |
-
}
|
2652 |
-
|
2653 |
-
Item.prototype = new Outlayer.Item();
|
2654 |
-
|
2655 |
-
Item.prototype._create = function() {
|
2656 |
-
// assign id, used for original-order sorting
|
2657 |
-
this.id = this.layout.itemGUID++;
|
2658 |
-
Outlayer.Item.prototype._create.call( this );
|
2659 |
-
this.sortData = {};
|
2660 |
-
};
|
2661 |
-
|
2662 |
-
Item.prototype.updateSortData = function() {
|
2663 |
-
// default sorters
|
2664 |
-
this.sortData.id = this.id;
|
2665 |
-
// for backward compatibility
|
2666 |
-
this.sortData['original-order'] = this.id;
|
2667 |
-
this.sortData.random = Math.random();
|
2668 |
-
// go thru getSortData obj and apply the sorters
|
2669 |
-
var getSortData = this.layout.options.getSortData;
|
2670 |
-
var sorters = this.layout._sorters;
|
2671 |
-
for ( var key in getSortData ) {
|
2672 |
-
var sorter = sorters[ key ];
|
2673 |
-
this.sortData[ key ] = sorter( this.element, this );
|
2674 |
-
}
|
2675 |
-
};
|
2676 |
-
|
2677 |
-
return Item;
|
2678 |
-
|
2679 |
-
}
|
2680 |
-
|
2681 |
-
// -------------------------- transport -------------------------- //
|
2682 |
-
|
2683 |
-
if ( typeof define === 'function' && define.amd ) {
|
2684 |
-
// AMD
|
2685 |
-
define( 'isotope/js/item',[
|
2686 |
-
'outlayer/outlayer'
|
2687 |
-
],
|
2688 |
-
itemDefinition );
|
2689 |
-
} else {
|
2690 |
-
// browser global
|
2691 |
-
window.Isotope = window.Isotope || {};
|
2692 |
-
window.Isotope.Item = itemDefinition(
|
2693 |
-
window.Outlayer
|
2694 |
-
);
|
2695 |
-
}
|
2696 |
-
|
2697 |
-
})( window );
|
2698 |
-
|
2699 |
-
( function( window ) {
|
2700 |
-
|
2701 |
-
|
2702 |
-
|
2703 |
-
// -------------------------- -------------------------- //
|
2704 |
-
|
2705 |
-
function layoutModeDefinition( getSize, Outlayer ) {
|
2706 |
-
|
2707 |
-
// layout mode class
|
2708 |
-
function LayoutMode( isotope ) {
|
2709 |
-
this.isotope = isotope;
|
2710 |
-
// link properties
|
2711 |
-
if ( isotope ) {
|
2712 |
-
this.options = isotope.options[ this.namespace ];
|
2713 |
-
this._getMeasurement = isotope._getMeasurement;
|
2714 |
-
this.element = isotope.element;
|
2715 |
-
this.items = isotope.filteredItems;
|
2716 |
-
this.size = isotope.size;
|
2717 |
-
}
|
2718 |
-
}
|
2719 |
-
|
2720 |
-
/**
|
2721 |
-
* some methods should just defer to default Outlayer method
|
2722 |
-
* and reference the Isotope instance as `this`
|
2723 |
-
**/
|
2724 |
-
( function() {
|
2725 |
-
var facadeMethods = [
|
2726 |
-
'_resetLayout',
|
2727 |
-
'_getItemLayoutPosition',
|
2728 |
-
'_manageStamp',
|
2729 |
-
'_getContainerSize',
|
2730 |
-
'_getElementOffset',
|
2731 |
-
'resize'
|
2732 |
-
];
|
2733 |
-
|
2734 |
-
for ( var i=0, len = facadeMethods.length; i < len; i++ ) {
|
2735 |
-
var methodName = facadeMethods[i];
|
2736 |
-
LayoutMode.prototype[ methodName ] = getOutlayerMethod( methodName );
|
2737 |
-
}
|
2738 |
-
|
2739 |
-
function getOutlayerMethod( methodName ) {
|
2740 |
-
return function() {
|
2741 |
-
return Outlayer.prototype[ methodName ].apply( this.isotope, arguments );
|
2742 |
-
};
|
2743 |
-
}
|
2744 |
-
})();
|
2745 |
-
|
2746 |
-
// ----- ----- //
|
2747 |
-
|
2748 |
-
// for horizontal layout modes, check vertical size
|
2749 |
-
LayoutMode.prototype.resizeVertical = function() {
|
2750 |
-
// don't trigger if size did not change
|
2751 |
-
var size = getSize( this.isotope.element );
|
2752 |
-
// check that this.size and size are there
|
2753 |
-
// IE8 triggers resize on body size change, so they might not be
|
2754 |
-
var hasSizes = this.isotope.size && size;
|
2755 |
-
if ( hasSizes && size.innerHeight === this.isotope.size.innerHeight ) {
|
2756 |
-
return;
|
2757 |
-
}
|
2758 |
-
|
2759 |
-
this.isotope.layout();
|
2760 |
-
};
|
2761 |
-
|
2762 |
-
// ----- measurements ----- //
|
2763 |
-
|
2764 |
-
LayoutMode.prototype.getColumnWidth = function() {
|
2765 |
-
this.getSegmentSize( 'column', 'Width' );
|
2766 |
-
};
|
2767 |
-
|
2768 |
-
LayoutMode.prototype.getRowHeight = function() {
|
2769 |
-
this.getSegmentSize( 'row', 'Height' );
|
2770 |
-
};
|
2771 |
-
|
2772 |
-
/**
|
2773 |
-
* get columnWidth or rowHeight
|
2774 |
-
* segment: 'column' or 'row'
|
2775 |
-
* size 'Width' or 'Height'
|
2776 |
-
**/
|
2777 |
-
LayoutMode.prototype.getSegmentSize = function( segment, size ) {
|
2778 |
-
var segmentName = segment + size;
|
2779 |
-
var outerSize = 'outer' + size;
|
2780 |
-
// columnWidth / outerWidth // rowHeight / outerHeight
|
2781 |
-
this._getMeasurement( segmentName, outerSize );
|
2782 |
-
// got rowHeight or columnWidth, we can chill
|
2783 |
-
if ( this[ segmentName ] ) {
|
2784 |
-
return;
|
2785 |
-
}
|
2786 |
-
// fall back to item of first element
|
2787 |
-
var firstItemSize = this.getFirstItemSize();
|
2788 |
-
this[ segmentName ] = firstItemSize && firstItemSize[ outerSize ] ||
|
2789 |
-
// or size of container
|
2790 |
-
this.isotope.size[ 'inner' + size ];
|
2791 |
-
};
|
2792 |
-
|
2793 |
-
LayoutMode.prototype.getFirstItemSize = function() {
|
2794 |
-
var firstItem = this.isotope.filteredItems[0];
|
2795 |
-
return firstItem && firstItem.element && getSize( firstItem.element );
|
2796 |
-
};
|
2797 |
-
|
2798 |
-
// ----- methods that should reference isotope ----- //
|
2799 |
-
|
2800 |
-
LayoutMode.prototype.layout = function() {
|
2801 |
-
this.isotope.layout.apply( this.isotope, arguments );
|
2802 |
-
};
|
2803 |
-
|
2804 |
-
LayoutMode.prototype.getSize = function() {
|
2805 |
-
this.isotope.getSize();
|
2806 |
-
this.size = this.isotope.size;
|
2807 |
-
};
|
2808 |
-
|
2809 |
-
// -------------------------- create -------------------------- //
|
2810 |
-
|
2811 |
-
LayoutMode.modes = {};
|
2812 |
-
|
2813 |
-
LayoutMode.create = function( namespace, options ) {
|
2814 |
-
|
2815 |
-
function Mode() {
|
2816 |
-
LayoutMode.apply( this, arguments );
|
2817 |
-
}
|
2818 |
-
|
2819 |
-
Mode.prototype = new LayoutMode();
|
2820 |
-
|
2821 |
-
// default options
|
2822 |
-
if ( options ) {
|
2823 |
-
Mode.options = options;
|
2824 |
-
}
|
2825 |
-
|
2826 |
-
Mode.prototype.namespace = namespace;
|
2827 |
-
// register in Isotope
|
2828 |
-
LayoutMode.modes[ namespace ] = Mode;
|
2829 |
-
|
2830 |
-
return Mode;
|
2831 |
-
};
|
2832 |
-
|
2833 |
-
|
2834 |
-
return LayoutMode;
|
2835 |
-
|
2836 |
-
}
|
2837 |
-
|
2838 |
-
if ( typeof define === 'function' && define.amd ) {
|
2839 |
-
// AMD
|
2840 |
-
define( 'isotope/js/layout-mode',[
|
2841 |
-
'get-size/get-size',
|
2842 |
-
'outlayer/outlayer'
|
2843 |
-
],
|
2844 |
-
layoutModeDefinition );
|
2845 |
-
} else {
|
2846 |
-
// browser global
|
2847 |
-
window.Isotope = window.Isotope || {};
|
2848 |
-
window.Isotope.LayoutMode = layoutModeDefinition(
|
2849 |
-
window.getSize,
|
2850 |
-
window.Outlayer
|
2851 |
-
);
|
2852 |
-
}
|
2853 |
-
|
2854 |
-
|
2855 |
-
})( window );
|
2856 |
-
|
2857 |
-
/*!
|
2858 |
-
* Isotope v2.0.0-beta.4
|
2859 |
-
* Magical sorting and filtering layouts
|
2860 |
-
* http://isotope.metafizzy.co
|
2861 |
-
*/
|
2862 |
-
|
2863 |
-
( function( window ) {
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
-
// -------------------------- vars -------------------------- //
|
2868 |
-
|
2869 |
-
var jQuery = window.jQuery;
|
2870 |
-
|
2871 |
-
// -------------------------- helpers -------------------------- //
|
2872 |
-
|
2873 |
-
// extend objects
|
2874 |
-
function extend( a, b ) {
|
2875 |
-
for ( var prop in b ) {
|
2876 |
-
a[ prop ] = b[ prop ];
|
2877 |
-
}
|
2878 |
-
return a;
|
2879 |
-
}
|
2880 |
-
|
2881 |
-
var trim = String.prototype.trim ?
|
2882 |
-
function( str ) {
|
2883 |
-
return str.trim();
|
2884 |
-
} :
|
2885 |
-
function( str ) {
|
2886 |
-
return str.replace( /^\s+|\s+$/g, '' );
|
2887 |
-
};
|
2888 |
-
|
2889 |
-
var docElem = document.documentElement;
|
2890 |
-
|
2891 |
-
var getText = docElem.textContent ?
|
2892 |
-
function( elem ) {
|
2893 |
-
return elem.textContent;
|
2894 |
-
} :
|
2895 |
-
function( elem ) {
|
2896 |
-
return elem.innerText;
|
2897 |
-
};
|
2898 |
-
|
2899 |
-
var objToString = Object.prototype.toString;
|
2900 |
-
function isArray( obj ) {
|
2901 |
-
return objToString.call( obj ) === '[object Array]';
|
2902 |
-
}
|
2903 |
-
|
2904 |
-
// index of helper cause IE8
|
2905 |
-
var indexOf = Array.prototype.indexOf ? function( ary, obj ) {
|
2906 |
-
return ary.indexOf( obj );
|
2907 |
-
} : function( ary, obj ) {
|
2908 |
-
for ( var i=0, len = ary.length; i < len; i++ ) {
|
2909 |
-
if ( ary[i] === obj ) {
|
2910 |
-
return i;
|
2911 |
-
}
|
2912 |
-
}
|
2913 |
-
return -1;
|
2914 |
-
};
|
2915 |
-
|
2916 |
-
// turn element or nodeList into an array
|
2917 |
-
function makeArray( obj ) {
|
2918 |
-
var ary = [];
|
2919 |
-
if ( isArray( obj ) ) {
|
2920 |
-
// use object if already an array
|
2921 |
-
ary = obj;
|
2922 |
-
} else if ( obj && typeof obj.length === 'number' ) {
|
2923 |
-
// convert nodeList to array
|
2924 |
-
for ( var i=0, len = obj.length; i < len; i++ ) {
|
2925 |
-
ary.push( obj[i] );
|
2926 |
-
}
|
2927 |
-
} else {
|
2928 |
-
// array of single index
|
2929 |
-
ary.push( obj );
|
2930 |
-
}
|
2931 |
-
return ary;
|
2932 |
-
}
|
2933 |
-
|
2934 |
-
function removeFrom( obj, ary ) {
|
2935 |
-
var index = indexOf( ary, obj );
|
2936 |
-
if ( index !== -1 ) {
|
2937 |
-
ary.splice( index, 1 );
|
2938 |
-
}
|
2939 |
-
}
|
2940 |
-
|
2941 |
-
// -------------------------- isotopeDefinition -------------------------- //
|
2942 |
-
|
2943 |
-
// used for AMD definition and requires
|
2944 |
-
function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode ) {
|
2945 |
-
// create an Outlayer layout class
|
2946 |
-
var Isotope = Outlayer.create( 'isotope', {
|
2947 |
-
layoutMode: "masonry",
|
2948 |
-
isJQueryFiltering: true,
|
2949 |
-
sortAscending: true
|
2950 |
-
});
|
2951 |
-
|
2952 |
-
Isotope.Item = Isotope.prototype.settings.item = Item;
|
2953 |
-
Isotope.LayoutMode = LayoutMode;
|
2954 |
-
|
2955 |
-
Isotope.prototype._create = function() {
|
2956 |
-
this.itemGUID = 0;
|
2957 |
-
// functions that sort items
|
2958 |
-
this._sorters = {};
|
2959 |
-
// call super
|
2960 |
-
Outlayer.prototype._create.call( this );
|
2961 |
-
|
2962 |
-
// create layout modes
|
2963 |
-
this.modes = {};
|
2964 |
-
// start filteredItems with all items
|
2965 |
-
this.filteredItems = this.items;
|
2966 |
-
// keep of track of sortBys
|
2967 |
-
this.sortHistory = [ 'original-order' ];
|
2968 |
-
// create from registered layout modes
|
2969 |
-
for ( var name in LayoutMode.modes ) {
|
2970 |
-
this._initLayoutMode( name );
|
2971 |
-
}
|
2972 |
-
};
|
2973 |
-
|
2974 |
-
Isotope.prototype.reloadItems = function() {
|
2975 |
-
// reset item ID counter
|
2976 |
-
this.itemGUID = 0;
|
2977 |
-
// call super
|
2978 |
-
Outlayer.prototype.reloadItems.call( this );
|
2979 |
-
};
|
2980 |
-
|
2981 |
-
Isotope.prototype._itemize = function() {
|
2982 |
-
var items = Outlayer.prototype._itemize.apply( this, arguments );
|
2983 |
-
// assign ID for original-order
|
2984 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
2985 |
-
var item = items[i];
|
2986 |
-
item.id = this.itemGUID++;
|
2987 |
-
}
|
2988 |
-
this.updateSortData( items );
|
2989 |
-
return items;
|
2990 |
-
};
|
2991 |
-
|
2992 |
-
|
2993 |
-
// -------------------------- layout -------------------------- //
|
2994 |
-
|
2995 |
-
Isotope.prototype._initLayoutMode = function( name ) {
|
2996 |
-
var Mode = LayoutMode.modes[ name ];
|
2997 |
-
// set mode options
|
2998 |
-
// HACK extend initial options, back-fill in default options
|
2999 |
-
var initialOpts = this.options[ name ] || {};
|
3000 |
-
this.options[ name ] = Mode.options ?
|
3001 |
-
extend( Mode.options, initialOpts ) : initialOpts;
|
3002 |
-
// init layout mode instance
|
3003 |
-
this.modes[ name ] = new Mode( this );
|
3004 |
-
};
|
3005 |
-
|
3006 |
-
|
3007 |
-
Isotope.prototype.layout = function() {
|
3008 |
-
// if first time doing layout, do all magic
|
3009 |
-
if ( !this._isLayoutInited && this.options.isInitLayout ) {
|
3010 |
-
this.arrange();
|
3011 |
-
return;
|
3012 |
-
}
|
3013 |
-
this._layout();
|
3014 |
-
};
|
3015 |
-
|
3016 |
-
// private method to be used in layout() & magic()
|
3017 |
-
Isotope.prototype._layout = function() {
|
3018 |
-
// don't animate first layout
|
3019 |
-
var isInstant = this._getIsInstant();
|
3020 |
-
// layout flow
|
3021 |
-
this._resetLayout();
|
3022 |
-
this._manageStamps();
|
3023 |
-
this.layoutItems( this.filteredItems, isInstant );
|
3024 |
-
|
3025 |
-
// flag for initalized
|
3026 |
-
this._isLayoutInited = true;
|
3027 |
-
};
|
3028 |
-
|
3029 |
-
// filter + sort + layout
|
3030 |
-
Isotope.prototype.arrange = function( opts ) {
|
3031 |
-
// set any options pass
|
3032 |
-
this.option( opts );
|
3033 |
-
this._getIsInstant();
|
3034 |
-
// filter, sort, and layout
|
3035 |
-
this.filteredItems = this._filter( this.items );
|
3036 |
-
this._sort();
|
3037 |
-
this._layout();
|
3038 |
-
};
|
3039 |
-
// alias to _init for main plugin method
|
3040 |
-
Isotope.prototype._init = Isotope.prototype.arrange;
|
3041 |
-
|
3042 |
-
// HACK
|
3043 |
-
// Don't animate/transition first layout
|
3044 |
-
// Or don't animate/transition other layouts
|
3045 |
-
Isotope.prototype._getIsInstant = function() {
|
3046 |
-
var isInstant = this.options.isLayoutInstant !== undefined ?
|
3047 |
-
this.options.isLayoutInstant : !this._isLayoutInited;
|
3048 |
-
return this._isInstant = isInstant;
|
3049 |
-
};
|
3050 |
-
|
3051 |
-
// -------------------------- filter -------------------------- //
|
3052 |
-
|
3053 |
-
Isotope.prototype._filter = function( items ) {
|
3054 |
-
var filter = this.options.filter;
|
3055 |
-
filter = filter || '*';
|
3056 |
-
var matches = [];
|
3057 |
-
var hiddenMatched = [];
|
3058 |
-
var visibleUnmatched = [];
|
3059 |
-
|
3060 |
-
var test = this._getFilterTest( filter );
|
3061 |
-
|
3062 |
-
// test each item
|
3063 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
3064 |
-
var item = items[i];
|
3065 |
-
if ( item.isIgnored ) {
|
3066 |
-
continue;
|
3067 |
-
}
|
3068 |
-
// add item to either matched or unmatched group
|
3069 |
-
var isMatched = test( item );
|
3070 |
-
// item.isFilterMatched = isMatched;
|
3071 |
-
// add to matches if its a match
|
3072 |
-
if ( isMatched ) {
|
3073 |
-
matches.push( item );
|
3074 |
-
}
|
3075 |
-
// add to additional group if item needs to be hidden or revealed
|
3076 |
-
if ( isMatched && item.isHidden ) {
|
3077 |
-
hiddenMatched.push( item );
|
3078 |
-
} else if ( !isMatched && !item.isHidden ) {
|
3079 |
-
visibleUnmatched.push( item );
|
3080 |
-
}
|
3081 |
-
}
|
3082 |
-
|
3083 |
-
// HACK
|
3084 |
-
// disable transition if instant
|
3085 |
-
var _transitionDuration = this.options.transitionDuration;
|
3086 |
-
if ( this._isInstant ) {
|
3087 |
-
this.options.transitionDuration = 0;
|
3088 |
-
}
|
3089 |
-
this.reveal( hiddenMatched );
|
3090 |
-
this.hide( visibleUnmatched );
|
3091 |
-
// set back
|
3092 |
-
if ( this._isInstant ) {
|
3093 |
-
this.options.transitionDuration = _transitionDuration;
|
3094 |
-
}
|
3095 |
-
|
3096 |
-
return matches;
|
3097 |
-
};
|
3098 |
-
|
3099 |
-
// get a jQuery, function, or a matchesSelector test given the filter
|
3100 |
-
Isotope.prototype._getFilterTest = function( filter ) {
|
3101 |
-
var test;
|
3102 |
-
if ( jQuery && this.options.isJQueryFiltering ) {
|
3103 |
-
test = function( item ) {
|
3104 |
-
return jQuery( item.element ).is( filter );
|
3105 |
-
};
|
3106 |
-
} else if ( typeof filter === 'function' ) {
|
3107 |
-
test = function( item ) {
|
3108 |
-
return filter( item.element );
|
3109 |
-
};
|
3110 |
-
} else {
|
3111 |
-
test = function( item ) {
|
3112 |
-
return matchesSelector( item.element, filter );
|
3113 |
-
};
|
3114 |
-
}
|
3115 |
-
return test;
|
3116 |
-
};
|
3117 |
-
|
3118 |
-
// -------------------------- sorting -------------------------- //
|
3119 |
-
|
3120 |
-
Isotope.prototype.updateSortData = function( items ) {
|
3121 |
-
// update sorters
|
3122 |
-
var getSortData = this.options.getSortData;
|
3123 |
-
for ( var key in getSortData ) {
|
3124 |
-
var sorter = getSortData[ key ];
|
3125 |
-
this._sorters[ key ] = mungeSorter( sorter );
|
3126 |
-
}
|
3127 |
-
// update item sort data
|
3128 |
-
// default to all items if none are passed in
|
3129 |
-
items = items || this.items;
|
3130 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
3131 |
-
var item = items[i];
|
3132 |
-
if ( item.isIgnored ) {
|
3133 |
-
continue;
|
3134 |
-
}
|
3135 |
-
item.updateSortData();
|
3136 |
-
}
|
3137 |
-
};
|
3138 |
-
|
3139 |
-
// ----- munge sorter ----- //
|
3140 |
-
|
3141 |
-
// encapsulate this, as we just need mungeSorter
|
3142 |
-
// other functions in here are just for munging
|
3143 |
-
var mungeSorter = ( function() {
|
3144 |
-
// add a magic layer to sorters for convienent shorthands
|
3145 |
-
// `.foo-bar` will use the text of .foo-bar querySelector
|
3146 |
-
// `[foo-bar]` will use attribute
|
3147 |
-
// you can also add parser
|
3148 |
-
// `.foo-bar parseInt` will parse that as a number
|
3149 |
-
function mungeSorter( sorter ) {
|
3150 |
-
// if not a string, return function or whatever it is
|
3151 |
-
if ( typeof sorter !== 'string' ) {
|
3152 |
-
return sorter;
|
3153 |
-
}
|
3154 |
-
// parse the sorter string
|
3155 |
-
var args = trim( sorter ).split(' ');
|
3156 |
-
var query = args[0];
|
3157 |
-
// check if query looks like [an-attribute]
|
3158 |
-
var attrMatch = query.match( /^\[(.+)\]$/ );
|
3159 |
-
var attr = attrMatch && attrMatch[1];
|
3160 |
-
var getValue = getValueGetter( attr, query );
|
3161 |
-
// use second argument as a parser
|
3162 |
-
var parser = getParser( args[1] );
|
3163 |
-
// parse the value, if there was a parser
|
3164 |
-
sorter = parser ? function( elem ) {
|
3165 |
-
return elem && parser( getValue( elem ) );
|
3166 |
-
} :
|
3167 |
-
// otherwise just return value
|
3168 |
-
function( elem ) {
|
3169 |
-
return elem && getValue( elem );
|
3170 |
-
};
|
3171 |
-
|
3172 |
-
return sorter;
|
3173 |
-
}
|
3174 |
-
|
3175 |
-
// get an attribute getter, or get text of the querySelector
|
3176 |
-
function getValueGetter( attr, query ) {
|
3177 |
-
var getValue;
|
3178 |
-
// if query looks like [foo-bar], get attribute
|
3179 |
-
if ( attr ) {
|
3180 |
-
getValue = function( elem ) {
|
3181 |
-
return elem.getAttribute( attr );
|
3182 |
-
};
|
3183 |
-
} else {
|
3184 |
-
// otherwise, assume its a querySelector, and get its text
|
3185 |
-
getValue = function( elem ) {
|
3186 |
-
var child = elem.querySelector( query );
|
3187 |
-
return child && getText( child );
|
3188 |
-
};
|
3189 |
-
}
|
3190 |
-
return getValue;
|
3191 |
-
}
|
3192 |
-
|
3193 |
-
// return a parser function if arg matches
|
3194 |
-
function getParser( arg ) {
|
3195 |
-
var parser;
|
3196 |
-
switch ( arg ) {
|
3197 |
-
case 'parseInt' :
|
3198 |
-
parser = function( val ) {
|
3199 |
-
return parseInt( val, 10 );
|
3200 |
-
};
|
3201 |
-
break;
|
3202 |
-
case 'parseFloat' :
|
3203 |
-
parser = function( val ) {
|
3204 |
-
return parseFloat( val );
|
3205 |
-
};
|
3206 |
-
break;
|
3207 |
-
default :
|
3208 |
-
// just return val if parser isn't one of these
|
3209 |
-
// TODO - console log that that parser doesn't exist
|
3210 |
-
parser = function( val ) {
|
3211 |
-
return val;
|
3212 |
-
};
|
3213 |
-
}
|
3214 |
-
return parser;
|
3215 |
-
}
|
3216 |
-
|
3217 |
-
return mungeSorter;
|
3218 |
-
})();
|
3219 |
-
|
3220 |
-
|
3221 |
-
// ----- sort method ----- //
|
3222 |
-
|
3223 |
-
// sort filteredItem order
|
3224 |
-
Isotope.prototype._sort = function() {
|
3225 |
-
var sortByOpt = this.options.sortBy;
|
3226 |
-
if ( !sortByOpt ) {
|
3227 |
-
return;
|
3228 |
-
}
|
3229 |
-
// concat all sortBy and sortHistory
|
3230 |
-
var sortBys = [].concat.apply( sortByOpt, this.sortHistory );
|
3231 |
-
// sort magic
|
3232 |
-
var itemSorter = getItemSorter( sortBys, this.options.sortAscending );
|
3233 |
-
this.filteredItems.sort( itemSorter );
|
3234 |
-
// keep track of sortBy History
|
3235 |
-
if ( sortByOpt !== this.sortHistory[0] ) {
|
3236 |
-
// add to front, oldest goes in last
|
3237 |
-
this.sortHistory.unshift( sortByOpt );
|
3238 |
-
}
|
3239 |
-
};
|
3240 |
-
|
3241 |
-
// returns a function used for sorting
|
3242 |
-
function getItemSorter( sortBys, sortAsc ) {
|
3243 |
-
return function sorter( itemA, itemB ) {
|
3244 |
-
// cycle through all sortKeys
|
3245 |
-
for ( var i = 0, len = sortBys.length; i < len; i++ ) {
|
3246 |
-
var sortBy = sortBys[i];
|
3247 |
-
var a = itemA.sortData[ sortBy ];
|
3248 |
-
var b = itemB.sortData[ sortBy ];
|
3249 |
-
if ( a > b || a < b ) {
|
3250 |
-
// if sortAsc is an object, use the value given the sortBy key
|
3251 |
-
var isAscending = sortAsc[ sortBy ] !== undefined ? sortAsc[ sortBy ] : sortAsc;
|
3252 |
-
var direction = isAscending ? 1 : -1;
|
3253 |
-
return ( a > b ? 1 : -1 ) * direction;
|
3254 |
-
}
|
3255 |
-
}
|
3256 |
-
return 0;
|
3257 |
-
};
|
3258 |
-
}
|
3259 |
-
|
3260 |
-
// -------------------------- methods -------------------------- //
|
3261 |
-
|
3262 |
-
// get layout mode
|
3263 |
-
Isotope.prototype._mode = function() {
|
3264 |
-
var layoutMode = this.options.layoutMode;
|
3265 |
-
var mode = this.modes[ layoutMode ];
|
3266 |
-
if ( !mode ) {
|
3267 |
-
// TODO console.error
|
3268 |
-
throw new Error( 'No layout mode: ' + layoutMode );
|
3269 |
-
}
|
3270 |
-
// HACK sync mode's options
|
3271 |
-
// any options set after init for layout mode need to be synced
|
3272 |
-
mode.options = this.options[ layoutMode ];
|
3273 |
-
return mode;
|
3274 |
-
};
|
3275 |
-
|
3276 |
-
Isotope.prototype._resetLayout = function() {
|
3277 |
-
// trigger original reset layout
|
3278 |
-
Outlayer.prototype._resetLayout.call( this );
|
3279 |
-
this._mode()._resetLayout();
|
3280 |
-
};
|
3281 |
-
|
3282 |
-
Isotope.prototype._getItemLayoutPosition = function( item ) {
|
3283 |
-
return this._mode()._getItemLayoutPosition( item );
|
3284 |
-
};
|
3285 |
-
|
3286 |
-
Isotope.prototype._manageStamp = function( stamp ) {
|
3287 |
-
var mode = this._mode();
|
3288 |
-
// HACK copy over some options
|
3289 |
-
mode.options.isOriginLeft = this.options.isOriginLeft;
|
3290 |
-
mode.options.isOriginTop = this.options.isOriginTop;
|
3291 |
-
mode._manageStamp( stamp );
|
3292 |
-
};
|
3293 |
-
|
3294 |
-
Isotope.prototype._getContainerSize = function() {
|
3295 |
-
return this._mode()._getContainerSize();
|
3296 |
-
};
|
3297 |
-
|
3298 |
-
Isotope.prototype.resize = function() {
|
3299 |
-
this._mode().resize();
|
3300 |
-
};
|
3301 |
-
|
3302 |
-
// -------------------------- adding & removing -------------------------- //
|
3303 |
-
|
3304 |
-
// HEADS UP overwrites default Outlayer appended
|
3305 |
-
Isotope.prototype.appended = function( elems ) {
|
3306 |
-
var items = this.addItems( elems );
|
3307 |
-
if ( !items.length ) {
|
3308 |
-
return;
|
3309 |
-
}
|
3310 |
-
var filteredItems = this._filterRevealAdded( items );
|
3311 |
-
// add to filteredItems
|
3312 |
-
this.filteredItems = this.filteredItems.concat( filteredItems );
|
3313 |
-
};
|
3314 |
-
|
3315 |
-
// HEADS UP overwrites default Outlayer prepended
|
3316 |
-
Isotope.prototype.prepended = function( elems ) {
|
3317 |
-
var items = this._itemize( elems );
|
3318 |
-
if ( !items.length ) {
|
3319 |
-
return;
|
3320 |
-
}
|
3321 |
-
// add items to beginning of collection
|
3322 |
-
var previousItems = this.items.slice(0);
|
3323 |
-
this.items = items.concat( previousItems );
|
3324 |
-
// start new layout
|
3325 |
-
this._resetLayout();
|
3326 |
-
this._manageStamps();
|
3327 |
-
// layout new stuff without transition
|
3328 |
-
var filteredItems = this._filterRevealAdded( items );
|
3329 |
-
// layout previous items
|
3330 |
-
this.layoutItems( previousItems );
|
3331 |
-
// add to filteredItems
|
3332 |
-
this.filteredItems = filteredItems.concat( this.filteredItems );
|
3333 |
-
};
|
3334 |
-
|
3335 |
-
Isotope.prototype._filterRevealAdded = function( items ) {
|
3336 |
-
// disable transition for filtering
|
3337 |
-
var transitionDuration = this.options.transitionDuration;
|
3338 |
-
this.options.transitionDuration = 0;
|
3339 |
-
var filteredItems = this._filter( items );
|
3340 |
-
// re-enable transition for reveal
|
3341 |
-
this.options.transitionDuration = transitionDuration;
|
3342 |
-
// layout and reveal just the new items
|
3343 |
-
this.layoutItems( filteredItems, true );
|
3344 |
-
this.reveal( filteredItems );
|
3345 |
-
return items;
|
3346 |
-
};
|
3347 |
-
|
3348 |
-
/**
|
3349 |
-
* Filter, sort, and layout newly-appended item elements
|
3350 |
-
* @param {Array or NodeList or Element} elems
|
3351 |
-
*/
|
3352 |
-
Isotope.prototype.insert = function( elems ) {
|
3353 |
-
var items = this.addItems( elems );
|
3354 |
-
if ( !items.length ) {
|
3355 |
-
return;
|
3356 |
-
}
|
3357 |
-
this.arrange();
|
3358 |
-
};
|
3359 |
-
|
3360 |
-
var _remove = Isotope.prototype.remove;
|
3361 |
-
Isotope.prototype.remove = function( elems ) {
|
3362 |
-
elems = makeArray( elems );
|
3363 |
-
var removeItems = this.getItems( elems );
|
3364 |
-
// do regular thing
|
3365 |
-
_remove.call( this, elems );
|
3366 |
-
// bail if no items to remove
|
3367 |
-
if ( !removeItems || !removeItems.length ) {
|
3368 |
-
return;
|
3369 |
-
}
|
3370 |
-
// remove elems from filteredItems
|
3371 |
-
for ( var i=0, len = removeItems.length; i < len; i++ ) {
|
3372 |
-
var item = removeItems[i];
|
3373 |
-
// remove item from collection
|
3374 |
-
removeFrom( item, this.filteredItems );
|
3375 |
-
}
|
3376 |
-
};
|
3377 |
-
|
3378 |
-
// ----- ----- //
|
3379 |
-
|
3380 |
-
return Isotope;
|
3381 |
-
}
|
3382 |
-
|
3383 |
-
// -------------------------- transport -------------------------- //
|
3384 |
-
|
3385 |
-
if ( typeof define === 'function' && define.amd ) {
|
3386 |
-
// AMD
|
3387 |
-
define( 'isotope/js/isotope',[
|
3388 |
-
'outlayer/outlayer',
|
3389 |
-
'get-size/get-size',
|
3390 |
-
'matches-selector/matches-selector',
|
3391 |
-
'./item',
|
3392 |
-
'./layout-mode'
|
3393 |
-
],
|
3394 |
-
isotopeDefinition );
|
3395 |
-
} else {
|
3396 |
-
// browser global
|
3397 |
-
window.Isotope = isotopeDefinition(
|
3398 |
-
window.Outlayer,
|
3399 |
-
window.getSize,
|
3400 |
-
window.matchesSelector,
|
3401 |
-
window.Isotope.Item,
|
3402 |
-
window.Isotope.LayoutMode
|
3403 |
-
);
|
3404 |
-
}
|
3405 |
-
|
3406 |
-
})( window );
|
3407 |
-
|
3408 |
-
/*!
|
3409 |
-
* Masonry v3.1.4
|
3410 |
-
* Cascading grid layout library
|
3411 |
-
* http://masonry.desandro.com
|
3412 |
-
* MIT License
|
3413 |
-
* by David DeSandro
|
3414 |
-
*/
|
3415 |
-
|
3416 |
-
( function( window ) {
|
3417 |
-
|
3418 |
-
|
3419 |
-
|
3420 |
-
// -------------------------- helpers -------------------------- //
|
3421 |
-
|
3422 |
-
var indexOf = Array.prototype.indexOf ?
|
3423 |
-
function( items, value ) {
|
3424 |
-
return items.indexOf( value );
|
3425 |
-
} :
|
3426 |
-
function ( items, value ) {
|
3427 |
-
for ( var i=0, len = items.length; i < len; i++ ) {
|
3428 |
-
var item = items[i];
|
3429 |
-
if ( item === value ) {
|
3430 |
-
return i;
|
3431 |
-
}
|
3432 |
-
}
|
3433 |
-
return -1;
|
3434 |
-
};
|
3435 |
-
|
3436 |
-
// -------------------------- masonryDefinition -------------------------- //
|
3437 |
-
|
3438 |
-
// used for AMD definition and requires
|
3439 |
-
function masonryDefinition( Outlayer, getSize ) {
|
3440 |
-
// create an Outlayer layout class
|
3441 |
-
var Masonry = Outlayer.create('masonry');
|
3442 |
-
|
3443 |
-
Masonry.prototype._resetLayout = function() {
|
3444 |
-
this.getSize();
|
3445 |
-
this._getMeasurement( 'columnWidth', 'outerWidth' );
|
3446 |
-
this._getMeasurement( 'gutter', 'outerWidth' );
|
3447 |
-
this.measureColumns();
|
3448 |
-
|
3449 |
-
// reset column Y
|
3450 |
-
var i = this.cols;
|
3451 |
-
this.colYs = [];
|
3452 |
-
while (i--) {
|
3453 |
-
this.colYs.push( 0 );
|
3454 |
-
}
|
3455 |
-
|
3456 |
-
this.maxY = 0;
|
3457 |
-
};
|
3458 |
-
|
3459 |
-
Masonry.prototype.measureColumns = function() {
|
3460 |
-
this.getContainerWidth();
|
3461 |
-
// if columnWidth is 0, default to outerWidth of first item
|
3462 |
-
if ( !this.columnWidth ) {
|
3463 |
-
var firstItem = this.items[0];
|
3464 |
-
var firstItemElem = firstItem && firstItem.element;
|
3465 |
-
// columnWidth fall back to item of first element
|
3466 |
-
this.columnWidth = firstItemElem && getSize( firstItemElem ).outerWidth ||
|
3467 |
-
// if first elem has no width, default to size of container
|
3468 |
-
this.containerWidth;
|
3469 |
-
}
|
3470 |
-
|
3471 |
-
this.columnWidth += this.gutter;
|
3472 |
-
|
3473 |
-
this.cols = Math.floor( ( this.containerWidth + this.gutter ) / this.columnWidth );
|
3474 |
-
this.cols = Math.max( this.cols, 1 );
|
3475 |
-
};
|
3476 |
-
|
3477 |
-
Masonry.prototype.getContainerWidth = function() {
|
3478 |
-
// container is parent if fit width
|
3479 |
-
var container = this.options.isFitWidth ? this.element.parentNode : this.element;
|
3480 |
-
// check that this.size and size are there
|
3481 |
-
// IE8 triggers resize on body size change, so they might not be
|
3482 |
-
var size = getSize( container );
|
3483 |
-
this.containerWidth = size && size.innerWidth;
|
3484 |
-
};
|
3485 |
-
|
3486 |
-
Masonry.prototype._getItemLayoutPosition = function( item ) {
|
3487 |
-
item.getSize();
|
3488 |
-
// how many columns does this brick span
|
3489 |
-
var remainder = item.size.outerWidth % this.columnWidth;
|
3490 |
-
var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil';
|
3491 |
-
// round if off by 1 pixel, otherwise use ceil
|
3492 |
-
var colSpan = Math[ mathMethod ]( item.size.outerWidth / this.columnWidth );
|
3493 |
-
colSpan = Math.min( colSpan, this.cols );
|
3494 |
-
|
3495 |
-
var colGroup = this._getColGroup( colSpan );
|
3496 |
-
// get the minimum Y value from the columns
|
3497 |
-
var minimumY = Math.min.apply( Math, colGroup );
|
3498 |
-
var shortColIndex = indexOf( colGroup, minimumY );
|
3499 |
-
|
3500 |
-
// position the brick
|
3501 |
-
var position = {
|
3502 |
-
x: this.columnWidth * shortColIndex,
|
3503 |
-
y: minimumY
|
3504 |
-
};
|
3505 |
-
|
3506 |
-
// apply setHeight to necessary columns
|
3507 |
-
var setHeight = minimumY + item.size.outerHeight;
|
3508 |
-
var setSpan = this.cols + 1 - colGroup.length;
|
3509 |
-
for ( var i = 0; i < setSpan; i++ ) {
|
3510 |
-
this.colYs[ shortColIndex + i ] = setHeight;
|
3511 |
-
}
|
3512 |
-
|
3513 |
-
return position;
|
3514 |
-
};
|
3515 |
-
|
3516 |
-
/**
|
3517 |
-
* @param {Number} colSpan - number of columns the element spans
|
3518 |
-
* @returns {Array} colGroup
|
3519 |
-
*/
|
3520 |
-
Masonry.prototype._getColGroup = function( colSpan ) {
|
3521 |
-
if ( colSpan < 2 ) {
|
3522 |
-
// if brick spans only one column, use all the column Ys
|
3523 |
-
return this.colYs;
|
3524 |
-
}
|
3525 |
-
|
3526 |
-
var colGroup = [];
|
3527 |
-
// how many different places could this brick fit horizontally
|
3528 |
-
var groupCount = this.cols + 1 - colSpan;
|
3529 |
-
// for each group potential horizontal position
|
3530 |
-
for ( var i = 0; i < groupCount; i++ ) {
|
3531 |
-
// make an array of colY values for that one group
|
3532 |
-
var groupColYs = this.colYs.slice( i, i + colSpan );
|
3533 |
-
// and get the max value of the array
|
3534 |
-
colGroup[i] = Math.max.apply( Math, groupColYs );
|
3535 |
-
}
|
3536 |
-
return colGroup;
|
3537 |
-
};
|
3538 |
-
|
3539 |
-
Masonry.prototype._manageStamp = function( stamp ) {
|
3540 |
-
var stampSize = getSize( stamp );
|
3541 |
-
var offset = this._getElementOffset( stamp );
|
3542 |
-
// get the columns that this stamp affects
|
3543 |
-
var firstX = this.options.isOriginLeft ? offset.left : offset.right;
|
3544 |
-
var lastX = firstX + stampSize.outerWidth;
|
3545 |
-
var firstCol = Math.floor( firstX / this.columnWidth );
|
3546 |
-
firstCol = Math.max( 0, firstCol );
|
3547 |
-
var lastCol = Math.floor( lastX / this.columnWidth );
|
3548 |
-
// lastCol should not go over if multiple of columnWidth #425
|
3549 |
-
lastCol -= lastX % this.columnWidth ? 0 : 1;
|
3550 |
-
lastCol = Math.min( this.cols - 1, lastCol );
|
3551 |
-
// set colYs to bottom of the stamp
|
3552 |
-
var stampMaxY = ( this.options.isOriginTop ? offset.top : offset.bottom ) +
|
3553 |
-
stampSize.outerHeight;
|
3554 |
-
for ( var i = firstCol; i <= lastCol; i++ ) {
|
3555 |
-
this.colYs[i] = Math.max( stampMaxY, this.colYs[i] );
|
3556 |
-
}
|
3557 |
-
};
|
3558 |
-
|
3559 |
-
Masonry.prototype._getContainerSize = function() {
|
3560 |
-
this.maxY = Math.max.apply( Math, this.colYs );
|
3561 |
-
var size = {
|
3562 |
-
height: this.maxY
|
3563 |
-
};
|
3564 |
-
|
3565 |
-
if ( this.options.isFitWidth ) {
|
3566 |
-
size.width = this._getContainerFitWidth();
|
3567 |
-
}
|
3568 |
-
|
3569 |
-
return size;
|
3570 |
-
};
|
3571 |
-
|
3572 |
-
Masonry.prototype._getContainerFitWidth = function() {
|
3573 |
-
var unusedCols = 0;
|
3574 |
-
// count unused columns
|
3575 |
-
var i = this.cols;
|
3576 |
-
while ( --i ) {
|
3577 |
-
if ( this.colYs[i] !== 0 ) {
|
3578 |
-
break;
|
3579 |
-
}
|
3580 |
-
unusedCols++;
|
3581 |
-
}
|
3582 |
-
// fit container to columns that have been used
|
3583 |
-
return ( this.cols - unusedCols ) * this.columnWidth - this.gutter;
|
3584 |
-
};
|
3585 |
-
|
3586 |
-
// debounced, layout on resize
|
3587 |
-
// HEADS UP this overwrites Outlayer.resize
|
3588 |
-
// Any changes in Outlayer.resize need to be manually added here
|
3589 |
-
Masonry.prototype.resize = function() {
|
3590 |
-
// don't trigger if size did not change
|
3591 |
-
var previousWidth = this.containerWidth;
|
3592 |
-
this.getContainerWidth();
|
3593 |
-
if ( previousWidth === this.containerWidth ) {
|
3594 |
-
return;
|
3595 |
-
}
|
3596 |
-
|
3597 |
-
this.layout();
|
3598 |
-
};
|
3599 |
-
|
3600 |
-
return Masonry;
|
3601 |
-
}
|
3602 |
-
|
3603 |
-
// -------------------------- transport -------------------------- //
|
3604 |
-
|
3605 |
-
if ( typeof define === 'function' && define.amd ) {
|
3606 |
-
// AMD
|
3607 |
-
define( 'masonry/masonry',[
|
3608 |
-
'outlayer/outlayer',
|
3609 |
-
'get-size/get-size'
|
3610 |
-
],
|
3611 |
-
masonryDefinition );
|
3612 |
-
} else {
|
3613 |
-
// browser global
|
3614 |
-
window.Masonry = masonryDefinition(
|
3615 |
-
window.Outlayer,
|
3616 |
-
window.getSize
|
3617 |
-
);
|
3618 |
-
}
|
3619 |
-
|
3620 |
-
})( window );
|
3621 |
-
|
3622 |
-
/*!
|
3623 |
-
* Masonry layout mode
|
3624 |
-
* sub-classes Masonry
|
3625 |
-
* http://masonry.desandro.com
|
3626 |
-
*/
|
3627 |
-
|
3628 |
-
( function( window ) {
|
3629 |
-
|
3630 |
-
|
3631 |
-
|
3632 |
-
// -------------------------- helpers -------------------------- //
|
3633 |
-
|
3634 |
-
// extend objects
|
3635 |
-
function extend( a, b ) {
|
3636 |
-
for ( var prop in b ) {
|
3637 |
-
a[ prop ] = b[ prop ];
|
3638 |
-
}
|
3639 |
-
return a;
|
3640 |
-
}
|
3641 |
-
|
3642 |
-
// -------------------------- masonryDefinition -------------------------- //
|
3643 |
-
|
3644 |
-
// used for AMD definition and requires
|
3645 |
-
function masonryDefinition( LayoutMode, Masonry ) {
|
3646 |
-
// create an Outlayer layout class
|
3647 |
-
var MasonryMode = LayoutMode.create('masonry');
|
3648 |
-
|
3649 |
-
// save on to these methods
|
3650 |
-
var _getElementOffset = MasonryMode.prototype._getElementOffset;
|
3651 |
-
var layout = MasonryMode.prototype.layout;
|
3652 |
-
|
3653 |
-
// sub-class Masonry
|
3654 |
-
extend( MasonryMode.prototype, Masonry.prototype );
|
3655 |
-
|
3656 |
-
// set back, as it was overwritten by Masonry
|
3657 |
-
MasonryMode.prototype._getElementOffset = _getElementOffset;
|
3658 |
-
MasonryMode.prototype.layout = layout;
|
3659 |
-
|
3660 |
-
return MasonryMode;
|
3661 |
-
}
|
3662 |
-
|
3663 |
-
// -------------------------- transport -------------------------- //
|
3664 |
-
|
3665 |
-
if ( typeof define === 'function' && define.amd ) {
|
3666 |
-
// AMD
|
3667 |
-
define( 'isotope/js/layout-modes/masonry',[
|
3668 |
-
'../layout-mode',
|
3669 |
-
'masonry/masonry'
|
3670 |
-
],
|
3671 |
-
masonryDefinition );
|
3672 |
-
} else {
|
3673 |
-
// browser global
|
3674 |
-
masonryDefinition(
|
3675 |
-
window.Isotope.LayoutMode,
|
3676 |
-
window.Masonry
|
3677 |
-
);
|
3678 |
-
}
|
3679 |
-
|
3680 |
-
})( window );
|
3681 |
-
|
3682 |
-
( function( window ) {
|
3683 |
-
|
3684 |
-
|
3685 |
-
|
3686 |
-
function fitRowsDefinition( LayoutMode ) {
|
3687 |
-
|
3688 |
-
var FitRows = LayoutMode.create('fitRows');
|
3689 |
-
|
3690 |
-
FitRows.prototype._resetLayout = function() {
|
3691 |
-
this.x = 0;
|
3692 |
-
this.y = 0;
|
3693 |
-
this.maxY = 0;
|
3694 |
-
};
|
3695 |
-
|
3696 |
-
FitRows.prototype._getItemLayoutPosition = function( item ) {
|
3697 |
-
item.getSize();
|
3698 |
-
|
3699 |
-
// if this element cannot fit in the current row
|
3700 |
-
if ( this.x !== 0 && item.size.outerWidth + this.x > this.isotope.size.innerWidth ) {
|
3701 |
-
this.x = 0;
|
3702 |
-
this.y = this.maxY;
|
3703 |
-
}
|
3704 |
-
|
3705 |
-
var position = {
|
3706 |
-
x: this.x,
|
3707 |
-
y: this.y
|
3708 |
-
};
|
3709 |
-
|
3710 |
-
this.maxY = Math.max( this.maxY, this.y + item.size.outerHeight );
|
3711 |
-
this.x += item.size.outerWidth;
|
3712 |
-
|
3713 |
-
return position;
|
3714 |
-
};
|
3715 |
-
|
3716 |
-
FitRows.prototype._getContainerSize = function() {
|
3717 |
-
return { height: this.maxY };
|
3718 |
-
};
|
3719 |
-
|
3720 |
-
return FitRows;
|
3721 |
-
|
3722 |
-
}
|
3723 |
-
|
3724 |
-
if ( typeof define === 'function' && define.amd ) {
|
3725 |
-
// AMD
|
3726 |
-
define( 'isotope/js/layout-modes/fit-rows',[
|
3727 |
-
'../layout-mode'
|
3728 |
-
],
|
3729 |
-
fitRowsDefinition );
|
3730 |
-
} else {
|
3731 |
-
// browser global
|
3732 |
-
fitRowsDefinition(
|
3733 |
-
window.Isotope.LayoutMode
|
3734 |
-
);
|
3735 |
-
}
|
3736 |
-
|
3737 |
-
})( window );
|
3738 |
-
|
3739 |
-
( function( window ) {
|
3740 |
-
|
3741 |
-
|
3742 |
-
|
3743 |
-
function cellsByRowDefinition( LayoutMode ) {
|
3744 |
-
|
3745 |
-
var CellsByRow = LayoutMode.create( 'cellsByRow' );
|
3746 |
-
|
3747 |
-
CellsByRow.prototype._resetLayout = function() {
|
3748 |
-
// reset properties
|
3749 |
-
this.itemIndex = 0;
|
3750 |
-
// measurements
|
3751 |
-
this.getColumnWidth();
|
3752 |
-
this.getRowHeight();
|
3753 |
-
// set cols
|
3754 |
-
this.cols = Math.floor( this.isotope.size.innerWidth / this.columnWidth );
|
3755 |
-
this.cols = Math.max( this.cols, 1 );
|
3756 |
-
};
|
3757 |
-
|
3758 |
-
CellsByRow.prototype._getItemLayoutPosition = function( item ) {
|
3759 |
-
item.getSize();
|
3760 |
-
var col = this.itemIndex % this.cols;
|
3761 |
-
var row = Math.floor( this.itemIndex / this.cols );
|
3762 |
-
// center item within cell
|
3763 |
-
var x = ( col + 0.5 ) * this.columnWidth - item.size.outerWidth / 2;
|
3764 |
-
var y = ( row + 0.5 ) * this.rowHeight - item.size.outerHeight / 2;
|
3765 |
-
this.itemIndex++;
|
3766 |
-
return { x: x, y: y };
|
3767 |
-
};
|
3768 |
-
|
3769 |
-
CellsByRow.prototype._getContainerSize = function() {
|
3770 |
-
return {
|
3771 |
-
height: Math.ceil( this.itemIndex / this.cols ) * this.rowHeight
|
3772 |
-
};
|
3773 |
-
};
|
3774 |
-
|
3775 |
-
return CellsByRow;
|
3776 |
-
|
3777 |
-
}
|
3778 |
-
|
3779 |
-
if ( typeof define === 'function' && define.amd ) {
|
3780 |
-
// AMD
|
3781 |
-
define( 'isotope/js/layout-modes/cells-by-row',[
|
3782 |
-
'../layout-mode',
|
3783 |
-
'get-size/get-size'
|
3784 |
-
],
|
3785 |
-
cellsByRowDefinition );
|
3786 |
-
} else {
|
3787 |
-
// browser global
|
3788 |
-
cellsByRowDefinition(
|
3789 |
-
window.Isotope.LayoutMode,
|
3790 |
-
window.getSize
|
3791 |
-
);
|
3792 |
-
}
|
3793 |
-
|
3794 |
-
|
3795 |
-
})( window );
|
3796 |
-
|
3797 |
-
|
3798 |
-
|
3799 |
-
( function( window ) {
|
3800 |
-
|
3801 |
-
|
3802 |
-
|
3803 |
-
function verticalDefinition( LayoutMode ) {
|
3804 |
-
|
3805 |
-
var Vertical = LayoutMode.create( 'vertical', {
|
3806 |
-
horizontalAlignment: 0
|
3807 |
-
});
|
3808 |
-
|
3809 |
-
Vertical.prototype._resetLayout = function() {
|
3810 |
-
this.y = 0;
|
3811 |
-
};
|
3812 |
-
|
3813 |
-
Vertical.prototype._getItemLayoutPosition = function( item ) {
|
3814 |
-
item.getSize();
|
3815 |
-
var x = ( this.isotope.size.innerWidth - item.size.outerWidth ) *
|
3816 |
-
this.options.horizontalAlignment;
|
3817 |
-
var y = this.y;
|
3818 |
-
this.y += item.size.outerHeight;
|
3819 |
-
return { x: x, y: y };
|
3820 |
-
};
|
3821 |
-
|
3822 |
-
Vertical.prototype._getContainerSize = function() {
|
3823 |
-
return { height: this.y };
|
3824 |
-
};
|
3825 |
-
|
3826 |
-
return Vertical;
|
3827 |
-
|
3828 |
-
}
|
3829 |
-
|
3830 |
-
if ( typeof define === 'function' && define.amd ) {
|
3831 |
-
// AMD
|
3832 |
-
define( 'isotope/js/layout-modes/vertical',[
|
3833 |
-
'../layout-mode'
|
3834 |
-
],
|
3835 |
-
verticalDefinition );
|
3836 |
-
} else {
|
3837 |
-
// browser global
|
3838 |
-
verticalDefinition(
|
3839 |
-
window.Isotope.LayoutMode
|
3840 |
-
);
|
3841 |
-
}
|
3842 |
-
|
3843 |
-
})( window );
|
1 |
+
/*!
|
2 |
+
* Isotope PACKAGED v2.2.2
|
3 |
+
*
|
4 |
+
* Licensed GPLv3 for open source use
|
5 |
+
* or Isotope Commercial License for commercial use
|
6 |
+
*
|
7 |
+
* http://isotope.metafizzy.co
|
8 |
+
* Copyright 2015 Metafizzy
|
9 |
+
*/
|
10 |
+
|
11 |
+
!function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}return this.each(function(){var d=a.data(this,b);d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d))})}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],c):c("object"==typeof exports?require("jquery"):a.jQuery)}(window),function(a){function b(b){var c=a.event;return c.target=c.target||c.srcElement||b,c}var c=document.documentElement,d=function(){};c.addEventListener?d=function(a,b,c){a.addEventListener(b,c,!1)}:c.attachEvent&&(d=function(a,c,d){a[c+d]=d.handleEvent?function(){var c=b(a);d.handleEvent.call(d,c)}:function(){var c=b(a);d.call(a,c)},a.attachEvent("on"+c,a[c+d])});var e=function(){};c.removeEventListener?e=function(a,b,c){a.removeEventListener(b,c,!1)}:c.detachEvent&&(e=function(a,b,c){a.detachEvent("on"+b,a[b+c]);try{delete a[b+c]}catch(d){a[b+c]=void 0}});var f={bind:d,unbind:e};"function"==typeof define&&define.amd?define("eventie/eventie",f):"object"==typeof exports?module.exports=f:a.eventie=f}(window),function(){"use strict";function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if(a instanceof RegExp){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;b<a.length;b+=1)c.push(a[b].listener);return c},d.getListenersAsObject=function(a){var b,c=this.getListeners(a);return c instanceof Array&&(b={},b[a]=c),b||c},d.addListener=function(a,c){var d,e=this.getListenersAsObject(a),f="object"==typeof c;for(d in e)e.hasOwnProperty(d)&&-1===b(e[d],c)&&e[d].push(f?c:{listener:c,once:!1});return this},d.on=c("addListener"),d.addOnceListener=function(a,b){return this.addListener(a,{listener:b,once:!0})},d.once=c("addOnceListener"),d.defineEvent=function(a){return this.getListeners(a),this},d.defineEvents=function(a){for(var b=0;b<a.length;b+=1)this.defineEvent(a[b]);return this},d.removeListener=function(a,c){var d,e,f=this.getListenersAsObject(a);for(e in f)f.hasOwnProperty(e)&&(d=b(f[e],c),-1!==d&&f[e].splice(d,1));return this},d.off=c("removeListener"),d.addListeners=function(a,b){return this.manipulateListeners(!1,a,b)},d.removeListeners=function(a,b){return this.manipulateListeners(!0,a,b)},d.manipulateListeners=function(a,b,c){var d,e,f=a?this.removeListener:this.addListener,g=a?this.removeListeners:this.addListeners;if("object"!=typeof b||b instanceof RegExp)for(d=c.length;d--;)f.call(this,b,c[d]);else for(d in b)b.hasOwnProperty(d)&&(e=b[d])&&("function"==typeof e?f.call(this,d,e):g.call(this,d,e));return this},d.removeEvent=function(a){var b,c=typeof a,d=this._getEvents();if("string"===c)delete d[a];else if(a instanceof RegExp)for(b in d)d.hasOwnProperty(b)&&a.test(b)&&delete d[b];else delete this._events;return this},d.removeAllListeners=c("removeEvent"),d.emitEvent=function(a,b){var c,d,e,f,g=this.getListenersAsObject(a);for(e in g)if(g.hasOwnProperty(e))for(d=g[e].length;d--;)c=g[e][d],c.once===!0&&this.removeListener(a,c.listener),f=c.listener.apply(this,b||[]),f===this._getOnceReturnValue()&&this.removeListener(a,c.listener);return this},d.trigger=c("emitEvent"),d.emit=function(a){var b=Array.prototype.slice.call(arguments,1);return this.emitEvent(a,b)},d.setOnceReturnValue=function(a){return this._onceReturnValue=a,this},d._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},d._getEvents=function(){return this._events||(this._events={})},a.noConflict=function(){return e.EventEmitter=f,a},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return a}):"object"==typeof module&&module.exports?module.exports=a:e.EventEmitter=a}.call(this),function(a){function b(a){if(a){if("string"==typeof d[a])return a;a=a.charAt(0).toUpperCase()+a.slice(1);for(var b,e=0,f=c.length;f>e;e++)if(b=c[e]+a,"string"==typeof d[b])return b}}var c="Webkit Moz ms Ms O".split(" "),d=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return b}):"object"==typeof exports?module.exports=b:a.getStyleProperty=b}(window),function(a,b){function c(a){var b=parseFloat(a),c=-1===a.indexOf("%")&&!isNaN(b);return c&&b}function d(){}function e(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},b=0,c=h.length;c>b;b++){var d=h[b];a[d]=0}return a}function f(b){function d(){if(!m){m=!0;var d=a.getComputedStyle;if(j=function(){var a=d?function(a){return d(a,null)}:function(a){return a.currentStyle};return function(b){var c=a(b);return c||g("Style returned "+c+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),c}}(),k=b("boxSizing")){var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style[k]="border-box";var f=document.body||document.documentElement;f.appendChild(e);var h=j(e);l=200===c(h.width),f.removeChild(e)}}}function f(a){if(d(),"string"==typeof a&&(a=document.querySelector(a)),a&&"object"==typeof a&&a.nodeType){var b=j(a);if("none"===b.display)return e();var f={};f.width=a.offsetWidth,f.height=a.offsetHeight;for(var g=f.isBorderBox=!(!k||!b[k]||"border-box"!==b[k]),m=0,n=h.length;n>m;m++){var o=h[m],p=b[o];p=i(a,p);var q=parseFloat(p);f[o]=isNaN(q)?0:q}var r=f.paddingLeft+f.paddingRight,s=f.paddingTop+f.paddingBottom,t=f.marginLeft+f.marginRight,u=f.marginTop+f.marginBottom,v=f.borderLeftWidth+f.borderRightWidth,w=f.borderTopWidth+f.borderBottomWidth,x=g&&l,y=c(b.width);y!==!1&&(f.width=y+(x?0:r+v));var z=c(b.height);return z!==!1&&(f.height=z+(x?0:s+w)),f.innerWidth=f.width-(r+v),f.innerHeight=f.height-(s+w),f.outerWidth=f.width+t,f.outerHeight=f.height+u,f}}function i(b,c){if(a.getComputedStyle||-1===c.indexOf("%"))return c;var d=b.style,e=d.left,f=b.runtimeStyle,g=f&&f.left;return g&&(f.left=b.currentStyle.left),d.left=c,c=d.pixelLeft,d.left=e,g&&(f.left=g),c}var j,k,l,m=!1;return f}var g="undefined"==typeof console?d:function(a){console.error(a)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],f):"object"==typeof exports?module.exports=f(require("desandro-get-style-property")):a.getSize=f(a.getStyleProperty)}(window),function(a){function b(a){"function"==typeof a&&(b.isReady?a():g.push(a))}function c(a){var c="readystatechange"===a.type&&"complete"!==f.readyState;b.isReady||c||d()}function d(){b.isReady=!0;for(var a=0,c=g.length;c>a;a++){var d=g[a];d()}}function e(e){return"complete"===f.readyState?d():(e.bind(f,"DOMContentLoaded",c),e.bind(f,"readystatechange",c),e.bind(a,"load",c)),b}var f=a.document,g=[];b.isReady=!1,"function"==typeof define&&define.amd?define("doc-ready/doc-ready",["eventie/eventie"],e):"object"==typeof exports?module.exports=e(require("eventie")):a.docReady=e(a.eventie)}(window),function(a){"use strict";function b(a,b){return a[g](b)}function c(a){if(!a.parentNode){var b=document.createDocumentFragment();b.appendChild(a)}}function d(a,b){c(a);for(var d=a.parentNode.querySelectorAll(b),e=0,f=d.length;f>e;e++)if(d[e]===a)return!0;return!1}function e(a,d){return c(a),b(a,d)}var f,g=function(){if(a.matches)return"matches";if(a.matchesSelector)return"matchesSelector";for(var b=["webkit","moz","ms","o"],c=0,d=b.length;d>c;c++){var e=b[c],f=e+"MatchesSelector";if(a[f])return f}}();if(g){var h=document.createElement("div"),i=b(h,"div");f=i?b:e}else f=d;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return f}):"object"==typeof exports?module.exports=f:window.matchesSelector=f}(Element.prototype),function(a,b){"use strict";"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["doc-ready/doc-ready","matches-selector/matches-selector"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("doc-ready"),require("desandro-matches-selector")):a.fizzyUIUtils=b(a,a.docReady,a.matchesSelector)}(window,function(a,b,c){var d={};d.extend=function(a,b){for(var c in b)a[c]=b[c];return a},d.modulo=function(a,b){return(a%b+b)%b};var e=Object.prototype.toString;d.isArray=function(a){return"[object Array]"==e.call(a)},d.makeArray=function(a){var b=[];if(d.isArray(a))b=a;else if(a&&"number"==typeof a.length)for(var c=0,e=a.length;e>c;c++)b.push(a[c]);else b.push(a);return b},d.indexOf=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},d.removeFrom=function(a,b){var c=d.indexOf(a,b);-1!=c&&a.splice(c,1)},d.isElement="function"==typeof HTMLElement||"object"==typeof HTMLElement?function(a){return a instanceof HTMLElement}:function(a){return a&&"object"==typeof a&&1==a.nodeType&&"string"==typeof a.nodeName},d.setText=function(){function a(a,c){b=b||(void 0!==document.documentElement.textContent?"textContent":"innerText"),a[b]=c}var b;return a}(),d.getParent=function(a,b){for(;a!=document.body;)if(a=a.parentNode,c(a,b))return a},d.getQueryElement=function(a){return"string"==typeof a?document.querySelector(a):a},d.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},d.filterFindElements=function(a,b){a=d.makeArray(a);for(var e=[],f=0,g=a.length;g>f;f++){var h=a[f];if(d.isElement(h))if(b){c(h,b)&&e.push(h);for(var i=h.querySelectorAll(b),j=0,k=i.length;k>j;j++)e.push(i[j])}else e.push(h)}return e},d.debounceMethod=function(a,b,c){var d=a.prototype[b],e=b+"Timeout";a.prototype[b]=function(){var a=this[e];a&&clearTimeout(a);var b=arguments,f=this;this[e]=setTimeout(function(){d.apply(f,b),delete f[e]},c||100)}},d.toDashed=function(a){return a.replace(/(.)([A-Z])/g,function(a,b,c){return b+"-"+c}).toLowerCase()};var f=a.console;return d.htmlInit=function(c,e){b(function(){for(var b=d.toDashed(e),g=document.querySelectorAll(".js-"+b),h="data-"+b+"-options",i=0,j=g.length;j>i;i++){var k,l=g[i],m=l.getAttribute(h);try{k=m&&JSON.parse(m)}catch(n){f&&f.error("Error parsing "+h+" on "+l.nodeName.toLowerCase()+(l.id?"#"+l.id:"")+": "+n);continue}var o=new c(l,k),p=a.jQuery;p&&p.data(l,e,o)}})},d}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property","fizzy-ui-utils/utils"],function(c,d,e,f){return b(a,c,d,e,f)}):"object"==typeof exports?module.exports=b(a,require("wolfy87-eventemitter"),require("get-size"),require("desandro-get-style-property"),require("fizzy-ui-utils")):(a.Outlayer={},a.Outlayer.Item=b(a,a.EventEmitter,a.getSize,a.getStyleProperty,a.fizzyUIUtils))}(window,function(a,b,c,d,e){"use strict";function f(a){for(var b in a)return!1;return b=null,!0}function g(a,b){a&&(this.element=a,this.layout=b,this.position={x:0,y:0},this._create())}function h(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}var i=a.getComputedStyle,j=i?function(a){return i(a,null)}:function(a){return a.currentStyle},k=d("transition"),l=d("transform"),m=k&&l,n=!!d("perspective"),o={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[k],p=["transform","transition","transitionDuration","transitionProperty"],q=function(){for(var a={},b=0,c=p.length;c>b;b++){var e=p[b],f=d(e);f&&f!==e&&(a[e]=f)}return a}();e.extend(g.prototype,b.prototype),g.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},g.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},g.prototype.getSize=function(){this.size=c(this.element)},g.prototype.css=function(a){var b=this.element.style;for(var c in a){var d=q[c]||c;b[d]=a[c]}},g.prototype.getPosition=function(){var a=j(this.element),b=this.layout.options,c=b.isOriginLeft,d=b.isOriginTop,e=a[c?"left":"right"],f=a[d?"top":"bottom"],g=this.layout.size,h=-1!=e.indexOf("%")?parseFloat(e)/100*g.width:parseInt(e,10),i=-1!=f.indexOf("%")?parseFloat(f)/100*g.height:parseInt(f,10);h=isNaN(h)?0:h,i=isNaN(i)?0:i,h-=c?g.paddingLeft:g.paddingRight,i-=d?g.paddingTop:g.paddingBottom,this.position.x=h,this.position.y=i},g.prototype.layoutPosition=function(){var a=this.layout.size,b=this.layout.options,c={},d=b.isOriginLeft?"paddingLeft":"paddingRight",e=b.isOriginLeft?"left":"right",f=b.isOriginLeft?"right":"left",g=this.position.x+a[d];c[e]=this.getXValue(g),c[f]="";var h=b.isOriginTop?"paddingTop":"paddingBottom",i=b.isOriginTop?"top":"bottom",j=b.isOriginTop?"bottom":"top",k=this.position.y+a[h];c[i]=this.getYValue(k),c[j]="",this.css(c),this.emitEvent("layout",[this])},g.prototype.getXValue=function(a){var b=this.layout.options;return b.percentPosition&&!b.isHorizontal?a/this.layout.size.width*100+"%":a+"px"},g.prototype.getYValue=function(a){var b=this.layout.options;return b.percentPosition&&b.isHorizontal?a/this.layout.size.height*100+"%":a+"px"},g.prototype._transitionTo=function(a,b){this.getPosition();var c=this.position.x,d=this.position.y,e=parseInt(a,10),f=parseInt(b,10),g=e===this.position.x&&f===this.position.y;if(this.setPosition(a,b),g&&!this.isTransitioning)return void this.layoutPosition();var h=a-c,i=b-d,j={};j.transform=this.getTranslate(h,i),this.transition({to:j,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},g.prototype.getTranslate=function(a,b){var c=this.layout.options;return a=c.isOriginLeft?a:-a,b=c.isOriginTop?b:-b,n?"translate3d("+a+"px, "+b+"px, 0)":"translate("+a+"px, "+b+"px)"},g.prototype.goTo=function(a,b){this.setPosition(a,b),this.layoutPosition()},g.prototype.moveTo=m?g.prototype._transitionTo:g.prototype.goTo,g.prototype.setPosition=function(a,b){this.position.x=parseInt(a,10),this.position.y=parseInt(b,10)},g.prototype._nonTransition=function(a){this.css(a.to),a.isCleaning&&this._removeStyles(a.to);for(var b in a.onTransitionEnd)a.onTransitionEnd[b].call(this)},g.prototype._transition=function(a){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(a);var b=this._transn;for(var c in a.onTransitionEnd)b.onEnd[c]=a.onTransitionEnd[c];for(c in a.to)b.ingProperties[c]=!0,a.isCleaning&&(b.clean[c]=!0);if(a.from){this.css(a.from);var d=this.element.offsetHeight;d=null}this.enableTransition(a.to),this.css(a.to),this.isTransitioning=!0};var r="opacity,"+h(q.transform||"transform");g.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:r,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(o,this,!1))},g.prototype.transition=g.prototype[k?"_transition":"_nonTransition"],g.prototype.onwebkitTransitionEnd=function(a){this.ontransitionend(a)},g.prototype.onotransitionend=function(a){this.ontransitionend(a)};var s={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};g.prototype.ontransitionend=function(a){if(a.target===this.element){var b=this._transn,c=s[a.propertyName]||a.propertyName;if(delete b.ingProperties[c],f(b.ingProperties)&&this.disableTransition(),c in b.clean&&(this.element.style[a.propertyName]="",delete b.clean[c]),c in b.onEnd){var d=b.onEnd[c];d.call(this),delete b.onEnd[c]}this.emitEvent("transitionEnd",[this])}},g.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(o,this,!1),this.isTransitioning=!1},g.prototype._removeStyles=function(a){var b={};for(var c in a)b[c]="";this.css(b)};var t={transitionProperty:"",transitionDuration:""};return g.prototype.removeTransitionStyles=function(){this.css(t)},g.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},g.prototype.remove=function(){if(!k||!parseFloat(this.layout.options.transitionDuration))return void this.removeElem();var a=this;this.once("transitionEnd",function(){a.removeElem()}),this.hide()},g.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var a=this.layout.options,b={},c=this.getHideRevealTransitionEndProperty("visibleStyle");b[c]=this.onRevealTransitionEnd,this.transition({from:a.hiddenStyle,to:a.visibleStyle,isCleaning:!0,onTransitionEnd:b})},g.prototype.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},g.prototype.getHideRevealTransitionEndProperty=function(a){var b=this.layout.options[a];if(b.opacity)return"opacity";for(var c in b)return c},g.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var a=this.layout.options,b={},c=this.getHideRevealTransitionEndProperty("hiddenStyle");b[c]=this.onHideTransitionEnd,this.transition({from:a.visibleStyle,to:a.hiddenStyle,isCleaning:!0,onTransitionEnd:b})},g.prototype.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},g.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},g}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","eventEmitter/EventEmitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(c,d,e,f,g){return b(a,c,d,e,f,g)}):"object"==typeof exports?module.exports=b(a,require("eventie"),require("wolfy87-eventemitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):a.Outlayer=b(a,a.eventie,a.EventEmitter,a.getSize,a.fizzyUIUtils,a.Outlayer.Item)}(window,function(a,b,c,d,e,f){"use strict";function g(a,b){var c=e.getQueryElement(a);if(!c)return void(h&&h.error("Bad element for "+this.constructor.namespace+": "+(c||a)));this.element=c,i&&(this.$element=i(this.element)),this.options=e.extend({},this.constructor.defaults),this.option(b);var d=++k;this.element.outlayerGUID=d,l[d]=this,this._create(),this.options.isInitLayout&&this.layout()}var h=a.console,i=a.jQuery,j=function(){},k=0,l={};return g.namespace="outlayer",g.Item=f,g.defaults={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,isResizingContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},e.extend(g.prototype,c.prototype),g.prototype.option=function(a){e.extend(this.options,a)},g.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),e.extend(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},g.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},g.prototype._itemize=function(a){for(var b=this._filterFindItemElements(a),c=this.constructor.Item,d=[],e=0,f=b.length;f>e;e++){var g=b[e],h=new c(g,this);d.push(h)}return d},g.prototype._filterFindItemElements=function(a){return e.filterFindElements(a,this.options.itemSelector)},g.prototype.getItemElements=function(){for(var a=[],b=0,c=this.items.length;c>b;b++)a.push(this.items[b].element);return a},g.prototype.layout=function(){this._resetLayout(),this._manageStamps();var a=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,a),this._isLayoutInited=!0},g.prototype._init=g.prototype.layout,g.prototype._resetLayout=function(){this.getSize()},g.prototype.getSize=function(){this.size=d(this.element)},g.prototype._getMeasurement=function(a,b){var c,f=this.options[a];f?("string"==typeof f?c=this.element.querySelector(f):e.isElement(f)&&(c=f),this[a]=c?d(c)[b]:f):this[a]=0},g.prototype.layoutItems=function(a,b){a=this._getItemsForLayout(a),this._layoutItems(a,b),this._postLayout()},g.prototype._getItemsForLayout=function(a){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];e.isIgnored||b.push(e)}return b},g.prototype._layoutItems=function(a,b){if(this._emitCompleteOnItems("layout",a),a&&a.length){for(var c=[],d=0,e=a.length;e>d;d++){var f=a[d],g=this._getItemLayoutPosition(f);g.item=f,g.isInstant=b||f.isLayoutInstant,c.push(g)}this._processLayoutQueue(c)}},g.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},g.prototype._processLayoutQueue=function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];this._positionItem(d.item,d.x,d.y,d.isInstant)}},g.prototype._positionItem=function(a,b,c,d){d?a.goTo(b,c):a.moveTo(b,c)},g.prototype._postLayout=function(){this.resizeContainer()},g.prototype.resizeContainer=function(){if(this.options.isResizingContainer){var a=this._getContainerSize();a&&(this._setContainerMeasure(a.width,!0),this._setContainerMeasure(a.height,!1))}},g.prototype._getContainerSize=j,g.prototype._setContainerMeasure=function(a,b){if(void 0!==a){var c=this.size;c.isBorderBox&&(a+=b?c.paddingLeft+c.paddingRight+c.borderLeftWidth+c.borderRightWidth:c.paddingBottom+c.paddingTop+c.borderTopWidth+c.borderBottomWidth),a=Math.max(a,0),this.element.style[b?"width":"height"]=a+"px"}},g.prototype._emitCompleteOnItems=function(a,b){function c(){e.dispatchEvent(a+"Complete",null,[b])}function d(){g++,g===f&&c()}var e=this,f=b.length;if(!b||!f)return void c();for(var g=0,h=0,i=b.length;i>h;h++){var j=b[h];j.once(a,d)}},g.prototype.dispatchEvent=function(a,b,c){var d=b?[b].concat(c):c;if(this.emitEvent(a,d),i)if(this.$element=this.$element||i(this.element),b){var e=i.Event(b);e.type=a,this.$element.trigger(e,c)}else this.$element.trigger(a,c)},g.prototype.ignore=function(a){var b=this.getItem(a);b&&(b.isIgnored=!0)},g.prototype.unignore=function(a){var b=this.getItem(a);b&&delete b.isIgnored},g.prototype.stamp=function(a){if(a=this._find(a)){this.stamps=this.stamps.concat(a);for(var b=0,c=a.length;c>b;b++){var d=a[b];this.ignore(d)}}},g.prototype.unstamp=function(a){if(a=this._find(a))for(var b=0,c=a.length;c>b;b++){var d=a[b];e.removeFrom(this.stamps,d),this.unignore(d)}},g.prototype._find=function(a){return a?("string"==typeof a&&(a=this.element.querySelectorAll(a)),a=e.makeArray(a)):void 0},g.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var a=0,b=this.stamps.length;b>a;a++){var c=this.stamps[a];this._manageStamp(c)}}},g.prototype._getBoundingRect=function(){var a=this.element.getBoundingClientRect(),b=this.size;this._boundingRect={left:a.left+b.paddingLeft+b.borderLeftWidth,top:a.top+b.paddingTop+b.borderTopWidth,right:a.right-(b.paddingRight+b.borderRightWidth),bottom:a.bottom-(b.paddingBottom+b.borderBottomWidth)}},g.prototype._manageStamp=j,g.prototype._getElementOffset=function(a){var b=a.getBoundingClientRect(),c=this._boundingRect,e=d(a),f={left:b.left-c.left-e.marginLeft,top:b.top-c.top-e.marginTop,right:c.right-b.right-e.marginRight,bottom:c.bottom-b.bottom-e.marginBottom};return f},g.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},g.prototype.bindResize=function(){this.isResizeBound||(b.bind(a,"resize",this),this.isResizeBound=!0)},g.prototype.unbindResize=function(){this.isResizeBound&&b.unbind(a,"resize",this),this.isResizeBound=!1},g.prototype.onresize=function(){function a(){b.resize(),delete b.resizeTimeout}this.resizeTimeout&&clearTimeout(this.resizeTimeout);var b=this;this.resizeTimeout=setTimeout(a,100)},g.prototype.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},g.prototype.needsResizeLayout=function(){var a=d(this.element),b=this.size&&a;return b&&a.innerWidth!==this.size.innerWidth},g.prototype.addItems=function(a){var b=this._itemize(a);return b.length&&(this.items=this.items.concat(b)),b},g.prototype.appended=function(a){var b=this.addItems(a);b.length&&(this.layoutItems(b,!0),this.reveal(b))},g.prototype.prepended=function(a){var b=this._itemize(a);if(b.length){var c=this.items.slice(0);this.items=b.concat(c),this._resetLayout(),this._manageStamps(),this.layoutItems(b,!0),this.reveal(b),this.layoutItems(c)}},g.prototype.reveal=function(a){this._emitCompleteOnItems("reveal",a);for(var b=a&&a.length,c=0;b&&b>c;c++){var d=a[c];d.reveal()}},g.prototype.hide=function(a){this._emitCompleteOnItems("hide",a);for(var b=a&&a.length,c=0;b&&b>c;c++){var d=a[c];d.hide()}},g.prototype.revealItemElements=function(a){var b=this.getItems(a);this.reveal(b)},g.prototype.hideItemElements=function(a){var b=this.getItems(a);this.hide(b)},g.prototype.getItem=function(a){for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];if(d.element===a)return d}},g.prototype.getItems=function(a){a=e.makeArray(a);for(var b=[],c=0,d=a.length;d>c;c++){var f=a[c],g=this.getItem(f);g&&b.push(g)}return b},g.prototype.remove=function(a){var b=this.getItems(a);if(this._emitCompleteOnItems("remove",b),b&&b.length)for(var c=0,d=b.length;d>c;c++){var f=b[c];f.remove(),e.removeFrom(this.items,f)}},g.prototype.destroy=function(){var a=this.element.style;a.height="",a.position="",a.width="";for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];d.destroy()}this.unbindResize();var e=this.element.outlayerGUID;delete l[e],delete this.element.outlayerGUID,i&&i.removeData(this.element,this.constructor.namespace)},g.data=function(a){a=e.getQueryElement(a);var b=a&&a.outlayerGUID;return b&&l[b]},g.create=function(a,b){function c(){g.apply(this,arguments)}return Object.create?c.prototype=Object.create(g.prototype):e.extend(c.prototype,g.prototype),c.prototype.constructor=c,c.defaults=e.extend({},g.defaults),e.extend(c.defaults,b),c.prototype.settings={},c.namespace=a,c.data=g.data,c.Item=function(){f.apply(this,arguments)},c.Item.prototype=new f,e.htmlInit(c,a),i&&i.bridget&&i.bridget(a,c),c},g.Item=f,g}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/item",["outlayer/outlayer"],b):"object"==typeof exports?module.exports=b(require("outlayer")):(a.Isotope=a.Isotope||{},a.Isotope.Item=b(a.Outlayer))}(window,function(a){"use strict";function b(){a.Item.apply(this,arguments)}b.prototype=new a.Item,b.prototype._create=function(){this.id=this.layout.itemGUID++,a.Item.prototype._create.call(this),this.sortData={}},b.prototype.updateSortData=function(){if(!this.isIgnored){this.sortData.id=this.id,this.sortData["original-order"]=this.id,this.sortData.random=Math.random();var a=this.layout.options.getSortData,b=this.layout._sorters;for(var c in a){var d=b[c];this.sortData[c]=d(this.element,this)}}};var c=b.prototype.destroy;return b.prototype.destroy=function(){c.apply(this,arguments),this.css({display:""})},b}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/layout-mode",["get-size/get-size","outlayer/outlayer"],b):"object"==typeof exports?module.exports=b(require("get-size"),require("outlayer")):(a.Isotope=a.Isotope||{},a.Isotope.LayoutMode=b(a.getSize,a.Outlayer))}(window,function(a,b){"use strict";function c(a){this.isotope=a,a&&(this.options=a.options[this.namespace],this.element=a.element,this.items=a.filteredItems,this.size=a.size)}return function(){function a(a){return function(){return b.prototype[a].apply(this.isotope,arguments)}}for(var d=["_resetLayout","_getItemLayoutPosition","_manageStamp","_getContainerSize","_getElementOffset","needsResizeLayout"],e=0,f=d.length;f>e;e++){var g=d[e];c.prototype[g]=a(g)}}(),c.prototype.needsVerticalResizeLayout=function(){var b=a(this.isotope.element),c=this.isotope.size&&b;return c&&b.innerHeight!=this.isotope.size.innerHeight},c.prototype._getMeasurement=function(){this.isotope._getMeasurement.apply(this,arguments)},c.prototype.getColumnWidth=function(){this.getSegmentSize("column","Width")},c.prototype.getRowHeight=function(){this.getSegmentSize("row","Height")},c.prototype.getSegmentSize=function(a,b){var c=a+b,d="outer"+b;if(this._getMeasurement(c,d),!this[c]){var e=this.getFirstItemSize();this[c]=e&&e[d]||this.isotope.size["inner"+b]}},c.prototype.getFirstItemSize=function(){var b=this.isotope.filteredItems[0];return b&&b.element&&a(b.element)},c.prototype.layout=function(){this.isotope.layout.apply(this.isotope,arguments)},c.prototype.getSize=function(){this.isotope.getSize(),this.size=this.isotope.size},c.modes={},c.create=function(a,b){function d(){c.apply(this,arguments)}return d.prototype=new c,b&&(d.options=b),d.prototype.namespace=a,c.modes[a]=d,d},c}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("masonry/masonry",["outlayer/outlayer","get-size/get-size","fizzy-ui-utils/utils"],b):"object"==typeof exports?module.exports=b(require("outlayer"),require("get-size"),require("fizzy-ui-utils")):a.Masonry=b(a.Outlayer,a.getSize,a.fizzyUIUtils)}(window,function(a,b,c){var d=a.create("masonry");return d.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns();var a=this.cols;for(this.colYs=[];a--;)this.colYs.push(0);this.maxY=0},d.prototype.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var a=this.items[0],c=a&&a.element;this.columnWidth=c&&b(c).outerWidth||this.containerWidth}var d=this.columnWidth+=this.gutter,e=this.containerWidth+this.gutter,f=e/d,g=d-e%d,h=g&&1>g?"round":"floor";f=Math[h](f),this.cols=Math.max(f,1)},d.prototype.getContainerWidth=function(){var a=this.options.isFitWidth?this.element.parentNode:this.element,c=b(a);this.containerWidth=c&&c.innerWidth},d.prototype._getItemLayoutPosition=function(a){a.getSize();var b=a.size.outerWidth%this.columnWidth,d=b&&1>b?"round":"ceil",e=Math[d](a.size.outerWidth/this.columnWidth);e=Math.min(e,this.cols);for(var f=this._getColGroup(e),g=Math.min.apply(Math,f),h=c.indexOf(f,g),i={x:this.columnWidth*h,y:g},j=g+a.size.outerHeight,k=this.cols+1-f.length,l=0;k>l;l++)this.colYs[h+l]=j;return i},d.prototype._getColGroup=function(a){if(2>a)return this.colYs;for(var b=[],c=this.cols+1-a,d=0;c>d;d++){var e=this.colYs.slice(d,d+a);b[d]=Math.max.apply(Math,e)}return b},d.prototype._manageStamp=function(a){var c=b(a),d=this._getElementOffset(a),e=this.options.isOriginLeft?d.left:d.right,f=e+c.outerWidth,g=Math.floor(e/this.columnWidth);g=Math.max(0,g);var h=Math.floor(f/this.columnWidth);h-=f%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var i=(this.options.isOriginTop?d.top:d.bottom)+c.outerHeight,j=g;h>=j;j++)this.colYs[j]=Math.max(i,this.colYs[j])},d.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var a={height:this.maxY};return this.options.isFitWidth&&(a.width=this._getContainerFitWidth()),a},d.prototype._getContainerFitWidth=function(){for(var a=0,b=this.cols;--b&&0===this.colYs[b];)a++;return(this.cols-a)*this.columnWidth-this.gutter},d.prototype.needsResizeLayout=function(){var a=this.containerWidth;return this.getContainerWidth(),a!==this.containerWidth},d}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/layout-modes/masonry",["../layout-mode","masonry/masonry"],b):"object"==typeof exports?module.exports=b(require("../layout-mode"),require("masonry-layout")):b(a.Isotope.LayoutMode,a.Masonry)}(window,function(a,b){"use strict";function c(a,b){for(var c in b)a[c]=b[c];return a}var d=a.create("masonry"),e=d.prototype._getElementOffset,f=d.prototype.layout,g=d.prototype._getMeasurement;
|
12 |
+
c(d.prototype,b.prototype),d.prototype._getElementOffset=e,d.prototype.layout=f,d.prototype._getMeasurement=g;var h=d.prototype.measureColumns;d.prototype.measureColumns=function(){this.items=this.isotope.filteredItems,h.call(this)};var i=d.prototype._manageStamp;return d.prototype._manageStamp=function(){this.options.isOriginLeft=this.isotope.options.isOriginLeft,this.options.isOriginTop=this.isotope.options.isOriginTop,i.apply(this,arguments)},d}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/layout-modes/fit-rows",["../layout-mode"],b):"object"==typeof exports?module.exports=b(require("../layout-mode")):b(a.Isotope.LayoutMode)}(window,function(a){"use strict";var b=a.create("fitRows");return b.prototype._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this._getMeasurement("gutter","outerWidth")},b.prototype._getItemLayoutPosition=function(a){a.getSize();var b=a.size.outerWidth+this.gutter,c=this.isotope.size.innerWidth+this.gutter;0!==this.x&&b+this.x>c&&(this.x=0,this.y=this.maxY);var d={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+a.size.outerHeight),this.x+=b,d},b.prototype._getContainerSize=function(){return{height:this.maxY}},b}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/layout-modes/vertical",["../layout-mode"],b):"object"==typeof exports?module.exports=b(require("../layout-mode")):b(a.Isotope.LayoutMode)}(window,function(a){"use strict";var b=a.create("vertical",{horizontalAlignment:0});return b.prototype._resetLayout=function(){this.y=0},b.prototype._getItemLayoutPosition=function(a){a.getSize();var b=(this.isotope.size.innerWidth-a.size.outerWidth)*this.options.horizontalAlignment,c=this.y;return this.y+=a.size.outerHeight,{x:b,y:c}},b.prototype._getContainerSize=function(){return{height:this.y}},b}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","matches-selector/matches-selector","fizzy-ui-utils/utils","isotope/js/item","isotope/js/layout-mode","isotope/js/layout-modes/masonry","isotope/js/layout-modes/fit-rows","isotope/js/layout-modes/vertical"],function(c,d,e,f,g,h){return b(a,c,d,e,f,g,h)}):"object"==typeof exports?module.exports=b(a,require("outlayer"),require("get-size"),require("desandro-matches-selector"),require("fizzy-ui-utils"),require("./item"),require("./layout-mode"),require("./layout-modes/masonry"),require("./layout-modes/fit-rows"),require("./layout-modes/vertical")):a.Isotope=b(a,a.Outlayer,a.getSize,a.matchesSelector,a.fizzyUIUtils,a.Isotope.Item,a.Isotope.LayoutMode)}(window,function(a,b,c,d,e,f,g){function h(a,b){return function(c,d){for(var e=0,f=a.length;f>e;e++){var g=a[e],h=c.sortData[g],i=d.sortData[g];if(h>i||i>h){var j=void 0!==b[g]?b[g]:b,k=j?1:-1;return(h>i?1:-1)*k}}return 0}}var i=a.jQuery,j=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^\s+|\s+$/g,"")},k=document.documentElement,l=k.textContent?function(a){return a.textContent}:function(a){return a.innerText},m=b.create("isotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});m.Item=f,m.LayoutMode=g,m.prototype._create=function(){this.itemGUID=0,this._sorters={},this._getSorters(),b.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"];for(var a in g.modes)this._initLayoutMode(a)},m.prototype.reloadItems=function(){this.itemGUID=0,b.prototype.reloadItems.call(this)},m.prototype._itemize=function(){for(var a=b.prototype._itemize.apply(this,arguments),c=0,d=a.length;d>c;c++){var e=a[c];e.id=this.itemGUID++}return this._updateItemsSortData(a),a},m.prototype._initLayoutMode=function(a){var b=g.modes[a],c=this.options[a]||{};this.options[a]=b.options?e.extend(b.options,c):c,this.modes[a]=new b(this)},m.prototype.layout=function(){return!this._isLayoutInited&&this.options.isInitLayout?void this.arrange():void this._layout()},m.prototype._layout=function(){var a=this._getIsInstant();this._resetLayout(),this._manageStamps(),this.layoutItems(this.filteredItems,a),this._isLayoutInited=!0},m.prototype.arrange=function(a){function b(){d.reveal(c.needReveal),d.hide(c.needHide)}this.option(a),this._getIsInstant();var c=this._filter(this.items);this.filteredItems=c.matches;var d=this;this._bindArrangeComplete(),this._isInstant?this._noTransition(b):b(),this._sort(),this._layout()},m.prototype._init=m.prototype.arrange,m.prototype._getIsInstant=function(){var a=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;return this._isInstant=a,a},m.prototype._bindArrangeComplete=function(){function a(){b&&c&&d&&e.dispatchEvent("arrangeComplete",null,[e.filteredItems])}var b,c,d,e=this;this.once("layoutComplete",function(){b=!0,a()}),this.once("hideComplete",function(){c=!0,a()}),this.once("revealComplete",function(){d=!0,a()})},m.prototype._filter=function(a){var b=this.options.filter;b=b||"*";for(var c=[],d=[],e=[],f=this._getFilterTest(b),g=0,h=a.length;h>g;g++){var i=a[g];if(!i.isIgnored){var j=f(i);j&&c.push(i),j&&i.isHidden?d.push(i):j||i.isHidden||e.push(i)}}return{matches:c,needReveal:d,needHide:e}},m.prototype._getFilterTest=function(a){return i&&this.options.isJQueryFiltering?function(b){return i(b.element).is(a)}:"function"==typeof a?function(b){return a(b.element)}:function(b){return d(b.element,a)}},m.prototype.updateSortData=function(a){var b;a?(a=e.makeArray(a),b=this.getItems(a)):b=this.items,this._getSorters(),this._updateItemsSortData(b)},m.prototype._getSorters=function(){var a=this.options.getSortData;for(var b in a){var c=a[b];this._sorters[b]=n(c)}},m.prototype._updateItemsSortData=function(a){for(var b=a&&a.length,c=0;b&&b>c;c++){var d=a[c];d.updateSortData()}};var n=function(){function a(a){if("string"!=typeof a)return a;var c=j(a).split(" "),d=c[0],e=d.match(/^\[(.+)\]$/),f=e&&e[1],g=b(f,d),h=m.sortDataParsers[c[1]];return a=h?function(a){return a&&h(g(a))}:function(a){return a&&g(a)}}function b(a,b){var c;return c=a?function(b){return b.getAttribute(a)}:function(a){var c=a.querySelector(b);return c&&l(c)}}return a}();m.sortDataParsers={parseInt:function(a){return parseInt(a,10)},parseFloat:function(a){return parseFloat(a)}},m.prototype._sort=function(){var a=this.options.sortBy;if(a){var b=[].concat.apply(a,this.sortHistory),c=h(b,this.options.sortAscending);this.filteredItems.sort(c),a!=this.sortHistory[0]&&this.sortHistory.unshift(a)}},m.prototype._mode=function(){var a=this.options.layoutMode,b=this.modes[a];if(!b)throw new Error("No layout mode: "+a);return b.options=this.options[a],b},m.prototype._resetLayout=function(){b.prototype._resetLayout.call(this),this._mode()._resetLayout()},m.prototype._getItemLayoutPosition=function(a){return this._mode()._getItemLayoutPosition(a)},m.prototype._manageStamp=function(a){this._mode()._manageStamp(a)},m.prototype._getContainerSize=function(){return this._mode()._getContainerSize()},m.prototype.needsResizeLayout=function(){return this._mode().needsResizeLayout()},m.prototype.appended=function(a){var b=this.addItems(a);if(b.length){var c=this._filterRevealAdded(b);this.filteredItems=this.filteredItems.concat(c)}},m.prototype.prepended=function(a){var b=this._itemize(a);if(b.length){this._resetLayout(),this._manageStamps();var c=this._filterRevealAdded(b);this.layoutItems(this.filteredItems),this.filteredItems=c.concat(this.filteredItems),this.items=b.concat(this.items)}},m.prototype._filterRevealAdded=function(a){var b=this._filter(a);return this.hide(b.needHide),this.reveal(b.matches),this.layoutItems(b.matches,!0),b.matches},m.prototype.insert=function(a){var b=this.addItems(a);if(b.length){var c,d,e=b.length;for(c=0;e>c;c++)d=b[c],this.element.appendChild(d.element);var f=this._filter(b).matches;for(c=0;e>c;c++)b[c].isLayoutInstant=!0;for(this.arrange(),c=0;e>c;c++)delete b[c].isLayoutInstant;this.reveal(f)}};var o=m.prototype.remove;return m.prototype.remove=function(a){a=e.makeArray(a);var b=this.getItems(a);o.call(this,a);var c=b&&b.length;if(c)for(var d=0;c>d;d++){var f=b[d];e.removeFrom(this.filteredItems,f)}},m.prototype.shuffle=function(){for(var a=0,b=this.items.length;b>a;a++){var c=this.items[a];c.sortData.random=Math.random()}this.options.sortBy="random",this._sort(),this._layout()},m.prototype._noTransition=function(a){var b=this.options.transitionDuration;this.options.transitionDuration=0;var c=a.call(this);return this.options.transitionDuration=b,c},m.prototype.getFilteredItemElements=function(){for(var a=[],b=0,c=this.filteredItems.length;c>b;b++)a.push(this.filteredItems[b].element);return a},m});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gallery-bank.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin URI: http://tech-banker.com
|
5 |
Description: Gallery Bank is an easy to use Responsive WordPress Gallery Plugin for photos, videos, galleries and albums.
|
6 |
Author: Tech Banker
|
7 |
-
Version: 3.0.
|
8 |
Author URI: http://tech-banker.com
|
9 |
License: GPLv3 or later
|
10 |
*/
|
4 |
Plugin URI: http://tech-banker.com
|
5 |
Description: Gallery Bank is an easy to use Responsive WordPress Gallery Plugin for photos, videos, galleries and albums.
|
6 |
Author: Tech Banker
|
7 |
+
Version: 3.0.330
|
8 |
Author URI: http://tech-banker.com
|
9 |
License: GPLv3 or later
|
10 |
*/
|
lib/add-new-album-class.php
CHANGED
@@ -170,12 +170,12 @@ else
|
|
170 |
die();
|
171 |
break;
|
172 |
case "delete_pic":
|
173 |
-
|
174 |
$albumId = intval($_REQUEST["albumid"]);
|
175 |
|
176 |
$wpdb->query
|
177 |
(
|
178 |
-
"DELETE FROM " . gallery_bank_pics() . " WHERE pic_id
|
179 |
);
|
180 |
die();
|
181 |
break;
|
170 |
die();
|
171 |
break;
|
172 |
case "delete_pic":
|
173 |
+
|
174 |
$albumId = intval($_REQUEST["albumid"]);
|
175 |
|
176 |
$wpdb->query
|
177 |
(
|
178 |
+
"DELETE FROM " . gallery_bank_pics() . " WHERE pic_id = $albumId"
|
179 |
);
|
180 |
die();
|
181 |
break;
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
=== Gallery Bank -
|
2 |
Contributors: Gallery-Bank,contact-banker
|
3 |
-
Tags:
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 4.3
|
6 |
-
Stable tag: 3.0.
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
10 |
-
|
11 |
|
12 |
== Description ==
|
13 |
|
@@ -72,7 +72,7 @@ Gallery Bank Regularly updates and simplicity of usage along with efficient func
|
|
72 |
|
73 |
**[Like & Support Us on Facebook](https://www.facebook.com/TechBanker/)**
|
74 |
|
75 |
-
= Key Features in Gallery Bank Lite Edition =
|
76 |
|
77 |
* Multi-Lingual. Available now in 36 Languages.
|
78 |
* Responsive Photo Gallery
|
@@ -91,7 +91,7 @@ Gallery Bank Regularly updates and simplicity of usage along with efficient func
|
|
91 |
* Masonry Gallery Format
|
92 |
* List Album Format
|
93 |
|
94 |
-
= Key Features in Gallery Bank Premium Editions =
|
95 |
|
96 |
Take your media to the next level with [Gallery Bank Premium Editions](http://tech-banker.com/products/wp-gallery-bank/), which gives you 200+ features such as:
|
97 |
|
@@ -500,6 +500,11 @@ is False in shortcode.
|
|
500 |
|
501 |
== Changelog ==
|
502 |
|
|
|
|
|
|
|
|
|
|
|
503 |
= 3.0.229 =
|
504 |
|
505 |
* Compatibility with 4.3
|
1 |
+
=== Gallery Bank - Photo Galleries & Albums ===
|
2 |
Contributors: Gallery-Bank,contact-banker
|
3 |
+
Tags: add album, add gallery, add pictures, admin, AJAX, album, banner rotator, best gallery, best gallery plugin, comments, filterable gallery, foto, fotoalbum, fotogalerie, free photo gallery, fullscreen gallery, fullscreen slider, galeri, galerie, Galleria, galleries, gallery, gallery decription, gallery image, gallery lightbox, gallery shortcode, gallery slider, image, image album, image gallery, image lightbox, image rotate, image slider, image slideshow, images, images gallery, instagram, jquery, jquery gallery, lightbox, media, mosaic, multiple pictures, photo, photo album, photo albums, photo gallery, photoalbum, photogallery, photography, photos, photoset, picture, pictures, responsive, responsive gallery, responsive wordpress photo gallery, sidebar, Simple gallery, slide, slide show, slideshow, thumbnail, thumbnail view, thumbnails, thumbs, upload images, upload photos, video gallery, videos, view images, view pictures, vimeo, watermarking, watermarks, website gallery, widget gallery, wordpress gallery, wordpress gallery plugin, wordpress photo gallery plugin, wp gallery, wp gallery plugins, youtube, gallery bank
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 4.3
|
6 |
+
Stable tag: 3.0.330
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
10 |
+
Gallery Bank is an super advanced plugin which creates Beautiful Photo Galleries and Albums for WordPress Websites. It is fully responsive.
|
11 |
|
12 |
== Description ==
|
13 |
|
72 |
|
73 |
**[Like & Support Us on Facebook](https://www.facebook.com/TechBanker/)**
|
74 |
|
75 |
+
= **Key Features in Gallery Bank Lite Edition** =
|
76 |
|
77 |
* Multi-Lingual. Available now in 36 Languages.
|
78 |
* Responsive Photo Gallery
|
91 |
* Masonry Gallery Format
|
92 |
* List Album Format
|
93 |
|
94 |
+
= **Key Features in Gallery Bank Premium Editions** =
|
95 |
|
96 |
Take your media to the next level with [Gallery Bank Premium Editions](http://tech-banker.com/products/wp-gallery-bank/), which gives you 200+ features such as:
|
97 |
|
500 |
|
501 |
== Changelog ==
|
502 |
|
503 |
+
= 3.0.330 =
|
504 |
+
|
505 |
+
* Few Security Issues Fixed.
|
506 |
+
* Isotope 2.2.2 Version used.
|
507 |
+
|
508 |
= 3.0.229 =
|
509 |
|
510 |
* Compatibility with 4.3
|
views/edit-album.php
CHANGED
@@ -460,12 +460,11 @@
|
|
460 |
jQuery("body,html").animate({
|
461 |
scrollTop: jQuery("body,html").position().top}, "slow");
|
462 |
var albumid = jQuery("#ux_hidden_album_id").val();
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
}
|
469 |
|
470 |
var uxEditDescription = "";
|
471 |
|
460 |
jQuery("body,html").animate({
|
461 |
scrollTop: jQuery("body,html").position().top}, "slow");
|
462 |
var albumid = jQuery("#ux_hidden_album_id").val();
|
463 |
+
jQuery.post(ajaxurl,"albumid=" + albumid + "¶m=delete_pic&action=add_new_album_library", function ()
|
464 |
+
{
|
465 |
+
|
466 |
+
|
467 |
+
});
|
|
|
468 |
|
469 |
var uxEditDescription = "";
|
470 |
|