');
this.$element.append(this.$stage.parent());
this.replace(this.$element.children().not(this.$stage.parent()));
this._width = this.$element.width(); // * 2 / 10
this.refresh();
this.$element.removeClass('owl-loading').addClass('owl-loaded');
this.$element.removeClass('owl-load-before').addClass('owl-loaded');
this.eventsCall();
this.internalEvents();
this.addTriggerableEvents();
this.trigger('initialized');
};
Owl.prototype.setup = function() {
var viewport = this.viewport(),
overwrites = this.options.responsive,
match = -1,
settings = null;
if (!overwrites) {
settings = $.extend({}, this.options);
} else {
$.each(overwrites, function(breakpoint) {
if (breakpoint <= viewport && breakpoint > match) {
match = Number(breakpoint);
}
});
settings = $.extend({}, this.options, overwrites[match]);
delete settings.responsive;
if (settings.responsiveClass) {
this.$element.attr('class', function(i, c) {
return c.replace(/\b owl-responsive-\S+/g, '');
}).addClass('owl-responsive-' + match);
}
}
if (this.settings === null || this._breakpoint !== match) {
this.trigger('change', {
property: {
name: 'settings',
value: settings
}
});
this._breakpoint = match;
this.settings = settings;
this.invalidate('settings');
this.trigger('changed', {
property: {
name: 'settings',
value: this.settings
}
});
}
};
Owl.prototype.optionsLogic = function() {
this.$element.toggleClass('owl-center', this.settings.center);
if (this.settings.loop && this._items.length < this.settings.items) {
this.settings.loop = false;
}
if (this.settings.autoWidth) {
this.settings.stagePadding = false;
this.settings.merge = false;
}
};
Owl.prototype.prepare = function(item) {
var event = this.trigger('prepare', {
content: item
});
if (!event.data) {
event.data = $('<' + this.settings.itemElement + '/>').addClass(this.settings.itemClass).append(item)
}
this.trigger('prepared', {
content: event.data
});
return event.data;
};
Owl.prototype.update = function() {
var i = 0,
n = this._pipe.length,
filter = $.proxy(function(p) {
return this[p]
}, this._invalidated),
cache = {};
while (i < n) {
if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
this._pipe[i].run(cache);
}
i++;
}
this._invalidated = {};
};
Owl.prototype.width = function(dimension) {
dimension = dimension || Owl.Width.Default;
switch (dimension) {
case Owl.Width.Inner:
case Owl.Width.Outer:
return this._width;
default:
return this._width - this.settings.stagePadding * 2 + this.settings.margin;
}
};
Owl.prototype.refresh = function() {
if (this._items.length === 0) {
return false;
}
var start = new Date().getTime();
this.trigger('refresh');
this.setup();
this.optionsLogic();
this.$stage.addClass('owl-refresh');
this.update();
this.$stage.removeClass('owl-refresh');
this.state.orientation = window.orientation;
this.watchVisibility();
this.trigger('refreshed');
};
Owl.prototype.eventsCall = function() {
this.e._onDragStart = $.proxy(function(e) {
this.onDragStart(e);
}, this);
this.e._onDragMove = $.proxy(function(e) {
this.onDragMove(e);
}, this);
this.e._onDragEnd = $.proxy(function(e) {
this.onDragEnd(e);
}, this);
this.e._onResize = $.proxy(function(e) {
this.onResize(e);
}, this);
this.e._transitionEnd = $.proxy(function(e) {
this.transitionEnd(e);
}, this);
this.e._preventClick = $.proxy(function(e) {
this.preventClick(e);
}, this);
};
Owl.prototype.onThrottledResize = function() {
window.clearTimeout(this.resizeTimer);
this.resizeTimer = window.setTimeout(this.e._onResize, this.settings.responsiveRefreshRate);
};
Owl.prototype.onResize = function() {
if (!this._items.length) {
return false;
}
if (this._width === this.$element.width()) {
return false;
}
if (this.trigger('resize').isDefaultPrevented()) {
return false;
}
this._width = this.$element.width();
this.invalidate('width');
this.refresh();
this.trigger('resized');
};
Owl.prototype.eventsRouter = function(event) {
var type = event.type;
if (type === "mousedown" || type === "touchstart") {
this.onDragStart(event);
} else if (type === "mousemove" || type === "touchmove") {
this.onDragMove(event);
} else if (type === "mouseup" || type === "touchend") {
this.onDragEnd(event);
} else if (type === "touchcancel") {
this.onDragEnd(event);
}
};
Owl.prototype.internalEvents = function() {
var isTouch = isTouchSupport(),
isTouchIE = isTouchSupportIE();
if (this.settings.mouseDrag) {
this.$stage.on('mousedown', $.proxy(function(event) {
this.eventsRouter(event)
}, this));
this.$stage.on('dragstart', function() {
return false
});
this.$stage.get(0).onselectstart = function() {
return false
};
} else {
this.$element.addClass('owl-text-select-on');
}
if (this.settings.touchDrag && !isTouchIE) {
this.$stage.on('touchstart touchcancel', $.proxy(function(event) {
this.eventsRouter(event)
}, this));
}
if (this.transitionEndVendor) {
this.on(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd, false);
}
if (this.settings.responsive !== false) {
this.on(window, 'resize', $.proxy(this.onThrottledResize, this));
}
};
Owl.prototype.onDragStart = function(event) {
var ev, isTouchEvent, pageX, pageY, animatedPos;
ev = event.originalEvent || event || window.event;
if (ev.which === 3 || this.state.isTouch) {
return false;
}
if (ev.type === 'mousedown') {
this.$stage.addClass('owl-grab');
}
this.trigger('drag');
this.drag.startTime = new Date().getTime();
this.speed(0);
this.state.isTouch = true;
this.state.isScrolling = false;
this.state.isSwiping = false;
this.drag.distance = 0;
pageX = getTouches(ev).x;
pageY = getTouches(ev).y;
this.drag.offsetX = this.$stage.position().left;
this.drag.offsetY = this.$stage.position().top;
if (this.settings.rtl) {
this.drag.offsetX = this.$stage.position().left + this.$stage.width() - this.width() + this.settings.margin;
}
if (this.state.inMotion && this.support3d) {
animatedPos = this.getTransformProperty();
this.drag.offsetX = animatedPos;
this.animate(animatedPos);
this.state.inMotion = true;
} else if (this.state.inMotion && !this.support3d) {
this.state.inMotion = false;
return false;
}
this.drag.startX = pageX - this.drag.offsetX;
this.drag.startY = pageY - this.drag.offsetY;
this.drag.start = pageX - this.drag.startX;
this.drag.targetEl = ev.target || ev.srcElement;
this.drag.updatedX = this.drag.start;
if (this.drag.targetEl.tagName === "IMG" || this.drag.targetEl.tagName === "A") {
this.drag.targetEl.draggable = false;
}
$(document).on('mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents', $.proxy(function(event) {
this.eventsRouter(event)
}, this));
};
Owl.prototype.onDragMove = function(event) {
var ev, isTouchEvent, pageX, pageY, minValue, maxValue, pull;
if (!this.state.isTouch) {
return;
}
if (this.state.isScrolling) {
return;
}
ev = event.originalEvent || event || window.event;
pageX = getTouches(ev).x;
pageY = getTouches(ev).y;
this.drag.currentX = pageX - this.drag.startX;
this.drag.currentY = pageY - this.drag.startY;
this.drag.distance = this.drag.currentX - this.drag.offsetX;
if (this.drag.distance < 0) {
this.state.direction = this.settings.rtl ? 'right' : 'left';
} else if (this.drag.distance > 0) {
this.state.direction = this.settings.rtl ? 'left' : 'right';
}
if (this.settings.loop) {
if (this.op(this.drag.currentX, '>', this.coordinates(this.minimum())) && this.state.direction === 'right') {
this.drag.currentX -= (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
} else if (this.op(this.drag.currentX, '<', this.coordinates(this.maximum())) && this.state.direction === 'left') {
this.drag.currentX += (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
}
} else {
minValue = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
maxValue = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
pull = this.settings.pullDrag ? this.drag.distance / 5 : 0;
this.drag.currentX = Math.max(Math.min(this.drag.currentX, minValue + pull), maxValue + pull);
}
if ((this.drag.distance > 8 || this.drag.distance < -8)) {
if (ev.preventDefault !== undefined) {
ev.preventDefault();
} else {
ev.returnValue = false;
}
this.state.isSwiping = true;
}
this.drag.updatedX = this.drag.currentX;
if ((this.drag.currentY > 16 || this.drag.currentY < -16) && this.state.isSwiping === false) {
this.state.isScrolling = true;
this.drag.updatedX = this.drag.start;
}
this.animate(this.drag.updatedX);
};
Owl.prototype.onDragEnd = function(event) {
var compareTimes, distanceAbs, closest;
if (!this.state.isTouch) {
return;
}
if (event.type === 'mouseup') {
this.$stage.removeClass('owl-grab');
}
this.trigger('dragged');
this.drag.targetEl.removeAttribute("draggable");
this.state.isTouch = false;
this.state.isScrolling = false;
this.state.isSwiping = false;
if (this.drag.distance === 0 && this.state.inMotion !== true) {
this.state.inMotion = false;
return false;
}
this.drag.endTime = new Date().getTime();
compareTimes = this.drag.endTime - this.drag.startTime;
distanceAbs = Math.abs(this.drag.distance);
if (distanceAbs > 3 || compareTimes > 300) {
this.removeClick(this.drag.targetEl);
}
closest = this.closest(this.drag.updatedX);
this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
this.current(closest);
this.invalidate('position');
this.update();
if (!this.settings.pullDrag && this.drag.updatedX === this.coordinates(closest)) {
this.transitionEnd();
}
this.drag.distance = 0;
$(document).off('.owl.dragEvents');
};
Owl.prototype.removeClick = function(target) {
this.drag.targetEl = target;
$(target).on('click.preventClick', this.e._preventClick);
window.setTimeout(function() {
$(target).off('click.preventClick');
}, 300);
};
Owl.prototype.preventClick = function(ev) {
if (ev.preventDefault) {
ev.preventDefault();
} else {
ev.returnValue = false;
}
if (ev.stopPropagation) {
ev.stopPropagation();
}
$(ev.target).off('click.preventClick');
};
Owl.prototype.getTransformProperty = function() {
var transform, matrix3d;
transform = window.getComputedStyle(this.$stage.get(0), null).getPropertyValue(this.vendorName + 'transform');
transform = transform.replace(/matrix(3d)?\(|\)/g, '').split(',');
matrix3d = transform.length === 16;
return matrix3d !== true ? transform[4] : transform[12];
};
Owl.prototype.closest = function(coordinate) {
var position = -1,
pull = 30,
width = this.width(),
coordinates = this.coordinates();
if (!this.settings.freeDrag) {
$.each(coordinates, $.proxy(function(index, value) {
if (coordinate > value - pull && coordinate < value + pull) {
position = index;
} else if (this.op(coordinate, '<', value) && this.op(coordinate, '>', coordinates[index + 1] || value - width)) {
position = this.state.direction === 'left' ? index + 1 : index;
}
return position === -1;
}, this));
}
if (!this.settings.loop) {
if (this.op(coordinate, '>', coordinates[this.minimum()])) {
position = coordinate = this.minimum();
} else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
position = coordinate = this.maximum();
}
}
return position;
};
Owl.prototype.animate = function(coordinate) {
this.trigger('translate');
this.state.inMotion = this.speed() > 0;
if (this.support3d) {
this.$stage.css({
transform: 'translate3d(' + coordinate + 'px' + ',0px, 0px)',
transition: (this.speed() / 1000) + 's'
});
} else if (this.state.isTouch) {
this.$stage.css({
left: coordinate + 'px'
});
} else {
this.$stage.animate({
left: coordinate
}, this.speed() / 1000, this.settings.fallbackEasing, $.proxy(function() {
if (this.state.inMotion) {
this.transitionEnd();
}
}, this));
}
};
Owl.prototype.current = function(position) {
if (position === undefined) {
return this._current;
}
if (this._items.length === 0) {
return undefined;
}
position = this.normalize(position);
if (this._current !== position) {
var event = this.trigger('change', {
property: {
name: 'position',
value: position
}
});
if (event.data !== undefined) {
position = this.normalize(event.data);
}
this._current = position;
this.invalidate('position');
this.trigger('changed', {
property: {
name: 'position',
value: this._current
}
});
}
return this._current;
};
Owl.prototype.invalidate = function(part) {
this._invalidated[part] = true;
}
Owl.prototype.reset = function(position) {
position = this.normalize(position);
if (position === undefined) {
return;
}
this._speed = 0;
this._current = position;
this.suppress(['translate', 'translated']);
this.animate(this.coordinates(position));
this.release(['translate', 'translated']);
};
Owl.prototype.normalize = function(position, relative) {
var n = (relative ? this._items.length : this._items.length + this._clones.length);
if (!$.isNumeric(position) || n < 1) {
return undefined;
}
if (this._clones.length) {
position = ((position % n) + n) % n;
} else {
position = Math.max(this.minimum(relative), Math.min(this.maximum(relative), position));
}
return position;
};
Owl.prototype.relative = function(position) {
position = this.normalize(position);
position = position - this._clones.length / 2;
return this.normalize(position, true);
};
Owl.prototype.maximum = function(relative) {
var maximum, width, i = 0,
coordinate, settings = this.settings;
if (relative) {
return this._items.length - 1;
}
if (!settings.loop && settings.center) {
maximum = this._items.length - 1;
} else if (!settings.loop && !settings.center) {
maximum = this._items.length - settings.items;
} else if (settings.loop || settings.center) {
maximum = this._items.length + settings.items;
} else if (settings.autoWidth || settings.merge) {
revert = settings.rtl ? 1 : -1;
width = this.$stage.width() - this.$element.width();
while (coordinate = this.coordinates(i)) {
if (coordinate * revert >= width) {
break;
}
maximum = ++i;
}
} else {
throw 'Can not detect maximum absolute position.'
}
return maximum;
};
Owl.prototype.minimum = function(relative) {
if (relative) {
return 0;
}
return this._clones.length / 2;
};
Owl.prototype.items = function(position) {
if (position === undefined) {
return this._items.slice();
}
position = this.normalize(position, true);
return this._items[position];
};
Owl.prototype.mergers = function(position) {
if (position === undefined) {
return this._mergers.slice();
}
position = this.normalize(position, true);
return this._mergers[position];
};
Owl.prototype.clones = function(position) {
var odd = this._clones.length / 2,
even = odd + this._items.length,
map = function(index) {
return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2
};
if (position === undefined) {
return $.map(this._clones, function(v, i) {
return map(i)
});
}
return $.map(this._clones, function(v, i) {
return v === position ? map(i) : null
});
};
Owl.prototype.speed = function(speed) {
if (speed !== undefined) {
this._speed = speed;
}
return this._speed;
};
Owl.prototype.coordinates = function(position) {
var coordinate = null;
if (position === undefined) {
return $.map(this._coordinates, $.proxy(function(coordinate, index) {
return this.coordinates(index);
}, this));
}
if (this.settings.center) {
coordinate = this._coordinates[position];
coordinate += (this.width() - coordinate + (this._coordinates[position - 1] || 0)) / 2 * (this.settings.rtl ? -1 : 1);
} else {
coordinate = this._coordinates[position - 1] || 0;
}
return coordinate;
};
Owl.prototype.duration = function(from, to, factor) {
return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
};
Owl.prototype.to = function(position, speed) {
if (this.settings.loop) {
var distance = position - this.relative(this.current()),
revert = this.current(),
before = this.current(),
after = this.current() + distance,
direction = before - after < 0 ? true : false,
items = this._clones.length + this._items.length;
if (after < this.settings.items && direction === false) {
revert = before + this._items.length;
this.reset(revert);
} else if (after >= items - this.settings.items && direction === true) {
revert = before - this._items.length;
this.reset(revert);
}
window.clearTimeout(this.e._goToLoop);
this.e._goToLoop = window.setTimeout($.proxy(function() {
this.speed(this.duration(this.current(), revert + distance, speed));
this.current(revert + distance);
this.update();
}, this), 30);
} else {
this.speed(this.duration(this.current(), position, speed));
this.current(position);
this.update();
}
};
Owl.prototype.next = function(speed) {
speed = speed || false;
this.to(this.relative(this.current()) + 1, speed);
};
Owl.prototype.prev = function(speed) {
speed = speed || false;
this.to(this.relative(this.current()) - 1, speed);
};
Owl.prototype.transitionEnd = function(event) {
if (event !== undefined) {
event.stopPropagation();
if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
return false;
}
}
this.state.inMotion = false;
this.trigger('translated');
};
Owl.prototype.viewport = function() {
var width;
if (this.options.responsiveBaseElement !== window) {
width = $(this.options.responsiveBaseElement).width();
} else if (window.innerWidth) {
width = window.innerWidth;
} else if (document.documentElement && document.documentElement.clientWidth) {
width = document.documentElement.clientWidth;
} else {
throw 'Can not detect viewport width.';
}
return width;
};
Owl.prototype.replace = function(content) {
this.$stage.empty();
this._items = [];
if (content) {
content = (content instanceof jQuery) ? content : $(content);
}
if (this.settings.nestedItemSelector) {
content = content.find('.' + this.settings.nestedItemSelector);
}
content.filter(function() {
return this.nodeType === 1;
}).each($.proxy(function(index, item) {
item = this.prepare(item);
this.$stage.append(item);
this._items.push(item);
this._mergers.push(item.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
}, this));
this.reset($.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
this.invalidate('items');
};
Owl.prototype.add = function(content, position) {
position = position === undefined ? this._items.length : this.normalize(position, true);
this.trigger('add', {
content: content,
position: position
});
if (this._items.length === 0 || position === this._items.length) {
this.$stage.append(content);
this._items.push(content);
this._mergers.push(content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
} else {
this._items[position].before(content);
this._items.splice(position, 0, content);
this._mergers.splice(position, 0, content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
}
this.invalidate('items');
this.trigger('added', {
content: content,
position: position
});
};
Owl.prototype.remove = function(position) {
position = this.normalize(position, true);
if (position === undefined) {
return;
}
this.trigger('remove', {
content: this._items[position],
position: position
});
this._items[position].remove();
this._items.splice(position, 1);
this._mergers.splice(position, 1);
this.invalidate('items');
this.trigger('removed', {
content: null,
position: position
});
};
Owl.prototype.addTriggerableEvents = function() {
var handler = $.proxy(function(callback, event) {
return $.proxy(function(e) {
if (e.relatedTarget !== this) {
this.suppress([event]);
callback.apply(this, [].slice.call(arguments, 1));
this.release([event]);
}
}, this);
}, this);
$.each({
'next': this.next,
'prev': this.prev,
'to': this.to,
'destroy': this.destroy,
'refresh': this.refresh,
'replace': this.replace,
'add': this.add,
'remove': this.remove
}, $.proxy(function(event, callback) {
this.$element.on(event + '.owl.carousel', handler(callback, event + '.owl.carousel'));
}, this));
};
Owl.prototype.watchVisibility = function() {
if (!isElVisible(this.$element.get(0))) {
this.$element.addClass('owl-hidden');
window.clearInterval(this.e._checkVisibile);
this.e._checkVisibile = window.setInterval($.proxy(checkVisible, this), 500);
}
function isElVisible(el) {
return el.offsetWidth > 0 && el.offsetHeight > 0;
}
function checkVisible() {
if (isElVisible(this.$element.get(0))) {
this.$element.removeClass('owl-hidden');
this.refresh();
window.clearInterval(this.e._checkVisibile);
}
}
};
Owl.prototype.preloadAutoWidthImages = function(imgs) {
var loaded, that, $el, img;
loaded = 0;
that = this;
imgs.each(function(i, el) {
$el = $(el);
img = new Image();
img.onload = function() {
loaded++;
$el.attr('src', img.src);
$el.css('opacity', 1);
if (loaded >= imgs.length) {
that.state.imagesLoaded = true;
that.initialize();
}
};
img.src = $el.attr('src') || $el.attr('data-src') || $el.attr('data-src-retina');
});
};
Owl.prototype.destroy = function() {
if (this.$element.hasClass(this.settings.themeClass)) {
this.$element.removeClass(this.settings.themeClass);
}
if (this.settings.responsive !== false) {
$(window).off('resize.owl.carousel');
}
if (this.transitionEndVendor) {
this.off(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd);
}
for (var i in this._plugins) {
this._plugins[i].destroy();
}
if (this.settings.mouseDrag || this.settings.touchDrag) {
this.$stage.off('mousedown touchstart touchcancel');
$(document).off('.owl.dragEvents');
this.$stage.get(0).onselectstart = function() {};
this.$stage.off('dragstart', function() {
return false
});
}
this.$element.off('.owl');
this.$stage.children('.cloned').remove();
this.e = null;
this.$element.removeData('owlCarousel');
this.$stage.children().contents().unwrap();
this.$stage.children().unwrap();
this.$stage.unwrap();
};
Owl.prototype.op = function(a, o, b) {
var rtl = this.settings.rtl;
switch (o) {
case '<':
return rtl ? a > b : a < b;
case '>':
return rtl ? a < b : a > b;
case '>=':
return rtl ? a <= b : a >= b;
case '<=':
return rtl ? a >= b : a <= b;
default:
break;
}
};
Owl.prototype.on = function(element, event, listener, capture) {
if (element.addEventListener) {
element.addEventListener(event, listener, capture);
} else if (element.attachEvent) {
element.attachEvent('on' + event, listener);
}
};
Owl.prototype.off = function(element, event, listener, capture) {
if (element.removeEventListener) {
element.removeEventListener(event, listener, capture);
} else if (element.detachEvent) {
element.detachEvent('on' + event, listener);
}
};
Owl.prototype.trigger = function(name, data, namespace) {
var status = {
item: {
count: this._items.length,
index: this.current()
}
},
handler = $.camelCase($.grep(['on', name, namespace], function(v) {
return v
}).join('-').toLowerCase()),
event = $.Event([name, 'owl', namespace || 'carousel'].join('.').toLowerCase(), $.extend({
relatedTarget: this
}, status, data));
if (!this._supress[name]) {
$.each(this._plugins, function(name, plugin) {
if (plugin.onTrigger) {
plugin.onTrigger(event);
}
});
this.$element.trigger(event);
if (this.settings && typeof this.settings[handler] === 'function') {
this.settings[handler].apply(this, event);
}
}
return event;
};
Owl.prototype.suppress = function(events) {
$.each(events, $.proxy(function(index, event) {
this._supress[event] = true;
}, this));
}
Owl.prototype.release = function(events) {
$.each(events, $.proxy(function(index, event) {
delete this._supress[event];
}, this));
}
Owl.prototype.browserSupport = function() {
this.support3d = isPerspective();
if (this.support3d) {
this.transformVendor = isTransform();
var endVendors = ['transitionend', 'webkitTransitionEnd', 'transitionend', 'oTransitionEnd'];
this.transitionEndVendor = endVendors[isTransition()];
this.vendorName = this.transformVendor.replace(/Transform/i, '');
this.vendorName = this.vendorName !== '' ? '-' + this.vendorName.toLowerCase() + '-' : '';
}
this.state.orientation = window.orientation;
};
function getTouches(event) {
if (event.touches !== undefined) {
return {
x: event.touches[0].pageX,
y: event.touches[0].pageY
};
}
if (event.touches === undefined) {
if (event.pageX !== undefined) {
return {
x: event.pageX,
y: event.pageY
};
}
if (event.pageX === undefined) {
return {
x: event.clientX,
y: event.clientY
};
}
}
}
function isStyleSupported(array) {
var p, s, fake = document.createElement('div'),
list = array;
for (p in list) {
s = list[p];
if (typeof fake.style[s] !== 'undefined') {
fake = null;
return [s, p];
}
}
return [false];
}
function isTransition() {
return isStyleSupported(['transition', 'WebkitTransition', 'MozTransition', 'OTransition'])[1];
}
function isTransform() {
return isStyleSupported(['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform'])[0];
}
function isPerspective() {
return isStyleSupported(['perspective', 'webkitPerspective', 'MozPerspective', 'OPerspective', 'MsPerspective'])[0];
}
function isTouchSupport() {
return 'ontouchstart' in window || !!(navigator.msMaxTouchPoints);
}
function isTouchSupportIE() {
return window.navigator.msPointerEnabled;
}
$.fn.owlCarousel = function(options) {
options = $.extend(true, {}, options, this.data('options'));
return this.each(function() {
if (!$(this).data('owlCarousel')) {
$(this).data('owlCarousel', new Owl(this, options));
}
});
};
$.fn.owlCarousel.Constructor = Owl;
})(window.Zepto || window.jQuery, window, document);;
(function($, window, document, undefined) {
var Lazy = function(carousel) {
this._core = carousel;
this._loaded = [];
this._handlers = {
'initialized.owl.carousel change.owl.carousel': $.proxy(function(e) {
if (!e.namespace) {
return;
}
if (!this._core.settings || !this._core.settings.lazyLoad) {
return;
}
if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
var settings = this._core.settings,
n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
i = ((settings.center && n * -1) || 0),
position = ((e.property && e.property.value) || this._core.current()) + i,
clones = this._core.clones().length,
load = $.proxy(function(i, v) {
this.load(v)
}, this);
while (i++ < n) {
this.load(clones / 2 + this._core.relative(position));
clones && $.each(this._core.clones(this._core.relative(position++)), load);
}
}
}, this)
};
this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
this._core.$element.on(this._handlers);
}
Lazy.Defaults = {
lazyLoad: false
}
Lazy.prototype.load = function(position) {
var $item = this._core.$stage.children().eq(position),
$elements = $item && $item.find('.owl-lazy');
if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
return;
}
$elements.each($.proxy(function(index, element) {
var $element = $(element),
image, url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src');
this._core.trigger('load', {
element: $element,
url: url
}, 'lazy');
if ($element.is('img')) {
$element.one('load.owl.lazy', $.proxy(function() {
$element.css('opacity', 1);
this._core.trigger('loaded', {
element: $element,
url: url
}, 'lazy');
}, this)).attr('src', url);
} else {
image = new Image();
image.onload = $.proxy(function() {
$element.css({
'background-image': 'url(' + url + ')',
'opacity': '1'
});
this._core.trigger('loaded', {
element: $element,
url: url
}, 'lazy');
}, this);
image.src = url;
}
}, this));
this._loaded.push($item.get(0));
}
Lazy.prototype.destroy = function() {
var handler, property;
for (handler in this.handlers) {
this._core.$element.off(handler, this.handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
}
$.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
})(window.Zepto || window.jQuery, window, document);;
(function($, window, document, undefined) {
var AutoHeight = function(carousel) {
this._core = carousel;
this._handlers = {
'initialized.owl.carousel': $.proxy(function() {
if (this._core.settings.autoHeight) {
this.update();
}
}, this),
'changed.owl.carousel': $.proxy(function(e) {
if (this._core.settings.autoHeight && e.property.name == 'position') {
this.update();
}
}, this),
'loaded.owl.lazy': $.proxy(function(e) {
if (this._core.settings.autoHeight && e.element.closest('.' + this._core.settings.itemClass) === this._core.$stage.children().eq(this._core.current())) {
this.update();
}
}, this)
};
this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
this._core.$element.on(this._handlers);
};
AutoHeight.Defaults = {
autoHeight: false,
autoHeightClass: 'owl-height'
};
AutoHeight.prototype.update = function() {
this._core.$stage.parent().height(this._core.$stage.children().eq(this._core.current()).height()).addClass(this._core.settings.autoHeightClass);
};
AutoHeight.prototype.destroy = function() {
var handler, property;
for (handler in this._handlers) {
this._core.$element.off(handler, this._handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
};
$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
})(window.Zepto || window.jQuery, window, document);;
(function($, window, document, undefined) {
var Video = function(carousel) {
this._core = carousel;
this._videos = {};
this._playing = null;
this._fullscreen = false;
this._handlers = {
'resize.owl.carousel': $.proxy(function(e) {
if (this._core.settings.video && !this.isInFullScreen()) {
e.preventDefault();
}
}, this),
'refresh.owl.carousel changed.owl.carousel': $.proxy(function(e) {
if (this._playing) {
this.stop();
}
}, this),
'prepared.owl.carousel': $.proxy(function(e) {
var $element = $(e.content).find('.owl-video');
if ($element.length) {
$element.css('display', 'none');
this.fetch($element, $(e.content));
}
}, this)
};
this._core.options = $.extend({}, Video.Defaults, this._core.options);
this._core.$element.on(this._handlers);
this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
this.play(e);
}, this));
};
Video.Defaults = {
video: false,
videoHeight: false,
videoWidth: false
};
Video.prototype.fetch = function(target, item) {
var type = target.attr('data-vimeo-id') ? 'vimeo' : 'youtube',
id = target.attr('data-vimeo-id') || target.attr('data-youtube-id'),
width = target.attr('data-width') || this._core.settings.videoWidth,
height = target.attr('data-height') || this._core.settings.videoHeight,
url = target.attr('href');
if (url) {
id = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
if (id[3].indexOf('youtu') > -1) {
type = 'youtube';
} else if (id[3].indexOf('vimeo') > -1) {
type = 'vimeo';
} else {
throw new Error('Video URL not supported.');
}
id = id[6];
} else {
throw new Error('Missing video URL.');
}
this._videos[url] = {
type: type,
id: id,
width: width,
height: height
};
item.attr('data-video', url);
this.thumbnail(target, this._videos[url]);
};
Video.prototype.thumbnail = function(target, video) {
var tnLink, icon, path, dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '',
customTn = target.find('img'),
srcType = 'src',
lazyClass = '',
settings = this._core.settings,
create = function(path) {
icon = '
';
if (settings.lazyLoad) {
tnLink = '
';
} else {
tnLink = '
';
}
target.after(tnLink);
target.after(icon);
};
target.wrap('
');
if (this._core.settings.lazyLoad) {
srcType = 'data-src';
lazyClass = 'owl-lazy';
}
if (customTn.length) {
create(customTn.attr(srcType));
customTn.remove();
return false;
}
if (video.type === 'youtube') {
path = "http://img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
create(path);
} else if (video.type === 'vimeo') {
$.ajax({
type: 'GET',
url: 'http://vimeo.com/api/v2/video/' + video.id + '.json',
jsonp: 'callback',
dataType: 'jsonp',
success: function(data) {
path = data[0].thumbnail_large;
create(path);
}
});
}
};
Video.prototype.stop = function() {
this._core.trigger('stop', null, 'video');
this._playing.find('.owl-video-frame').remove();
this._playing.removeClass('owl-video-playing');
this._playing = null;
};
Video.prototype.play = function(ev) {
this._core.trigger('play', null, 'video');
if (this._playing) {
this.stop();
}
var target = $(ev.target || ev.srcElement),
item = target.closest('.' + this._core.settings.itemClass),
video = this._videos[item.attr('data-video')],
width = video.width || '100%',
height = video.height || this._core.$stage.height(),
html, wrap;
if (video.type === 'youtube') {
html = '
';
} else if (video.type === 'vimeo') {
html = '
';
}
item.addClass('owl-video-playing');
this._playing = item;
wrap = $('
' + html + '
');
target.after(wrap);
};
Video.prototype.isInFullScreen = function() {
var element = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement;
if (element && $(element).parent().hasClass('owl-video-frame')) {
this._core.speed(0);
this._fullscreen = true;
}
if (element && this._fullscreen && this._playing) {
return false;
}
if (this._fullscreen) {
this._fullscreen = false;
return false;
}
if (this._playing) {
if (this._core.state.orientation !== window.orientation) {
this._core.state.orientation = window.orientation;
return false;
}
}
return true;
};
Video.prototype.destroy = function() {
var handler, property;
this._core.$element.off('click.owl.video');
for (handler in this._handlers) {
this._core.$element.off(handler, this._handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
};
$.fn.owlCarousel.Constructor.Plugins.Video = Video;
})(window.Zepto || window.jQuery, window, document);;
(function($, window, document, undefined) {
var Animate = function(scope) {
this.core = scope;
this.core.options = $.extend({}, Animate.Defaults, this.core.options);
this.swapping = true;
this.previous = undefined;
this.next = undefined;
this.handlers = {
'change.owl.carousel': $.proxy(function(e) {
if (e.property.name == 'position') {
this.previous = this.core.current();
this.next = e.property.value;
}
}, this),
'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
this.swapping = e.type == 'translated';
}, this),
'translate.owl.carousel': $.proxy(function(e) {
if (this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
this.swap();
}
}, this)
};
this.core.$element.on(this.handlers);
};
Animate.Defaults = {
animateOut: false,
animateIn: false
};
Animate.prototype.swap = function() {
if (this.core.settings.items !== 1 || !this.core.support3d) {
return;
}
this.core.speed(0);
var left, clear = $.proxy(this.clear, this),
previous = this.core.$stage.children().eq(this.previous),
next = this.core.$stage.children().eq(this.next),
incoming = this.core.settings.animateIn,
outgoing = this.core.settings.animateOut;
if (this.core.current() === this.previous) {
return;
}
if (outgoing) {
left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
previous.css({
'left': left + 'px'
}).addClass('animated owl-animated-out').addClass(outgoing).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
}
if (incoming) {
next.addClass('animated owl-animated-in').addClass(incoming).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
}
};
Animate.prototype.clear = function(e) {
$(e.target).css({
'left': ''
}).removeClass('animated owl-animated-out owl-animated-in').removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut);
this.core.transitionEnd();
}
Animate.prototype.destroy = function() {
var handler, property;
for (handler in this.handlers) {
this.core.$element.off(handler, this.handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
};
$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
})(window.Zepto || window.jQuery, window, document);;
(function($, window, document, undefined) {
var Autoplay = function(scope) {
this.core = scope;
this.core.options = $.extend({}, Autoplay.Defaults, this.core.options);
this.handlers = {
'translated.owl.carousel refreshed.owl.carousel': $.proxy(function() {
this.autoplay();
}, this),
'play.owl.autoplay': $.proxy(function(e, t, s) {
this.play(t, s);
}, this),
'stop.owl.autoplay': $.proxy(function() {
this.stop();
}, this),
'mouseover.owl.autoplay': $.proxy(function() {
if (this.core.settings.autoplayHoverPause) {
this.pause();
}
}, this),
'mouseleave.owl.autoplay': $.proxy(function() {
if (this.core.settings.autoplayHoverPause) {
this.autoplay();
}
}, this)
};
this.core.$element.on(this.handlers);
};
Autoplay.Defaults = {
autoplay: false,
autoplayTimeout: 5000,
autoplayHoverPause: false,
autoplaySpeed: false
};
Autoplay.prototype.autoplay = function() {
if (this.core.settings.autoplay && !this.core.state.videoPlay) {
window.clearInterval(this.interval);
this.interval = window.setInterval($.proxy(function() {
this.play();
}, this), this.core.settings.autoplayTimeout);
} else {
window.clearInterval(this.interval);
}
};
Autoplay.prototype.play = function(timeout, speed) {
if (document.hidden === true) {
return;
}
if (this.core.state.isTouch || this.core.state.isScrolling || this.core.state.isSwiping || this.core.state.inMotion) {
return;
}
if (this.core.settings.autoplay === false) {
window.clearInterval(this.interval);
return;
}
this.core.next(this.core.settings.autoplaySpeed);
};
Autoplay.prototype.stop = function() {
window.clearInterval(this.interval);
};
Autoplay.prototype.pause = function() {
window.clearInterval(this.interval);
};
Autoplay.prototype.destroy = function() {
var handler, property;
window.clearInterval(this.interval);
for (handler in this.handlers) {
this.core.$element.off(handler, this.handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
};
$.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
})(window.Zepto || window.jQuery, window, document);;
(function($, window, document, undefined) {
'use strict';
var Navigation = function(carousel) {
this._core = carousel;
this._initialized = false;
this._pages = [];
this._controls = {};
this._templates = [];
this.$element = this._core.$element;
this._overrides = {
next: this._core.next,
prev: this._core.prev,
to: this._core.to
};
this._handlers = {
'prepared.owl.carousel': $.proxy(function(e) {
if (this._core.settings.dotsData) {
this._templates.push($(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
}
}, this),
'add.owl.carousel': $.proxy(function(e) {
if (this._core.settings.dotsData) {
this._templates.splice(e.position, 0, $(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
}
}, this),
'remove.owl.carousel prepared.owl.carousel': $.proxy(function(e) {
if (this._core.settings.dotsData) {
this._templates.splice(e.position, 1);
}
}, this),
'change.owl.carousel': $.proxy(function(e) {
if (e.property.name == 'position') {
if (!this._core.state.revert && !this._core.settings.loop && this._core.settings.navRewind) {
var current = this._core.current(),
maximum = this._core.maximum(),
minimum = this._core.minimum();
e.data = e.property.value > maximum ? current >= maximum ? minimum : maximum : e.property.value < minimum ? maximum : e.property.value;
}
}
}, this),
'changed.owl.carousel': $.proxy(function(e) {
if (e.property.name == 'position') {
this.draw();
}
}, this),
'refreshed.owl.carousel': $.proxy(function() {
if (!this._initialized) {
this.initialize();
this._initialized = true;
}
this._core.trigger('refresh', null, 'navigation');
this.update();
this.draw();
this._core.trigger('refreshed', null, 'navigation');
}, this)
};
this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
this.$element.on(this._handlers);
}
Navigation.Defaults = {
nav: false,
navRewind: true,
navText: ['', ''],
navSpeed: false,
navElement: 'div',
navContainer: false,
navContainerClass: 'owl-nav',
navClass: ['owl-prev', 'owl-next'],
slideBy: 1,
dotClass: 'owl-dot',
dotsClass: 'owl-dots',
dots: true,
dotsEach: false,
dotData: false,
dotsSpeed: false,
dotsContainer: false,
controlsClass: 'owl-controls'
}
Navigation.prototype.initialize = function() {
var $container, override, options = this._core.settings;
if (!options.dotsData) {
this._templates = [$('
').addClass(options.dotClass).append($('
')).prop('outerHTML')];
}
if (!options.navContainer || !options.dotsContainer) {
this._controls.$container = $('').addClass(options.controlsClass).appendTo(this.$element);
}
this._controls.$indicators = options.dotsContainer ? $(options.dotsContainer) : $('
').hide().addClass(options.dotsClass).appendTo(this._controls.$container);
this._controls.$indicators.on('click', 'div', $.proxy(function(e) {
var index = $(e.target).parent().is(this._controls.$indicators) ? $(e.target).index() : $(e.target).parent().index();
e.preventDefault();
this.to(index, options.dotsSpeed);
}, this));
$container = options.navContainer ? $(options.navContainer) : $('
').addClass(options.navContainerClass).prependTo(this._controls.$container);
this._controls.$next = $('<' + options.navElement + '>');
this._controls.$previous = this._controls.$next.clone();
this._controls.$previous.addClass(options.navClass[0]).html(options.navText[0]).hide().prependTo($container).on('click', $.proxy(function(e) {
this.prev(options.navSpeed);
}, this));
this._controls.$next.addClass(options.navClass[1]).html(options.navText[1]).hide().appendTo($container).on('click', $.proxy(function(e) {
this.next(options.navSpeed);
}, this));
for (override in this._overrides) {
this._core[override] = $.proxy(this[override], this);
}
}
Navigation.prototype.destroy = function() {
var handler, control, property, override;
for (handler in this._handlers) {
this.$element.off(handler, this._handlers[handler]);
}
for (control in this._controls) {
this._controls[control].remove();
}
for (override in this.overides) {
this._core[override] = this._overrides[override];
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
}
Navigation.prototype.update = function() {
var i, j, k, options = this._core.settings,
lower = this._core.clones().length / 2,
upper = lower + this._core.items().length,
size = options.center || options.autoWidth || options.dotData ? 1 : options.dotsEach || options.items;
if (options.slideBy !== 'page') {
options.slideBy = Math.min(options.slideBy, options.items);
}
if (options.dots || options.slideBy == 'page') {
this._pages = [];
for (i = lower, j = 0, k = 0; i < upper; i++) {
if (j >= size || j === 0) {
this._pages.push({
start: i - lower,
end: i - lower + size - 1
});
j = 0, ++k;
}
j += this._core.mergers(this._core.relative(i));
}
}
}
Navigation.prototype.draw = function() {
var difference, i, html = '',
options = this._core.settings,
$items = this._core.$stage.children(),
index = this._core.relative(this._core.current());
if (options.nav && !options.loop && !options.navRewind) {
this._controls.$previous.toggleClass('disabled', index <= 0);
this._controls.$next.toggleClass('disabled', index >= this._core.maximum());
}
this._controls.$previous.toggle(options.nav);
this._controls.$next.toggle(options.nav);
if (options.dots) {
difference = this._pages.length - this._controls.$indicators.children().length;
if (options.dotData && difference !== 0) {
for (i = 0; i < this._controls.$indicators.children().length; i++) {
html += this._templates[this._core.relative(i)];
}
this._controls.$indicators.html(html);
} else if (difference > 0) {
html = new Array(difference + 1).join(this._templates[0]);
this._controls.$indicators.append(html);
} else if (difference < 0) {
this._controls.$indicators.children().slice(difference).remove();
}
this._controls.$indicators.find('.active').removeClass('active');
this._controls.$indicators.children().eq($.inArray(this.current(), this._pages)).addClass('active');
}
this._controls.$indicators.toggle(options.dots);
}
Navigation.prototype.onTrigger = function(event) {
var settings = this._core.settings;
event.page = {
index: $.inArray(this.current(), this._pages),
count: this._pages.length,
size: settings && (settings.center || settings.autoWidth || settings.dotData ? 1 : settings.dotsEach || settings.items)
};
}
Navigation.prototype.current = function() {
var index = this._core.relative(this._core.current());
return $.grep(this._pages, function(o) {
return o.start <= index && o.end >= index;
}).pop();
}
Navigation.prototype.getPosition = function(successor) {
var position, length, options = this._core.settings;
if (options.slideBy == 'page') {
position = $.inArray(this.current(), this._pages);
length = this._pages.length;
successor ? ++position : --position;
position = this._pages[((position % length) + length) % length].start;
} else {
position = this._core.relative(this._core.current());
length = this._core.items().length;
successor ? position += options.slideBy : position -= options.slideBy;
}
return position;
}
Navigation.prototype.next = function(speed) {
$.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
}
Navigation.prototype.prev = function(speed) {
$.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
}
Navigation.prototype.to = function(position, speed, standard) {
var length;
if (!standard) {
length = this._pages.length;
$.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
} else {
$.proxy(this._overrides.to, this._core)(position, speed);
}
}
$.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
})(window.Zepto || window.jQuery, window, document);;
(function($, window, document, undefined) {
'use strict';
var Hash = function(carousel) {
this._core = carousel;
this._hashes = {};
this.$element = this._core.$element;
this._handlers = {
'initialized.owl.carousel': $.proxy(function() {
if (this._core.settings.startPosition == 'URLHash') {
$(window).trigger('hashchange.owl.navigation');
}
}, this),
'prepared.owl.carousel': $.proxy(function(e) {
var hash = $(e.content).find('[data-hash]').andSelf('[data-hash]').attr('data-hash');
this._hashes[hash] = e.content;
}, this)
};
this._core.options = $.extend({}, Hash.Defaults, this._core.options);
this.$element.on(this._handlers);
$(window).on('hashchange.owl.navigation', $.proxy(function() {
var hash = window.location.hash.substring(1),
items = this._core.$stage.children(),
position = this._hashes[hash] && items.index(this._hashes[hash]) || 0;
if (!hash) {
return false;
}
this._core.to(position, false, true);
}, this));
}
Hash.Defaults = {
URLhashListener: false
}
Hash.prototype.destroy = function() {
var handler, property;
$(window).off('hashchange.owl.navigation');
for (handler in this._handlers) {
this._core.$element.off(handler, this._handlers[handler]);
}
for (property in Object.getOwnPropertyNames(this)) {
typeof this[property] != 'function' && (this[property] = null);
}
}
$.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
})(window.Zepto || window.jQuery, window, document);
"use strict";;(function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof exports==='object'){factory(require('jquery'));}else{factory(window.jQuery||window.Zepto);}}(function($){var CLOSE_EVENT='Close',BEFORE_CLOSE_EVENT='BeforeClose',AFTER_CLOSE_EVENT='AfterClose',BEFORE_APPEND_EVENT='BeforeAppend',MARKUP_PARSE_EVENT='MarkupParse',OPEN_EVENT='Open',CHANGE_EVENT='Change',NS='mfp',EVENT_NS='.'+NS,READY_CLASS='mfp-ready',REMOVING_CLASS='mfp-removing',PREVENT_CLOSE_CLASS='mfp-prevent-close';var mfp,MagnificPopup=function(){},_isJQ=!!(window.jQuery),_prevStatus,_window=$(window),_document,_prevContentType,_wrapClasses,_currPopupType;var _mfpOn=function(name,f){mfp.ev.on(NS+name+EVENT_NS,f);},_getEl=function(className,appendTo,html,raw){var el=document.createElement('div');el.className='mfp-'+className;if(html){el.innerHTML=html;}if(!raw){el=$(el);if(appendTo){el.appendTo(appendTo);}}else if(appendTo){appendTo.appendChild(el);}return el;},_mfpTrigger=function(e,data){mfp.ev.triggerHandler(NS+e,data);if(mfp.st.callbacks){e=e.charAt(0).toLowerCase()+e.slice(1);if(mfp.st.callbacks[e]){mfp.st.callbacks[e].apply(mfp,$.isArray(data)?data:[data]);}}},_getCloseBtn=function(type){if(type!==_currPopupType||!mfp.currTemplate.closeBtn){mfp.currTemplate.closeBtn=$(mfp.st.closeMarkup.replace('%title%',mfp.st.tClose));_currPopupType=type;}return mfp.currTemplate.closeBtn;},_checkInstance=function(){if(!$.magnificPopup.instance){mfp=new MagnificPopup();mfp.init();$.magnificPopup.instance=mfp;}},supportsTransitions=function(){var s=document.createElement('p').style,v=['ms','O','Moz','Webkit'];if(s['transition']!==undefined){return true;}while(v.length){if(v.pop()+'Transition'in s){return true;}}return false;};MagnificPopup.prototype={constructor:MagnificPopup,init:function(){var appVersion=navigator.appVersion;mfp.isIE7=appVersion.indexOf("MSIE 7.")!==-1;mfp.isIE8=appVersion.indexOf("MSIE 8.")!==-1;mfp.isLowIE=mfp.isIE7||mfp.isIE8;mfp.isAndroid=(/android/gi).test(appVersion);mfp.isIOS=(/iphone|ipad|ipod/gi).test(appVersion);mfp.supportsTransition=supportsTransitions();mfp.probablyMobile=(mfp.isAndroid||mfp.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent));_document=$(document);mfp.popupsCache={};},open:function(data){var i;if(data.isObj===false){mfp.items=data.items.toArray();mfp.index=0;var items=data.items,item;for(i=0;i
(winHeight||_window.height()));},_setFocus:function(){(mfp.st.focus?mfp.content.find(mfp.st.focus).eq(0):mfp.wrap).focus();},_onFocusIn:function(e){if(e.target!==mfp.wrap[0]&&!$.contains(mfp.wrap[0],e.target)){mfp._setFocus();return false;}},_parseMarkup:function(template,values,item){var arr;if(item.data){values=$.extend(item.data,values);}_mfpTrigger(MARKUP_PARSE_EVENT,[template,values,item]);$.each(values,function(key,value){if(value===undefined||value===false){return true;}arr=key.split('_');if(arr.length>1){var el=template.find(EVENT_NS+'-'+arr[0]);if(el.length>0){var attr=arr[1];if(attr==='replaceWith'){if(el[0]!==value[0]){el.replaceWith(value);}}else if(attr==='img'){if(el.is('img')){el.attr('src',value);}else{el.replaceWith('
');}}else{el.attr(arr[1],value);}}}else{template.find(EVENT_NS+'-'+key).html(value);}});},_getScrollbarSize:function(){if(mfp.scrollbarSize===undefined){var scrollDiv=document.createElement("div");scrollDiv.style.cssText='width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';document.body.appendChild(scrollDiv);mfp.scrollbarSize=scrollDiv.offsetWidth-scrollDiv.clientWidth;document.body.removeChild(scrollDiv);}return mfp.scrollbarSize;}};$.magnificPopup={instance:null,proto:MagnificPopup.prototype,modules:[],open:function(options,index){_checkInstance();if(!options){options={};}else{options=$.extend(true,{},options);}options.isObj=true;options.index=index||0;return this.instance.open(options);},close:function(){return $.magnificPopup.instance&&$.magnificPopup.instance.close();},registerModule:function(name,module){if(module.options){$.magnificPopup.defaults[name]=module.options;}$.extend(this.proto,module.proto);this.modules.push(name);},defaults:{disableOn:0,key:null,midClick:false,mainClass:'',preloader:true,focus:'',closeOnContentClick:false,closeOnBgClick:true,closeBtnInside:false,showCloseBtn:false,enableEscapeKey:true,modal:false,alignTop:false,removalDelay:0,prependTo:null,fixedContentPos:'auto',fixedBgPos:'auto',overflowY:'auto',closeMarkup:'',tClose:'Close (Esc)',tLoading:'Loading...'}};$.fn.magnificPopup=function(options){_checkInstance();var jqEl=$(this);if(typeof options==="string"){if(options==='open'){var items,itemOpts=_isJQ?jqEl.data('magnificPopup'):jqEl[0].magnificPopup,index=parseInt(arguments[1],10)||0;if(itemOpts.items){items=itemOpts.items[index];}else{items=jqEl;if(itemOpts.delegate){items=items.find(itemOpts.delegate);}items=items.eq(index);}mfp._openClick({mfpEl:items},jqEl,itemOpts);}else{if(mfp.isOpen)mfp[options].apply(mfp,Array.prototype.slice.call(arguments,1));}}else{options=$.extend(true,{},options);if(_isJQ){jqEl.data('magnificPopup',options);}else{jqEl[0].magnificPopup=options;}mfp.addGroup(jqEl,options);}return jqEl;};var INLINE_NS='inline',_hiddenClass,_inlinePlaceholder,_lastInlineElement,_putInlineElementsBack=function(){if(_lastInlineElement){_inlinePlaceholder.after(_lastInlineElement.addClass(_hiddenClass)).detach();_lastInlineElement=null;}};$.magnificPopup.registerModule(INLINE_NS,{options:{hiddenClass:'hide',markup:'',tNotFound:'Вече сте влезли в профила си.'},proto:{initInline:function(){mfp.types.push(INLINE_NS);_mfpOn(CLOSE_EVENT+'.'+INLINE_NS,function(){_putInlineElementsBack();});},getInline:function(item,template){_putInlineElementsBack();if(item.src){var inlineSt=mfp.st.inline,el=$(item.src);if(el.length){var parent=el[0].parentNode;if(parent&&parent.tagName){if(!_inlinePlaceholder){_hiddenClass=inlineSt.hiddenClass;_inlinePlaceholder=_getEl(_hiddenClass);_hiddenClass='mfp-'+_hiddenClass;}_lastInlineElement=el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass);}mfp.updateStatus('ready');}else{mfp.updateStatus('error',inlineSt.tNotFound);el=$('');}item.inlineElement=el;return el;}mfp.updateStatus('ready');mfp._parseMarkup(template,{},item);return template;}}});var AJAX_NS='ajax',_ajaxCur,_removeAjaxCursor=function(){if(_ajaxCur){$(document.body).removeClass(_ajaxCur);}},_destroyAjaxRequest=function(){_removeAjaxCursor();if(mfp.req){mfp.req.abort();}};$.magnificPopup.registerModule(AJAX_NS,{options:{settings:null,cursor:'mfp-ajax-cur',tError:'
The content could not be loaded.'},proto:{initAjax:function(){mfp.types.push(AJAX_NS);_ajaxCur=mfp.st.ajax.cursor;_mfpOn(CLOSE_EVENT+'.'+AJAX_NS,_destroyAjaxRequest);_mfpOn('BeforeChange.'+AJAX_NS,_destroyAjaxRequest);},getAjax:function(item){if(_ajaxCur){$(document.body).addClass(_ajaxCur);}mfp.updateStatus('loading');var opts=$.extend({url:item.src,success:function(data,textStatus,jqXHR){var temp={data:data,xhr:jqXHR};_mfpTrigger('ParseAjax',temp);mfp.appendContent($(temp.data),AJAX_NS);item.finished=true;_removeAjaxCursor();mfp._setFocus();setTimeout(function(){mfp.wrap.addClass(READY_CLASS);},16);mfp.updateStatus('ready');_mfpTrigger('AjaxContentAdded');},error:function(){_removeAjaxCursor();item.finished=item.loadError=true;mfp.updateStatus('error',mfp.st.ajax.tError.replace('%url%',item.src));}},mfp.st.ajax.settings);mfp.req=$.ajax(opts);return'';}}});var _imgInterval,_getTitle=function(item){if(item.data&&item.data.title!==undefined)return item.data.title;var src=mfp.st.image.titleSrc;if(src){if($.isFunction(src)){return src.call(mfp,item);}else if(item.el){return item.el.attr(src)||'';}}return'';};$.magnificPopup.registerModule('image',{options:{markup:'
',cursor:'mfp-zoom-out-cur',titleSrc:'title',verticalFit:true,tError:'
The image could not be loaded.'},proto:{initImage:function(){var imgSt=mfp.st.image,ns='.image';mfp.types.push('image');_mfpOn(OPEN_EVENT+ns,function(){if(mfp.currItem.type==='image'&&imgSt.cursor){$(document.body).addClass(imgSt.cursor);}});_mfpOn(CLOSE_EVENT+ns,function(){if(imgSt.cursor){$(document.body).removeClass(imgSt.cursor);}_window.off('resize'+EVENT_NS);});_mfpOn('Resize'+ns,mfp.resizeImage);if(mfp.isLowIE){_mfpOn('AfterChange',mfp.resizeImage);}},resizeImage:function(){var item=mfp.currItem;if(!item||!item.img)return;if(mfp.st.image.verticalFit){var decr=0;if(mfp.isLowIE){decr=parseInt(item.img.css('padding-top'),10)+parseInt(item.img.css('padding-bottom'),10);}item.img.css('max-height',mfp.wH-decr);}},_onImageHasSize:function(item){if(item.img){item.hasSize=true;if(_imgInterval){clearInterval(_imgInterval);}item.isCheckingImgSize=false;_mfpTrigger('ImageHasSize',item);if(item.imgHidden){if(mfp.content)mfp.content.removeClass('mfp-loading');item.imgHidden=false;}}},findImageSize:function(item){var counter=0,img=item.img[0],mfpSetInterval=function(delay){if(_imgInterval){clearInterval(_imgInterval);}_imgInterval=setInterval(function(){if(img.naturalWidth>0){mfp._onImageHasSize(item);return;}if(counter>200){clearInterval(_imgInterval);}counter++;if(counter===3){mfpSetInterval(10);}else if(counter===40){mfpSetInterval(50);}else if(counter===100){mfpSetInterval(500);}},delay);};mfpSetInterval(1);},getImage:function(item,template){var guard=0,onLoadComplete=function(){if(item){if(item.img[0].complete){item.img.off('.mfploader');if(item===mfp.currItem){mfp._onImageHasSize(item);mfp.updateStatus('ready');}item.hasSize=true;item.loaded=true;_mfpTrigger('ImageLoadComplete');}else{guard++;if(guard<200){setTimeout(onLoadComplete,100);}else{onLoadError();}}}},onLoadError=function(){if(item){item.img.off('.mfploader');if(item===mfp.currItem){mfp._onImageHasSize(item);mfp.updateStatus('error',imgSt.tError.replace('%url%',item.src));}item.hasSize=true;item.loaded=true;item.loadError=true;}},imgSt=mfp.st.image;var el=template.find('.mfp-img');if(el.length){var img=document.createElement('img');img.className='mfp-img';if(item.el&&item.el.find('img').length){img.alt=item.el.find('img').attr('alt');}item.img=$(img).on('load.mfploader',onLoadComplete).on('error.mfploader',onLoadError);img.src=item.src;if(el.is('img')){item.img=item.img.clone();}img=item.img[0];if(img.naturalWidth>0){item.hasSize=true;}else if(!img.width){item.hasSize=false;}}mfp._parseMarkup(template,{title:_getTitle(item),img_replaceWith:item.img},item);mfp.resizeImage();if(item.hasSize){if(_imgInterval)clearInterval(_imgInterval);if(item.loadError){template.addClass('mfp-loading');mfp.updateStatus('error',imgSt.tError.replace('%url%',item.src));}else{template.removeClass('mfp-loading');mfp.updateStatus('ready');}return template;}mfp.updateStatus('loading');item.loading=true;if(!item.hasSize){item.imgHidden=true;template.addClass('mfp-loading');mfp.findImageSize(item);}return template;}}});var hasMozTransform,getHasMozTransform=function(){if(hasMozTransform===undefined){hasMozTransform=document.createElement('p').style.MozTransform!==undefined;}return hasMozTransform;};$.magnificPopup.registerModule('zoom',{options:{enabled:false,easing:'ease-in-out',duration:300,opener:function(element){return element.is('img')?element:element.find('img');}},proto:{initZoom:function(){var zoomSt=mfp.st.zoom,ns='.zoom',image;if(!zoomSt.enabled||!mfp.supportsTransition){return;}var duration=zoomSt.duration,getElToAnimate=function(image){var newImg=image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),transition='all '+(zoomSt.duration/1000)+'s '+zoomSt.easing,cssObj={position:'fixed',zIndex:9999,left:0,top:0,'-webkit-backface-visibility':'hidden'},t='transition';cssObj['-webkit-'+t]=cssObj['-moz-'+t]=cssObj['-o-'+t]=cssObj[t]=transition;newImg.css(cssObj);return newImg;},showMainContent=function(){mfp.content.css('visibility','visible');},openTimeout,animatedImg;_mfpOn('BuildControls'+ns,function(){if(mfp._allowZoom()){clearTimeout(openTimeout);mfp.content.css('visibility','hidden');image=mfp._getItemToZoom();if(!image){showMainContent();return;}animatedImg=getElToAnimate(image);animatedImg.css(mfp._getOffset());mfp.wrap.append(animatedImg);openTimeout=setTimeout(function(){animatedImg.css(mfp._getOffset(true));openTimeout=setTimeout(function(){showMainContent();setTimeout(function(){animatedImg.remove();image=animatedImg=null;_mfpTrigger('ZoomAnimationEnded');},16);},duration);},16);}});_mfpOn(BEFORE_CLOSE_EVENT+ns,function(){if(mfp._allowZoom()){clearTimeout(openTimeout);mfp.st.removalDelay=duration;if(!image){image=mfp._getItemToZoom();if(!image){return;}animatedImg=getElToAnimate(image);}animatedImg.css(mfp._getOffset(true));mfp.wrap.append(animatedImg);mfp.content.css('visibility','hidden');setTimeout(function(){animatedImg.css(mfp._getOffset());},16);}});_mfpOn(CLOSE_EVENT+ns,function(){if(mfp._allowZoom()){showMainContent();if(animatedImg){animatedImg.remove();}image=null;}});},_allowZoom:function(){return mfp.currItem.type==='image';},_getItemToZoom:function(){if(mfp.currItem.hasSize){return mfp.currItem.img;}else{return false;}},_getOffset:function(isLarge){var el;if(isLarge){el=mfp.currItem.img;}else{el=mfp.st.zoom.opener(mfp.currItem.el||mfp.currItem);}var offset=el.offset();var paddingTop=parseInt(el.css('padding-top'),10);var paddingBottom=parseInt(el.css('padding-bottom'),10);offset.top-=($(window).scrollTop()-paddingTop);var obj={width:el.width(),height:(_isJQ?el.innerHeight():el[0].offsetHeight)-paddingBottom-paddingTop};if(getHasMozTransform()){obj['-moz-transform']=obj['transform']='translate('+offset.left+'px,'+offset.top+'px)';}else{obj.left=offset.left;obj.top=offset.top;}return obj;}}});var IFRAME_NS='iframe',_emptyPage='//about:blank',_fixIframeBugs=function(isShowing){if(mfp.currTemplate[IFRAME_NS]){var el=mfp.currTemplate[IFRAME_NS].find('iframe');if(el.length){if(!isShowing){el[0].src=_emptyPage;}if(mfp.isIE8){el.css('display',isShowing?'block':'none');}}}};$.magnificPopup.registerModule(IFRAME_NS,{options:{markup:'
',srcAction:'iframe_src',patterns:{youtube:{index:'youtube.com',id:'v=',src:'//www.youtube.com/embed/%id%?autoplay=1'},vimeo:{index:'vimeo.com/',id:'/',src:'//player.vimeo.com/video/%id%?autoplay=1'},gmaps:{index:'//maps.google.',src:'%id%&output=embed'}}},proto:{initIframe:function(){mfp.types.push(IFRAME_NS);_mfpOn('BeforeChange',function(e,prevType,newType){if(prevType!==newType){if(prevType===IFRAME_NS){_fixIframeBugs();}else if(newType===IFRAME_NS){_fixIframeBugs(true);}}});_mfpOn(CLOSE_EVENT+'.'+IFRAME_NS,function(){_fixIframeBugs();});},getIframe:function(item,template){var embedSrc=item.src;var iframeSt=mfp.st.iframe;$.each(iframeSt.patterns,function(){if(embedSrc.indexOf(this.index)>-1){if(this.id){if(typeof this.id==='string'){embedSrc=embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length,embedSrc.length);}else{embedSrc=this.id.call(this,embedSrc);}}embedSrc=this.src.replace('%id%',embedSrc);return false;}});var dataObj={};if(iframeSt.srcAction){dataObj[iframeSt.srcAction]=embedSrc;}mfp._parseMarkup(template,dataObj,item);mfp.updateStatus('ready');return template;}}});var _getLoopedId=function(index){var numSlides=mfp.items.length;if(index>numSlides-1){return index-numSlides;}else if(index<0){return numSlides+index;}return index;},_replaceCurrTotal=function(text,curr,total){return text.replace(/%curr%/gi,curr+1).replace(/%total%/gi,total);};$.magnificPopup.registerModule('gallery',{options:{enabled:false,arrowMarkup:'
',preload:[0,2],navigateByImgClick:true,arrows:true,tPrev:'Previous (Left arrow key)',tNext:'Next (Right arrow key)',tCounter:'%curr% of %total%'},proto:{initGallery:function(){var gSt=mfp.st.gallery,ns='.mfp-gallery',supportsFastClick=Boolean($.fn.mfpFastClick);mfp.direction=true;if(!gSt||!gSt.enabled)return false;_wrapClasses+=' mfp-gallery';_mfpOn(OPEN_EVENT+ns,function(){if(gSt.navigateByImgClick){mfp.wrap.on('click'+ns,'.mfp-img',function(){if(mfp.items.length>1){mfp.next();return false;}});}_document.on('keydown'+ns,function(e){if(e.keyCode===37){mfp.prev();}else if(e.keyCode===39){mfp.next();}});});_mfpOn('UpdateStatus'+ns,function(e,data){if(data.text){data.text=_replaceCurrTotal(data.text,mfp.currItem.index,mfp.items.length);}});_mfpOn(MARKUP_PARSE_EVENT+ns,function(e,element,values,item){var l=mfp.items.length;values.counter=l>1?_replaceCurrTotal(gSt.tCounter,item.index,l):'';});_mfpOn('BuildControls'+ns,function(){if(mfp.items.length>1&&gSt.arrows&&!mfp.arrowLeft){var markup=gSt.arrowMarkup,arrowLeft=mfp.arrowLeft=$(markup.replace(/%title%/gi,gSt.tPrev).replace(/%dir%/gi,'left')).addClass(PREVENT_CLOSE_CLASS),arrowRight=mfp.arrowRight=$(markup.replace(/%title%/gi,gSt.tNext).replace(/%dir%/gi,'right')).addClass(PREVENT_CLOSE_CLASS);var eName=supportsFastClick?'mfpFastClick':'click';arrowLeft[eName](function(){mfp.prev();});arrowRight[eName](function(){mfp.next();});if(mfp.isIE7){_getEl('b',arrowLeft[0],false,true);_getEl('a',arrowLeft[0],false,true);_getEl('b',arrowRight[0],false,true);_getEl('a',arrowRight[0],false,true);}mfp.container.append(arrowLeft.add(arrowRight));}});_mfpOn(CHANGE_EVENT+ns,function(){if(mfp._preloadTimeout)clearTimeout(mfp._preloadTimeout);mfp._preloadTimeout=setTimeout(function(){mfp.preloadNearbyImages();mfp._preloadTimeout=null;},16);});_mfpOn(CLOSE_EVENT+ns,function(){_document.off(ns);mfp.wrap.off('click'+ns);if(mfp.arrowLeft&&supportsFastClick){mfp.arrowLeft.add(mfp.arrowRight).destroyMfpFastClick();}mfp.arrowRight=mfp.arrowLeft=null;});},next:function(){mfp.direction=true;mfp.index=_getLoopedId(mfp.index+1);mfp.updateItemHTML();},prev:function(){mfp.direction=false;mfp.index=_getLoopedId(mfp.index-1);mfp.updateItemHTML();},goTo:function(newIndex){mfp.direction=(newIndex>=mfp.index);mfp.index=newIndex;mfp.updateItemHTML();},preloadNearbyImages:function(){var p=mfp.st.gallery.preload,preloadBefore=Math.min(p[0],mfp.items.length),preloadAfter=Math.min(p[1],mfp.items.length),i;for(i=1;i<=(mfp.direction?preloadAfter:preloadBefore);i++){mfp._preloadItem(mfp.index+i);}for(i=1;i<=(mfp.direction?preloadBefore:preloadAfter);i++){mfp._preloadItem(mfp.index-i);}},_preloadItem:function(index){index=_getLoopedId(index);if(mfp.items[index].preloaded){return;}var item=mfp.items[index];if(!item.parsed){item=mfp.parseEl(index);}_mfpTrigger('LazyLoad',item);if(item.type==='image'){item.img=$('
![]()
').on('load.mfploader',function(){item.hasSize=true;}).on('error.mfploader',function(){item.hasSize=true;item.loadError=true;_mfpTrigger('LazyLoadError',item);}).attr('src',item.src);}item.preloaded=true;}}});var RETINA_NS='retina';$.magnificPopup.registerModule(RETINA_NS,{options:{replaceSrc:function(item){return item.src.replace(/\.\w+$/,function(m){return'@2x'+m;});},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var st=mfp.st.retina,ratio=st.ratio;ratio=!isNaN(ratio)?ratio:ratio();if(ratio>1){_mfpOn('ImageHasSize'+'.'+RETINA_NS,function(e,item){item.img.css({'max-width':item.img[0].naturalWidth/ratio,'width':'100%'});});_mfpOn('ElementParse'+'.'+RETINA_NS,function(e,item){item.src=st.replaceSrc(item,ratio);});}}}}});(function(){var ghostClickDelay=1000,supportsTouch='ontouchstart'in window,unbindTouchMove=function(){_window.off('touchmove'+ns+' touchend'+ns);},eName='mfpFastClick',ns='.'+eName;$.fn.mfpFastClick=function(callback){return $(this).each(function(){var elem=$(this),lock;if(supportsTouch){var timeout,startX,startY,pointerMoved,point,numPointers;elem.on('touchstart'+ns,function(e){pointerMoved=false;numPointers=1;point=e.originalEvent?e.originalEvent.touches[0]:e.touches[0];startX=point.clientX;startY=point.clientY;_window.on('touchmove'+ns,function(e){point=e.originalEvent?e.originalEvent.touches:e.touches;numPointers=point.length;point=point[0];if(Math.abs(point.clientX-startX)>10||Math.abs(point.clientY-startY)>10){pointerMoved=true;unbindTouchMove();}}).on('touchend'+ns,function(e){unbindTouchMove();if(pointerMoved||numPointers>1){return;}lock=true;e.preventDefault();clearTimeout(timeout);timeout=setTimeout(function(){lock=false;},ghostClickDelay);callback();});});}elem.on('click'+ns,function(){if(!lock){callback();}});});};$.fn.destroyMfpFastClick=function(){$(this).off('touchstart'+ns+' click'+ns);if(supportsTouch)_window.off('touchmove'+ns+' touchend'+ns);};})();_checkInstance();}));/*!
* jQuery Form Plugin
* version: 3.51.0-2014.06.20
* Requires jQuery v1.5 or later
* Copyright (c) 2014 M. Alsup
* Examples and documentation at: http://malsup.com/jquery/form/
* Project repository: https://github.com/malsup/form
* Dual licensed under the MIT and GPL licenses.
* https://github.com/malsup/form#copyright-and-license
*/
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=this;if(i.clk=r,"image"==r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("
").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;i
').val(m.extraData[d].value).appendTo(w)[0]:e('').val(m.extraData[d]).appendTo(w)[0]);m.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(h){var x=document.createElement("form").submit;x.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",c),r?w.setAttribute("target",r):f.removeAttr("target"),e(l).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t==k&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(m.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(l){var p=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];p?x.responseText=p.textContent?p.textContent:p.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==c&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,c,m)}catch(y){i="parsererror",x.error=r=y||i}}catch(y){a("error caught: ",y),i="error",x.error=r=y||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,E,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,m,r])),d&&e.event.trigger("ajaxComplete",[x,m]),d&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget?v.attr("src",m.iframeSrc):v.remove(),x.responseXML=null},100)}}}var c,l,m,d,p,v,g,x,y,b,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(l=0;l'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(n){}v.attr("src",m.iframeSrc),x.error=r,m.error&&m.error.call(m.context,x,r,t),d&&e.event.trigger("ajaxError",[x,m,r]),m.complete&&m.complete.call(m.context,x,r)}},d=m.global,d&&0===e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,m]),m.beforeSend&&m.beforeSend.call(m.context,x,m)===!1)return m.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;y=w.clk,y&&(b=y.name,b&&!y.disabled&&(m.extraData=m.extraData||{},m.extraData[b]=y.value,"image"==y.type&&(m.extraData[b+".x"]=w.clk_x,m.extraData[b+".y"]=w.clk_y)));var D=1,k=2,A=e("meta[name=csrf-token]").attr("content"),L=e("meta[name=csrf-param]").attr("content");L&&A&&(m.extraData=m.extraData||{},m.extraData[L]=A),m.forceSync?o():setTimeout(o,10);var E,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i="xml"===r||!r&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&("json"===r||!r&&n.indexOf("json")>=0?o=C(o):("script"===r||!r&&n.indexOf("javascript")>=0)&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var u,c,l,f=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),c=t.url||this.attr2("action"),l="string"==typeof c?e.trim(c):"",l=l||window.location.href||"",l&&(l=(l.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:l,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var d=t.traditional;void 0===d&&(d=e.ajaxSettings.traditional);var p,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,p=e.param(t.data,d)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,d);p&&(g=g?g+"&"+p:p),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(y,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=x.length;o>i;i++)x[i].apply(n,[e,r,a||f,f])},t.error){var b=t.error;t.error=function(e,r,a){var n=t.context||this;b.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),w=j.length>0,S="multipart/form-data",D=f.attr("enctype")==S||f.attr("encoding")==S,k=n.fileapi&&n.formdata;a("fileAPI :"+k);var A,L=(w||D)&&!k;t.iframe!==!1&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||D)&&k?o(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var E=0;Ec;c++)if(d=u[c],f=d.name,f&&!d.disabled)if(t&&o.clk&&"image"==d.type)o.clk==d&&(a.push({name:f,value:e(d).val(),type:d.type}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}));else if(m=e.fieldValue(d,!0),m&&m.constructor==Array)for(r&&r.push(d),l=0,h=m.length;h>l;l++)a.push({name:f,value:m[l]});else if(n.fileapi&&"file"==d.type){r&&r.push(d);var v=d.files;if(v.length)for(l=0;li;i++)r.push({name:a,value:n[i]});else null!==n&&"undefined"!=typeof n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;n>a;a++){var i=this[a],o=e.fieldValue(i,t);null===o||"undefined"==typeof o||o.constructor==Array&&!o.length||(o.constructor==Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,n=t.type,i=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==i&&-1==t.selectedIndex))return null;if("select"==i){var o=t.selectedIndex;if(0>o)return null;for(var s=[],u=t.options,c="select-one"==n,l=c?o+1:u.length,f=c?o:0;l>f;f++){var m=u[f];if(m.selected){var d=m.value;if(d||(d=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),c)return d;s.push(d)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1});var slice=[].slice;(function($,window){var Starrr;window.Starrr=Starrr=(function(){Starrr.prototype.defaults={rating:void 0,max:5,readOnly:false,emptyClass:'icon-star-empty',fullClass:'icon-star',change:function(e,value){}};function Starrr($el,options){this.options=$.extend({},this.defaults,options);this.$el=$el;this.createStars();this.syncRating();if(this.options.readOnly){return;}this.$el.on('mouseover.starrr','a',(function(_this){return function(e){return _this.syncRating(_this.getStars().index(e.currentTarget)+1);};})(this));this.$el.on('mouseout.starrr',(function(_this){return function(){return _this.syncRating();};})(this));this.$el.on('click.starrr','a',(function(_this){return function(e){e.preventDefault();return _this.setRating(_this.getStars().index(e.currentTarget)+1);};})(this));this.$el.on('starrr:change',this.options.change);}Starrr.prototype.getStars=function(){return this.$el.find('a');};Starrr.prototype.createStars=function(){var j,ref,results;results=[];for(j=1,ref=this.options.max;1<=ref?j<=ref:j>=ref;1<=ref?j++:j--){results.push(this.$el.append(""));}return results;};Starrr.prototype.setRating=function(rating){if(this.options.rating===rating){rating=void 0;}this.options.rating=rating;this.syncRating();return this.$el.trigger('starrr:change',rating);};Starrr.prototype.getRating=function(){return this.options.rating;};Starrr.prototype.syncRating=function(rating){var $stars,i,j,ref,results;rating||(rating=this.options.rating);$stars=this.getStars();results=[];for(i=j=1,ref=this.options.max;1<=ref?j<=ref:j>=ref;i=1<=ref?++j:--j){results.push($stars.eq(i-1).removeClass(rating>=i?this.options.emptyClass:this.options.fullClass).addClass(rating>=i?this.options.fullClass:this.options.emptyClass));}return results;};return Starrr;})();return $.fn.extend({starrr:function(){var args,option;option=arguments[0],args=2<=arguments.length?slice.call(arguments,1):[];return this.each(function(){var data;data=$(this).data('starrr');if(!data){$(this).data('starrr',(data=new Starrr($(this),option)));}if(typeof option==='string'){return data[option].apply(data,args);}});}});})(window.jQuery,window);;(function($){$.fn.extend({donetyping:function(callback,timeout){timeout=timeout||1e3;var timeoutReference,doneTyping=function(el){if(!timeoutReference)return;timeoutReference=null;callback.call(el);};return this.each(function(i,el){var $el=$(el);$el.is(':input')&&$el.on('keyup keypress paste',function(e){if(e.type=='keyup'&&e.keyCode!=8)return;if(timeoutReference)clearTimeout(timeoutReference);timeoutReference=setTimeout(function(){doneTyping(el);},timeout);}).on('blur',function(){doneTyping(el);});});}});})(jQuery);+(function(window,$,undefined){'use strict';var support={calc:false};$.fn.rrssb=function(options){var settings=$.extend({description:undefined,emailAddress:undefined,emailBody:undefined,emailSubject:undefined,image:undefined,title:undefined,url:undefined,phone:undefined,},options);settings.emailSubject=settings.emailSubject||settings.title;settings.emailBody=settings.emailBody||((settings.description?settings.description:'')+(settings.url?'\n\n'+settings.url:''));for(var key in settings){if(settings.hasOwnProperty(key)&&settings[key]!==undefined){settings[key]=encodeString(settings[key]);}};if(settings.url!==undefined){$(this).find('.rrssb-facebook a').attr('href','https://www.facebook.com/sharer/sharer.php?u='+settings.url);$(this).find('.rrssb-tumblr a').attr('href','http://tumblr.com/share/link?url='+settings.url+(settings.title!==undefined?'&name='+settings.title:'')+(settings.description!==undefined?'&description='+settings.description:''));$(this).find('.rrssb-linkedin a').attr('href','http://www.linkedin.com/shareArticle?mini=true&url='+settings.url+(settings.title!==undefined?'&title='+settings.title:'')+(settings.description!==undefined?'&summary='+settings.description:''));$(this).find('.rrssb-twitter a').attr('href','https://twitter.com/intent/tweet?text='+(settings.description!==undefined?settings.description:'')+'%20'+settings.url);$(this).find('.rrssb-hackernews a').attr('href','https://news.ycombinator.com/submitlink?u='+settings.url+(settings.title!==undefined?'&text='+settings.title:''));$(this).find('.rrssb-vk a').attr('href','https://vk.com/share.php?url='+settings.url);$(this).find('.rrssb-reddit a').attr('href','http://www.reddit.com/submit?url='+settings.url+(settings.description!==undefined?'&text='+settings.description:'')+(settings.title!==undefined?'&title='+settings.title:''));$(this).find('.rrssb-googleplus a').attr('href','https://plus.google.com/share?url='+(settings.description!==undefined?settings.description:'')+'%20'+settings.url);$(this).find('.rrssb-pinterest a').attr('href','http://pinterest.com/pin/create/button/?url='+settings.url+((settings.image!==undefined)?'&media='+settings.image:'')+(settings.description!==undefined?'&description='+settings.description:''));$(this).find('.rrssb-pocket a').attr('href','https://getpocket.com/save?url='+settings.url);$(this).find('.rrssb-github a').attr('href',settings.url);$(this).find('.rrssb-print a').attr('href','javascript:window.print()');$(this).find('.rrssb-whatsapp a').attr('href','whatsapp://send?text='+(settings.description!==undefined?settings.description+'%20':(settings.title!==undefined?settings.title+'%20':''))+settings.url);$(this).find('.rrssb-viber a').attr('href','viber://forward?text='+encodeURIComponent(window.location.href));}if(settings.emailAddress!==undefined||settings.emailSubject){$(this).find('.rrssb-email a').attr('href','mailto:'+(settings.emailAddress?settings.emailAddress:'')+'?'+(settings.emailSubject!==undefined?'subject='+settings.emailSubject:'')+(settings.emailBody!==undefined?'&body='+settings.emailBody:''));}};var detectCalcSupport=function(){var el=$('');var calcProps=['calc','-webkit-calc','-moz-calc'];$('body').append(el);for(var i=0;i
170&&buttonCountSmall<1){self.addClass('large-format');var fontSize=buttonWidth/12+'px';self.css('font-size',fontSize);}else{self.removeClass('large-format');self.css('font-size','');}if(containerWidthbtnWidth){var btn2small=buttons.not('.small').last();$(btn2small).addClass('small');sizeSmallBtns();}}if(!--count)backUpFromSmall();});});if(init===true){rrssbMagicLayout(sizeSmallBtns);}};var sizeSmallBtns=function(){$('.rrssb-buttons').each(function(index){var self=$(this);var regButtonCount;var regPercent;var pixelsOff;var magicWidth;var smallBtnFraction;var buttons=$('li',self);var smallButtons=buttons.filter('.small');var smallBtnCount=smallButtons.length;if(smallBtnCount>0&&smallBtnCount!==buttons.length){self.removeClass('small-format');smallButtons.css('width','42px');pixelsOff=smallBtnCount*42;regButtonCount=buttons.not('.small').length;regPercent=100/regButtonCount;smallBtnFraction=pixelsOff/regButtonCount;if(support.calc===false){magicWidth=((self.innerWidth()-1)/regButtonCount)-smallBtnFraction;magicWidth=Math.floor(magicWidth*1000)/1000;magicWidth+='px';}else{magicWidth=support.calc+'('+regPercent+'% - '+smallBtnFraction+'px)';}buttons.not('.small').css('width',magicWidth);}else if(smallBtnCount===buttons.length){self.addClass('small-format');setPercentBtns();}else{self.removeClass('small-format');setPercentBtns();}});makeExtremityBtns();};var rrssbInit=function(){$('.rrssb-buttons').each(function(index){$(this).addClass('rrssb-'+(index+1));});detectCalcSupport();setPercentBtns();$('.rrssb-buttons li .rrssb-text').each(function(index){var buttonTxt=$(this);var txtWdth=buttonTxt.width();buttonTxt.closest('li').attr('data-size',txtWdth);});checkSize(true);};var rrssbMagicLayout=function(callback){$('.rrssb-buttons li.small').removeClass('small');checkSize();callback();};var popupCenter=function(url,title,w,h){var dualScreenLeft=window.screenLeft!==undefined?window.screenLeft:screen.left;var dualScreenTop=window.screenTop!==undefined?window.screenTop:screen.top;var width=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;var height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;var left=((width/2)-(w/2))+dualScreenLeft;var top=((height/3)-(h/3))+dualScreenTop;var newWindow=window.open(url,title,'scrollbars=yes, width='+w+', height='+h+', top='+top+', left='+left);if(newWindow&&newWindow.focus){newWindow.focus();}};var waitForFinalEvent=(function(){var timers={};return function(callback,ms,uniqueId){if(!uniqueId){uniqueId="Don't call this twice without a uniqueId";}if(timers[uniqueId]){clearTimeout(timers[uniqueId]);}timers[uniqueId]=setTimeout(callback,ms);};})();$(document).ready(function(){try{$(document).on('click','.rrssb-buttons a.popup',{},function popUp(e){var self=$(this);popupCenter(self.attr('href'),self.find('.rrssb-text').html(),580,470);e.preventDefault();});}catch(e){}$(window).resize(function(){rrssbMagicLayout(sizeSmallBtns);waitForFinalEvent(function(){rrssbMagicLayout(sizeSmallBtns);},200,"finished resizing");});rrssbInit();});window.rrssbInit=rrssbInit;})(window,jQuery);/*!
* MockJax - jQuery Plugin to Mock Ajax requests
*
* Version: 1.5.0pre
* Released:
* Home: http://github.com/appendto/jquery-mockjax
* Author: Jonathan Sharp (http://jdsharp.com)
* License: MIT,GPL
*
* Copyright (c) 2011 appendTo LLC.
* Dual licensed under the MIT or GPL licenses.
* http://appendto.com/open-source-licenses
*/
(function($){var _ajax=$.ajax,mockHandlers=[],CALLBACK_REGEX=/=\?(&|$)/,jsc=(new Date()).getTime();function parseXML(xml){if(window['DOMParser']==undefined&&window.ActiveXObject){DOMParser=function(){};DOMParser.prototype.parseFromString=function(xmlString){var doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(xmlString);return doc;};}try{var xmlDoc=(new DOMParser()).parseFromString(xml,'text/xml');if($.isXMLDoc(xmlDoc)){var err=$('parsererror',xmlDoc);if(err.length==1){throw('Error: '+$(xmlDoc).text());}}else{throw('Unable to parse XML');}}catch(e){var msg=(e.name==undefined?e:e.name+': '+e.message);$(document).trigger('xmlParseError',[msg]);return undefined;}return xmlDoc;}function trigger(s,type,args){(s.context?jQuery(s.context):jQuery.event).trigger(type,args);}function isMockDataEqual(mock,live){var identical=false;if(typeof live==='string'){return $.isFunction(mock.test)?mock.test(live):mock==live;}$.each(mock,function(k,v){if(live[k]===undefined){identical=false;return identical;}else{identical=true;if(typeof live[k]=='object'){return isMockDataEqual(mock[k],live[k]);}else{if($.isFunction(mock[k].test)){identical=mock[k].test(live[k]);}else{identical=(mock[k]==live[k]);}return identical;}}});return identical;}function getMockForRequest(handler,requestSettings){if($.isFunction(handler)){return handler(requestSettings);}if($.isFunction(handler.url.test)){if(!handler.url.test(requestSettings.url)){return null;}}else{var star=handler.url.indexOf('*');if(handler.url!==requestSettings.url&&star===-1||!new RegExp(handler.url.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace('*','.+')).test(requestSettings.url)){return null;}}if(handler.data&&requestSettings.data){if(!isMockDataEqual(handler.data,requestSettings.data)){return null;}}if(handler&&handler.type&&handler.type.toLowerCase()!=requestSettings.type.toLowerCase()){return null;}return handler;}function logMock(mockHandler,requestSettings){var c=$.extend({},$.mockjaxSettings,mockHandler);if(c.log&&$.isFunction(c.log)){c.log('MOCK '+requestSettings.type.toUpperCase()+': '+requestSettings.url,$.extend({},requestSettings));}}function _xhrSend(mockHandler,requestSettings,origSettings){var process=(function(that){return function(){return(function(){this.status=mockHandler.status;this.statusText=mockHandler.statusText;this.readyState=4;if($.isFunction(mockHandler.response)){mockHandler.response(origSettings);}if(requestSettings.dataType=='json'&&(typeof mockHandler.responseText=='object')){this.responseText=JSON.stringify(mockHandler.responseText);}else if(requestSettings.dataType=='xml'){if(typeof mockHandler.responseXML=='string'){this.responseXML=parseXML(mockHandler.responseXML);}else{this.responseXML=mockHandler.responseXML;}}else{this.responseText=mockHandler.responseText;}if(typeof mockHandler.status=='number'||typeof mockHandler.status=='string'){this.status=mockHandler.status;}if(typeof mockHandler.statusText==="string"){this.statusText=mockHandler.statusText;}if($.isFunction(this.onreadystatechange)){if(mockHandler.isTimeout){this.status=-1;}this.onreadystatechange(mockHandler.isTimeout?'timeout':undefined);}else if(mockHandler.isTimeout){this.status=-1;}}).apply(that);};})(this);if(mockHandler.proxy){_ajax({global:false,url:mockHandler.proxy,type:mockHandler.proxyType,data:mockHandler.data,dataType:requestSettings.dataType==="script"?"text/plain":requestSettings.dataType,complete:function(xhr,txt){mockHandler.responseXML=xhr.responseXML;mockHandler.responseText=xhr.responseText;mockHandler.status=xhr.status;mockHandler.statusText=xhr.statusText;this.responseTimer=setTimeout(process,mockHandler.responseTime||0);}});}else{if(requestSettings.async===false){process();}else{this.responseTimer=setTimeout(process,mockHandler.responseTime||50);}}}function xhr(mockHandler,requestSettings,origSettings,origHandler){mockHandler=$.extend({},$.mockjaxSettings,mockHandler);if(typeof mockHandler.headers==='undefined'){mockHandler.headers={};}if(mockHandler.contentType){mockHandler.headers['content-type']=mockHandler.contentType;}return{status:mockHandler.status,statusText:mockHandler.statusText,readyState:1,open:function(){},send:function(){origHandler.fired=true;_xhrSend.call(this,mockHandler,requestSettings,origSettings);},abort:function(){clearTimeout(this.responseTimer);},setRequestHeader:function(header,value){mockHandler.headers[header]=value;},getResponseHeader:function(header){if(mockHandler.headers&&mockHandler.headers[header]){return mockHandler.headers[header];}else if(header.toLowerCase()=='last-modified'){return mockHandler.lastModified||(new Date()).toString();}else if(header.toLowerCase()=='etag'){return mockHandler.etag||'';}else if(header.toLowerCase()=='content-type'){return mockHandler.contentType||'text/plain';}},getAllResponseHeaders:function(){var headers='';$.each(mockHandler.headers,function(k,v){headers+=k+': '+v+"\n";});return headers;}};}function processJsonpMock(requestSettings,mockHandler,origSettings){processJsonpUrl(requestSettings);requestSettings.dataType="json";if(requestSettings.data&&CALLBACK_REGEX.test(requestSettings.data)||CALLBACK_REGEX.test(requestSettings.url)){createJsonpCallback(requestSettings,mockHandler);var rurl=/^(\w+:)?\/\/([^\/?#]+)/,parts=rurl.exec(requestSettings.url),remote=parts&&(parts[1]&&parts[1]!==location.protocol||parts[2]!==location.host);requestSettings.dataType="script";if(requestSettings.type.toUpperCase()==="GET"&&remote){var newMockReturn=processJsonpRequest(requestSettings,mockHandler,origSettings);if(newMockReturn){return newMockReturn;}else{return true;}}}return null;}function processJsonpUrl(requestSettings){if(requestSettings.type.toUpperCase()==="GET"){if(!CALLBACK_REGEX.test(requestSettings.url)){requestSettings.url+=(/\?/.test(requestSettings.url)?"&":"?")+(requestSettings.jsonp||"callback")+"=?";}}else if(!requestSettings.data||!CALLBACK_REGEX.test(requestSettings.data)){requestSettings.data=(requestSettings.data?requestSettings.data+"&":"")+(requestSettings.jsonp||"callback")+"=?";}}function processJsonpRequest(requestSettings,mockHandler,origSettings){var callbackContext=origSettings&&origSettings.context||requestSettings,newMock=null;if(mockHandler.response&&$.isFunction(mockHandler.response)){mockHandler.response(origSettings);}else{if(typeof mockHandler.responseText==='object'){$.globalEval('('+JSON.stringify(mockHandler.responseText)+')');}else{$.globalEval('('+mockHandler.responseText+')');}}jsonpSuccess(requestSettings,mockHandler);jsonpComplete(requestSettings,mockHandler);if(jQuery.Deferred){newMock=new jQuery.Deferred();if(typeof mockHandler.responseText=="object"){newMock.resolve(mockHandler.responseText);}else{newMock.resolve(jQuery.parseJSON(mockHandler.responseText));}}return newMock;}function createJsonpCallback(requestSettings,mockHandler){jsonp=requestSettings.jsonpCallback||("jsonp"+jsc++);if(requestSettings.data){requestSettings.data=(requestSettings.data+"").replace(CALLBACK_REGEX,"="+jsonp+"$1");}requestSettings.url=requestSettings.url.replace(CALLBACK_REGEX,"="+jsonp+"$1");window[jsonp]=window[jsonp]||function(tmp){data=tmp;jsonpSuccess(requestSettings,mockHandler);jsonpComplete(requestSettings,mockHandler);window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head){head.removeChild(script);}};}function jsonpSuccess(requestSettings,mockHandler){if(requestSettings.success){requestSettings.success.call(callbackContext,(mockHandler.response?mockHandler.response.toString():mockHandler.responseText||''),status,{});}if(requestSettings.global){trigger(requestSettings,"ajaxSuccess",[{},requestSettings]);}}function jsonpComplete(requestSettings,mockHandler){if(requestSettings.complete){requestSettings.complete.call(callbackContext,{},status);}if(requestSettings.global){trigger("ajaxComplete",[{},requestSettings]);}if(requestSettings.global&&! --jQuery.active){jQuery.event.trigger("ajaxStop");}}function handleAjax(url,origSettings){var mockRequest,requestSettings,mockHandler;if(typeof url==="object"){origSettings=url;url=undefined;}else{origSettings.url=url;}requestSettings=jQuery.extend(true,{},jQuery.ajaxSettings,origSettings);for(var k=0;k").text(i[r]).html();e=i.join("
")}n.addClass(t.fn.editableform.errorGroupClass),o.addClass(t.fn.editableform.errorBlockClass).html(e).show()}},submit:function(e){e.stopPropagation(),e.preventDefault();var i,n=this.input.input2value();if(i=this.validate(n))return this.error(i),this.showForm(),void 0;if(!this.options.savenochange&&this.input.value2str(n)==this.input.value2str(this.value))return this.$div.triggerHandler("nochange"),void 0;var o=this.input.value2submit(n);this.isSaving=!0,t.when(this.save(o)).done(t.proxy(function(t){this.isSaving=!1;var e="function"==typeof this.options.success?this.options.success.call(this.options.scope,t,n):null;return e===!1?(this.error(!1),this.showForm(!1),void 0):"string"==typeof e?(this.error(e),this.showForm(),void 0):(e&&"object"==typeof e&&e.hasOwnProperty("newValue")&&(n=e.newValue),this.error(!1),this.value=n,this.$div.triggerHandler("save",{newValue:n,submitValue:o,response:t}),void 0)},this)).fail(t.proxy(function(t){this.isSaving=!1;var e;e="function"==typeof this.options.error?this.options.error.call(this.options.scope,t,n):"string"==typeof t?t:t.responseText||t.statusText||"Unknown error!",this.error(e),this.showForm()},this))},save:function(e){this.options.pk=t.fn.editableutils.tryParseJson(this.options.pk,!0);var i,n="function"==typeof this.options.pk?this.options.pk.call(this.options.scope):this.options.pk,o=!!("function"==typeof this.options.url||this.options.url&&("always"===this.options.send||"auto"===this.options.send&&null!==n&&void 0!==n));return o?(this.showLoading(),i={name:this.options.name||"",value:e,pk:n},"function"==typeof this.options.params?i=this.options.params.call(this.options.scope,i):(this.options.params=t.fn.editableutils.tryParseJson(this.options.params,!0),t.extend(i,this.options.params)),"function"==typeof this.options.url?this.options.url.call(this.options.scope,i):t.ajax(t.extend({url:this.options.url,data:i,type:"POST"},this.options.ajaxOptions))):void 0},validate:function(t){return void 0===t&&(t=this.value),"function"==typeof this.options.validate?this.options.validate.call(this.options.scope,t):void 0},option:function(t,e){t in this.options&&(this.options[t]=e),"value"===t&&this.setValue(e)},setValue:function(t,e){this.value=e?this.input.str2value(t):t,this.$form&&this.$form.is(":visible")&&this.input.value2input(this.value)}},t.fn.editableform=function(i){var n=arguments;return this.each(function(){var o=t(this),r=o.data("editableform"),s="object"==typeof i&&i;r||o.data("editableform",r=new e(this,s)),"string"==typeof i&&r[i].apply(r,Array.prototype.slice.call(n,1))})},t.fn.editableform.Constructor=e,t.fn.editableform.defaults={type:"text",url:null,params:null,name:null,pk:null,value:null,defaultValue:null,send:"auto",validate:null,success:null,error:null,ajaxOptions:null,showbuttons:!0,scope:null,savenochange:!1},t.fn.editableform.template='',t.fn.editableform.loading='',t.fn.editableform.buttons='',t.fn.editableform.errorGroupClass="has-error",t.fn.editableform.errorBlockClass="editable-error"}(window.jQuery),function(t){"use strict";t.fn.editableutils={inherit:function(t,e){var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t,t.superclass=e.prototype},setCursorPosition:function(t,e){if(t.setSelectionRange)t.setSelectionRange(e,e);else if(t.createTextRange){var i=t.createTextRange();i.collapse(!0),i.moveEnd("character",e),i.moveStart("character",e),i.select()}},tryParseJson:function(t,e){if("string"==typeof t&&t.length&&t.match(/^[\{\[].*[\}\]]$/))if(e)try{t=new Function("return "+t)()}catch(i){}finally{return t}else t=new Function("return "+t)();return t},sliceObj:function(e,i,n){var o,r,s={};if(!t.isArray(i)||!i.length)return s;for(var a=0;a").text(e).html()},itemsByValue:function(e,i,n){if(!i||null===e)return[];if("function"!=typeof n){var o=n||"value";n=function(t){return t[o]}}var r=t.isArray(e),s=[],a=this;return t.each(i,function(i,o){if(o.children)s=s.concat(a.itemsByValue(e,o.children,n));else if(r)t.grep(e,function(t){return t==(o&&"object"==typeof o?n(o):o)}).length&&s.push(o);else{var l=o&&"object"==typeof o?n(o):o;e==l&&s.push(o)}}),s},createInput:function(e){var i,n,o,r=e.type;return"date"===r&&("inline"===e.mode?t.fn.editabletypes.datefield?r="datefield":t.fn.editabletypes.dateuifield&&(r="dateuifield"):t.fn.editabletypes.date?r="date":t.fn.editabletypes.dateui&&(r="dateui"),"date"!==r||t.fn.editabletypes.date||(r="combodate")),"datetime"===r&&"inline"===e.mode&&(r="datetimefield"),"wysihtml5"!==r||t.fn.editabletypes[r]||(r="textarea"),"function"==typeof t.fn.editabletypes[r]?(i=t.fn.editabletypes[r],n=this.sliceObj(e,this.objectKeys(i.defaults)),o=new i(n)):(t.error("Unknown type: "+r),!1)},supportsTransitions:function(){var t=document.body||document.documentElement,e=t.style,i="transition",n=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof e[i])return!0;i=i.charAt(0).toUpperCase()+i.substr(1);for(var o=0;o"),this.tip().is(this.innerCss)?this.tip().append(this.$form):this.tip().find(this.innerCss).append(this.$form),this.renderForm()},hide:function(t){if(this.tip()&&this.tip().is(":visible")&&this.$element.hasClass("editable-open")){if(this.$form.data("editableform").isSaving)return this.delayedHide={reason:t},void 0;this.delayedHide=!1,this.$element.removeClass("editable-open"),this.innerHide(),this.$element.triggerHandler("hidden",t||"manual")}},innerShow:function(){},innerHide:function(){},toggle:function(t){this.container()&&this.tip()&&this.tip().is(":visible")?this.hide():this.show(t)},setPosition:function(){},save:function(t,e){this.$element.triggerHandler("save",e),this.hide("save")},option:function(t,e){this.options[t]=e,t in this.containerOptions?(this.containerOptions[t]=e,this.setContainerOption(t,e)):(this.formOptions[t]=e,this.$form&&this.$form.editableform("option",t,e))},setContainerOption:function(t,e){this.call("option",t,e)},destroy:function(){this.hide(),this.innerDestroy(),this.$element.off("destroyed"),this.$element.removeData("editableContainer")},innerDestroy:function(){},closeOthers:function(e){t(".editable-open").each(function(i,n){if(n!==e&&!t(n).find(e).length){var o=t(n),r=o.data("editableContainer");r&&("cancel"===r.options.onblur?o.data("editableContainer").hide("onblur"):"submit"===r.options.onblur&&o.data("editableContainer").tip().find("form").submit())}})},activate:function(){this.tip&&this.tip().is(":visible")&&this.$form&&this.$form.data("editableform").input.activate()}},t.fn.editableContainer=function(n){var o=arguments;return this.each(function(){var r=t(this),s="editableContainer",a=r.data(s),l="object"==typeof n&&n,c="inline"===l.mode?i:e;a||r.data(s,a=new c(this,l)),"string"==typeof n&&a[n].apply(a,Array.prototype.slice.call(o,1))})},t.fn.editableContainer.Popup=e,t.fn.editableContainer.Inline=i,t.fn.editableContainer.defaults={value:null,placement:"top",autohide:!0,onblur:"cancel",anim:!1,mode:"popup"},jQuery.event.special.destroyed={remove:function(t){t.handler&&t.handler()}}}(window.jQuery),function(t){"use strict";t.extend(t.fn.editableContainer.Inline.prototype,t.fn.editableContainer.Popup.prototype,{containerName:"editableform",innerCss:".editable-inline",containerClass:"editable-container editable-inline",initContainer:function(){this.$tip=t(""),this.options.anim||(this.options.anim=0)},splitOptions:function(){this.containerOptions={},this.formOptions=this.options},tip:function(){return this.$tip},innerShow:function(){this.$element.hide(),this.tip().insertAfter(this.$element).show()},innerHide:function(){this.$tip.hide(this.options.anim,t.proxy(function(){this.$element.show(),this.innerDestroy()},this))},innerDestroy:function(){this.tip()&&this.tip().empty().remove()}})}(window.jQuery),function(t){"use strict";var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.editable.defaults,i,t.fn.editableutils.getConfigData(this.$element)),this.options.selector?this.initLive():this.init(),this.options.highlight&&!t.fn.editableutils.supportsTransitions()&&(this.options.highlight=!1)};e.prototype={constructor:e,init:function(){var e,i=!1;if(this.options.name=this.options.name||this.$element.attr("id"),this.options.scope=this.$element[0],this.input=t.fn.editableutils.createInput(this.options),this.input){switch(void 0===this.options.value||null===this.options.value?(this.value=this.input.html2value(t.trim(this.$element.html())),i=!0):(this.options.value=t.fn.editableutils.tryParseJson(this.options.value,!0),this.value="string"==typeof this.options.value?this.input.str2value(this.options.value):this.options.value),this.$element.addClass("editable"),"textarea"===this.input.type&&this.$element.addClass("editable-pre-wrapped"),"manual"!==this.options.toggle?(this.$element.addClass("editable-click"),this.$element.on(this.options.toggle+".editable",t.proxy(function(t){if(this.options.disabled||t.preventDefault(),"mouseenter"===this.options.toggle)this.show();else{var e="click"!==this.options.toggle;this.toggle(e)}},this))):this.$element.attr("tabindex",-1),"function"==typeof this.options.display&&(this.options.autotext="always"),this.options.autotext){case"always":e=!0;break;case"auto":e=!t.trim(this.$element.text()).length&&null!==this.value&&void 0!==this.value&&!i;break;default:e=!1}t.when(e?this.render():!0).then(t.proxy(function(){this.options.disabled?this.disable():this.enable(),this.$element.triggerHandler("init",this)},this))}},initLive:function(){var e=this.options.selector;this.options.selector=!1,this.options.autotext="never",this.$element.on(this.options.toggle+".editable",e,t.proxy(function(e){var i=t(e.target);i.data("editable")||(i.hasClass(this.options.emptyclass)&&i.empty(),i.editable(this.options).trigger(e))},this))},render:function(t){return this.options.display!==!1?this.input.value2htmlFinal?this.input.value2html(this.value,this.$element[0],this.options.display,t):"function"==typeof this.options.display?this.options.display.call(this.$element[0],this.value,t):this.input.value2html(this.value,this.$element[0]):void 0},enable:function(){this.options.disabled=!1,this.$element.removeClass("editable-disabled"),this.handleEmpty(this.isEmpty),"manual"!==this.options.toggle&&"-1"===this.$element.attr("tabindex")&&this.$element.removeAttr("tabindex")},disable:function(){this.options.disabled=!0,this.hide(),this.$element.addClass("editable-disabled"),this.handleEmpty(this.isEmpty),this.$element.attr("tabindex",-1)},toggleDisabled:function(){this.options.disabled?this.enable():this.disable()},option:function(e,i){return e&&"object"==typeof e?(t.each(e,t.proxy(function(e,i){this.option(t.trim(e),i)},this)),void 0):(this.options[e]=i,"disabled"===e?i?this.disable():this.enable():("value"===e&&this.setValue(i),this.container&&this.container.option(e,i),this.input.option&&this.input.option(e,i),void 0))},handleEmpty:function(e){this.options.display!==!1&&(this.isEmpty=void 0!==e?e:""===t.trim(this.$element.html())?!0:""!==t.trim(this.$element.text())?!1:!this.$element.height()||!this.$element.width(),this.options.disabled?this.isEmpty&&(this.$element.empty(),this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass)):this.isEmpty?(this.$element.html(this.options.emptytext),this.options.emptyclass&&this.$element.addClass(this.options.emptyclass)):this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass))},show:function(e){if(!this.options.disabled){if(this.container){if(this.container.tip().is(":visible"))return}else{var i=t.extend({},this.options,{value:this.value,input:this.input});this.$element.editableContainer(i),this.$element.on("save.internal",t.proxy(this.save,this)),this.container=this.$element.data("editableContainer")}this.container.show(e)}},hide:function(){this.container&&this.container.hide()},toggle:function(t){this.container&&this.container.tip().is(":visible")?this.hide():this.show(t)},save:function(t,e){if(this.options.unsavedclass){var i=!1;i=i||"function"==typeof this.options.url,i=i||this.options.display===!1,i=i||void 0!==e.response,i=i||this.options.savenochange&&this.input.value2str(this.value)!==this.input.value2str(e.newValue),i?this.$element.removeClass(this.options.unsavedclass):this.$element.addClass(this.options.unsavedclass)}if(this.options.highlight){var n=this.$element,o=n.css("background-color");n.css("background-color",this.options.highlight),setTimeout(function(){"transparent"===o&&(o=""),n.css("background-color",o),n.addClass("editable-bg-transition"),setTimeout(function(){n.removeClass("editable-bg-transition")},1700)},10)}this.setValue(e.newValue,!1,e.response)},validate:function(){return"function"==typeof this.options.validate?this.options.validate.call(this,this.value):void 0},setValue:function(e,i,n){this.value=i?this.input.str2value(e):e,this.container&&this.container.option("value",this.value),t.when(this.render(n)).then(t.proxy(function(){this.handleEmpty()},this))},activate:function(){this.container&&this.container.activate()},destroy:function(){this.disable(),this.container&&this.container.destroy(),this.input.destroy(),"manual"!==this.options.toggle&&(this.$element.removeClass("editable-click"),this.$element.off(this.options.toggle+".editable")),this.$element.off("save.internal"),this.$element.removeClass("editable editable-open editable-disabled"),this.$element.removeData("editable")}},t.fn.editable=function(i){var n={},o=arguments,r="editable";switch(i){case"validate":return this.each(function(){var e,i=t(this),o=i.data(r);o&&(e=o.validate())&&(n[o.options.name]=e)}),n;case"getValue":return 2===arguments.length&&arguments[1]===!0?n=this.eq(0).data(r).value:this.each(function(){var e=t(this),i=e.data(r);i&&void 0!==i.value&&null!==i.value&&(n[i.options.name]=i.input.value2submit(i.value))}),n;case"submit":var s,a=arguments[1]||{},l=this,c=this.editable("validate");return t.isEmptyObject(c)?(s=this.editable("getValue"),a.data&&t.extend(s,a.data),t.ajax(t.extend({url:a.url,data:s,type:"POST"},a.ajaxOptions)).success(function(t){"function"==typeof a.success&&a.success.call(l,t,a)}).error(function(){"function"==typeof a.error&&a.error.apply(l,arguments)})):"function"==typeof a.error&&a.error.call(l,c),this}return this.each(function(){var n=t(this),s=n.data(r),a="object"==typeof i&&i;return a&&a.selector?(s=new e(this,a),void 0):(s||n.data(r,s=new e(this,a)),"string"==typeof i&&s[i].apply(s,Array.prototype.slice.call(o,1)),void 0)})},t.fn.editable.defaults={type:"text",disabled:!1,toggle:"click",emptytext:"Empty",autotext:"auto",value:null,display:null,emptyclass:"editable-empty",unsavedclass:"editable-unsaved",selector:null,highlight:"#FFFF80"}}(window.jQuery),function(t){"use strict";t.fn.editabletypes={};var e=function(){};e.prototype={init:function(e,i,n){this.type=e,this.options=t.extend({},n,i)},prerender:function(){this.$tpl=t(this.options.tpl),this.$input=this.$tpl,this.$clear=null,this.error=null},render:function(){},value2html:function(e,i){t(i).text(t.trim(e))},html2value:function(e){return t("").html(e).text()},value2str:function(t){return t},str2value:function(t){return t},value2submit:function(t){return t},value2input:function(t){this.$input.val(t)},input2value:function(){return this.$input.val()},activate:function(){this.$input.is(":visible")&&this.$input.focus()},clear:function(){this.$input.val(null)},escape:function(e){return t("
").text(e).html()},autosubmit:function(){},destroy:function(){},setClass:function(){this.options.inputclass&&this.$input.addClass(this.options.inputclass)},setAttr:function(t){void 0!==this.options[t]&&null!==this.options[t]&&this.$input.attr(t,this.options[t])},option:function(t,e){this.options[t]=e}},e.defaults={tpl:"",inputclass:"input-medium",scope:null,showbuttons:!0},t.extend(t.fn.editabletypes,{abstractinput:e})}(window.jQuery),function(t){"use strict";var e=function(){};t.fn.editableutils.inherit(e,t.fn.editabletypes.abstractinput),t.extend(e.prototype,{render:function(){var e=t.Deferred();return this.error=null,this.onSourceReady(function(){this.renderList(),e.resolve()},function(){this.error=this.options.sourceError,e.resolve()}),e.promise()},html2value:function(){return null},value2html:function(e,i,n,o){var r=t.Deferred(),s=function(){"function"==typeof n?n.call(i,e,this.sourceData,o):this.value2htmlFinal(e,i),r.resolve()};return null===e?s.call(this):this.onSourceReady(s,function(){r.resolve()}),r.promise()},onSourceReady:function(e,i){var n;if(t.isFunction(this.options.source)?(n=this.options.source.call(this.options.scope),this.sourceData=null):n=this.options.source,this.options.sourceCache&&t.isArray(this.sourceData))return e.call(this),void 0;try{n=t.fn.editableutils.tryParseJson(n,!1)}catch(o){return i.call(this),void 0}if("string"==typeof n){if(this.options.sourceCache){var r,s=n;if(t(document).data(s)||t(document).data(s,{}),r=t(document).data(s),r.loading===!1&&r.sourceData)return this.sourceData=r.sourceData,this.doPrepend(),e.call(this),void 0;if(r.loading===!0)return r.callbacks.push(t.proxy(function(){this.sourceData=r.sourceData,this.doPrepend(),e.call(this)},this)),r.err_callbacks.push(t.proxy(i,this)),void 0;r.loading=!0,r.callbacks=[],r.err_callbacks=[]}t.ajax({url:n,type:"get",cache:!1,dataType:"json",success:t.proxy(function(n){r&&(r.loading=!1),this.sourceData=this.makeArray(n),t.isArray(this.sourceData)?(r&&(r.sourceData=this.sourceData,t.each(r.callbacks,function(){this.call()})),this.doPrepend(),e.call(this)):(i.call(this),r&&t.each(r.err_callbacks,function(){this.call()}))},this),error:t.proxy(function(){i.call(this),r&&(r.loading=!1,t.each(r.err_callbacks,function(){this.call()}))},this)})}else this.sourceData=this.makeArray(n),t.isArray(this.sourceData)?(this.doPrepend(),e.call(this)):i.call(this)},doPrepend:function(){null!==this.options.prepend&&void 0!==this.options.prepend&&(t.isArray(this.prependData)||(t.isFunction(this.options.prepend)&&(this.options.prepend=this.options.prepend.call(this.options.scope)),this.options.prepend=t.fn.editableutils.tryParseJson(this.options.prepend,!0),"string"==typeof this.options.prepend&&(this.options.prepend={"":this.options.prepend}),this.prependData=this.makeArray(this.options.prepend)),t.isArray(this.prependData)&&t.isArray(this.sourceData)&&(this.sourceData=this.prependData.concat(this.sourceData)))},renderList:function(){},value2htmlFinal:function(){},makeArray:function(e){var i,n,o,r,s=[];if(!e||"string"==typeof e)return null;if(t.isArray(e)){r=function(t,e){return n={value:t,text:e},i++>=2?!1:void 0};for(var a=0;a
1&&(o.children&&(o.children=this.makeArray(o.children)),s.push(o))):s.push({value:o,text:o})}else t.each(e,function(t,e){s.push({value:t,text:e})});return s},option:function(t,e){this.options[t]=e,"source"===t&&(this.sourceData=null),"prepend"===t&&(this.prependData=null)}}),e.defaults=t.extend({},t.fn.editabletypes.abstractinput.defaults,{source:null,prepend:!1,sourceError:"Error when loading list",sourceCache:!0}),t.fn.editabletypes.list=e}(window.jQuery),function(t){"use strict";var e=function(t){this.init("text",t,e.defaults)};t.fn.editableutils.inherit(e,t.fn.editabletypes.abstractinput),t.extend(e.prototype,{render:function(){this.renderClear(),this.setClass(),this.setAttr("placeholder")},activate:function(){this.$input.is(":visible")&&(this.$input.focus(),t.fn.editableutils.setCursorPosition(this.$input.get(0),this.$input.val().length),this.toggleClear&&this.toggleClear())},renderClear:function(){this.options.clear&&(this.$clear=t(''),this.$input.after(this.$clear).css("padding-right",24).keyup(t.proxy(function(e){if(!~t.inArray(e.keyCode,[40,38,9,13,27])){clearTimeout(this.t);var i=this;this.t=setTimeout(function(){i.toggleClear(e)},100)}},this)).parent().css("position","relative"),this.$clear.click(t.proxy(this.clear,this)))},postrender:function(){},toggleClear:function(){if(this.$clear){var t=this.$input.val().length,e=this.$clear.is(":visible");t&&!e&&this.$clear.show(),!t&&e&&this.$clear.hide()}},clear:function(){this.$clear.hide(),this.$input.val("").focus()}}),e.defaults=t.extend({},t.fn.editabletypes.abstractinput.defaults,{tpl:'',placeholder:null,clear:!0}),t.fn.editabletypes.text=e}(window.jQuery),function(t){"use strict";var e=function(t){this.init("textarea",t,e.defaults)};t.fn.editableutils.inherit(e,t.fn.editabletypes.abstractinput),t.extend(e.prototype,{render:function(){this.setClass(),this.setAttr("placeholder"),this.setAttr("rows"),this.$input.keydown(function(e){e.ctrlKey&&13===e.which&&t(this).closest("form").submit()})},activate:function(){t.fn.editabletypes.text.prototype.activate.call(this)}}),e.defaults=t.extend({},t.fn.editabletypes.abstractinput.defaults,{tpl:"",inputclass:"input-large",placeholder:null,rows:7}),t.fn.editabletypes.textarea=e}(window.jQuery),function(t){"use strict";var e=function(t){this.init("select",t,e.defaults)};t.fn.editableutils.inherit(e,t.fn.editabletypes.list),t.extend(e.prototype,{renderList:function(){this.$input.empty();var e=function(i,n){var o;if(t.isArray(n))for(var r=0;r",o),n[r].children))):(o.value=n[r].value,n[r].disabled&&(o.disabled=!0),i.append(t("