Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

More tile layout options and jcarousel added

Taylor Gunnoe5376da66b8d3
diff --git a/web/css/wv.layers.modal.css b/web/css/wv.layers.modal.css
index 1031f1106..8f279f3d9 100644
--- a/web/css/wv.layers.modal.css
+++ b/web/css/wv.layers.modal.css
@@ -8,6 +8,7 @@
}
.layer-modal, .layer-modal.ui-dialog{
background:rgb(220,220,220);
+
}
.layer-modal div, .layer-modal span{
font-family:open_sans_light;
@@ -47,13 +48,36 @@
/* Tile layout */
-.product-modal{
- position:relative;
+#product-modal{
+ padding-left:10px;
+ padding-right:10px;
+ padding-top:0;
+}
+.stamp {
+ cursor:pointer;
+ position:absolute
+}
+.grid{
+ height:100%;
+}
+.grid1{
+ position: relative;
+ float:left;
+ width:310px;
+}
+
+.grid2{
+ margin-left:320px;
}
.grid-item {
background-color:#000;
width: 150px;
height: 70px;
+ cursor:pointer;
+}
+.grid-item:hover,
+.stamp:hover {
+ opacity:0.6;
}
.grid-item--width2 {
background-color:#666;
diff --git a/web/css/wv.sidebar.css b/web/css/wv.sidebar.css
index 42f0aaf8a..c166f132c 100644
--- a/web/css/wv.sidebar.css
+++ b/web/css/wv.sidebar.css
@@ -34,6 +34,9 @@
-o-box-sizing:border-box;
padding:5px 0 0 0;
}
+#productsHolder ul#overlays{
+ margin-bottom:10px;
+}
#productsHolder footer{
padding:10px 0;
}
diff --git a/web/ext/layers/jcarousel/jcarousel.js b/web/ext/layers/jcarousel/jcarousel.js
new file mode 100755
index 000000000..9f9a21b96
--- /dev/null
+++ b/web/ext/layers/jcarousel/jcarousel.js
@@ -0,0 +1,1026 @@
+/*! jCarousel - v0.3.3 - 2015-04-07
+* http://sorgalla.com/jcarousel/
+* Copyright (c) 2006-2015 Jan Sorgalla; Licensed MIT */
+(function($) {
+ 'use strict';
+
+ var jCarousel = $.jCarousel = {};
+
+ jCarousel.version = '0.3.3';
+
+ var rRelativeTarget = /^([+\-]=)?(.+)$/;
+
+ jCarousel.parseTarget = function(target) {
+ var relative = false,
+ parts = typeof target !== 'object' ?
+ rRelativeTarget.exec(target) :
+ null;
+
+ if (parts) {
+ target = parseInt(parts[2], 10) || 0;
+
+ if (parts[1]) {
+ relative = true;
+ if (parts[1] === '-=') {
+ target *= -1;
+ }
+ }
+ } else if (typeof target !== 'object') {
+ target = parseInt(target, 10) || 0;
+ }
+
+ return {
+ target: target,
+ relative: relative
+ };
+ };
+
+ jCarousel.detectCarousel = function(element) {
+ var carousel;
+
+ while (element.length > 0) {
+ carousel = element.filter('[data-jcarousel]');
+
+ if (carousel.length > 0) {
+ return carousel;
+ }
+
+ carousel = element.find('[data-jcarousel]');
+
+ if (carousel.length > 0) {
+ return carousel;
+ }
+
+ element = element.parent();
+ }
+
+ return null;
+ };
+
+ jCarousel.base = function(pluginName) {
+ return {
+ version: jCarousel.version,
+ _options: {},
+ _element: null,
+ _carousel: null,
+ _init: $.noop,
+ _create: $.noop,
+ _destroy: $.noop,
+ _reload: $.noop,
+ create: function() {
+ this._element
+ .attr('data-' + pluginName.toLowerCase(), true)
+ .data(pluginName, this);
+
+ if (false === this._trigger('create')) {
+ return this;
+ }
+
+ this._create();
+
+ this._trigger('createend');
+
+ return this;
+ },
+ destroy: function() {
+ if (false === this._trigger('destroy')) {
+ return this;
+ }
+
+ this._destroy();
+
+ this._trigger('destroyend');
+
+ this._element
+ .removeData(pluginName)
+ .removeAttr('data-' + pluginName.toLowerCase());
+
+ return this;
+ },
+ reload: function(options) {
+ if (false === this._trigger('reload')) {
+ return this;
+ }
+
+ if (options) {
+ this.options(options);
+ }
+
+ this._reload();
+
+ this._trigger('reloadend');
+
+ return this;
+ },
+ element: function() {
+ return this._element;
+ },
+ options: function(key, value) {
+ if (arguments.length === 0) {
+ return $.extend({}, this._options);
+ }
+
+ if (typeof key === 'string') {
+ if (typeof value === 'undefined') {
+ return typeof this._options[key] === 'undefined' ?
+ null :
+ this._options[key];
+ }
+
+ this._options[key] = value;
+ } else {
+ this._options = $.extend({}, this._options, key);
+ }
+
+ return this;
+ },
+ carousel: function() {
+ if (!this._carousel) {
+ this._carousel = jCarousel.detectCarousel(this.options('carousel') || this._element);
+
+ if (!this._carousel) {
+ $.error('Could not detect carousel for plugin "' + pluginName + '"');
+ }
+ }
+
+ return this._carousel;
+ },
+ _trigger: function(type, element, data) {
+ var event,
+ defaultPrevented = false;
+
+ data = [this].concat(data || []);
+
+ (element || this._element).each(function() {
+ event = $.Event((pluginName + ':' + type).toLowerCase());
+
+ $(this).trigger(event, data);
+
+ if (event.isDefaultPrevented()) {
+ defaultPrevented = true;
+ }
+ });
+
+ return !defaultPrevented;
+ }
+ };
+ };
+
+ jCarousel.plugin = function(pluginName, pluginPrototype) {
+ var Plugin = $[pluginName] = function(element, options) {
+ this._element = $(element);
+ this.options(options);
+
+ this._init();
+ this.create();
+ };
+
+ Plugin.fn = Plugin.prototype = $.extend(
+ {},
+ jCarousel.base(pluginName),
+ pluginPrototype
+ );
+
+ $.fn[pluginName] = function(options) {
+ var args = Array.prototype.slice.call(arguments, 1),
+ returnValue = this;
+
+ if (typeof options === 'string') {
+ this.each(function() {
+ var instance = $(this).data(pluginName);
+
+ if (!instance) {
+ return $.error(
+ 'Cannot call methods on ' + pluginName + ' prior to initialization; ' +
+ 'attempted to call method "' + options + '"'
+ );
+ }
+
+ if (!$.isFunction(instance[options]) || options.charAt(0) === '_') {
+ return $.error(
+ 'No such method "' + options + '" for ' + pluginName + ' instance'
+ );
+ }
+
+ var methodValue = instance[options].apply(instance, args);
+
+ if (methodValue !== instance && typeof methodValue !== 'undefined') {
+ returnValue = methodValue;
+ return false;
+ }
+ });
+ } else {
+ this.each(function() {
+ var instance = $(this).data(pluginName);
+
+ if (instance instanceof Plugin) {
+ instance.reload(options);
+ } else {
+ new Plugin(this, options);
+ }
+ });
+ }
+
+ return returnValue;
+ };
+
+ return Plugin;
+ };
+}(jQuery));
+
+(function($, window) {
+ 'use strict';
+
+ var toFloat = function(val) {
+ return parseFloat(val) || 0;
+ };
+
+ $.jCarousel.plugin('jcarousel', {
+ animating: false,
+ tail: 0,
+ inTail: false,
+ resizeTimer: null,
+ lt: null,
+ vertical: false,
+ rtl: false,
+ circular: false,
+ underflow: false,
+ relative: false,
+
+ _options: {
+ list: function() {
+ return this.element().children().eq(0);
+ },
+ items: function() {
+ return this.list().children();
+ },
+ animation: 400,
+ transitions: false,
+ wrap: null,
+ vertical: null,
+ rtl: null,
+ center: false
+ },
+
+ // Protected, don't access directly
+ _list: null,
+ _items: null,
+ _target: $(),
+ _first: $(),
+ _last: $(),
+ _visible: $(),
+ _fullyvisible: $(),
+ _init: function() {
+ var self = this;
+
+ this.onWindowResize = function() {
+ if (self.resizeTimer) {
+ clearTimeout(self.resizeTimer);
+ }
+
+ self.resizeTimer = setTimeout(function() {
+ self.reload();
+ }, 100);
+ };
+
+ return this;
+ },
+ _create: function() {
+ this._reload();
+
+ $(window).on('resize.jcarousel', this.onWindowResize);
+ },
+ _destroy: function() {
+ $(window).off('resize.jcarousel', this.onWindowResize);
+ },
+ _reload: function() {
+ this.vertical = this.options('vertical');
+
+ if (this.vertical == null) {
+ this.vertical = this.list().height() > this.list().width();
+ }
+
+ this.rtl = this.options('rtl');
+
+ if (this.rtl == null) {
+ this.rtl = (function(element) {
+ if (('' + element.attr('dir')).toLowerCase() === 'rtl') {
+ return true;
+ }
+
+ var found = false;
+
+ element.parents('[dir]').each(function() {
+ if ((/rtl/i).test($(this).attr('dir'))) {
+ found = true;
+ return false;
+ }
+ });
+
+ return found;
+ }(this._element));
+ }
+
+ this.lt = this.vertical ? 'top' : 'left';
+
+ // Ensure before closest() call
+ this.relative = this.list().css('position') === 'relative';
+
+ // Force list and items reload
+ this._list = null;
+ this._items = null;
+
+ var item = this.index(this._target) >= 0 ?
+ this._target :
+ this.closest();
+
+ // _prepare() needs this here
+ this.circular = this.options('wrap') === 'circular';
+ this.underflow = false;
+
+ var props = {'left': 0, 'top': 0};
+
+ if (item.length > 0) {
+ this._prepare(item);
+ this.list().find('[data-jcarousel-clone]').remove();
+
+ // Force items reload
+ this._items = null;
+
+ this.underflow = this._fullyvisible.length >= this.items().length;
+ this.circular = this.circular && !this.underflow;
+
+ props[this.lt] = this._position(item) + 'px';
+ }
+
+ this.move(props);
+
+ return this;
+ },
+ list: function() {
+ if (this._list === null) {
+ var option = this.options('list');
+ this._list = $.isFunction(option) ? option.call(this) : this._element.find(option);
+ }
+
+ return this._list;
+ },
+ items: function() {
+ if (this._items === null) {
+ var option = this.options('items');
+ this._items = ($.isFunction(option) ? option.call(this) : this.list().find(option)).not('[data-jcarousel-clone]');
+ }
+
+ return this._items;
+ },
+ index: function(item) {
+ return this.items().index(item);
+ },
+ closest: function() {
+ var self = this,
+ pos = this.list().position()[this.lt],
+ closest = $(), // Ensure we're returning a jQuery instance
+ stop = false,
+ lrb = this.vertical ? 'bottom' : (this.rtl && !this.relative ? 'left' : 'right'),
+ width;
+
+ if (this.rtl && this.relative && !this.vertical) {
+ pos += this.list().width() - this.clipping();
+ }
+
+ this.items().each(function() {
+ closest = $(this);
+
+ if (stop) {
+ return false;
+ }
+
+ var dim = self.dimension(closest);
+
+ pos += dim;
+
+ if (pos >= 0) {
+ width = dim - toFloat(closest.css('margin-' + lrb));
+
+ if ((Math.abs(pos) - dim + (width / 2)) <= 0) {
+ stop = true;
+ } else {
+ return false;
+ }
+ }
+ });
+
+
+ return closest;
+ },
+ target: function() {
+ return this._target;
+ },
+ first: function() {
+ return this._first;
+ },
+ last: function() {
+ return this._last;
+ },
+ visible: function() {
+ return this._visible;
+ },
+ fullyvisible: function() {
+ return this._fullyvisible;
+ },
+ hasNext: function() {
+ if (false === this._trigger('hasnext')) {
+ return true;
+ }
+
+ var wrap = this.options('wrap'),
+ end = this.items().length - 1,
+ check = this.options('center') ? this._target : this._last;
+
+ return end >= 0 && !this.underflow &&
+ ((wrap && wrap !== 'first') ||
+ (this.index(check) < end) ||
+ (this.tail && !this.inTail)) ? true : false;
+ },
+ hasPrev: function() {
+ if (false === this._trigger('hasprev')) {
+ return true;
+ }
+
+ var wrap = this.options('wrap');
+
+ return this.items().length > 0 && !this.underflow &&
+ ((wrap && wrap !== 'last') ||
+ (this.index(this._first) > 0) ||
+ (this.tail && this.inTail)) ? true : false;
+ },
+ clipping: function() {
+ return this._element['inner' + (this.vertical ? 'Height' : 'Width')]();
+ },
+ dimension: function(element) {
+ return element['outer' + (this.vertical ? 'Height' : 'Width')](true);
+ },
+ scroll: function(target, animate, callback) {
+ if (this.animating) {
+ return this;
+ }
+
+ if (false === this._trigger('scroll', null, [target, animate])) {
+ return this;
+ }
+
+ if ($.isFunction(animate)) {
+ callback = animate;
+ animate = true;
+ }
+
+ var parsed = $.jCarousel.parseTarget(target);
+
+ if (parsed.relative) {
+ var end = this.items().length - 1,
+ scroll = Math.abs(parsed.target),
+ wrap = this.options('wrap'),
+ current,
+ first,
+ index,
+ start,
+ curr,
+ isVisible,
+ props,
+ i;
+
+ if (parsed.target > 0) {
+ var last = this.index(this._last);
+
+ if (last >= end && this.tail) {
+ if (!this.inTail) {
+ this._scrollTail(animate, callback);
+ } else {
+ if (wrap === 'both' || wrap === 'last') {
+ this._scroll(0, animate, callback);
+ } else {
+ if ($.isFunction(callback)) {
+ callback.call(this, false);
+ }
+ }
+ }
+ } else {
+ current = this.index(this._target);
+
+ if ((this.underflow && current === end && (wrap === 'circular' || wrap === 'both' || wrap === 'last')) ||
+ (!this.underflow && last === end && (wrap === 'both' || wrap === 'last'))) {
+ this._scroll(0, animate, callback);
+ } else {
+ index = current + scroll;
+
+ if (this.circular && index > end) {
+ i = end;
+ curr = this.items().get(-1);
+
+ while (i++ < index) {
+ curr = this.items().eq(0);
+ isVisible = this._visible.index(curr) >= 0;
+
+ if (isVisible) {
+ curr.after(curr.clone(true).attr('data-jcarousel-clone', true));
+ }
+
+ this.list().append(curr);
+
+ if (!isVisible) {
+ props = {};
+ props[this.lt] = this.dimension(curr);
+ this.moveBy(props);
+ }
+
+ // Force items reload
+ this._items = null;
+ }
+
+ this._scroll(curr, animate, callback);
+ } else {
+ this._scroll(Math.min(index, end), animate, callback);
+ }
+ }
+ }
+ } else {
+ if (this.inTail) {
+ this._scroll(Math.max((this.index(this._first) - scroll) + 1, 0), animate, callback);
+ } else {
+ first = this.index(this._first);
+ current = this.index(this._target);
+ start = this.underflow ? current : first;
+ index = start - scroll;
+
+ if (start <= 0 && ((this.underflow && wrap === 'circular') || wrap === 'both' || wrap === 'first')) {
+ this._scroll(end, animate, callback);
+ } else {
+ if (this.circular && index < 0) {
+ i = index;
+ curr = this.items().get(0);
+
+ while (i++ < 0) {
+ curr = this.items().eq(-1);
+ isVisible = this._visible.index(curr) >= 0;
+
+ if (isVisible) {
+ curr.after(curr.clone(true).attr('data-jcarousel-clone', true));
+ }
+
+ this.list().prepend(curr);
+
+ // Force items reload
+ this._items = null;
+
+ var dim = this.dimension(curr);
+
+ props = {};
+ props[this.lt] = -dim;
+ this.moveBy(props);
+
+ }
+
+ this._scroll(curr, animate, callback);
+ } else {
+ this._scroll(Math.max(index, 0), animate, callback);
+ }
+ }
+ }
+ }
+ } else {
+ this._scroll(parsed.target, animate, callback);
+ }
+
+ this._trigger('scrollend');
+
+ return this;
+ },
+ moveBy: function(properties, opts) {
+ var position = this.list().position(),
+ multiplier = 1,
+ correction = 0;
+
+ if (this.rtl && !this.vertical) {
+ multiplier = -1;
+
+ if (this.relative) {
+ correction = this.list().width() - this.clipping();
+ }
+ }
+
+ if (properties.left) {
+ properties.left = (position.left + correction + toFloat(properties.left) * multiplier) + 'px';
+ }
+
+ if (properties.top) {
+ properties.top = (position.top + correction + toFloat(properties.top) * multiplier) + 'px';
+ }
+
+ return this.move(properties, opts);
+ },
+ move: function(properties, opts) {
+ opts = opts || {};
+
+ var option = this.options('transitions'),
+ transitions = !!option,
+ transforms = !!option.transforms,
+ transforms3d = !!option.transforms3d,
+ duration = opts.duration || 0,
+ list = this.list();
+
+ if (!transitions && duration > 0) {
+ list.animate(properties, opts);
+ return;
+ }
+
+ var complete = opts.complete || $.noop,
+ css = {};
+
+ if (transitions) {
+ var backup = {
+ transitionDuration: list.css('transitionDuration'),
+ transitionTimingFunction: list.css('transitionTimingFunction'),
+ transitionProperty: list.css('transitionProperty')
+ },
+ oldComplete = complete;
+
+ complete = function() {
+ $(this).css(backup);
+ oldComplete.call(this);
+ };
+ css = {
+ transitionDuration: (duration > 0 ? duration / 1000 : 0) + 's',
+ transitionTimingFunction: option.easing || opts.easing,
+ transitionProperty: duration > 0 ? (function() {
+ if (transforms || transforms3d) {
+ // We have to use 'all' because jQuery doesn't prefix
+ // css values, like transition-property: transform;
+ return 'all';
+ }
+
+ return properties.left ? 'left' : 'top';
+ })() : 'none',
+ transform: 'none'
+ };
+ }
+
+ if (transforms3d) {
+ css.transform = 'translate3d(' + (properties.left || 0) + ',' + (properties.top || 0) + ',0)';
+ } else if (transforms) {
+ css.transform = 'translate(' + (properties.left || 0) + ',' + (properties.top || 0) + ')';
+ } else {
+ $.extend(css, properties);
+ }
+
+ if (transitions && duration > 0) {
+ list.one('transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd', complete);
+ }
+
+ list.css(css);
+
+ if (duration <= 0) {
+ list.each(function() {
+ complete.call(this);
+ });
+ }
+ },
+ _scroll: function(item, animate, callback) {
+ if (this.animating) {
+ if ($.isFunction(callback)) {
+ callback.call(this, false);
+ }
+
+ return this;
+ }
+
+ if (typeof item !== 'object') {
+ item = this.items().eq(item);
+ } else if (typeof item.jquery === 'undefined') {
+ item = $(item);
+ }
+
+ if (item.length === 0) {
+ if ($.isFunction(callback)) {
+ callback.call(this, false);
+ }
+
+ return this;
+ }
+
+ this.inTail = false;
+
+ this._prepare(item);
+
+ var pos = this._position(item),
+ currPos = this.list().position()[this.lt];
+
+ if (pos === currPos) {
+ if ($.isFunction(callback)) {
+ callback.call(this, false);
+ }
+
+ return this;
+ }
+
+ var properties = {};
+ properties[this.lt] = pos + 'px';
+
+ this._animate(properties, animate, callback);
+
+ return this;
+ },
+ _scrollTail: function(animate, callback) {
+ if (this.animating || !this.tail) {
+ if ($.isFunction(callback)) {
+ callback.call(this, false);
+ }
+
+ return this;
+ }
+
+ var pos = this.list().position()[this.lt];
+
+ if (this.rtl && this.relative && !this.vertical) {
+ pos += this.list().width() - this.clipping();
+ }
+
+ if (this.rtl && !this.vertical) {
+ pos += this.tail;
+ } else {
+ pos -= this.tail;
+ }
+
+ this.inTail = true;
+
+ var properties = {};
+ properties[this.lt] = pos + 'px';
+
+ this._update({
+ target: this._target.next(),
+ fullyvisible: this._fullyvisible.slice(1).add(this._visible.last())
+ });
+
+ this._animate(properties, animate, callback);
+
+ return this;
+ },
+ _animate: function(properties, animate, callback) {
+ callback = callback || $.noop;
+
+ if (false === this._trigger('animate')) {
+ callback.call(this, false);
+ return this;
+ }
+
+ this.animating = true;
+
+ var animation = this.options('animation'),
+ complete = $.proxy(function() {
+ this.animating = false;
+
+ var c = this.list().find('[data-jcarousel-clone]');
+
+ if (c.length > 0) {
+ c.remove();
+ this._reload();
+ }
+
+ this._trigger('animateend');
+
+ callback.call(this, true);
+ }, this);
+
+ var opts = typeof animation === 'object' ?
+ $.extend({}, animation) :
+ {duration: animation},
+ oldComplete = opts.complete || $.noop;
+
+ if (animate === false) {
+ opts.duration = 0;
+ } else if (typeof $.fx.speeds[opts.duration] !== 'undefined') {
+ opts.duration = $.fx.speeds[opts.duration];
+ }
+
+ opts.complete = function() {
+ complete();
+ oldComplete.call(this);
+ };
+
+ this.move(properties, opts);
+
+ return this;
+ },
+ _prepare: function(item) {
+ var index = this.index(item),
+ idx = index,
+ wh = this.dimension(item),
+ clip = this.clipping(),
+ lrb = this.vertical ? 'bottom' : (this.rtl ? 'left' : 'right'),
+ center = this.options('center'),
+ update = {
+ target: item,
+ first: item,
+ last: item,
+ visible: item,
+ fullyvisible: wh <= clip ? item : $()
+ },
+ curr,
+ isVisible,
+ margin,
+ dim;
+
+ if (center) {
+ wh /= 2;
+ clip /= 2;
+ }
+
+ if (wh < clip) {
+ while (true) {
+ curr = this.items().eq(++idx);
+
+ if (curr.length === 0) {
+ if (!this.circular) {
+ break;
+ }
+
+ curr = this.items().eq(0);
+
+ if (item.get(0) === curr.get(0)) {
+ break;
+ }
+
+ isVisible = this._visible.index(curr) >= 0;
+
+ if (isVisible) {
+ curr.after(curr.clone(true).attr('data-jcarousel-clone', true));
+ }
+
+ this.list().append(curr);
+
+ if (!isVisible) {
+ var props = {};
+ props[this.lt] = this.dimension(curr);
+ this.moveBy(props);
+ }
+
+ // Force items reload
+ this._items = null;
+ }
+
+ dim = this.dimension(curr);
+
+ if (dim === 0) {
+ break;
+ }
+
+ wh += dim;
+
+ update.last = curr;
+ update.visible = update.visible.add(curr);
+
+ // Remove right/bottom margin from total width
+ margin = toFloat(curr.css('margin-' + lrb));
+
+ if ((wh - margin) <= clip) {
+ update.fullyvisible = update.fullyvisible.add(curr);
+ }
+
+ if (wh >= clip) {
+ break;
+ }
+ }
+ }
+
+ if (!this.circular && !center && wh < clip) {
+ idx = index;
+
+ while (true) {
+ if (--idx < 0) {
+ break;
+ }
+
+ curr = this.items().eq(idx);
+
+ if (curr.length === 0) {
+ break;
+ }
+
+ dim = this.dimension(curr);
+
+ if (dim === 0) {
+ break;
+ }
+
+ wh += dim;
+
+ update.first = curr;
+ update.visible = update.visible.add(curr);
+
+ // Remove right/bottom margin from total width
+ margin = toFloat(curr.css('margin-' + lrb));
+
+ if ((wh - margin) <= clip) {
+ update.fullyvisible = update.fullyvisible.add(curr);
+ }
+
+ if (wh >= clip) {
+ break;
+ }
+ }
+ }
+
+ this._update(update);
+
+ this.tail = 0;
+
+ if (!center &&
+ this.options('wrap') !== 'circular' &&
+ this.options('wrap') !== 'custom' &&
+ this.index(update.last) === (this.items().length - 1)) {
+
+ // Remove right/bottom margin from total width
+ wh -= toFloat(update.last.css('margin-' + lrb));
+
+ if (wh > clip) {
+ this.tail = wh - clip;
+ }
+ }
+
+ return this;
+ },
+ _position: function(item) {
+ var first = this._first,
+ pos = first.position()[this.lt],
+ center = this.options('center'),
+ centerOffset = center ? (this.clipping() / 2) - (this.dimension(first) / 2) : 0;
+
+ if (this.rtl && !this.vertical) {
+ if (this.relative) {
+ pos -= this.list().width() - this.dimension(first);
+ } else {
+ pos -= this.clipping() - this.dimension(first);
+ }
+
+ pos += centerOffset;
+ } else {
+ pos -= centerOffset;
+ }
+
+ if (!center &&
+ (this.index(item) > this.index(first) || this.inTail) &&
+ this.tail) {
+ pos = this.rtl && !this.vertical ? pos - this.tail : pos + this.tail;
+ this.inTail = true;
+ } else {
+ this.inTail = false;
+ }
+
+ return -pos;
+ },
+ _update: function(update) {
+ var self = this,
+ current = {
+ target: this._target,
+ first: this._first,
+ last: this._last,
+ visible: this._visible,
+ fullyvisible: this._fullyvisible
+ },
+ back = this.index(update.first || current.first) < this.index(current.first),
+ key,
+ doUpdate = function(key) {
+ var elIn = [],
+ elOut = [];
+
+ update[key].each(function() {
+ if (current[key].index(this) < 0) {
+ elIn.push(this);
+ }
+ });
+
+ current[key].each(function() {
+ if (update[key].index(this) < 0) {
+ elOut.push(this);
+ }
+ });
+
+ if (back) {
+ elIn = elIn.reverse();
+ } else {
+ elOut = elOut.reverse();
+ }
+
+ self._trigger(key + 'in', $(elIn));
+ self._trigger(key + 'out', $(elOut));
+
+ self['_' + key] = update[key];
+ };
+
+ for (key in update) {
+ doUpdate(key);
+ }
+
+ return this;
+ }
+ });
+}(jQuery, window));
diff --git a/web/ext/layers/jcarousel/jcarousel.min.js b/web/ext/layers/jcarousel/jcarousel.min.js
new file mode 100755
index 000000000..96e91a3d5
--- /dev/null
+++ b/web/ext/layers/jcarousel/jcarousel.min.js
@@ -0,0 +1,4 @@
+/*! jCarousel - v0.3.3 - 2015-04-07
+* http://sorgalla.com/jcarousel/
+* Copyright (c) 2006-2015 Jan Sorgalla; Licensed MIT */
+!function(a){"use strict";var b=a.jCarousel={};b.version="0.3.3";var c=/^([+\-]=)?(.+)$/;b.parseTarget=function(a){var b=!1,d="object"!=typeof a?c.exec(a):null;return d?(a=parseInt(d[2],10)||0,d[1]&&(b=!0,"-="===d[1]&&(a*=-1))):"object"!=typeof a&&(a=parseInt(a,10)||0),{target:a,relative:b}},b.detectCarousel=function(a){for(var b;a.length>0;){if(b=a.filter("[data-jcarousel]"),b.length>0)return b;if(b=a.find("[data-jcarousel]"),b.length>0)return b;a=a.parent()}return null},b.base=function(c){return{version:b.version,_options:{},_element:null,_carousel:null,_init:a.noop,_create:a.noop,_destroy:a.noop,_reload:a.noop,create:function(){return this._element.attr("data-"+c.toLowerCase(),!0).data(c,this),!1===this._trigger("create")?this:(this._create(),this._trigger("createend"),this)},destroy:function(){return!1===this._trigger("destroy")?this:(this._destroy(),this._trigger("destroyend"),this._element.removeData(c).removeAttr("data-"+c.toLowerCase()),this)},reload:function(a){return!1===this._trigger("reload")?this:(a&&this.options(a),this._reload(),this._trigger("reloadend"),this)},element:function(){return this._element},options:function(b,c){if(0===arguments.length)return a.extend({},this._options);if("string"==typeof b){if("undefined"==typeof c)return"undefined"==typeof this._options[b]?null:this._options[b];this._options[b]=c}else this._options=a.extend({},this._options,b);return this},carousel:function(){return this._carousel||(this._carousel=b.detectCarousel(this.options("carousel")||this._element),this._carousel||a.error('Could not detect carousel for plugin "'+c+'"')),this._carousel},_trigger:function(b,d,e){var f,g=!1;return e=[this].concat(e||[]),(d||this._element).each(function(){f=a.Event((c+":"+b).toLowerCase()),a(this).trigger(f,e),f.isDefaultPrevented()&&(g=!0)}),!g}}},b.plugin=function(c,d){var e=a[c]=function(b,c){this._element=a(b),this.options(c),this._init(),this.create()};return e.fn=e.prototype=a.extend({},b.base(c),d),a.fn[c]=function(b){var d=Array.prototype.slice.call(arguments,1),f=this;return this.each("string"==typeof b?function(){var e=a(this).data(c);if(!e)return a.error("Cannot call methods on "+c+' prior to initialization; attempted to call method "'+b+'"');if(!a.isFunction(e[b])||"_"===b.charAt(0))return a.error('No such method "'+b+'" for '+c+" instance");var g=e[b].apply(e,d);return g!==e&&"undefined"!=typeof g?(f=g,!1):void 0}:function(){var d=a(this).data(c);d instanceof e?d.reload(b):new e(this,b)}),f},e}}(jQuery),function(a,b){"use strict";var c=function(a){return parseFloat(a)||0};a.jCarousel.plugin("jcarousel",{animating:!1,tail:0,inTail:!1,resizeTimer:null,lt:null,vertical:!1,rtl:!1,circular:!1,underflow:!1,relative:!1,_options:{list:function(){return this.element().children().eq(0)},items:function(){return this.list().children()},animation:400,transitions:!1,wrap:null,vertical:null,rtl:null,center:!1},_list:null,_items:null,_target:a(),_first:a(),_last:a(),_visible:a(),_fullyvisible:a(),_init:function(){var a=this;return this.onWindowResize=function(){a.resizeTimer&&clearTimeout(a.resizeTimer),a.resizeTimer=setTimeout(function(){a.reload()},100)},this},_create:function(){this._reload(),a(b).on("resize.jcarousel",this.onWindowResize)},_destroy:function(){a(b).off("resize.jcarousel",this.onWindowResize)},_reload:function(){this.vertical=this.options("vertical"),null==this.vertical&&(this.vertical=this.list().height()>this.list().width()),this.rtl=this.options("rtl"),null==this.rtl&&(this.rtl=function(b){if("rtl"===(""+b.attr("dir")).toLowerCase())return!0;var c=!1;return b.parents("[dir]").each(function(){return/rtl/i.test(a(this).attr("dir"))?(c=!0,!1):void 0}),c}(this._element)),this.lt=this.vertical?"top":"left",this.relative="relative"===this.list().css("position"),this._list=null,this._items=null;var b=this.index(this._target)>=0?this._target:this.closest();this.circular="circular"===this.options("wrap"),this.underflow=!1;var c={left:0,top:0};return b.length>0&&(this._prepare(b),this.list().find("[data-jcarousel-clone]").remove(),this._items=null,this.underflow=this._fullyvisible.length>=this.items().length,this.circular=this.circular&&!this.underflow,c[this.lt]=this._position(b)+"px"),this.move(c),this},list:function(){if(null===this._list){var b=this.options("list");this._list=a.isFunction(b)?b.call(this):this._element.find(b)}return this._list},items:function(){if(null===this._items){var b=this.options("items");this._items=(a.isFunction(b)?b.call(this):this.list().find(b)).not("[data-jcarousel-clone]")}return this._items},index:function(a){return this.items().index(a)},closest:function(){var b,d=this,e=this.list().position()[this.lt],f=a(),g=!1,h=this.vertical?"bottom":this.rtl&&!this.relative?"left":"right";return this.rtl&&this.relative&&!this.vertical&&(e+=this.list().width()-this.clipping()),this.items().each(function(){if(f=a(this),g)return!1;var i=d.dimension(f);if(e+=i,e>=0){if(b=i-c(f.css("margin-"+h)),!(Math.abs(e)-i+b/2<=0))return!1;g=!0}}),f},target:function(){return this._target},first:function(){return this._first},last:function(){return this._last},visible:function(){return this._visible},fullyvisible:function(){return this._fullyvisible},hasNext:function(){if(!1===this._trigger("hasnext"))return!0;var a=this.options("wrap"),b=this.items().length-1,c=this.options("center")?this._target:this._last;return b>=0&&!this.underflow&&(a&&"first"!==a||this.index(c)<b||this.tail&&!this.inTail)?!0:!1},hasPrev:function(){if(!1===this._trigger("hasprev"))return!0;var a=this.options("wrap");return this.items().length>0&&!this.underflow&&(a&&"last"!==a||this.index(this._first)>0||this.tail&&this.inTail)?!0:!1},clipping:function(){return this._element["inner"+(this.vertical?"Height":"Width")]()},dimension:function(a){return a["outer"+(this.vertical?"Height":"Width")](!0)},scroll:function(b,c,d){if(this.animating)return this;if(!1===this._trigger("scroll",null,[b,c]))return this;a.isFunction(c)&&(d=c,c=!0);var e=a.jCarousel.parseTarget(b);if(e.relative){var f,g,h,i,j,k,l,m,n=this.items().length-1,o=Math.abs(e.target),p=this.options("wrap");if(e.target>0){var q=this.index(this._last);if(q>=n&&this.tail)this.inTail?"both"===p||"last"===p?this._scroll(0,c,d):a.isFunction(d)&&d.call(this,!1):this._scrollTail(c,d);else if(f=this.index(this._target),this.underflow&&f===n&&("circular"===p||"both"===p||"last"===p)||!this.underflow&&q===n&&("both"===p||"last"===p))this._scroll(0,c,d);else if(h=f+o,this.circular&&h>n){for(m=n,j=this.items().get(-1);m++<h;)j=this.items().eq(0),k=this._visible.index(j)>=0,k&&j.after(j.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(j),k||(l={},l[this.lt]=this.dimension(j),this.moveBy(l)),this._items=null;this._scroll(j,c,d)}else this._scroll(Math.min(h,n),c,d)}else if(this.inTail)this._scroll(Math.max(this.index(this._first)-o+1,0),c,d);else if(g=this.index(this._first),f=this.index(this._target),i=this.underflow?f:g,h=i-o,0>=i&&(this.underflow&&"circular"===p||"both"===p||"first"===p))this._scroll(n,c,d);else if(this.circular&&0>h){for(m=h,j=this.items().get(0);m++<0;){j=this.items().eq(-1),k=this._visible.index(j)>=0,k&&j.after(j.clone(!0).attr("data-jcarousel-clone",!0)),this.list().prepend(j),this._items=null;var r=this.dimension(j);l={},l[this.lt]=-r,this.moveBy(l)}this._scroll(j,c,d)}else this._scroll(Math.max(h,0),c,d)}else this._scroll(e.target,c,d);return this._trigger("scrollend"),this},moveBy:function(a,b){var d=this.list().position(),e=1,f=0;return this.rtl&&!this.vertical&&(e=-1,this.relative&&(f=this.list().width()-this.clipping())),a.left&&(a.left=d.left+f+c(a.left)*e+"px"),a.top&&(a.top=d.top+f+c(a.top)*e+"px"),this.move(a,b)},move:function(b,c){c=c||{};var d=this.options("transitions"),e=!!d,f=!!d.transforms,g=!!d.transforms3d,h=c.duration||0,i=this.list();if(!e&&h>0)return void i.animate(b,c);var j=c.complete||a.noop,k={};if(e){var l={transitionDuration:i.css("transitionDuration"),transitionTimingFunction:i.css("transitionTimingFunction"),transitionProperty:i.css("transitionProperty")},m=j;j=function(){a(this).css(l),m.call(this)},k={transitionDuration:(h>0?h/1e3:0)+"s",transitionTimingFunction:d.easing||c.easing,transitionProperty:h>0?function(){return f||g?"all":b.left?"left":"top"}():"none",transform:"none"}}g?k.transform="translate3d("+(b.left||0)+","+(b.top||0)+",0)":f?k.transform="translate("+(b.left||0)+","+(b.top||0)+")":a.extend(k,b),e&&h>0&&i.one("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",j),i.css(k),0>=h&&i.each(function(){j.call(this)})},_scroll:function(b,c,d){if(this.animating)return a.isFunction(d)&&d.call(this,!1),this;if("object"!=typeof b?b=this.items().eq(b):"undefined"==typeof b.jquery&&(b=a(b)),0===b.length)return a.isFunction(d)&&d.call(this,!1),this;this.inTail=!1,this._prepare(b);var e=this._position(b),f=this.list().position()[this.lt];if(e===f)return a.isFunction(d)&&d.call(this,!1),this;var g={};return g[this.lt]=e+"px",this._animate(g,c,d),this},_scrollTail:function(b,c){if(this.animating||!this.tail)return a.isFunction(c)&&c.call(this,!1),this;var d=this.list().position()[this.lt];this.rtl&&this.relative&&!this.vertical&&(d+=this.list().width()-this.clipping()),this.rtl&&!this.vertical?d+=this.tail:d-=this.tail,this.inTail=!0;var e={};return e[this.lt]=d+"px",this._update({target:this._target.next(),fullyvisible:this._fullyvisible.slice(1).add(this._visible.last())}),this._animate(e,b,c),this},_animate:function(b,c,d){if(d=d||a.noop,!1===this._trigger("animate"))return d.call(this,!1),this;this.animating=!0;var e=this.options("animation"),f=a.proxy(function(){this.animating=!1;var a=this.list().find("[data-jcarousel-clone]");a.length>0&&(a.remove(),this._reload()),this._trigger("animateend"),d.call(this,!0)},this),g="object"==typeof e?a.extend({},e):{duration:e},h=g.complete||a.noop;return c===!1?g.duration=0:"undefined"!=typeof a.fx.speeds[g.duration]&&(g.duration=a.fx.speeds[g.duration]),g.complete=function(){f(),h.call(this)},this.move(b,g),this},_prepare:function(b){var d,e,f,g,h=this.index(b),i=h,j=this.dimension(b),k=this.clipping(),l=this.vertical?"bottom":this.rtl?"left":"right",m=this.options("center"),n={target:b,first:b,last:b,visible:b,fullyvisible:k>=j?b:a()};if(m&&(j/=2,k/=2),k>j)for(;;){if(d=this.items().eq(++i),0===d.length){if(!this.circular)break;if(d=this.items().eq(0),b.get(0)===d.get(0))break;if(e=this._visible.index(d)>=0,e&&d.after(d.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(d),!e){var o={};o[this.lt]=this.dimension(d),this.moveBy(o)}this._items=null}if(g=this.dimension(d),0===g)break;if(j+=g,n.last=d,n.visible=n.visible.add(d),f=c(d.css("margin-"+l)),k>=j-f&&(n.fullyvisible=n.fullyvisible.add(d)),j>=k)break}if(!this.circular&&!m&&k>j)for(i=h;;){if(--i<0)break;if(d=this.items().eq(i),0===d.length)break;if(g=this.dimension(d),0===g)break;if(j+=g,n.first=d,n.visible=n.visible.add(d),f=c(d.css("margin-"+l)),k>=j-f&&(n.fullyvisible=n.fullyvisible.add(d)),j>=k)break}return this._update(n),this.tail=0,m||"circular"===this.options("wrap")||"custom"===this.options("wrap")||this.index(n.last)!==this.items().length-1||(j-=c(n.last.css("margin-"+l)),j>k&&(this.tail=j-k)),this},_position:function(a){var b=this._first,c=b.position()[this.lt],d=this.options("center"),e=d?this.clipping()/2-this.dimension(b)/2:0;return this.rtl&&!this.vertical?(c-=this.relative?this.list().width()-this.dimension(b):this.clipping()-this.dimension(b),c+=e):c-=e,!d&&(this.index(a)>this.index(b)||this.inTail)&&this.tail?(c=this.rtl&&!this.vertical?c-this.tail:c+this.tail,this.inTail=!0):this.inTail=!1,-c},_update:function(b){var c,d=this,e={target:this._target,first:this._first,last:this._last,visible:this._visible,fullyvisible:this._fullyvisible},f=this.index(b.first||e.first)<this.index(e.first),g=function(c){var g=[],h=[];b[c].each(function(){e[c].index(this)<0&&g.push(this)}),e[c].each(function(){b[c].index(this)<0&&h.push(this)}),f?g=g.reverse():h=h.reverse(),d._trigger(c+"in",a(g)),d._trigger(c+"out",a(h)),d["_"+c]=b[c]};for(c in b)g(c);return this}})}(jQuery,window);
\ No newline at end of file
diff --git a/web/index.html b/web/index.html
index fa56d0d7e..ae48a59a3 100644
--- a/web/index.html
+++ b/web/index.html
@@ -134,7 +134,10 @@
<!-- link.dev --> <script type="text/javascript" src="ext/layers/isotope/isotope.pkgd.js"></script>
<!-- link.prod --> <!-- <script type="text/javascript" src="ext/ui/layers/isotope.pkgd.min.js"></script> -->
<!-- link.dev --> <script type="text/javascript" src="ext/layers/isotope/packery-mode.pkgd.js"></script>
- <!-- link.prod --> <!-- <script type="text/javascript" src="ext/ui/layers/packery-mode.pkgd.min.js"></script> -->
+ <!-- link.prod --> <!-- <script type="text/javascript" src="ext/ui/layers/isotope/packery-mode.pkgd.min.js"></script> -->
+
+ <!-- link.dev --> <script type="text/javascript" src="ext/layers/jcarousel/jcarousel.js"></script>
+ <!-- link.prod --> <!-- <script type="text/javascript" src="ext/ui/layers/jcarousel/jcarousel.min.js"></script> -->
<!-- link.prod --> <!-- <script type="text/javascript" src="js/wv.js?v=20131218215115174&mobile"></script> -->
@@ -315,19 +318,45 @@
</div>
<div id="product-modal">
<div class="grid">
- <div class="grid-item grid-item--width3 grid-item--height2">...</div>
- <div class="grid-item grid-item--width2">Test Test font</div>
- <div class="grid-item">...</div>
- <div class="grid-item">...</div>
- <div class="grid-item">...</div>
- <div class="grid-item">...</div>
- <div class="grid-item">...</div>
- <div class="grid-item">...</div>
- <div class="grid-item grid-item--height3 grid-item--width2">...</div>
- <div class="grid-item grid-item--height3 grid-item--width2">...</div>
- <div class="grid-item">...</div>
- <div class="grid-item">...</div>
- <div class="grid-item">...</div>
+ <div class="stamp grid-item--height2">
+ <ul>
+ <li>Slide 1</li>
+ <li>Slide 2</li>
+ </ul>
+ </div>
+ <div class="grid-item grid-item--width2">
+ <p class="number">1</p>
+ </div>
+ <div class="grid-item">
+ <p class="number">2</p>
+ </div>
+ <div class="grid-item">
+ <p class="number">3</p>
+ </div>
+ <div class="grid-item" id="test">
+ <p class="number">4</p>
+ </div>
+ <div class="grid-item">
+ <p class="number">5</p>
+ </div>
+ <div class="grid-item">
+ <p class="number">6</p>
+ </div>
+ <div class="grid-item">
+ <p class="number">7</p>
+ </div>
+ <div class="grid-item grid-item--height3 grid-item--width2">
+ <p class="number">8</p>
+ </div>
+ <div class="grid-item grid-item--height3 grid-item--width2">
+ <p class="number">9</p>
+ </div>
+ <div class="grid-item">
+ <p class="number">10</p>
+ </div>
+ <div class="grid-item">
+ <p class="number">11</p>
+ </div>
</div>
</div>
<div id="wv-tour-content"></div>
diff --git a/web/js/layers/wv.layers.active.js b/web/js/layers/wv.layers.active.js
index f8fb3fd81..956ac1f8c 100644
--- a/web/js/layers/wv.layers.active.js
+++ b/web/js/layers/wv.layers.active.js
@@ -66,7 +66,7 @@ wv.layers.active = wv.layers.active || function(models, ui, config) {
$container.addClass('bank');
- _.each(groups, function(group) {
+ _.eachRight(groups, function(group) {
renderGroup($container, group);
});
diff --git a/web/js/layers/wv.layers.modal.js b/web/js/layers/wv.layers.modal.js
index 6452a87db..db16504f8 100644
--- a/web/js/layers/wv.layers.modal.js
+++ b/web/js/layers/wv.layers.modal.js
@@ -23,41 +23,88 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
var model = models.layers;
var $addBtn = $("#layers-add");
var self = {};
+ var sizeMultiplier;
- var resize = function(){
+ var redo = function(){
var h = $(window).height() - 200;
- var w = $(window).width() - 200;
- $( "#product-modal" ).dialog({
+ var w = $(window).width() - ($(window).width()*0.15);
+ var gridItemWidth = 160; //with of grid item + spacing
+ sizeMultiplier = Math.floor(w / gridItemWidth);
+
+ $( "#product-modal" ).dialog( "option", {
height: h,
- width: w,
+ width: gridItemWidth * sizeMultiplier + 10,
});
+ $( '.stamp' ).css("width", sizeMultiplier * gridItemWidth - 10 + "px");
+ };
+ var resize = function(){
+ if( $("#product-modal").dialog( "isOpen" ) ) {
+ redo();
+ }
+ };
+ var drawCategories = function(){
+
};
var init = function(){
var h = $(window).height() - 200;
- var w = $(window).width() - 200;
+ var w = $(window).width() - ($(window).width()*0.15);
+ var gridItemWidth = 160; //with of grid item + spacing
+
+ sizeMultiplier = Math.floor(w / gridItemWidth);
+
+ $( '.stamp' ).css("width", sizeMultiplier * gridItemWidth - 10 + "px");
+
+ $( '.grid, .grid2' ).isotope( {
+ // options
+ itemSelector: '.grid-item',
+ stamp: '.stamp',
+ sortBy: 'number',
+ layoutMode: 'packery',
+ packery: {
+ gutter: 10,
+ //isHorizontal: true
+ },
+ //transitionDuration: '0.2s'
+ } );
+
$addBtn.click(function(e){
$( "#product-modal" ).dialog({
resizable: false,
- height:h,
- width:w,
+ height: h,
+ width: gridItemWidth * sizeMultiplier + 10,
modal: true,
- dialogClass:"layer-modal",
+ dialogClass: "layer-modal",
draggable: false,
- title: "Search"
- });
- $('.grid').isotope({
- // options
- itemSelector: '.grid-item',
- layoutMode: 'packery',
- packery: {
- gutter: 10
+ title: "Search",
+ show: {
+ effect: "puff",
+ duration: 400
+ },
+ hide: {
+ effect: "puff",
+
+ duration: 300
+ },
+ open: function( event, ui ) {
+ redo();
+ //$('.grid').show(50);
+ $('.grid').isotope();
+
+ $(".ui-widget-overlay").click(function(e){
+ $( "#product-modal" ).dialog( "close" );
+ });
+ },
+ close: function( event, ui ) {
+ //$('.grid').hide(50);
+ $(".ui-widget-overlay").unbind("click");
},
-
});
+
});
-
+ //$( "#product-modal" ).dialog("close");
+
$(window).resize(resize);
};