mirror of
https://github.com/opelly27/CloudResumeFrontend.git
synced 2026-05-20 09:47:35 +00:00
Add files via upload
This commit is contained in:
Vendored
+1586
File diff suppressed because it is too large
Load Diff
Vendored
+3240
File diff suppressed because it is too large
Load Diff
Vendored
+834
@@ -0,0 +1,834 @@
|
||||
/*
|
||||
Copyright (C) Federico Zivolo 2017
|
||||
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
||||
*/
|
||||
(function(e, t) {
|
||||
'object' == typeof exports && 'undefined' != typeof module ? module.exports = t() : 'function' == typeof define && define.amd ? define(t) : e.Popper = t()
|
||||
})(this, function() {
|
||||
'use strict';
|
||||
|
||||
function e(e) {
|
||||
return e && '[object Function]' === {}.toString.call(e)
|
||||
}
|
||||
|
||||
function t(e, t) {
|
||||
if (1 !== e.nodeType) return [];
|
||||
var o = window.getComputedStyle(e, null);
|
||||
return t ? o[t] : o
|
||||
}
|
||||
|
||||
function o(e) {
|
||||
return 'HTML' === e.nodeName ? e : e.parentNode || e.host
|
||||
}
|
||||
|
||||
function n(e) {
|
||||
if (!e || -1 !== ['HTML', 'BODY', '#document'].indexOf(e.nodeName)) return window.document.body;
|
||||
var i = t(e),
|
||||
r = i.overflow,
|
||||
p = i.overflowX,
|
||||
s = i.overflowY;
|
||||
return /(auto|scroll)/.test(r + s + p) ? e : n(o(e))
|
||||
}
|
||||
|
||||
function r(e) {
|
||||
var o = e && e.offsetParent,
|
||||
i = o && o.nodeName;
|
||||
return i && 'BODY' !== i && 'HTML' !== i ? -1 !== ['TD', 'TABLE'].indexOf(o.nodeName) && 'static' === t(o, 'position') ? r(o) : o : window.document.documentElement
|
||||
}
|
||||
|
||||
function p(e) {
|
||||
var t = e.nodeName;
|
||||
return 'BODY' !== t && ('HTML' === t || r(e.firstElementChild) === e)
|
||||
}
|
||||
|
||||
function s(e) {
|
||||
return null === e.parentNode ? e : s(e.parentNode)
|
||||
}
|
||||
|
||||
function d(e, t) {
|
||||
if (!e || !e.nodeType || !t || !t.nodeType) return window.document.documentElement;
|
||||
var o = e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING,
|
||||
i = o ? e : t,
|
||||
n = o ? t : e,
|
||||
a = document.createRange();
|
||||
a.setStart(i, 0), a.setEnd(n, 0);
|
||||
var f = a.commonAncestorContainer;
|
||||
if (e !== f && t !== f || i.contains(n)) return p(f) ? f : r(f);
|
||||
var l = s(e);
|
||||
return l.host ? d(l.host, t) : d(e, s(t).host)
|
||||
}
|
||||
|
||||
function a(e) {
|
||||
var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 'top',
|
||||
o = 'top' === t ? 'scrollTop' : 'scrollLeft',
|
||||
i = e.nodeName;
|
||||
if ('BODY' === i || 'HTML' === i) {
|
||||
var n = window.document.documentElement,
|
||||
r = window.document.scrollingElement || n;
|
||||
return r[o]
|
||||
}
|
||||
return e[o]
|
||||
}
|
||||
|
||||
function f(e, t) {
|
||||
var o = 2 < arguments.length && void 0 !== arguments[2] && arguments[2],
|
||||
i = a(t, 'top'),
|
||||
n = a(t, 'left'),
|
||||
r = o ? -1 : 1;
|
||||
return e.top += i * r, e.bottom += i * r, e.left += n * r, e.right += n * r, e
|
||||
}
|
||||
|
||||
function l(e, t) {
|
||||
var o = 'x' === t ? 'Left' : 'Top',
|
||||
i = 'Left' == o ? 'Right' : 'Bottom';
|
||||
return +e['border' + o + 'Width'].split('px')[0] + +e['border' + i + 'Width'].split('px')[0]
|
||||
}
|
||||
|
||||
function m(e, t, o, i) {
|
||||
return _(t['offset' + e], o['client' + e], o['offset' + e], ie() ? o['offset' + e] + i['margin' + ('Height' === e ? 'Top' : 'Left')] + i['margin' + ('Height' === e ? 'Bottom' : 'Right')] : 0)
|
||||
}
|
||||
|
||||
function h() {
|
||||
var e = window.document.body,
|
||||
t = window.document.documentElement,
|
||||
o = ie() && window.getComputedStyle(t);
|
||||
return {
|
||||
height: m('Height', e, t, o),
|
||||
width: m('Width', e, t, o)
|
||||
}
|
||||
}
|
||||
|
||||
function c(e) {
|
||||
return se({}, e, {
|
||||
right: e.left + e.width,
|
||||
bottom: e.top + e.height
|
||||
})
|
||||
}
|
||||
|
||||
function g(e) {
|
||||
var o = {};
|
||||
if (ie()) try {
|
||||
o = e.getBoundingClientRect();
|
||||
var i = a(e, 'top'),
|
||||
n = a(e, 'left');
|
||||
o.top += i, o.left += n, o.bottom += i, o.right += n
|
||||
} catch (e) {} else o = e.getBoundingClientRect();
|
||||
var r = {
|
||||
left: o.left,
|
||||
top: o.top,
|
||||
width: o.right - o.left,
|
||||
height: o.bottom - o.top
|
||||
},
|
||||
p = 'HTML' === e.nodeName ? h() : {},
|
||||
s = p.width || e.clientWidth || r.right - r.left,
|
||||
d = p.height || e.clientHeight || r.bottom - r.top,
|
||||
f = e.offsetWidth - s,
|
||||
m = e.offsetHeight - d;
|
||||
if (f || m) {
|
||||
var g = t(e);
|
||||
f -= l(g, 'x'), m -= l(g, 'y'), r.width -= f, r.height -= m
|
||||
}
|
||||
return c(r)
|
||||
}
|
||||
|
||||
function u(e, o) {
|
||||
var i = ie(),
|
||||
r = 'HTML' === o.nodeName,
|
||||
p = g(e),
|
||||
s = g(o),
|
||||
d = n(e),
|
||||
a = t(o),
|
||||
l = +a.borderTopWidth.split('px')[0],
|
||||
m = +a.borderLeftWidth.split('px')[0],
|
||||
h = c({
|
||||
top: p.top - s.top - l,
|
||||
left: p.left - s.left - m,
|
||||
width: p.width,
|
||||
height: p.height
|
||||
});
|
||||
if (h.marginTop = 0, h.marginLeft = 0, !i && r) {
|
||||
var u = +a.marginTop.split('px')[0],
|
||||
b = +a.marginLeft.split('px')[0];
|
||||
h.top -= l - u, h.bottom -= l - u, h.left -= m - b, h.right -= m - b, h.marginTop = u, h.marginLeft = b
|
||||
}
|
||||
return (i ? o.contains(d) : o === d && 'BODY' !== d.nodeName) && (h = f(h, o)), h
|
||||
}
|
||||
|
||||
function b(e) {
|
||||
var t = window.document.documentElement,
|
||||
o = u(e, t),
|
||||
i = _(t.clientWidth, window.innerWidth || 0),
|
||||
n = _(t.clientHeight, window.innerHeight || 0),
|
||||
r = a(t),
|
||||
p = a(t, 'left'),
|
||||
s = {
|
||||
top: r - o.top + o.marginTop,
|
||||
left: p - o.left + o.marginLeft,
|
||||
width: i,
|
||||
height: n
|
||||
};
|
||||
return c(s)
|
||||
}
|
||||
|
||||
function y(e) {
|
||||
var i = e.nodeName;
|
||||
return 'BODY' === i || 'HTML' === i ? !1 : 'fixed' === t(e, 'position') || y(o(e))
|
||||
}
|
||||
|
||||
function w(e, t, i, r) {
|
||||
var p = {
|
||||
top: 0,
|
||||
left: 0
|
||||
},
|
||||
s = d(e, t);
|
||||
if ('viewport' === r) p = b(s);
|
||||
else {
|
||||
var a;
|
||||
'scrollParent' === r ? (a = n(o(e)), 'BODY' === a.nodeName && (a = window.document.documentElement)) : 'window' === r ? a = window.document.documentElement : a = r;
|
||||
var f = u(a, s);
|
||||
if ('HTML' === a.nodeName && !y(s)) {
|
||||
var l = h(),
|
||||
m = l.height,
|
||||
c = l.width;
|
||||
p.top += f.top - f.marginTop, p.bottom = m + f.top, p.left += f.left - f.marginLeft, p.right = c + f.left
|
||||
} else p = f
|
||||
}
|
||||
return p.left += i, p.top += i, p.right -= i, p.bottom -= i, p
|
||||
}
|
||||
|
||||
function v(e) {
|
||||
var t = e.width,
|
||||
o = e.height;
|
||||
return t * o
|
||||
}
|
||||
|
||||
function E(e, t, o, i, n) {
|
||||
var r = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 0;
|
||||
if (-1 === e.indexOf('auto')) return e;
|
||||
var p = w(o, i, r, n),
|
||||
s = {
|
||||
top: {
|
||||
width: p.width,
|
||||
height: t.top - p.top
|
||||
},
|
||||
right: {
|
||||
width: p.right - t.right,
|
||||
height: p.height
|
||||
},
|
||||
bottom: {
|
||||
width: p.width,
|
||||
height: p.bottom - t.bottom
|
||||
},
|
||||
left: {
|
||||
width: t.left - p.left,
|
||||
height: p.height
|
||||
}
|
||||
},
|
||||
d = Object.keys(s).map(function(e) {
|
||||
return se({
|
||||
key: e
|
||||
}, s[e], {
|
||||
area: v(s[e])
|
||||
})
|
||||
}).sort(function(e, t) {
|
||||
return t.area - e.area
|
||||
}),
|
||||
a = d.filter(function(e) {
|
||||
var t = e.width,
|
||||
i = e.height;
|
||||
return t >= o.clientWidth && i >= o.clientHeight
|
||||
}),
|
||||
f = 0 < a.length ? a[0].key : d[0].key,
|
||||
l = e.split('-')[1];
|
||||
return f + (l ? '-' + l : '')
|
||||
}
|
||||
|
||||
function x(e, t, o) {
|
||||
var i = d(t, o);
|
||||
return u(o, i)
|
||||
}
|
||||
|
||||
function O(e) {
|
||||
var t = window.getComputedStyle(e),
|
||||
o = parseFloat(t.marginTop) + parseFloat(t.marginBottom),
|
||||
i = parseFloat(t.marginLeft) + parseFloat(t.marginRight),
|
||||
n = {
|
||||
width: e.offsetWidth + i,
|
||||
height: e.offsetHeight + o
|
||||
};
|
||||
return n
|
||||
}
|
||||
|
||||
function L(e) {
|
||||
var t = {
|
||||
left: 'right',
|
||||
right: 'left',
|
||||
bottom: 'top',
|
||||
top: 'bottom'
|
||||
};
|
||||
return e.replace(/left|right|bottom|top/g, function(e) {
|
||||
return t[e]
|
||||
})
|
||||
}
|
||||
|
||||
function S(e, t, o) {
|
||||
o = o.split('-')[0];
|
||||
var i = O(e),
|
||||
n = {
|
||||
width: i.width,
|
||||
height: i.height
|
||||
},
|
||||
r = -1 !== ['right', 'left'].indexOf(o),
|
||||
p = r ? 'top' : 'left',
|
||||
s = r ? 'left' : 'top',
|
||||
d = r ? 'height' : 'width',
|
||||
a = r ? 'width' : 'height';
|
||||
return n[p] = t[p] + t[d] / 2 - i[d] / 2, n[s] = o === s ? t[s] - i[a] : t[L(s)], n
|
||||
}
|
||||
|
||||
function T(e, t) {
|
||||
return Array.prototype.find ? e.find(t) : e.filter(t)[0]
|
||||
}
|
||||
|
||||
function C(e, t, o) {
|
||||
if (Array.prototype.findIndex) return e.findIndex(function(e) {
|
||||
return e[t] === o
|
||||
});
|
||||
var i = T(e, function(e) {
|
||||
return e[t] === o
|
||||
});
|
||||
return e.indexOf(i)
|
||||
}
|
||||
|
||||
function N(t, o, i) {
|
||||
var n = void 0 === i ? t : t.slice(0, C(t, 'name', i));
|
||||
return n.forEach(function(t) {
|
||||
t.function && console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
|
||||
var i = t.function || t.fn;
|
||||
t.enabled && e(i) && (o.offsets.popper = c(o.offsets.popper), o.offsets.reference = c(o.offsets.reference), o = i(o, t))
|
||||
}), o
|
||||
}
|
||||
|
||||
function k() {
|
||||
if (!this.state.isDestroyed) {
|
||||
var e = {
|
||||
instance: this,
|
||||
styles: {},
|
||||
attributes: {},
|
||||
flipped: !1,
|
||||
offsets: {}
|
||||
};
|
||||
e.offsets.reference = x(this.state, this.popper, this.reference), e.placement = E(this.options.placement, e.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding), e.originalPlacement = e.placement, e.offsets.popper = S(this.popper, e.offsets.reference, e.placement), e.offsets.popper.position = 'absolute', e = N(this.modifiers, e), this.state.isCreated ? this.options.onUpdate(e) : (this.state.isCreated = !0, this.options.onCreate(e))
|
||||
}
|
||||
}
|
||||
|
||||
function W(e, t) {
|
||||
return e.some(function(e) {
|
||||
var o = e.name,
|
||||
i = e.enabled;
|
||||
return i && o === t
|
||||
})
|
||||
}
|
||||
|
||||
function B(e) {
|
||||
for (var t = [!1, 'ms', 'Webkit', 'Moz', 'O'], o = e.charAt(0).toUpperCase() + e.slice(1), n = 0; n < t.length - 1; n++) {
|
||||
var i = t[n],
|
||||
r = i ? '' + i + o : e;
|
||||
if ('undefined' != typeof window.document.body.style[r]) return r
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function D() {
|
||||
return this.state.isDestroyed = !0, W(this.modifiers, 'applyStyle') && (this.popper.removeAttribute('x-placement'), this.popper.style.left = '', this.popper.style.position = '', this.popper.style.top = '', this.popper.style[B('transform')] = ''), this.disableEventListeners(), this.options.removeOnDestroy && this.popper.parentNode.removeChild(this.popper), this
|
||||
}
|
||||
|
||||
function H(e, t, o, i) {
|
||||
var r = 'BODY' === e.nodeName,
|
||||
p = r ? window : e;
|
||||
p.addEventListener(t, o, {
|
||||
passive: !0
|
||||
}), r || H(n(p.parentNode), t, o, i), i.push(p)
|
||||
}
|
||||
|
||||
function P(e, t, o, i) {
|
||||
o.updateBound = i, window.addEventListener('resize', o.updateBound, {
|
||||
passive: !0
|
||||
});
|
||||
var r = n(e);
|
||||
return H(r, 'scroll', o.updateBound, o.scrollParents), o.scrollElement = r, o.eventsEnabled = !0, o
|
||||
}
|
||||
|
||||
function A() {
|
||||
this.state.eventsEnabled || (this.state = P(this.reference, this.options, this.state, this.scheduleUpdate))
|
||||
}
|
||||
|
||||
function M(e, t) {
|
||||
return window.removeEventListener('resize', t.updateBound), t.scrollParents.forEach(function(e) {
|
||||
e.removeEventListener('scroll', t.updateBound)
|
||||
}), t.updateBound = null, t.scrollParents = [], t.scrollElement = null, t.eventsEnabled = !1, t
|
||||
}
|
||||
|
||||
function I() {
|
||||
this.state.eventsEnabled && (window.cancelAnimationFrame(this.scheduleUpdate), this.state = M(this.reference, this.state))
|
||||
}
|
||||
|
||||
function R(e) {
|
||||
return '' !== e && !isNaN(parseFloat(e)) && isFinite(e)
|
||||
}
|
||||
|
||||
function U(e, t) {
|
||||
Object.keys(t).forEach(function(o) {
|
||||
var i = ''; - 1 !== ['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(o) && R(t[o]) && (i = 'px'), e.style[o] = t[o] + i
|
||||
})
|
||||
}
|
||||
|
||||
function Y(e, t) {
|
||||
Object.keys(t).forEach(function(o) {
|
||||
var i = t[o];
|
||||
!1 === i ? e.removeAttribute(o) : e.setAttribute(o, t[o])
|
||||
})
|
||||
}
|
||||
|
||||
function F(e, t, o) {
|
||||
var i = T(e, function(e) {
|
||||
var o = e.name;
|
||||
return o === t
|
||||
}),
|
||||
n = !!i && e.some(function(e) {
|
||||
return e.name === o && e.enabled && e.order < i.order
|
||||
});
|
||||
if (!n) {
|
||||
var r = '`' + t + '`';
|
||||
console.warn('`' + o + '`' + ' modifier is required by ' + r + ' modifier in order to work, be sure to include it before ' + r + '!')
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
function j(e) {
|
||||
return 'end' === e ? 'start' : 'start' === e ? 'end' : e
|
||||
}
|
||||
|
||||
function K(e) {
|
||||
var t = 1 < arguments.length && void 0 !== arguments[1] && arguments[1],
|
||||
o = ae.indexOf(e),
|
||||
i = ae.slice(o + 1).concat(ae.slice(0, o));
|
||||
return t ? i.reverse() : i
|
||||
}
|
||||
|
||||
function q(e, t, o, i) {
|
||||
var n = e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),
|
||||
r = +n[1],
|
||||
p = n[2];
|
||||
if (!r) return e;
|
||||
if (0 === p.indexOf('%')) {
|
||||
var s;
|
||||
switch (p) {
|
||||
case '%p':
|
||||
s = o;
|
||||
break;
|
||||
case '%':
|
||||
case '%r':
|
||||
default:
|
||||
s = i;
|
||||
}
|
||||
var d = c(s);
|
||||
return d[t] / 100 * r
|
||||
}
|
||||
if ('vh' === p || 'vw' === p) {
|
||||
var a;
|
||||
return a = 'vh' === p ? _(document.documentElement.clientHeight, window.innerHeight || 0) : _(document.documentElement.clientWidth, window.innerWidth || 0), a / 100 * r
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
function G(e, t, o, i) {
|
||||
var n = [0, 0],
|
||||
r = -1 !== ['right', 'left'].indexOf(i),
|
||||
p = e.split(/(\+|\-)/).map(function(e) {
|
||||
return e.trim()
|
||||
}),
|
||||
s = p.indexOf(T(p, function(e) {
|
||||
return -1 !== e.search(/,|\s/)
|
||||
}));
|
||||
p[s] && -1 === p[s].indexOf(',') && console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
|
||||
var d = /\s*,\s*|\s+/,
|
||||
a = -1 === s ? [p] : [p.slice(0, s).concat([p[s].split(d)[0]]), [p[s].split(d)[1]].concat(p.slice(s + 1))];
|
||||
return a = a.map(function(e, i) {
|
||||
var n = (1 === i ? !r : r) ? 'height' : 'width',
|
||||
p = !1;
|
||||
return e.reduce(function(e, t) {
|
||||
return '' === e[e.length - 1] && -1 !== ['+', '-'].indexOf(t) ? (e[e.length - 1] = t, p = !0, e) : p ? (e[e.length - 1] += t, p = !1, e) : e.concat(t)
|
||||
}, []).map(function(e) {
|
||||
return q(e, n, t, o)
|
||||
})
|
||||
}), a.forEach(function(e, t) {
|
||||
e.forEach(function(o, i) {
|
||||
R(o) && (n[t] += o * ('-' === e[i - 1] ? -1 : 1))
|
||||
})
|
||||
}), n
|
||||
}
|
||||
for (var z = Math.min, V = Math.floor, _ = Math.max, X = ['native code', '[object MutationObserverConstructor]'], Q = function(e) {
|
||||
return X.some(function(t) {
|
||||
return -1 < (e || '').toString().indexOf(t)
|
||||
})
|
||||
}, J = 'undefined' != typeof window, Z = ['Edge', 'Trident', 'Firefox'], $ = 0, ee = 0; ee < Z.length; ee += 1)
|
||||
if (J && 0 <= navigator.userAgent.indexOf(Z[ee])) {
|
||||
$ = 1;
|
||||
break
|
||||
}
|
||||
var i, te = J && Q(window.MutationObserver),
|
||||
oe = te ? function(e) {
|
||||
var t = !1,
|
||||
o = 0,
|
||||
i = document.createElement('span'),
|
||||
n = new MutationObserver(function() {
|
||||
e(), t = !1
|
||||
});
|
||||
return n.observe(i, {
|
||||
attributes: !0
|
||||
}),
|
||||
function() {
|
||||
t || (t = !0, i.setAttribute('x-index', o), ++o)
|
||||
}
|
||||
} : function(e) {
|
||||
var t = !1;
|
||||
return function() {
|
||||
t || (t = !0, setTimeout(function() {
|
||||
t = !1, e()
|
||||
}, $))
|
||||
}
|
||||
},
|
||||
ie = function() {
|
||||
return void 0 == i && (i = -1 !== navigator.appVersion.indexOf('MSIE 10')), i
|
||||
},
|
||||
ne = function(e, t) {
|
||||
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
|
||||
},
|
||||
re = function() {
|
||||
function e(e, t) {
|
||||
for (var o, n = 0; n < t.length; n++) o = t[n], o.enumerable = o.enumerable || !1, o.configurable = !0, 'value' in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
|
||||
}
|
||||
return function(t, o, i) {
|
||||
return o && e(t.prototype, o), i && e(t, i), t
|
||||
}
|
||||
}(),
|
||||
pe = function(e, t, o) {
|
||||
return t in e ? Object.defineProperty(e, t, {
|
||||
value: o,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}) : e[t] = o, e
|
||||
},
|
||||
se = Object.assign || function(e) {
|
||||
for (var t, o = 1; o < arguments.length; o++)
|
||||
for (var i in t = arguments[o], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
||||
return e
|
||||
},
|
||||
de = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'],
|
||||
ae = de.slice(3),
|
||||
fe = {
|
||||
FLIP: 'flip',
|
||||
CLOCKWISE: 'clockwise',
|
||||
COUNTERCLOCKWISE: 'counterclockwise'
|
||||
},
|
||||
le = function() {
|
||||
function t(o, i) {
|
||||
var n = this,
|
||||
r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {};
|
||||
ne(this, t), this.scheduleUpdate = function() {
|
||||
return requestAnimationFrame(n.update)
|
||||
}, this.update = oe(this.update.bind(this)), this.options = se({}, t.Defaults, r), this.state = {
|
||||
isDestroyed: !1,
|
||||
isCreated: !1,
|
||||
scrollParents: []
|
||||
}, this.reference = o.jquery ? o[0] : o, this.popper = i.jquery ? i[0] : i, this.options.modifiers = {}, Object.keys(se({}, t.Defaults.modifiers, r.modifiers)).forEach(function(e) {
|
||||
n.options.modifiers[e] = se({}, t.Defaults.modifiers[e] || {}, r.modifiers ? r.modifiers[e] : {})
|
||||
}), this.modifiers = Object.keys(this.options.modifiers).map(function(e) {
|
||||
return se({
|
||||
name: e
|
||||
}, n.options.modifiers[e])
|
||||
}).sort(function(e, t) {
|
||||
return e.order - t.order
|
||||
}), this.modifiers.forEach(function(t) {
|
||||
t.enabled && e(t.onLoad) && t.onLoad(n.reference, n.popper, n.options, t, n.state)
|
||||
}), this.update();
|
||||
var p = this.options.eventsEnabled;
|
||||
p && this.enableEventListeners(), this.state.eventsEnabled = p
|
||||
}
|
||||
return re(t, [{
|
||||
key: 'update',
|
||||
value: function() {
|
||||
return k.call(this)
|
||||
}
|
||||
}, {
|
||||
key: 'destroy',
|
||||
value: function() {
|
||||
return D.call(this)
|
||||
}
|
||||
}, {
|
||||
key: 'enableEventListeners',
|
||||
value: function() {
|
||||
return A.call(this)
|
||||
}
|
||||
}, {
|
||||
key: 'disableEventListeners',
|
||||
value: function() {
|
||||
return I.call(this)
|
||||
}
|
||||
}]), t
|
||||
}();
|
||||
return le.Utils = ('undefined' == typeof window ? global : window).PopperUtils, le.placements = de, le.Defaults = {
|
||||
placement: 'bottom',
|
||||
eventsEnabled: !0,
|
||||
removeOnDestroy: !1,
|
||||
onCreate: function() {},
|
||||
onUpdate: function() {},
|
||||
modifiers: {
|
||||
shift: {
|
||||
order: 100,
|
||||
enabled: !0,
|
||||
fn: function(e) {
|
||||
var t = e.placement,
|
||||
o = t.split('-')[0],
|
||||
i = t.split('-')[1];
|
||||
if (i) {
|
||||
var n = e.offsets,
|
||||
r = n.reference,
|
||||
p = n.popper,
|
||||
s = -1 !== ['bottom', 'top'].indexOf(o),
|
||||
d = s ? 'left' : 'top',
|
||||
a = s ? 'width' : 'height',
|
||||
f = {
|
||||
start: pe({}, d, r[d]),
|
||||
end: pe({}, d, r[d] + r[a] - p[a])
|
||||
};
|
||||
e.offsets.popper = se({}, p, f[i])
|
||||
}
|
||||
return e
|
||||
}
|
||||
},
|
||||
offset: {
|
||||
order: 200,
|
||||
enabled: !0,
|
||||
fn: function(e, t) {
|
||||
var o, i = t.offset,
|
||||
n = e.placement,
|
||||
r = e.offsets,
|
||||
p = r.popper,
|
||||
s = r.reference,
|
||||
d = n.split('-')[0];
|
||||
return o = R(+i) ? [+i, 0] : G(i, p, s, d), 'left' === d ? (p.top += o[0], p.left -= o[1]) : 'right' === d ? (p.top += o[0], p.left += o[1]) : 'top' === d ? (p.left += o[0], p.top -= o[1]) : 'bottom' === d && (p.left += o[0], p.top += o[1]), e.popper = p, e
|
||||
},
|
||||
offset: 0
|
||||
},
|
||||
preventOverflow: {
|
||||
order: 300,
|
||||
enabled: !0,
|
||||
fn: function(e, t) {
|
||||
var o = t.boundariesElement || r(e.instance.popper);
|
||||
e.instance.reference === o && (o = r(o));
|
||||
var i = w(e.instance.popper, e.instance.reference, t.padding, o);
|
||||
t.boundaries = i;
|
||||
var n = t.priority,
|
||||
p = e.offsets.popper,
|
||||
s = {
|
||||
primary: function(e) {
|
||||
var o = p[e];
|
||||
return p[e] < i[e] && !t.escapeWithReference && (o = _(p[e], i[e])), pe({}, e, o)
|
||||
},
|
||||
secondary: function(e) {
|
||||
var o = 'right' === e ? 'left' : 'top',
|
||||
n = p[o];
|
||||
return p[e] > i[e] && !t.escapeWithReference && (n = z(p[o], i[e] - ('right' === e ? p.width : p.height))), pe({}, o, n)
|
||||
}
|
||||
};
|
||||
return n.forEach(function(e) {
|
||||
var t = -1 === ['left', 'top'].indexOf(e) ? 'secondary' : 'primary';
|
||||
p = se({}, p, s[t](e))
|
||||
}), e.offsets.popper = p, e
|
||||
},
|
||||
priority: ['left', 'right', 'top', 'bottom'],
|
||||
padding: 5,
|
||||
boundariesElement: 'scrollParent'
|
||||
},
|
||||
keepTogether: {
|
||||
order: 400,
|
||||
enabled: !0,
|
||||
fn: function(e) {
|
||||
var t = e.offsets,
|
||||
o = t.popper,
|
||||
i = t.reference,
|
||||
n = e.placement.split('-')[0],
|
||||
r = V,
|
||||
p = -1 !== ['top', 'bottom'].indexOf(n),
|
||||
s = p ? 'right' : 'bottom',
|
||||
d = p ? 'left' : 'top',
|
||||
a = p ? 'width' : 'height';
|
||||
return o[s] < r(i[d]) && (e.offsets.popper[d] = r(i[d]) - o[a]), o[d] > r(i[s]) && (e.offsets.popper[d] = r(i[s])), e
|
||||
}
|
||||
},
|
||||
arrow: {
|
||||
order: 500,
|
||||
enabled: !0,
|
||||
fn: function(e, t) {
|
||||
if (!F(e.instance.modifiers, 'arrow', 'keepTogether')) return e;
|
||||
var o = t.element;
|
||||
if ('string' == typeof o) {
|
||||
if (o = e.instance.popper.querySelector(o), !o) return e;
|
||||
} else if (!e.instance.popper.contains(o)) return console.warn('WARNING: `arrow.element` must be child of its popper element!'), e;
|
||||
var i = e.placement.split('-')[0],
|
||||
n = e.offsets,
|
||||
r = n.popper,
|
||||
p = n.reference,
|
||||
s = -1 !== ['left', 'right'].indexOf(i),
|
||||
d = s ? 'height' : 'width',
|
||||
a = s ? 'top' : 'left',
|
||||
f = s ? 'left' : 'top',
|
||||
l = s ? 'bottom' : 'right',
|
||||
m = O(o)[d];
|
||||
p[l] - m < r[a] && (e.offsets.popper[a] -= r[a] - (p[l] - m)), p[a] + m > r[l] && (e.offsets.popper[a] += p[a] + m - r[l]);
|
||||
var h = p[a] + p[d] / 2 - m / 2,
|
||||
g = h - c(e.offsets.popper)[a];
|
||||
return g = _(z(r[d] - m, g), 0), e.arrowElement = o, e.offsets.arrow = {}, e.offsets.arrow[a] = Math.round(g), e.offsets.arrow[f] = '', e
|
||||
},
|
||||
element: '[x-arrow]'
|
||||
},
|
||||
flip: {
|
||||
order: 600,
|
||||
enabled: !0,
|
||||
fn: function(e, t) {
|
||||
if (W(e.instance.modifiers, 'inner')) return e;
|
||||
if (e.flipped && e.placement === e.originalPlacement) return e;
|
||||
var o = w(e.instance.popper, e.instance.reference, t.padding, t.boundariesElement),
|
||||
i = e.placement.split('-')[0],
|
||||
n = L(i),
|
||||
r = e.placement.split('-')[1] || '',
|
||||
p = [];
|
||||
switch (t.behavior) {
|
||||
case fe.FLIP:
|
||||
p = [i, n];
|
||||
break;
|
||||
case fe.CLOCKWISE:
|
||||
p = K(i);
|
||||
break;
|
||||
case fe.COUNTERCLOCKWISE:
|
||||
p = K(i, !0);
|
||||
break;
|
||||
default:
|
||||
p = t.behavior;
|
||||
}
|
||||
return p.forEach(function(s, d) {
|
||||
if (i !== s || p.length === d + 1) return e;
|
||||
i = e.placement.split('-')[0], n = L(i);
|
||||
var a = e.offsets.popper,
|
||||
f = e.offsets.reference,
|
||||
l = V,
|
||||
m = 'left' === i && l(a.right) > l(f.left) || 'right' === i && l(a.left) < l(f.right) || 'top' === i && l(a.bottom) > l(f.top) || 'bottom' === i && l(a.top) < l(f.bottom),
|
||||
h = l(a.left) < l(o.left),
|
||||
c = l(a.right) > l(o.right),
|
||||
g = l(a.top) < l(o.top),
|
||||
u = l(a.bottom) > l(o.bottom),
|
||||
b = 'left' === i && h || 'right' === i && c || 'top' === i && g || 'bottom' === i && u,
|
||||
y = -1 !== ['top', 'bottom'].indexOf(i),
|
||||
w = !!t.flipVariations && (y && 'start' === r && h || y && 'end' === r && c || !y && 'start' === r && g || !y && 'end' === r && u);
|
||||
(m || b || w) && (e.flipped = !0, (m || b) && (i = p[d + 1]), w && (r = j(r)), e.placement = i + (r ? '-' + r : ''), e.offsets.popper = se({}, e.offsets.popper, S(e.instance.popper, e.offsets.reference, e.placement)), e = N(e.instance.modifiers, e, 'flip'))
|
||||
}), e
|
||||
},
|
||||
behavior: 'flip',
|
||||
padding: 5,
|
||||
boundariesElement: 'viewport'
|
||||
},
|
||||
inner: {
|
||||
order: 700,
|
||||
enabled: !1,
|
||||
fn: function(e) {
|
||||
var t = e.placement,
|
||||
o = t.split('-')[0],
|
||||
i = e.offsets,
|
||||
n = i.popper,
|
||||
r = i.reference,
|
||||
p = -1 !== ['left', 'right'].indexOf(o),
|
||||
s = -1 === ['top', 'left'].indexOf(o);
|
||||
return n[p ? 'left' : 'top'] = r[t] - (s ? n[p ? 'width' : 'height'] : 0), e.placement = L(t), e.offsets.popper = c(n), e
|
||||
}
|
||||
},
|
||||
hide: {
|
||||
order: 800,
|
||||
enabled: !0,
|
||||
fn: function(e) {
|
||||
if (!F(e.instance.modifiers, 'hide', 'preventOverflow')) return e;
|
||||
var t = e.offsets.reference,
|
||||
o = T(e.instance.modifiers, function(e) {
|
||||
return 'preventOverflow' === e.name
|
||||
}).boundaries;
|
||||
if (t.bottom < o.top || t.left > o.right || t.top > o.bottom || t.right < o.left) {
|
||||
if (!0 === e.hide) return e;
|
||||
e.hide = !0, e.attributes['x-out-of-boundaries'] = ''
|
||||
} else {
|
||||
if (!1 === e.hide) return e;
|
||||
e.hide = !1, e.attributes['x-out-of-boundaries'] = !1
|
||||
}
|
||||
return e
|
||||
}
|
||||
},
|
||||
computeStyle: {
|
||||
order: 850,
|
||||
enabled: !0,
|
||||
fn: function(e, t) {
|
||||
var o = t.x,
|
||||
i = t.y,
|
||||
n = e.offsets.popper,
|
||||
p = T(e.instance.modifiers, function(e) {
|
||||
return 'applyStyle' === e.name
|
||||
}).gpuAcceleration;
|
||||
void 0 !== p && console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
|
||||
var s, d, a = void 0 === p ? t.gpuAcceleration : p,
|
||||
f = r(e.instance.popper),
|
||||
l = g(f),
|
||||
m = {
|
||||
position: n.position
|
||||
},
|
||||
h = {
|
||||
left: V(n.left),
|
||||
top: V(n.top),
|
||||
bottom: V(n.bottom),
|
||||
right: V(n.right)
|
||||
},
|
||||
c = 'bottom' === o ? 'top' : 'bottom',
|
||||
u = 'right' === i ? 'left' : 'right',
|
||||
b = B('transform');
|
||||
if (d = 'bottom' == c ? -l.height + h.bottom : h.top, s = 'right' == u ? -l.width + h.right : h.left, a && b) m[b] = 'translate3d(' + s + 'px, ' + d + 'px, 0)', m[c] = 0, m[u] = 0, m.willChange = 'transform';
|
||||
else {
|
||||
var y = 'bottom' == c ? -1 : 1,
|
||||
w = 'right' == u ? -1 : 1;
|
||||
m[c] = d * y, m[u] = s * w, m.willChange = c + ', ' + u
|
||||
}
|
||||
var v = {
|
||||
"x-placement": e.placement
|
||||
};
|
||||
return e.attributes = se({}, v, e.attributes), e.styles = se({}, m, e.styles), e
|
||||
},
|
||||
gpuAcceleration: !0,
|
||||
x: 'bottom',
|
||||
y: 'right'
|
||||
},
|
||||
applyStyle: {
|
||||
order: 900,
|
||||
enabled: !0,
|
||||
fn: function(e) {
|
||||
return U(e.instance.popper, e.styles), Y(e.instance.popper, e.attributes), e.offsets.arrow && U(e.arrowElement, e.offsets.arrow), e
|
||||
},
|
||||
onLoad: function(e, t, o, i, n) {
|
||||
var r = x(n, t, e),
|
||||
p = E(o.placement, r, t, e, o.modifiers.flip.boundariesElement, o.modifiers.flip.padding);
|
||||
return t.setAttribute('x-placement', p), U(t, {
|
||||
position: 'absolute'
|
||||
}), o
|
||||
},
|
||||
gpuAcceleration: void 0
|
||||
}
|
||||
}
|
||||
}, le
|
||||
});
|
||||
@@ -0,0 +1,237 @@
|
||||
/*!
|
||||
|
||||
=========================================================
|
||||
* Now-ui-kit - v1.1.0
|
||||
=========================================================
|
||||
|
||||
* Product Page: https://www.creative-tim.com/product/now-ui-kit
|
||||
* Copyright 2017 Creative Tim (http://www.creative-tim.com)
|
||||
* Licensed under MIT (https://github.com/creativetimofficial/now-ui-kit/blob/master/LICENSE.md)
|
||||
|
||||
* Designed by www.invisionapp.com Coded by www.creative-tim.com
|
||||
|
||||
=========================================================
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
*/
|
||||
|
||||
var transparent = true;
|
||||
|
||||
var transparentDemo = true;
|
||||
var fixedTop = false;
|
||||
|
||||
var navbar_initialized,
|
||||
backgroundOrange = false,
|
||||
toggle_initialized = false;
|
||||
|
||||
$(document).ready(function() {
|
||||
// Activate the Tooltips
|
||||
$('[data-toggle="tooltip"], [rel="tooltip"]').tooltip();
|
||||
|
||||
// Activate Popovers and set color for popovers
|
||||
$('[data-toggle="popover"]').each(function() {
|
||||
color_class = $(this).data('color');
|
||||
$(this).popover({
|
||||
template: '<div class="popover popover-' + color_class + '" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'
|
||||
});
|
||||
});
|
||||
|
||||
// Activate the image for the navbar-collapse
|
||||
nowuiKit.initNavbarImage();
|
||||
|
||||
$navbar = $('.navbar[color-on-scroll]');
|
||||
scroll_distance = $navbar.attr('color-on-scroll') || 500;
|
||||
|
||||
// Check if we have the class "navbar-color-on-scroll" then add the function to remove the class "navbar-transparent" so it will transform to a plain color.
|
||||
|
||||
if ($('.navbar[color-on-scroll]').length != 0) {
|
||||
nowuiKit.checkScrollForTransparentNavbar();
|
||||
$(window).on('scroll', nowuiKit.checkScrollForTransparentNavbar)
|
||||
}
|
||||
|
||||
$('.form-control').on("focus", function() {
|
||||
$(this).parent('.input-group').addClass("input-group-focus");
|
||||
}).on("blur", function() {
|
||||
$(this).parent(".input-group").removeClass("input-group-focus");
|
||||
});
|
||||
|
||||
// Activate bootstrapSwitch
|
||||
$('.bootstrap-switch').each(function() {
|
||||
$this = $(this);
|
||||
data_on_label = $this.data('on-label') || '';
|
||||
data_off_label = $this.data('off-label') || '';
|
||||
|
||||
$this.bootstrapSwitch({
|
||||
onText: data_on_label,
|
||||
offText: data_off_label
|
||||
});
|
||||
});
|
||||
|
||||
if ($(window).width() >= 992) {
|
||||
big_image = $('.page-header-image[data-parallax="true"]');
|
||||
|
||||
$(window).on('scroll', nowuiKitDemo.checkScrollForParallax);
|
||||
}
|
||||
|
||||
// Activate Carousel
|
||||
$('.carousel').carousel({
|
||||
interval: 4000
|
||||
});
|
||||
|
||||
$('.date-picker').each(function() {
|
||||
$(this).datepicker({
|
||||
templates: {
|
||||
leftArrow: '<i class="now-ui-icons arrows-1_minimal-left"></i>',
|
||||
rightArrow: '<i class="now-ui-icons arrows-1_minimal-right"></i>'
|
||||
}
|
||||
}).on('show', function() {
|
||||
$('.datepicker').addClass('open');
|
||||
|
||||
datepicker_color = $(this).data('datepicker-color');
|
||||
if (datepicker_color.length != 0) {
|
||||
$('.datepicker').addClass('datepicker-' + datepicker_color + '');
|
||||
}
|
||||
}).on('hide', function() {
|
||||
$('.datepicker').removeClass('open');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(window).on('resize', function() {
|
||||
nowuiKit.initNavbarImage();
|
||||
});
|
||||
|
||||
$(document).on('click', '.navbar-toggler', function() {
|
||||
$toggle = $(this);
|
||||
|
||||
if (nowuiKit.misc.navbar_menu_visible == 1) {
|
||||
$('html').removeClass('nav-open');
|
||||
nowuiKit.misc.navbar_menu_visible = 0;
|
||||
$('#bodyClick').remove();
|
||||
setTimeout(function() {
|
||||
$toggle.removeClass('toggled');
|
||||
}, 550);
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
$toggle.addClass('toggled');
|
||||
}, 580);
|
||||
div = '<div id="bodyClick"></div>';
|
||||
$(div).appendTo('body').click(function() {
|
||||
$('html').removeClass('nav-open');
|
||||
nowuiKit.misc.navbar_menu_visible = 0;
|
||||
setTimeout(function() {
|
||||
$toggle.removeClass('toggled');
|
||||
$('#bodyClick').remove();
|
||||
}, 550);
|
||||
});
|
||||
|
||||
$('html').addClass('nav-open');
|
||||
nowuiKit.misc.navbar_menu_visible = 1;
|
||||
}
|
||||
});
|
||||
|
||||
nowuiKit = {
|
||||
misc: {
|
||||
navbar_menu_visible: 0
|
||||
},
|
||||
|
||||
checkScrollForTransparentNavbar: debounce(function() {
|
||||
if ($(document).scrollTop() > scroll_distance) {
|
||||
if (transparent) {
|
||||
transparent = false;
|
||||
$('.navbar[color-on-scroll]').removeClass('navbar-transparent');
|
||||
}
|
||||
} else {
|
||||
if (!transparent) {
|
||||
transparent = true;
|
||||
$('.navbar[color-on-scroll]').addClass('navbar-transparent');
|
||||
}
|
||||
}
|
||||
}, 17),
|
||||
|
||||
initNavbarImage: function() {
|
||||
var $navbar = $('.navbar').find('.navbar-translate').siblings('.navbar-collapse');
|
||||
var background_image = $navbar.data('nav-image');
|
||||
|
||||
if ($(window).width() < 991 || $('body').hasClass('burger-menu')) {
|
||||
if (background_image != undefined) {
|
||||
$navbar.css('background', "url('" + background_image + "')")
|
||||
.removeAttr('data-nav-image')
|
||||
.css('background-size', "cover")
|
||||
.addClass('has-image');
|
||||
}
|
||||
} else if (background_image != undefined) {
|
||||
$navbar.css('background', "")
|
||||
.attr('data-nav-image', '' + background_image + '')
|
||||
.css('background-size', "")
|
||||
.removeClass('has-image');
|
||||
}
|
||||
},
|
||||
|
||||
initSliders: function() {
|
||||
// Sliders for demo purpose in refine cards section
|
||||
var slider = document.getElementById('sliderRegular');
|
||||
|
||||
noUiSlider.create(slider, {
|
||||
start: 40,
|
||||
connect: [true, false],
|
||||
range: {
|
||||
min: 0,
|
||||
max: 100
|
||||
}
|
||||
});
|
||||
|
||||
var slider2 = document.getElementById('sliderDouble');
|
||||
|
||||
noUiSlider.create(slider2, {
|
||||
start: [20, 60],
|
||||
connect: true,
|
||||
range: {
|
||||
min: 0,
|
||||
max: 100
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var big_image;
|
||||
|
||||
// Javascript just for Demo purpose, remove it from your project
|
||||
nowuiKitDemo = {
|
||||
checkScrollForParallax: debounce(function() {
|
||||
var current_scroll = $(this).scrollTop();
|
||||
|
||||
oVal = ($(window).scrollTop() / 3);
|
||||
big_image.css({
|
||||
'transform': 'translate3d(0,' + oVal + 'px,0)',
|
||||
'-webkit-transform': 'translate3d(0,' + oVal + 'px,0)',
|
||||
'-ms-transform': 'translate3d(0,' + oVal + 'px,0)',
|
||||
'-o-transform': 'translate3d(0,' + oVal + 'px,0)'
|
||||
});
|
||||
|
||||
}, 6)
|
||||
|
||||
}
|
||||
|
||||
// Returns a function, that, as long as it continues to be invoked, will not
|
||||
// be triggered. The function will be called after it stops being called for
|
||||
// N milliseconds. If `immediate` is passed, trigger the function on the
|
||||
// leading edge, instead of the trailing.
|
||||
|
||||
function debounce(func, wait, immediate) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var context = this,
|
||||
args = arguments;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function() {
|
||||
timeout = null;
|
||||
if (!immediate) func.apply(context, args);
|
||||
}, wait);
|
||||
if (immediate && !timeout) func.apply(context, args);
|
||||
};
|
||||
};
|
||||
Vendored
+2056
File diff suppressed because it is too large
Load Diff
Vendored
+744
@@ -0,0 +1,744 @@
|
||||
/* ========================================================================
|
||||
* bootstrap-switch - v3.3.2
|
||||
* http://www.bootstrap-switch.org
|
||||
* ========================================================================
|
||||
* Copyright 2012-2013 Mattia Larentis
|
||||
*
|
||||
* ========================================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ========================================================================
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var slice = [].slice;
|
||||
|
||||
(function($, window) {
|
||||
"use strict";
|
||||
var BootstrapSwitch;
|
||||
BootstrapSwitch = (function() {
|
||||
function BootstrapSwitch(element, options) {
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
this.$element = $(element);
|
||||
this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, {
|
||||
state: this.$element.is(":checked"),
|
||||
size: this.$element.data("size"),
|
||||
animate: this.$element.data("animate"),
|
||||
disabled: this.$element.is(":disabled"),
|
||||
readonly: this.$element.is("[readonly]"),
|
||||
indeterminate: this.$element.data("indeterminate"),
|
||||
inverse: this.$element.data("inverse"),
|
||||
radioAllOff: this.$element.data("radio-all-off"),
|
||||
onColor: this.$element.data("on-color"),
|
||||
offColor: this.$element.data("off-color"),
|
||||
onText: this.$element.data("on-text"),
|
||||
offText: this.$element.data("off-text"),
|
||||
labelText: this.$element.data("label-text"),
|
||||
handleWidth: this.$element.data("handle-width"),
|
||||
labelWidth: this.$element.data("label-width"),
|
||||
baseClass: this.$element.data("base-class"),
|
||||
wrapperClass: this.$element.data("wrapper-class")
|
||||
}, options);
|
||||
this.prevOptions = {};
|
||||
this.$wrapper = $("<div>", {
|
||||
"class": (function(_this) {
|
||||
return function() {
|
||||
var classes;
|
||||
classes = ["" + _this.options.baseClass].concat(_this._getClasses(_this.options.wrapperClass));
|
||||
classes.push(_this.options.state ? _this.options.baseClass + "-on" : _this.options.baseClass + "-off");
|
||||
if (_this.options.size != null) {
|
||||
classes.push(_this.options.baseClass + "-" + _this.options.size);
|
||||
}
|
||||
if (_this.options.disabled) {
|
||||
classes.push(_this.options.baseClass + "-disabled");
|
||||
}
|
||||
if (_this.options.readonly) {
|
||||
classes.push(_this.options.baseClass + "-readonly");
|
||||
}
|
||||
if (_this.options.indeterminate) {
|
||||
classes.push(_this.options.baseClass + "-indeterminate");
|
||||
}
|
||||
if (_this.options.inverse) {
|
||||
classes.push(_this.options.baseClass + "-inverse");
|
||||
}
|
||||
if (_this.$element.attr("id")) {
|
||||
classes.push(_this.options.baseClass + "-id-" + (_this.$element.attr("id")));
|
||||
}
|
||||
return classes.join(" ");
|
||||
};
|
||||
})(this)()
|
||||
});
|
||||
this.$container = $("<div>", {
|
||||
"class": this.options.baseClass + "-container"
|
||||
});
|
||||
this.$on = $("<span>", {
|
||||
html: this.options.onText,
|
||||
"class": this.options.baseClass + "-handle-on " + this.options.baseClass + "-" + this.options.onColor
|
||||
});
|
||||
this.$off = $("<span>", {
|
||||
html: this.options.offText,
|
||||
"class": this.options.baseClass + "-handle-off " + this.options.baseClass + "-" + this.options.offColor
|
||||
});
|
||||
this.$label = $("<span>", {
|
||||
html: this.options.labelText,
|
||||
"class": this.options.baseClass + "-label"
|
||||
});
|
||||
this.$element.on("init.bootstrapSwitch", (function(_this) {
|
||||
return function() {
|
||||
return _this.options.onInit.apply(element, arguments);
|
||||
};
|
||||
})(this));
|
||||
this.$element.on("switchChange.bootstrapSwitch", (function(_this) {
|
||||
return function(e) {
|
||||
if (false === _this.options.onSwitchChange.apply(element, arguments)) {
|
||||
if (_this.$element.is(":radio")) {
|
||||
return $("[name='" + (_this.$element.attr('name')) + "']").trigger("previousState.bootstrapSwitch", true);
|
||||
} else {
|
||||
return _this.$element.trigger("previousState.bootstrapSwitch", true);
|
||||
}
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
this.$container = this.$element.wrap(this.$container).parent();
|
||||
this.$wrapper = this.$container.wrap(this.$wrapper).parent();
|
||||
this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off);
|
||||
if (this.options.indeterminate) {
|
||||
this.$element.prop("indeterminate", true);
|
||||
}
|
||||
this._init();
|
||||
this._elementHandlers();
|
||||
this._handleHandlers();
|
||||
this._labelHandlers();
|
||||
this._formHandler();
|
||||
this._externalLabelHandler();
|
||||
this.$element.trigger("init.bootstrapSwitch", this.options.state);
|
||||
}
|
||||
|
||||
BootstrapSwitch.prototype._constructor = BootstrapSwitch;
|
||||
|
||||
BootstrapSwitch.prototype.setPrevOptions = function() {
|
||||
return this.prevOptions = $.extend(true, {}, this.options);
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.state = function(value, skip) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.state;
|
||||
}
|
||||
if (this.options.disabled || this.options.readonly) {
|
||||
return this.$element;
|
||||
}
|
||||
if (this.options.state && !this.options.radioAllOff && this.$element.is(":radio")) {
|
||||
return this.$element;
|
||||
}
|
||||
if (this.$element.is(":radio")) {
|
||||
$("[name='" + (this.$element.attr('name')) + "']").trigger("setPreviousOptions.bootstrapSwitch");
|
||||
} else {
|
||||
this.$element.trigger("setPreviousOptions.bootstrapSwitch");
|
||||
}
|
||||
if (this.options.indeterminate) {
|
||||
this.indeterminate(false);
|
||||
}
|
||||
value = !!value;
|
||||
this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip);
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.toggleState = function(skip) {
|
||||
if (this.options.disabled || this.options.readonly) {
|
||||
return this.$element;
|
||||
}
|
||||
if (this.options.indeterminate) {
|
||||
this.indeterminate(false);
|
||||
return this.state(true);
|
||||
} else {
|
||||
return this.$element.prop("checked", !this.options.state).trigger("change.bootstrapSwitch", skip);
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.size = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.size;
|
||||
}
|
||||
if (this.options.size != null) {
|
||||
this.$wrapper.removeClass(this.options.baseClass + "-" + this.options.size);
|
||||
}
|
||||
if (value) {
|
||||
this.$wrapper.addClass(this.options.baseClass + "-" + value);
|
||||
}
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
this.options.size = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.animate = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.animate;
|
||||
}
|
||||
value = !!value;
|
||||
if (value === this.options.animate) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleAnimate();
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.toggleAnimate = function() {
|
||||
this.options.animate = !this.options.animate;
|
||||
this.$wrapper.toggleClass(this.options.baseClass + "-animate");
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.disabled = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.disabled;
|
||||
}
|
||||
value = !!value;
|
||||
if (value === this.options.disabled) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleDisabled();
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.toggleDisabled = function() {
|
||||
this.options.disabled = !this.options.disabled;
|
||||
this.$element.prop("disabled", this.options.disabled);
|
||||
this.$wrapper.toggleClass(this.options.baseClass + "-disabled");
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.readonly = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.readonly;
|
||||
}
|
||||
value = !!value;
|
||||
if (value === this.options.readonly) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleReadonly();
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.toggleReadonly = function() {
|
||||
this.options.readonly = !this.options.readonly;
|
||||
this.$element.prop("readonly", this.options.readonly);
|
||||
this.$wrapper.toggleClass(this.options.baseClass + "-readonly");
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.indeterminate = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.indeterminate;
|
||||
}
|
||||
value = !!value;
|
||||
if (value === this.options.indeterminate) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleIndeterminate();
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.toggleIndeterminate = function() {
|
||||
this.options.indeterminate = !this.options.indeterminate;
|
||||
this.$element.prop("indeterminate", this.options.indeterminate);
|
||||
this.$wrapper.toggleClass(this.options.baseClass + "-indeterminate");
|
||||
this._containerPosition();
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.inverse = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.inverse;
|
||||
}
|
||||
value = !!value;
|
||||
if (value === this.options.inverse) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleInverse();
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.toggleInverse = function() {
|
||||
var $off, $on;
|
||||
this.$wrapper.toggleClass(this.options.baseClass + "-inverse");
|
||||
$on = this.$on.clone(true);
|
||||
$off = this.$off.clone(true);
|
||||
this.$on.replaceWith($off);
|
||||
this.$off.replaceWith($on);
|
||||
this.$on = $off;
|
||||
this.$off = $on;
|
||||
this.options.inverse = !this.options.inverse;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.onColor = function(value) {
|
||||
var color;
|
||||
color = this.options.onColor;
|
||||
if (typeof value === "undefined") {
|
||||
return color;
|
||||
}
|
||||
if (color != null) {
|
||||
this.$on.removeClass(this.options.baseClass + "-" + color);
|
||||
}
|
||||
this.$on.addClass(this.options.baseClass + "-" + value);
|
||||
this.options.onColor = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.offColor = function(value) {
|
||||
var color;
|
||||
color = this.options.offColor;
|
||||
if (typeof value === "undefined") {
|
||||
return color;
|
||||
}
|
||||
if (color != null) {
|
||||
this.$off.removeClass(this.options.baseClass + "-" + color);
|
||||
}
|
||||
this.$off.addClass(this.options.baseClass + "-" + value);
|
||||
this.options.offColor = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.onText = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.onText;
|
||||
}
|
||||
this.$on.html(value);
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
this.options.onText = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.offText = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.offText;
|
||||
}
|
||||
this.$off.html(value);
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
this.options.offText = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.labelText = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.labelText;
|
||||
}
|
||||
this.$label.html(value);
|
||||
this._width();
|
||||
this.options.labelText = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.handleWidth = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.handleWidth;
|
||||
}
|
||||
this.options.handleWidth = value;
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.labelWidth = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.labelWidth;
|
||||
}
|
||||
this.options.labelWidth = value;
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.baseClass = function(value) {
|
||||
return this.options.baseClass;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.wrapperClass = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.wrapperClass;
|
||||
}
|
||||
if (!value) {
|
||||
value = $.fn.bootstrapSwitch.defaults.wrapperClass;
|
||||
}
|
||||
this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(" "));
|
||||
this.$wrapper.addClass(this._getClasses(value).join(" "));
|
||||
this.options.wrapperClass = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.radioAllOff = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.radioAllOff;
|
||||
}
|
||||
value = !!value;
|
||||
if (value === this.options.radioAllOff) {
|
||||
return this.$element;
|
||||
}
|
||||
this.options.radioAllOff = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.onInit = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.onInit;
|
||||
}
|
||||
if (!value) {
|
||||
value = $.fn.bootstrapSwitch.defaults.onInit;
|
||||
}
|
||||
this.options.onInit = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.onSwitchChange = function(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return this.options.onSwitchChange;
|
||||
}
|
||||
if (!value) {
|
||||
value = $.fn.bootstrapSwitch.defaults.onSwitchChange;
|
||||
}
|
||||
this.options.onSwitchChange = value;
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype.destroy = function() {
|
||||
var $form;
|
||||
$form = this.$element.closest("form");
|
||||
if ($form.length) {
|
||||
$form.off("reset.bootstrapSwitch").removeData("bootstrap-switch");
|
||||
}
|
||||
this.$container.children().not(this.$element).remove();
|
||||
this.$element.unwrap().unwrap().off(".bootstrapSwitch").removeData("bootstrap-switch");
|
||||
return this.$element;
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._width = function() {
|
||||
var $handles, handleWidth;
|
||||
$handles = this.$on.add(this.$off);
|
||||
$handles.add(this.$label).css("width", "");
|
||||
handleWidth = this.options.handleWidth === "auto" ? Math.max(this.$on.width(), this.$off.width()) : this.options.handleWidth;
|
||||
$handles.width(handleWidth);
|
||||
this.$label.width((function(_this) {
|
||||
return function(index, width) {
|
||||
if (_this.options.labelWidth !== "auto") {
|
||||
return _this.options.labelWidth;
|
||||
}
|
||||
if (width < handleWidth) {
|
||||
return handleWidth;
|
||||
} else {
|
||||
return width;
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
this._handleWidth = this.$on.outerWidth();
|
||||
this._labelWidth = this.$label.outerWidth();
|
||||
this.$container.width((this._handleWidth * 2) + this._labelWidth);
|
||||
return this.$wrapper.width(this._handleWidth + this._labelWidth);
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._containerPosition = function(state, callback) {
|
||||
if (state == null) {
|
||||
state = this.options.state;
|
||||
}
|
||||
this.$container.css("margin-left", (function(_this) {
|
||||
return function() {
|
||||
var values;
|
||||
values = [0, "-" + _this._handleWidth + "px"];
|
||||
if (_this.options.indeterminate) {
|
||||
return "-" + (_this._handleWidth / 2) + "px";
|
||||
}
|
||||
if (state) {
|
||||
if (_this.options.inverse) {
|
||||
return values[1];
|
||||
} else {
|
||||
return values[0];
|
||||
}
|
||||
} else {
|
||||
if (_this.options.inverse) {
|
||||
return values[0];
|
||||
} else {
|
||||
return values[1];
|
||||
}
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
return setTimeout(function() {
|
||||
return callback();
|
||||
}, 50);
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._init = function() {
|
||||
var init, initInterval;
|
||||
init = (function(_this) {
|
||||
return function() {
|
||||
_this.setPrevOptions();
|
||||
_this._width();
|
||||
return _this._containerPosition(null, function() {
|
||||
if (_this.options.animate) {
|
||||
return _this.$wrapper.addClass(_this.options.baseClass + "-animate");
|
||||
}
|
||||
});
|
||||
};
|
||||
})(this);
|
||||
if (this.$wrapper.is(":visible")) {
|
||||
return init();
|
||||
}
|
||||
return initInterval = window.setInterval((function(_this) {
|
||||
return function() {
|
||||
if (_this.$wrapper.is(":visible")) {
|
||||
init();
|
||||
return window.clearInterval(initInterval);
|
||||
}
|
||||
};
|
||||
})(this), 50);
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._elementHandlers = function() {
|
||||
return this.$element.on({
|
||||
"setPreviousOptions.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
return _this.setPrevOptions();
|
||||
};
|
||||
})(this),
|
||||
"previousState.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
_this.options = _this.prevOptions;
|
||||
if (_this.options.indeterminate) {
|
||||
_this.$wrapper.addClass(_this.options.baseClass + "-indeterminate");
|
||||
}
|
||||
return _this.$element.prop("checked", _this.options.state).trigger("change.bootstrapSwitch", true);
|
||||
};
|
||||
})(this),
|
||||
"change.bootstrapSwitch": (function(_this) {
|
||||
return function(e, skip) {
|
||||
var state;
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
state = _this.$element.is(":checked");
|
||||
_this._containerPosition(state);
|
||||
if (state === _this.options.state) {
|
||||
return;
|
||||
}
|
||||
_this.options.state = state;
|
||||
_this.$wrapper.toggleClass(_this.options.baseClass + "-off").toggleClass(_this.options.baseClass + "-on");
|
||||
if (!skip) {
|
||||
if (_this.$element.is(":radio")) {
|
||||
$("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.bootstrapSwitch", true);
|
||||
}
|
||||
return _this.$element.trigger("switchChange.bootstrapSwitch", [state]);
|
||||
}
|
||||
};
|
||||
})(this),
|
||||
"focus.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
e.preventDefault();
|
||||
return _this.$wrapper.addClass(_this.options.baseClass + "-focused");
|
||||
};
|
||||
})(this),
|
||||
"blur.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
e.preventDefault();
|
||||
return _this.$wrapper.removeClass(_this.options.baseClass + "-focused");
|
||||
};
|
||||
})(this),
|
||||
"keydown.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
if (!e.which || _this.options.disabled || _this.options.readonly) {
|
||||
return;
|
||||
}
|
||||
switch (e.which) {
|
||||
case 37:
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
return _this.state(false);
|
||||
case 39:
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
return _this.state(true);
|
||||
}
|
||||
};
|
||||
})(this)
|
||||
});
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._handleHandlers = function() {
|
||||
this.$on.on("click.bootstrapSwitch", (function(_this) {
|
||||
return function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
_this.state(false);
|
||||
return _this.$element.trigger("focus.bootstrapSwitch");
|
||||
};
|
||||
})(this));
|
||||
return this.$off.on("click.bootstrapSwitch", (function(_this) {
|
||||
return function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
_this.state(true);
|
||||
return _this.$element.trigger("focus.bootstrapSwitch");
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._labelHandlers = function() {
|
||||
return this.$label.on({
|
||||
"click": function(e) {
|
||||
return e.stopPropagation();
|
||||
},
|
||||
"mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
if (_this._dragStart || _this.options.disabled || _this.options.readonly) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
_this._dragStart = (e.pageX || e.originalEvent.touches[0].pageX) - parseInt(_this.$container.css("margin-left"), 10);
|
||||
if (_this.options.animate) {
|
||||
_this.$wrapper.removeClass(_this.options.baseClass + "-animate");
|
||||
}
|
||||
return _this.$element.trigger("focus.bootstrapSwitch");
|
||||
};
|
||||
})(this),
|
||||
"mousemove.bootstrapSwitch touchmove.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
var difference;
|
||||
if (_this._dragStart == null) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
difference = (e.pageX || e.originalEvent.touches[0].pageX) - _this._dragStart;
|
||||
if (difference < -_this._handleWidth || difference > 0) {
|
||||
return;
|
||||
}
|
||||
_this._dragEnd = difference;
|
||||
return _this.$container.css("margin-left", _this._dragEnd + "px");
|
||||
};
|
||||
})(this),
|
||||
"mouseup.bootstrapSwitch touchend.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
var state;
|
||||
if (!_this._dragStart) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
if (_this.options.animate) {
|
||||
_this.$wrapper.addClass(_this.options.baseClass + "-animate");
|
||||
}
|
||||
if (_this._dragEnd) {
|
||||
state = _this._dragEnd > -(_this._handleWidth / 2);
|
||||
_this._dragEnd = false;
|
||||
_this.state(_this.options.inverse ? !state : state);
|
||||
} else {
|
||||
_this.state(!_this.options.state);
|
||||
}
|
||||
return _this._dragStart = false;
|
||||
};
|
||||
})(this),
|
||||
"mouseleave.bootstrapSwitch": (function(_this) {
|
||||
return function(e) {
|
||||
return _this.$label.trigger("mouseup.bootstrapSwitch");
|
||||
};
|
||||
})(this)
|
||||
});
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._externalLabelHandler = function() {
|
||||
var $externalLabel;
|
||||
$externalLabel = this.$element.closest("label");
|
||||
return $externalLabel.on("click", (function(_this) {
|
||||
return function(event) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
if (event.target === $externalLabel[0]) {
|
||||
return _this.toggleState();
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._formHandler = function() {
|
||||
var $form;
|
||||
$form = this.$element.closest("form");
|
||||
if ($form.data("bootstrap-switch")) {
|
||||
return;
|
||||
}
|
||||
return $form.on("reset.bootstrapSwitch", function() {
|
||||
return window.setTimeout(function() {
|
||||
return $form.find("input").filter(function() {
|
||||
return $(this).data("bootstrap-switch");
|
||||
}).each(function() {
|
||||
return $(this).bootstrapSwitch("state", this.checked);
|
||||
});
|
||||
}, 1);
|
||||
}).data("bootstrap-switch", true);
|
||||
};
|
||||
|
||||
BootstrapSwitch.prototype._getClasses = function(classes) {
|
||||
var c, cls, i, len;
|
||||
if (!$.isArray(classes)) {
|
||||
return [this.options.baseClass + "-" + classes];
|
||||
}
|
||||
cls = [];
|
||||
for (i = 0, len = classes.length; i < len; i++) {
|
||||
c = classes[i];
|
||||
cls.push(this.options.baseClass + "-" + c);
|
||||
}
|
||||
return cls;
|
||||
};
|
||||
|
||||
return BootstrapSwitch;
|
||||
|
||||
})();
|
||||
$.fn.bootstrapSwitch = function() {
|
||||
var args, option, ret;
|
||||
option = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
||||
ret = this;
|
||||
this.each(function() {
|
||||
var $this, data;
|
||||
$this = $(this);
|
||||
data = $this.data("bootstrap-switch");
|
||||
if (!data) {
|
||||
$this.data("bootstrap-switch", data = new BootstrapSwitch(this, option));
|
||||
}
|
||||
if (typeof option === "string") {
|
||||
return ret = data[option].apply(data, args);
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
};
|
||||
$.fn.bootstrapSwitch.Constructor = BootstrapSwitch;
|
||||
return $.fn.bootstrapSwitch.defaults = {
|
||||
state: true,
|
||||
size: null,
|
||||
animate: true,
|
||||
disabled: false,
|
||||
readonly: false,
|
||||
indeterminate: false,
|
||||
inverse: false,
|
||||
radioAllOff: false,
|
||||
onColor: "primary",
|
||||
offColor: "default",
|
||||
onText: "ON",
|
||||
offText: "OFF",
|
||||
labelText: " ",
|
||||
handleWidth: "auto",
|
||||
labelWidth: "auto",
|
||||
baseClass: "bootstrap-switch",
|
||||
wrapperClass: "wrapper",
|
||||
onInit: function() {},
|
||||
onSwitchChange: function() {}
|
||||
};
|
||||
})(window.jQuery, window);
|
||||
|
||||
}).call(this);
|
||||
@@ -0,0 +1,619 @@
|
||||
/*!
|
||||
* Sharrre.com - Make your sharing widget!
|
||||
* Version: beta 1.3.5
|
||||
* Author: Julien Hany
|
||||
* License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
|
||||
;
|
||||
(function($, window, document, undefined) {
|
||||
|
||||
/* Defaults
|
||||
================================================== */
|
||||
var pluginName = 'sharrre',
|
||||
defaults = {
|
||||
className: 'sharrre',
|
||||
share: {
|
||||
googlePlus: false,
|
||||
facebook: false,
|
||||
twitter: false,
|
||||
digg: false,
|
||||
delicious: false,
|
||||
stumbleupon: false,
|
||||
linkedin: false,
|
||||
pinterest: false
|
||||
},
|
||||
shareTotal: 0,
|
||||
template: '',
|
||||
title: '',
|
||||
url: document.location.href,
|
||||
text: document.title,
|
||||
urlCurl: 'sharrre.php', //PHP script for google plus...
|
||||
count: {}, //counter by social network
|
||||
total: 0, //total of sharing
|
||||
shorterTotal: true, //show total by k or M when number is to big
|
||||
enableHover: true, //disable if you want to personalize hover event with callback
|
||||
enableCounter: true, //disable if you just want use buttons
|
||||
enableTracking: false, //tracking with google analitycs
|
||||
hover: function() {}, //personalize hover event with this callback function
|
||||
hide: function() {}, //personalize hide event with this callback function
|
||||
click: function() {}, //personalize click event with this callback function
|
||||
render: function() {}, //personalize render event with this callback function
|
||||
buttons: { //settings for buttons
|
||||
googlePlus: { //http://www.google.com/webmasters/+1/button/
|
||||
url: '', //if you need to personnalize button url
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
size: 'medium',
|
||||
lang: 'en-US',
|
||||
annotation: ''
|
||||
},
|
||||
facebook: { //http://developers.facebook.com/docs/reference/plugins/like/
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
action: 'like',
|
||||
layout: 'button_count',
|
||||
width: '',
|
||||
send: 'false',
|
||||
faces: 'false',
|
||||
colorscheme: '',
|
||||
font: '',
|
||||
lang: 'en_US'
|
||||
},
|
||||
twitter: { //http://twitter.com/about/resources/tweetbutton
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
count: 'horizontal',
|
||||
hashtags: '',
|
||||
via: '',
|
||||
related: '',
|
||||
lang: 'en'
|
||||
},
|
||||
digg: { //http://about.digg.com/downloads/button/smart
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
type: 'DiggCompact'
|
||||
},
|
||||
delicious: {
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
size: 'medium' //medium or tall
|
||||
},
|
||||
stumbleupon: { //http://www.stumbleupon.com/badges/
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
layout: '1'
|
||||
},
|
||||
linkedin: { //http://developer.linkedin.com/plugins/share-button
|
||||
url: '', //if you need to personalize url button
|
||||
urlCount: false, //if you want to use personnalize button url on global counter
|
||||
counter: ''
|
||||
},
|
||||
pinterest: { //http://pinterest.com/about/goodies/
|
||||
url: '', //if you need to personalize url button
|
||||
media: '',
|
||||
description: '',
|
||||
layout: 'horizontal'
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Json URL to get count number
|
||||
================================================== */
|
||||
urlJson = {
|
||||
googlePlus: "",
|
||||
|
||||
//new FQL method by Sire
|
||||
facebook: "https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",
|
||||
//old method facebook: "http://graph.facebook.com/?id={url}&callback=?",
|
||||
//facebook : "http://api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json"
|
||||
|
||||
twitter: "http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",
|
||||
digg: "http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",
|
||||
delicious: 'http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?',
|
||||
//stumbleupon: "http://www.stumbleupon.com/services/1.01/badge.getinfo?url={url}&format=jsonp&callback=?",
|
||||
stumbleupon: "",
|
||||
linkedin: "http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",
|
||||
pinterest: "http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"
|
||||
},
|
||||
/* Load share buttons asynchronously
|
||||
================================================== */
|
||||
loadButton = {
|
||||
googlePlus: function(self) {
|
||||
var sett = self.options.buttons.googlePlus;
|
||||
//$(self.element).find('.buttons').append('<div class="button googleplus"><g:plusone size="'+self.options.buttons.googlePlus.size+'" href="'+self.options.url+'"></g:plusone></div>');
|
||||
$(self.element).find('.buttons').append('<div class="button googleplus"><div class="g-plusone" data-size="' + sett.size + '" data-href="' + (sett.url !== '' ? sett.url : self.options.url) + '" data-annotation="' + sett.annotation + '"></div></div>');
|
||||
window.___gcfg = {
|
||||
lang: self.options.buttons.googlePlus.lang
|
||||
};
|
||||
var loading = 0;
|
||||
if (typeof gapi === 'undefined' && loading == 0) {
|
||||
loading = 1;
|
||||
(function() {
|
||||
var po = document.createElement('script');
|
||||
po.type = 'text/javascript';
|
||||
po.async = true;
|
||||
po.src = '//apis.google.com/js/plusone.js';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(po, s);
|
||||
})();
|
||||
} else {
|
||||
gapi.plusone.go();
|
||||
}
|
||||
},
|
||||
facebook: function(self) {
|
||||
var sett = self.options.buttons.facebook;
|
||||
$(self.element).find('.buttons').append('<div class="button facebook"><div id="fb-root"></div><div class="fb-like" data-href="' + (sett.url !== '' ? sett.url : self.options.url) + '" data-send="' + sett.send + '" data-layout="' + sett.layout + '" data-width="' + sett.width + '" data-show-faces="' + sett.faces + '" data-action="' + sett.action + '" data-colorscheme="' + sett.colorscheme + '" data-font="' + sett.font + '" data-via="' + sett.via + '"></div></div>');
|
||||
var loading = 0;
|
||||
if (typeof FB === 'undefined' && loading == 0) {
|
||||
loading = 1;
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) {
|
||||
return;
|
||||
}
|
||||
js = d.createElement(s);
|
||||
js.id = id;
|
||||
js.src = '//connect.facebook.net/' + sett.lang + '/all.js#xfbml=1';
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
} else {
|
||||
FB.XFBML.parse();
|
||||
}
|
||||
},
|
||||
twitter: function(self) {
|
||||
var sett = self.options.buttons.twitter;
|
||||
$(self.element).find('.buttons').append('<div class="button twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="' + (sett.url !== '' ? sett.url : self.options.url) + '" data-count="' + sett.count + '" data-text="' + self.options.text + '" data-via="' + sett.via + '" data-hashtags="' + sett.hashtags + '" data-related="' + sett.related + '" data-lang="' + sett.lang + '">Tweet</a></div>');
|
||||
var loading = 0;
|
||||
if (typeof twttr === 'undefined' && loading == 0) {
|
||||
loading = 1;
|
||||
(function() {
|
||||
var twitterScriptTag = document.createElement('script');
|
||||
twitterScriptTag.type = 'text/javascript';
|
||||
twitterScriptTag.async = true;
|
||||
twitterScriptTag.src = '//platform.twitter.com/widgets.js';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(twitterScriptTag, s);
|
||||
})();
|
||||
} else {
|
||||
$.ajax({
|
||||
url: '//platform.twitter.com/widgets.js',
|
||||
dataType: 'script',
|
||||
cache: true
|
||||
}); //http://stackoverflow.com/q/6536108
|
||||
}
|
||||
},
|
||||
digg: function(self) {
|
||||
var sett = self.options.buttons.digg;
|
||||
$(self.element).find('.buttons').append('<div class="button digg"><a class="DiggThisButton ' + sett.type + '" rel="nofollow external" href="http://digg.com/submit?url=' + encodeURIComponent((sett.url !== '' ? sett.url : self.options.url)) + '"></a></div>');
|
||||
var loading = 0;
|
||||
if (typeof __DBW === 'undefined' && loading == 0) {
|
||||
loading = 1;
|
||||
(function() {
|
||||
var s = document.createElement('SCRIPT'),
|
||||
s1 = document.getElementsByTagName('SCRIPT')[0];
|
||||
s.type = 'text/javascript';
|
||||
s.async = true;
|
||||
s.src = '//widgets.digg.com/buttons.js';
|
||||
s1.parentNode.insertBefore(s, s1);
|
||||
})();
|
||||
}
|
||||
},
|
||||
delicious: function(self) {
|
||||
if (self.options.buttons.delicious.size == 'tall') { //tall
|
||||
var css = 'width:50px;',
|
||||
cssCount = 'height:35px;width:50px;font-size:15px;line-height:35px;',
|
||||
cssShare = 'height:18px;line-height:18px;margin-top:3px;';
|
||||
} else { //medium
|
||||
var css = 'width:93px;',
|
||||
cssCount = 'float:right;padding:0 3px;height:20px;width:26px;line-height:20px;',
|
||||
cssShare = 'float:left;height:20px;line-height:20px;';
|
||||
}
|
||||
var count = self.shorterTotal(self.options.count.delicious);
|
||||
if (typeof count === "undefined") {
|
||||
count = 0;
|
||||
}
|
||||
$(self.element).find('.buttons').append(
|
||||
'<div class="button delicious"><div style="' + css + 'font:12px Arial,Helvetica,sans-serif;cursor:pointer;color:#666666;display:inline-block;float:none;height:20px;line-height:normal;margin:0;padding:0;text-indent:0;vertical-align:baseline;">' +
|
||||
'<div style="' + cssCount + 'background-color:#fff;margin-bottom:5px;overflow:hidden;text-align:center;border:1px solid #ccc;border-radius:3px;">' + count + '</div>' +
|
||||
'<div style="' + cssShare + 'display:block;padding:0;text-align:center;text-decoration:none;width:50px;background-color:#7EACEE;border:1px solid #40679C;border-radius:3px;color:#fff;">' +
|
||||
'<img src="http://www.delicious.com/static/img/delicious.small.gif" height="10" width="10" alt="Delicious" /> Add</div></div></div>');
|
||||
|
||||
$(self.element).find('.delicious').on('click', function() {
|
||||
self.openPopup('delicious');
|
||||
});
|
||||
},
|
||||
stumbleupon: function(self) {
|
||||
var sett = self.options.buttons.stumbleupon;
|
||||
$(self.element).find('.buttons').append('<div class="button stumbleupon"><su:badge layout="' + sett.layout + '" location="' + (sett.url !== '' ? sett.url : self.options.url) + '"></su:badge></div>');
|
||||
var loading = 0;
|
||||
if (typeof STMBLPN === 'undefined' && loading == 0) {
|
||||
loading = 1;
|
||||
(function() {
|
||||
var li = document.createElement('script');
|
||||
li.type = 'text/javascript';
|
||||
li.async = true;
|
||||
li.src = '//platform.stumbleupon.com/1/widgets.js';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(li, s);
|
||||
})();
|
||||
s = window.setTimeout(function() {
|
||||
if (typeof STMBLPN !== 'undefined') {
|
||||
STMBLPN.processWidgets();
|
||||
clearInterval(s);
|
||||
}
|
||||
}, 500);
|
||||
} else {
|
||||
STMBLPN.processWidgets();
|
||||
}
|
||||
},
|
||||
linkedin: function(self) {
|
||||
var sett = self.options.buttons.linkedin;
|
||||
$(self.element).find('.buttons').append('<div class="button linkedin"><script type="in/share" data-url="' + (sett.url !== '' ? sett.url : self.options.url) + '" data-counter="' + sett.counter + '"></script></div>');
|
||||
var loading = 0;
|
||||
if (typeof window.IN === 'undefined' && loading == 0) {
|
||||
loading = 1;
|
||||
(function() {
|
||||
var li = document.createElement('script');
|
||||
li.type = 'text/javascript';
|
||||
li.async = true;
|
||||
li.src = '//platform.linkedin.com/in.js';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(li, s);
|
||||
})();
|
||||
} else {
|
||||
window.IN.init();
|
||||
}
|
||||
},
|
||||
pinterest: function(self) {
|
||||
var sett = self.options.buttons.pinterest;
|
||||
$(self.element).find('.buttons').append('<div class="button pinterest"><a href="http://pinterest.com/pin/create/button/?url=' + (sett.url !== '' ? sett.url : self.options.url) + '&media=' + sett.media + '&description=' + sett.description + '" class="pin-it-button" count-layout="' + sett.layout + '">Pin It</a></div>');
|
||||
|
||||
(function() {
|
||||
var li = document.createElement('script');
|
||||
li.type = 'text/javascript';
|
||||
li.async = true;
|
||||
li.src = '//assets.pinterest.com/js/pinit.js';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(li, s);
|
||||
})();
|
||||
}
|
||||
},
|
||||
/* Tracking for Google Analytics
|
||||
================================================== */
|
||||
tracking = {
|
||||
googlePlus: function() {},
|
||||
facebook: function() {
|
||||
//console.log('facebook');
|
||||
fb = window.setInterval(function() {
|
||||
if (typeof FB !== 'undefined') {
|
||||
FB.Event.subscribe('edge.create', function(targetUrl) {
|
||||
_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]);
|
||||
});
|
||||
FB.Event.subscribe('edge.remove', function(targetUrl) {
|
||||
_gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]);
|
||||
});
|
||||
FB.Event.subscribe('message.send', function(targetUrl) {
|
||||
_gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]);
|
||||
});
|
||||
//console.log('ok');
|
||||
clearInterval(fb);
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
twitter: function() {
|
||||
//console.log('twitter');
|
||||
tw = window.setInterval(function() {
|
||||
if (typeof twttr !== 'undefined') {
|
||||
twttr.events.bind('tweet', function(event) {
|
||||
if (event) {
|
||||
_gaq.push(['_trackSocial', 'twitter', 'tweet']);
|
||||
}
|
||||
});
|
||||
//console.log('ok');
|
||||
clearInterval(tw);
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
digg: function() {
|
||||
//if somenone find a solution, mail me !
|
||||
/*$(this.element).find('.digg').on('click', function(){
|
||||
_gaq.push(['_trackSocial', 'digg', 'add']);
|
||||
});*/
|
||||
},
|
||||
delicious: function() {},
|
||||
stumbleupon: function() {},
|
||||
linkedin: function() {
|
||||
function LinkedInShare() {
|
||||
_gaq.push(['_trackSocial', 'linkedin', 'share']);
|
||||
}
|
||||
},
|
||||
pinterest: function() {
|
||||
//if somenone find a solution, mail me !
|
||||
}
|
||||
},
|
||||
/* Popup for each social network
|
||||
================================================== */
|
||||
popup = {
|
||||
googlePlus: function(opt) {
|
||||
window.open("https://plus.google.com/share?hl=" + opt.buttons.googlePlus.lang + "&url=" + encodeURIComponent((opt.buttons.googlePlus.url !== '' ? opt.buttons.googlePlus.url : opt.url)), "", "toolbar=0, status=0, width=900, height=500");
|
||||
},
|
||||
facebook: function(opt) {
|
||||
window.open("http://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url)) + "&t=" + opt.text + "", "", "toolbar=0, status=0, width=900, height=500");
|
||||
},
|
||||
twitter: function(opt) {
|
||||
window.open("https://twitter.com/intent/tweet?text=" + encodeURIComponent(opt.text) + "&url=" + encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url)) + (opt.buttons.twitter.via !== '' ? '&via=' + opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=650, height=360");
|
||||
},
|
||||
digg: function(opt) {
|
||||
window.open("http://digg.com/tools/diggthis/submit?url=" + encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url)) + "&title=" + opt.text + "&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360");
|
||||
},
|
||||
delicious: function(opt) {
|
||||
window.open('http://www.delicious.com/save?v=5&noui&jump=close&url=' + encodeURIComponent((opt.buttons.delicious.url !== '' ? opt.buttons.delicious.url : opt.url)) + '&title=' + opt.text, 'delicious', 'toolbar=no,width=550,height=550');
|
||||
},
|
||||
stumbleupon: function(opt) {
|
||||
window.open('http://www.stumbleupon.com/badge/?url=' + encodeURIComponent((opt.buttons.stumbleupon.url !== '' ? opt.buttons.stumbleupon.url : opt.url)), 'stumbleupon', 'toolbar=no,width=550,height=550');
|
||||
},
|
||||
linkedin: function(opt) {
|
||||
window.open('https://www.linkedin.com/cws/share?url=' + encodeURIComponent((opt.buttons.linkedin.url !== '' ? opt.buttons.linkedin.url : opt.url)) + '&token=&isFramed=true', 'linkedin', 'toolbar=no,width=550,height=550');
|
||||
},
|
||||
pinterest: function(opt) {
|
||||
window.open('http://pinterest.com/pin/create/button/?url=' + encodeURIComponent((opt.buttons.pinterest.url !== '' ? opt.buttons.pinterest.url : opt.url)) + '&media=' + encodeURIComponent(opt.buttons.pinterest.media) + '&description=' + opt.buttons.pinterest.description, 'pinterest', 'toolbar=no,width=700,height=300');
|
||||
}
|
||||
};
|
||||
|
||||
/* Plugin constructor
|
||||
================================================== */
|
||||
function Plugin(element, options) {
|
||||
this.element = element;
|
||||
|
||||
this.options = $.extend(true, {}, defaults, options);
|
||||
this.options.share = options.share; //simple solution to allow order of buttons
|
||||
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
/* Initialization method
|
||||
================================================== */
|
||||
Plugin.prototype.init = function() {
|
||||
var self = this;
|
||||
if (this.options.urlCurl !== '') {
|
||||
urlJson.googlePlus = this.options.urlCurl + '?url={url}&type=googlePlus'; // PHP script for GooglePlus...
|
||||
urlJson.stumbleupon = this.options.urlCurl + '?url={url}&type=stumbleupon'; // PHP script for Stumbleupon...
|
||||
}
|
||||
$(this.element).addClass(this.options.className); //add class
|
||||
|
||||
//HTML5 Custom data
|
||||
if (typeof $(this.element).data('title') !== 'undefined') {
|
||||
this.options.title = $(this.element).attr('data-title');
|
||||
}
|
||||
if (typeof $(this.element).data('url') !== 'undefined') {
|
||||
this.options.url = $(this.element).data('url');
|
||||
}
|
||||
if (typeof $(this.element).data('text') !== 'undefined') {
|
||||
this.options.text = $(this.element).data('text');
|
||||
}
|
||||
|
||||
//how many social website have been selected
|
||||
$.each(this.options.share, function(name, val) {
|
||||
if (val === true) {
|
||||
self.options.shareTotal++;
|
||||
}
|
||||
});
|
||||
|
||||
if (self.options.enableCounter === true) { //if for some reason you don't need counter
|
||||
//get count of social share that have been selected
|
||||
$.each(this.options.share, function(name, val) {
|
||||
if (val === true) {
|
||||
//self.getSocialJson(name);
|
||||
try {
|
||||
self.getSocialJson(name);
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
} else if (self.options.template !== '') { //for personalized button (with template)
|
||||
this.options.render(this, this.options);
|
||||
} else { // if you want to use official button like example 3 or 5
|
||||
this.loadButtons();
|
||||
}
|
||||
|
||||
//add hover event
|
||||
$(this.element).hover(function() {
|
||||
//load social button if enable and 1 time
|
||||
if ($(this).find('.buttons').length === 0 && self.options.enableHover === true) {
|
||||
self.loadButtons();
|
||||
}
|
||||
self.options.hover(self, self.options);
|
||||
}, function() {
|
||||
self.options.hide(self, self.options);
|
||||
});
|
||||
|
||||
//click event
|
||||
$(this.element).click(function() {
|
||||
self.options.click(self, self.options);
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
/* loadButtons methode
|
||||
================================================== */
|
||||
Plugin.prototype.loadButtons = function() {
|
||||
var self = this;
|
||||
$(this.element).append('<div class="buttons"></div>');
|
||||
$.each(self.options.share, function(name, val) {
|
||||
if (val == true) {
|
||||
loadButton[name](self);
|
||||
if (self.options.enableTracking === true) { //add tracking
|
||||
tracking[name]();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* getSocialJson methode
|
||||
================================================== */
|
||||
Plugin.prototype.getSocialJson = function(name) {
|
||||
var self = this,
|
||||
count = 0,
|
||||
url = urlJson[name].replace('{url}', encodeURIComponent(this.options.url));
|
||||
if (this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== '') {
|
||||
url = urlJson[name].replace('{url}', this.options.buttons[name].url);
|
||||
}
|
||||
//console.log('name : ' + name + ' - url : '+url); //debug
|
||||
if (url != '' && self.options.urlCurl !== '') { //urlCurl = '' if you don't want to used PHP script but used social button
|
||||
$.getJSON(url, function(json) {
|
||||
if (typeof json.count !== "undefined") { //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg
|
||||
var temp = json.count + '';
|
||||
temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars
|
||||
count += parseInt(temp, 10);
|
||||
}
|
||||
//get the FB total count (shares, likes and more)
|
||||
else if (json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined") { //Facebook total count
|
||||
count += parseInt(json.data[0].total_count, 10);
|
||||
} else if (typeof json[0] !== "undefined") { //Delicious
|
||||
count += parseInt(json[0].total_posts, 10);
|
||||
} else if (typeof json[0] !== "undefined") { //Stumbleupon
|
||||
}
|
||||
self.options.count[name] = count;
|
||||
self.options.total += count;
|
||||
self.renderer();
|
||||
self.rendererPerso();
|
||||
//console.log(json); //debug
|
||||
})
|
||||
.error(function() {
|
||||
self.options.count[name] = 0;
|
||||
self.rendererPerso();
|
||||
});
|
||||
} else {
|
||||
self.renderer();
|
||||
self.options.count[name] = 0;
|
||||
self.rendererPerso();
|
||||
}
|
||||
};
|
||||
|
||||
/* launch render methode
|
||||
================================================== */
|
||||
Plugin.prototype.rendererPerso = function() {
|
||||
//check if this is the last social website to launch render
|
||||
var shareCount = 0;
|
||||
for (e in this.options.count) {
|
||||
shareCount++;
|
||||
}
|
||||
if (shareCount === this.options.shareTotal) {
|
||||
this.options.render(this, this.options);
|
||||
}
|
||||
};
|
||||
|
||||
/* render methode
|
||||
================================================== */
|
||||
Plugin.prototype.renderer = function() {
|
||||
var total = this.options.total,
|
||||
template = this.options.template;
|
||||
if (this.options.shorterTotal === true) { //format number like 1.2k or 5M
|
||||
total = this.shorterTotal(total);
|
||||
}
|
||||
|
||||
if (template !== '') { //if there is a template
|
||||
template = template.replace('{total}', total);
|
||||
$(this.element).html(template);
|
||||
} else { //template by defaults
|
||||
$(this.element).html(
|
||||
'<div class="box"><a class="count" href="#">' + total + '</a>' +
|
||||
(this.options.title !== '' ? '<a class="share" href="#">' + this.options.title + '</a>' : '') +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/* format total numbers like 1.2k or 5M
|
||||
================================================== */
|
||||
Plugin.prototype.shorterTotal = function(num) {
|
||||
if (num >= 1e6) {
|
||||
num = (num / 1e6).toFixed(2) + "M"
|
||||
} else if (num >= 1e3) {
|
||||
num = (num / 1e3).toFixed(1) + "k"
|
||||
}
|
||||
return num;
|
||||
};
|
||||
|
||||
/* Methode for open popup
|
||||
================================================== */
|
||||
Plugin.prototype.openPopup = function(site) {
|
||||
popup[site](this.options); //open
|
||||
if (this.options.enableTracking === true) { //tracking!
|
||||
var tracking = {
|
||||
googlePlus: {
|
||||
site: 'Google',
|
||||
action: '+1'
|
||||
},
|
||||
facebook: {
|
||||
site: 'facebook',
|
||||
action: 'like'
|
||||
},
|
||||
twitter: {
|
||||
site: 'twitter',
|
||||
action: 'tweet'
|
||||
},
|
||||
digg: {
|
||||
site: 'digg',
|
||||
action: 'add'
|
||||
},
|
||||
delicious: {
|
||||
site: 'delicious',
|
||||
action: 'add'
|
||||
},
|
||||
stumbleupon: {
|
||||
site: 'stumbleupon',
|
||||
action: 'add'
|
||||
},
|
||||
linkedin: {
|
||||
site: 'linkedin',
|
||||
action: 'share'
|
||||
},
|
||||
pinterest: {
|
||||
site: 'pinterest',
|
||||
action: 'pin'
|
||||
}
|
||||
};
|
||||
_gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]);
|
||||
}
|
||||
};
|
||||
|
||||
/* Methode for add +1 to a counter
|
||||
================================================== */
|
||||
Plugin.prototype.simulateClick = function() {
|
||||
var html = $(this.element).html();
|
||||
$(this.element).html(html.replace(this.options.total, this.options.total + 1));
|
||||
};
|
||||
|
||||
/* Methode for add +1 to a counter
|
||||
================================================== */
|
||||
Plugin.prototype.update = function(url, text) {
|
||||
if (url !== '') {
|
||||
this.options.url = url;
|
||||
}
|
||||
if (text !== '') {
|
||||
this.options.text = text;
|
||||
}
|
||||
};
|
||||
|
||||
/* A really lightweight plugin wrapper around the constructor, preventing against multiple instantiations
|
||||
================================================== */
|
||||
$.fn[pluginName] = function(options) {
|
||||
var args = arguments;
|
||||
if (options === undefined || typeof options === 'object') {
|
||||
return this.each(function() {
|
||||
if (!$.data(this, 'plugin_' + pluginName)) {
|
||||
$.data(this, 'plugin_' + pluginName, new Plugin(this, options));
|
||||
}
|
||||
});
|
||||
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
|
||||
return this.each(function() {
|
||||
var instance = $.data(this, 'plugin_' + pluginName);
|
||||
if (instance instanceof Plugin && typeof instance[options] === 'function') {
|
||||
instance[options].apply(instance, Array.prototype.slice.call(args, 1));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
})(jQuery, window, document);
|
||||
Vendored
+900
@@ -0,0 +1,900 @@
|
||||
/*! nouislider - 9.1.0 - 2016-12-10 16:00:32 */
|
||||
|
||||
! function(a) {
|
||||
"function" == typeof define && define.amd ? define([], a) : "object" == typeof exports ? module.exports = a() : window.noUiSlider = a()
|
||||
}(function() {
|
||||
"use strict";
|
||||
|
||||
function a(a, b) {
|
||||
var c = document.createElement("div");
|
||||
return j(c, b), a.appendChild(c), c
|
||||
}
|
||||
|
||||
function b(a) {
|
||||
return a.filter(function(a) {
|
||||
return !this[a] && (this[a] = !0)
|
||||
}, {})
|
||||
}
|
||||
|
||||
function c(a, b) {
|
||||
return Math.round(a / b) * b
|
||||
}
|
||||
|
||||
function d(a, b) {
|
||||
var c = a.getBoundingClientRect(),
|
||||
d = a.ownerDocument,
|
||||
e = d.documentElement,
|
||||
f = m();
|
||||
return /webkit.*Chrome.*Mobile/i.test(navigator.userAgent) && (f.x = 0), b ? c.top + f.y - e.clientTop : c.left + f.x - e.clientLeft
|
||||
}
|
||||
|
||||
function e(a) {
|
||||
return "number" == typeof a && !isNaN(a) && isFinite(a)
|
||||
}
|
||||
|
||||
function f(a, b, c) {
|
||||
c > 0 && (j(a, b), setTimeout(function() {
|
||||
k(a, b)
|
||||
}, c))
|
||||
}
|
||||
|
||||
function g(a) {
|
||||
return Math.max(Math.min(a, 100), 0)
|
||||
}
|
||||
|
||||
function h(a) {
|
||||
return Array.isArray(a) ? a : [a]
|
||||
}
|
||||
|
||||
function i(a) {
|
||||
a = String(a);
|
||||
var b = a.split(".");
|
||||
return b.length > 1 ? b[1].length : 0
|
||||
}
|
||||
|
||||
function j(a, b) {
|
||||
a.classList ? a.classList.add(b) : a.className += " " + b
|
||||
}
|
||||
|
||||
function k(a, b) {
|
||||
a.classList ? a.classList.remove(b) : a.className = a.className.replace(new RegExp("(^|\\b)" + b.split(" ").join("|") + "(\\b|$)", "gi"), " ")
|
||||
}
|
||||
|
||||
function l(a, b) {
|
||||
return a.classList ? a.classList.contains(b) : new RegExp("\\b" + b + "\\b").test(a.className)
|
||||
}
|
||||
|
||||
function m() {
|
||||
var a = void 0 !== window.pageXOffset,
|
||||
b = "CSS1Compat" === (document.compatMode || ""),
|
||||
c = a ? window.pageXOffset : b ? document.documentElement.scrollLeft : document.body.scrollLeft,
|
||||
d = a ? window.pageYOffset : b ? document.documentElement.scrollTop : document.body.scrollTop;
|
||||
return {
|
||||
x: c,
|
||||
y: d
|
||||
}
|
||||
}
|
||||
|
||||
function n() {
|
||||
return window.navigator.pointerEnabled ? {
|
||||
start: "pointerdown",
|
||||
move: "pointermove",
|
||||
end: "pointerup"
|
||||
} : window.navigator.msPointerEnabled ? {
|
||||
start: "MSPointerDown",
|
||||
move: "MSPointerMove",
|
||||
end: "MSPointerUp"
|
||||
} : {
|
||||
start: "mousedown touchstart",
|
||||
move: "mousemove touchmove",
|
||||
end: "mouseup touchend"
|
||||
}
|
||||
}
|
||||
|
||||
function o(a, b) {
|
||||
return 100 / (b - a)
|
||||
}
|
||||
|
||||
function p(a, b) {
|
||||
return 100 * b / (a[1] - a[0])
|
||||
}
|
||||
|
||||
function q(a, b) {
|
||||
return p(a, a[0] < 0 ? b + Math.abs(a[0]) : b - a[0])
|
||||
}
|
||||
|
||||
function r(a, b) {
|
||||
return b * (a[1] - a[0]) / 100 + a[0]
|
||||
}
|
||||
|
||||
function s(a, b) {
|
||||
for (var c = 1; a >= b[c];) c += 1;
|
||||
return c
|
||||
}
|
||||
|
||||
function t(a, b, c) {
|
||||
if (c >= a.slice(-1)[0]) return 100;
|
||||
var d, e, f, g, h = s(c, a);
|
||||
return d = a[h - 1], e = a[h], f = b[h - 1], g = b[h], f + q([d, e], c) / o(f, g)
|
||||
}
|
||||
|
||||
function u(a, b, c) {
|
||||
if (c >= 100) return a.slice(-1)[0];
|
||||
var d, e, f, g, h = s(c, b);
|
||||
return d = a[h - 1], e = a[h], f = b[h - 1], g = b[h], r([d, e], (c - f) * o(f, g))
|
||||
}
|
||||
|
||||
function v(a, b, d, e) {
|
||||
if (100 === e) return e;
|
||||
var f, g, h = s(e, a);
|
||||
return d ? (f = a[h - 1], g = a[h], e - f > (g - f) / 2 ? g : f) : b[h - 1] ? a[h - 1] + c(e - a[h - 1], b[h - 1]) : e
|
||||
}
|
||||
|
||||
function w(a, b, c) {
|
||||
var d;
|
||||
if ("number" == typeof b && (b = [b]), "[object Array]" !== Object.prototype.toString.call(b)) throw new Error("noUiSlider: 'range' contains invalid value.");
|
||||
if (d = "min" === a ? 0 : "max" === a ? 100 : parseFloat(a), !e(d) || !e(b[0])) throw new Error("noUiSlider: 'range' value isn't numeric.");
|
||||
c.xPct.push(d), c.xVal.push(b[0]), d ? c.xSteps.push(!isNaN(b[1]) && b[1]) : isNaN(b[1]) || (c.xSteps[0] = b[1]), c.xHighestCompleteStep.push(0)
|
||||
}
|
||||
|
||||
function x(a, b, c) {
|
||||
if (!b) return !0;
|
||||
c.xSteps[a] = p([c.xVal[a], c.xVal[a + 1]], b) / o(c.xPct[a], c.xPct[a + 1]);
|
||||
var d = (c.xVal[a + 1] - c.xVal[a]) / c.xNumSteps[a],
|
||||
e = Math.ceil(Number(d.toFixed(3)) - 1),
|
||||
f = c.xVal[a] + c.xNumSteps[a] * e;
|
||||
c.xHighestCompleteStep[a] = f
|
||||
}
|
||||
|
||||
function y(a, b, c, d) {
|
||||
this.xPct = [], this.xVal = [], this.xSteps = [d || !1], this.xNumSteps = [!1], this.xHighestCompleteStep = [], this.snap = b, this.direction = c;
|
||||
var e, f = [];
|
||||
for (e in a) a.hasOwnProperty(e) && f.push([a[e], e]);
|
||||
for (f.length && "object" == typeof f[0][0] ? f.sort(function(a, b) {
|
||||
return a[0][0] - b[0][0]
|
||||
}) : f.sort(function(a, b) {
|
||||
return a[0] - b[0]
|
||||
}), e = 0; e < f.length; e++) w(f[e][1], f[e][0], this);
|
||||
for (this.xNumSteps = this.xSteps.slice(0), e = 0; e < this.xNumSteps.length; e++) x(e, this.xNumSteps[e], this)
|
||||
}
|
||||
|
||||
function z(a, b) {
|
||||
if (!e(b)) throw new Error("noUiSlider: 'step' is not numeric.");
|
||||
a.singleStep = b
|
||||
}
|
||||
|
||||
function A(a, b) {
|
||||
if ("object" != typeof b || Array.isArray(b)) throw new Error("noUiSlider: 'range' is not an object.");
|
||||
if (void 0 === b.min || void 0 === b.max) throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");
|
||||
if (b.min === b.max) throw new Error("noUiSlider: 'range' 'min' and 'max' cannot be equal.");
|
||||
a.spectrum = new y(b, a.snap, a.dir, a.singleStep)
|
||||
}
|
||||
|
||||
function B(a, b) {
|
||||
if (b = h(b), !Array.isArray(b) || !b.length) throw new Error("noUiSlider: 'start' option is incorrect.");
|
||||
a.handles = b.length, a.start = b
|
||||
}
|
||||
|
||||
function C(a, b) {
|
||||
if (a.snap = b, "boolean" != typeof b) throw new Error("noUiSlider: 'snap' option must be a boolean.")
|
||||
}
|
||||
|
||||
function D(a, b) {
|
||||
if (a.animate = b, "boolean" != typeof b) throw new Error("noUiSlider: 'animate' option must be a boolean.")
|
||||
}
|
||||
|
||||
function E(a, b) {
|
||||
if (a.animationDuration = b, "number" != typeof b) throw new Error("noUiSlider: 'animationDuration' option must be a number.")
|
||||
}
|
||||
|
||||
function F(a, b) {
|
||||
var c, d = [!1];
|
||||
if ("lower" === b ? b = [!0, !1] : "upper" === b && (b = [!1, !0]), b === !0 || b === !1) {
|
||||
for (c = 1; c < a.handles; c++) d.push(b);
|
||||
d.push(!1)
|
||||
} else {
|
||||
if (!Array.isArray(b) || !b.length || b.length !== a.handles + 1) throw new Error("noUiSlider: 'connect' option doesn't match handle count.");
|
||||
d = b
|
||||
}
|
||||
a.connect = d
|
||||
}
|
||||
|
||||
function G(a, b) {
|
||||
switch (b) {
|
||||
case "horizontal":
|
||||
a.ort = 0;
|
||||
break;
|
||||
case "vertical":
|
||||
a.ort = 1;
|
||||
break;
|
||||
default:
|
||||
throw new Error("noUiSlider: 'orientation' option is invalid.")
|
||||
}
|
||||
}
|
||||
|
||||
function H(a, b) {
|
||||
if (!e(b)) throw new Error("noUiSlider: 'margin' option must be numeric.");
|
||||
if (0 !== b && (a.margin = a.spectrum.getMargin(b), !a.margin)) throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.")
|
||||
}
|
||||
|
||||
function I(a, b) {
|
||||
if (!e(b)) throw new Error("noUiSlider: 'limit' option must be numeric.");
|
||||
if (a.limit = a.spectrum.getMargin(b), !a.limit || a.handles < 2) throw new Error("noUiSlider: 'limit' option is only supported on linear sliders with 2 or more handles.")
|
||||
}
|
||||
|
||||
function J(a, b) {
|
||||
if (!e(b)) throw new Error("noUiSlider: 'padding' option must be numeric.");
|
||||
if (0 !== b) {
|
||||
if (a.padding = a.spectrum.getMargin(b), !a.padding) throw new Error("noUiSlider: 'padding' option is only supported on linear sliders.");
|
||||
if (a.padding < 0) throw new Error("noUiSlider: 'padding' option must be a positive number.");
|
||||
if (a.padding >= 50) throw new Error("noUiSlider: 'padding' option must be less than half the range.")
|
||||
}
|
||||
}
|
||||
|
||||
function K(a, b) {
|
||||
switch (b) {
|
||||
case "ltr":
|
||||
a.dir = 0;
|
||||
break;
|
||||
case "rtl":
|
||||
a.dir = 1;
|
||||
break;
|
||||
default:
|
||||
throw new Error("noUiSlider: 'direction' option was not recognized.")
|
||||
}
|
||||
}
|
||||
|
||||
function L(a, b) {
|
||||
if ("string" != typeof b) throw new Error("noUiSlider: 'behaviour' must be a string containing options.");
|
||||
var c = b.indexOf("tap") >= 0,
|
||||
d = b.indexOf("drag") >= 0,
|
||||
e = b.indexOf("fixed") >= 0,
|
||||
f = b.indexOf("snap") >= 0,
|
||||
g = b.indexOf("hover") >= 0;
|
||||
if (e) {
|
||||
if (2 !== a.handles) throw new Error("noUiSlider: 'fixed' behaviour must be used with 2 handles");
|
||||
H(a, a.start[1] - a.start[0])
|
||||
}
|
||||
a.events = {
|
||||
tap: c || f,
|
||||
drag: d,
|
||||
fixed: e,
|
||||
snap: f,
|
||||
hover: g
|
||||
}
|
||||
}
|
||||
|
||||
function M(a, b) {
|
||||
if (b !== !1)
|
||||
if (b === !0) {
|
||||
a.tooltips = [];
|
||||
for (var c = 0; c < a.handles; c++) a.tooltips.push(!0)
|
||||
} else {
|
||||
if (a.tooltips = h(b), a.tooltips.length !== a.handles) throw new Error("noUiSlider: must pass a formatter for all handles.");
|
||||
a.tooltips.forEach(function(a) {
|
||||
if ("boolean" != typeof a && ("object" != typeof a || "function" != typeof a.to)) throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function N(a, b) {
|
||||
if (a.format = b, "function" == typeof b.to && "function" == typeof b.from) return !0;
|
||||
throw new Error("noUiSlider: 'format' requires 'to' and 'from' methods.")
|
||||
}
|
||||
|
||||
function O(a, b) {
|
||||
if (void 0 !== b && "string" != typeof b && b !== !1) throw new Error("noUiSlider: 'cssPrefix' must be a string or `false`.");
|
||||
a.cssPrefix = b
|
||||
}
|
||||
|
||||
function P(a, b) {
|
||||
if (void 0 !== b && "object" != typeof b) throw new Error("noUiSlider: 'cssClasses' must be an object.");
|
||||
if ("string" == typeof a.cssPrefix) {
|
||||
a.cssClasses = {};
|
||||
for (var c in b) b.hasOwnProperty(c) && (a.cssClasses[c] = a.cssPrefix + b[c])
|
||||
} else a.cssClasses = b
|
||||
}
|
||||
|
||||
function Q(a, b) {
|
||||
if (b !== !0 && b !== !1) throw new Error("noUiSlider: 'useRequestAnimationFrame' option should be true (default) or false.");
|
||||
a.useRequestAnimationFrame = b
|
||||
}
|
||||
|
||||
function R(a) {
|
||||
var b = {
|
||||
margin: 0,
|
||||
limit: 0,
|
||||
padding: 0,
|
||||
animate: !0,
|
||||
animationDuration: 300,
|
||||
format: U
|
||||
},
|
||||
c = {
|
||||
step: {
|
||||
r: !1,
|
||||
t: z
|
||||
},
|
||||
start: {
|
||||
r: !0,
|
||||
t: B
|
||||
},
|
||||
connect: {
|
||||
r: !0,
|
||||
t: F
|
||||
},
|
||||
direction: {
|
||||
r: !0,
|
||||
t: K
|
||||
},
|
||||
snap: {
|
||||
r: !1,
|
||||
t: C
|
||||
},
|
||||
animate: {
|
||||
r: !1,
|
||||
t: D
|
||||
},
|
||||
animationDuration: {
|
||||
r: !1,
|
||||
t: E
|
||||
},
|
||||
range: {
|
||||
r: !0,
|
||||
t: A
|
||||
},
|
||||
orientation: {
|
||||
r: !1,
|
||||
t: G
|
||||
},
|
||||
margin: {
|
||||
r: !1,
|
||||
t: H
|
||||
},
|
||||
limit: {
|
||||
r: !1,
|
||||
t: I
|
||||
},
|
||||
padding: {
|
||||
r: !1,
|
||||
t: J
|
||||
},
|
||||
behaviour: {
|
||||
r: !0,
|
||||
t: L
|
||||
},
|
||||
format: {
|
||||
r: !1,
|
||||
t: N
|
||||
},
|
||||
tooltips: {
|
||||
r: !1,
|
||||
t: M
|
||||
},
|
||||
cssPrefix: {
|
||||
r: !1,
|
||||
t: O
|
||||
},
|
||||
cssClasses: {
|
||||
r: !1,
|
||||
t: P
|
||||
},
|
||||
useRequestAnimationFrame: {
|
||||
r: !1,
|
||||
t: Q
|
||||
}
|
||||
},
|
||||
d = {
|
||||
connect: !1,
|
||||
direction: "ltr",
|
||||
behaviour: "tap",
|
||||
orientation: "horizontal",
|
||||
cssPrefix: "noUi-",
|
||||
cssClasses: {
|
||||
target: "target",
|
||||
base: "base",
|
||||
origin: "origin",
|
||||
handle: "handle",
|
||||
handleLower: "handle-lower",
|
||||
handleUpper: "handle-upper",
|
||||
horizontal: "horizontal",
|
||||
vertical: "vertical",
|
||||
background: "background",
|
||||
connect: "connect",
|
||||
ltr: "ltr",
|
||||
rtl: "rtl",
|
||||
draggable: "draggable",
|
||||
drag: "state-drag",
|
||||
tap: "state-tap",
|
||||
active: "active",
|
||||
tooltip: "tooltip",
|
||||
pips: "pips",
|
||||
pipsHorizontal: "pips-horizontal",
|
||||
pipsVertical: "pips-vertical",
|
||||
marker: "marker",
|
||||
markerHorizontal: "marker-horizontal",
|
||||
markerVertical: "marker-vertical",
|
||||
markerNormal: "marker-normal",
|
||||
markerLarge: "marker-large",
|
||||
markerSub: "marker-sub",
|
||||
value: "value",
|
||||
valueHorizontal: "value-horizontal",
|
||||
valueVertical: "value-vertical",
|
||||
valueNormal: "value-normal",
|
||||
valueLarge: "value-large",
|
||||
valueSub: "value-sub"
|
||||
},
|
||||
useRequestAnimationFrame: !0
|
||||
};
|
||||
Object.keys(c).forEach(function(e) {
|
||||
if (void 0 === a[e] && void 0 === d[e]) {
|
||||
if (c[e].r) throw new Error("noUiSlider: '" + e + "' is required.");
|
||||
return !0
|
||||
}
|
||||
c[e].t(b, void 0 === a[e] ? d[e] : a[e])
|
||||
}), b.pips = a.pips;
|
||||
var e = [
|
||||
["left", "top"],
|
||||
["right", "bottom"]
|
||||
];
|
||||
return b.style = e[b.dir][b.ort], b.styleOposite = e[b.dir ? 0 : 1][b.ort], b
|
||||
}
|
||||
|
||||
function S(c, e, i) {
|
||||
function o(b, c) {
|
||||
var d = a(b, e.cssClasses.origin),
|
||||
f = a(d, e.cssClasses.handle);
|
||||
return f.setAttribute("data-handle", c), 0 === c ? j(f, e.cssClasses.handleLower) : c === e.handles - 1 && j(f, e.cssClasses.handleUpper), d
|
||||
}
|
||||
|
||||
function p(b, c) {
|
||||
return !!c && a(b, e.cssClasses.connect)
|
||||
}
|
||||
|
||||
function q(a, b) {
|
||||
ba = [], ca = [], ca.push(p(b, a[0]));
|
||||
for (var c = 0; c < e.handles; c++) ba.push(o(b, c)), ha[c] = c, ca.push(p(b, a[c + 1]))
|
||||
}
|
||||
|
||||
function r(b) {
|
||||
j(b, e.cssClasses.target), 0 === e.dir ? j(b, e.cssClasses.ltr) : j(b, e.cssClasses.rtl), 0 === e.ort ? j(b, e.cssClasses.horizontal) : j(b, e.cssClasses.vertical), aa = a(b, e.cssClasses.base)
|
||||
}
|
||||
|
||||
function s(b, c) {
|
||||
return !!e.tooltips[c] && a(b.firstChild, e.cssClasses.tooltip)
|
||||
}
|
||||
|
||||
function t() {
|
||||
var a = ba.map(s);
|
||||
Z("update", function(b, c, d) {
|
||||
if (a[c]) {
|
||||
var f = b[c];
|
||||
e.tooltips[c] !== !0 && (f = e.tooltips[c].to(d[c])), a[c].innerHTML = f
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function u(a, b, c) {
|
||||
if ("range" === a || "steps" === a) return ja.xVal;
|
||||
if ("count" === a) {
|
||||
var d, e = 100 / (b - 1),
|
||||
f = 0;
|
||||
for (b = [];
|
||||
(d = f++ * e) <= 100;) b.push(d);
|
||||
a = "positions"
|
||||
}
|
||||
return "positions" === a ? b.map(function(a) {
|
||||
return ja.fromStepping(c ? ja.getStep(a) : a)
|
||||
}) : "values" === a ? c ? b.map(function(a) {
|
||||
return ja.fromStepping(ja.getStep(ja.toStepping(a)))
|
||||
}) : b : void 0
|
||||
}
|
||||
|
||||
function v(a, c, d) {
|
||||
function e(a, b) {
|
||||
return (a + b).toFixed(7) / 1
|
||||
}
|
||||
var f = {},
|
||||
g = ja.xVal[0],
|
||||
h = ja.xVal[ja.xVal.length - 1],
|
||||
i = !1,
|
||||
j = !1,
|
||||
k = 0;
|
||||
return d = b(d.slice().sort(function(a, b) {
|
||||
return a - b
|
||||
})), d[0] !== g && (d.unshift(g), i = !0), d[d.length - 1] !== h && (d.push(h), j = !0), d.forEach(function(b, g) {
|
||||
var h, l, m, n, o, p, q, r, s, t, u = b,
|
||||
v = d[g + 1];
|
||||
if ("steps" === c && (h = ja.xNumSteps[g]), h || (h = v - u), u !== !1 && void 0 !== v)
|
||||
for (h = Math.max(h, 1e-7), l = u; l <= v; l = e(l, h)) {
|
||||
for (n = ja.toStepping(l), o = n - k, r = o / a, s = Math.round(r), t = o / s, m = 1; m <= s; m += 1) p = k + m * t, f[p.toFixed(5)] = ["x", 0];
|
||||
q = d.indexOf(l) > -1 ? 1 : "steps" === c ? 2 : 0, !g && i && (q = 0), l === v && j || (f[n.toFixed(5)] = [l, q]), k = n
|
||||
}
|
||||
}), f
|
||||
}
|
||||
|
||||
function w(a, b, c) {
|
||||
function d(a, b) {
|
||||
var c = b === e.cssClasses.value,
|
||||
d = c ? m : n,
|
||||
f = c ? k : l;
|
||||
return b + " " + d[e.ort] + " " + f[a]
|
||||
}
|
||||
|
||||
function f(a, b, c) {
|
||||
return 'class="' + d(c[1], b) + '" style="' + e.style + ": " + a + '%"'
|
||||
}
|
||||
|
||||
function g(a, d) {
|
||||
d[1] = d[1] && b ? b(d[0], d[1]) : d[1], i += "<div " + f(a, e.cssClasses.marker, d) + "></div>", d[1] && (i += "<div " + f(a, e.cssClasses.value, d) + ">" + c.to(d[0]) + "</div>")
|
||||
}
|
||||
var h = document.createElement("div"),
|
||||
i = "",
|
||||
k = [e.cssClasses.valueNormal, e.cssClasses.valueLarge, e.cssClasses.valueSub],
|
||||
l = [e.cssClasses.markerNormal, e.cssClasses.markerLarge, e.cssClasses.markerSub],
|
||||
m = [e.cssClasses.valueHorizontal, e.cssClasses.valueVertical],
|
||||
n = [e.cssClasses.markerHorizontal, e.cssClasses.markerVertical];
|
||||
return j(h, e.cssClasses.pips), j(h, 0 === e.ort ? e.cssClasses.pipsHorizontal : e.cssClasses.pipsVertical), Object.keys(a).forEach(function(b) {
|
||||
g(b, a[b])
|
||||
}), h.innerHTML = i, h
|
||||
}
|
||||
|
||||
function x(a) {
|
||||
var b = a.mode,
|
||||
c = a.density || 1,
|
||||
d = a.filter || !1,
|
||||
e = a.values || !1,
|
||||
f = a.stepped || !1,
|
||||
g = u(b, e, f),
|
||||
h = v(c, b, g),
|
||||
i = a.format || {
|
||||
to: Math.round
|
||||
};
|
||||
return fa.appendChild(w(h, d, i))
|
||||
}
|
||||
|
||||
function y() {
|
||||
var a = aa.getBoundingClientRect(),
|
||||
b = "offset" + ["Width", "Height"][e.ort];
|
||||
return 0 === e.ort ? a.width || aa[b] : a.height || aa[b]
|
||||
}
|
||||
|
||||
function z(a, b, c, d) {
|
||||
var f = function(b) {
|
||||
return !fa.hasAttribute("disabled") && (!l(fa, e.cssClasses.tap) && (!!(b = A(b, d.pageOffset)) && (!(a === ea.start && void 0 !== b.buttons && b.buttons > 1) && ((!d.hover || !b.buttons) && (b.calcPoint = b.points[e.ort], void c(b, d))))))
|
||||
},
|
||||
g = [];
|
||||
return a.split(" ").forEach(function(a) {
|
||||
b.addEventListener(a, f, !1), g.push([a, f])
|
||||
}), g
|
||||
}
|
||||
|
||||
function A(a, b) {
|
||||
a.preventDefault();
|
||||
var c, d, e = 0 === a.type.indexOf("touch"),
|
||||
f = 0 === a.type.indexOf("mouse"),
|
||||
g = 0 === a.type.indexOf("pointer");
|
||||
if (0 === a.type.indexOf("MSPointer") && (g = !0), e) {
|
||||
if (a.touches.length > 1) return !1;
|
||||
c = a.changedTouches[0].pageX, d = a.changedTouches[0].pageY
|
||||
}
|
||||
return b = b || m(), (f || g) && (c = a.clientX + b.x, d = a.clientY + b.y), a.pageOffset = b, a.points = [c, d], a.cursor = f || g, a
|
||||
}
|
||||
|
||||
function B(a) {
|
||||
var b = a - d(aa, e.ort),
|
||||
c = 100 * b / y();
|
||||
return e.dir ? 100 - c : c
|
||||
}
|
||||
|
||||
function C(a) {
|
||||
var b = 100,
|
||||
c = !1;
|
||||
return ba.forEach(function(d, e) {
|
||||
if (!d.hasAttribute("disabled")) {
|
||||
var f = Math.abs(ga[e] - a);
|
||||
f < b && (c = e, b = f)
|
||||
}
|
||||
}), c
|
||||
}
|
||||
|
||||
function D(a, b, c, d) {
|
||||
var e = c.slice(),
|
||||
f = [!a, a],
|
||||
g = [a, !a];
|
||||
d = d.slice(), a && d.reverse(), d.length > 1 ? d.forEach(function(a, c) {
|
||||
var d = M(e, a, e[a] + b, f[c], g[c]);
|
||||
d === !1 ? b = 0 : (b = d - e[a], e[a] = d)
|
||||
}) : f = g = [!0];
|
||||
var h = !1;
|
||||
d.forEach(function(a, d) {
|
||||
h = Q(a, c[a] + b, f[d], g[d]) || h
|
||||
}), h && d.forEach(function(a) {
|
||||
E("update", a), E("slide", a)
|
||||
})
|
||||
}
|
||||
|
||||
function E(a, b, c) {
|
||||
Object.keys(la).forEach(function(d) {
|
||||
var f = d.split(".")[0];
|
||||
a === f && la[d].forEach(function(a) {
|
||||
a.call(da, ka.map(e.format.to), b, ka.slice(), c || !1, ga.slice())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function F(a, b) {
|
||||
"mouseout" === a.type && "HTML" === a.target.nodeName && null === a.relatedTarget && H(a, b)
|
||||
}
|
||||
|
||||
function G(a, b) {
|
||||
if (navigator.appVersion.indexOf("MSIE 9") === -1 && 0 === a.buttons && 0 !== b.buttonsProperty) return H(a, b);
|
||||
var c = (e.dir ? -1 : 1) * (a.calcPoint - b.startCalcPoint),
|
||||
d = 100 * c / b.baseSize;
|
||||
D(c > 0, d, b.locations, b.handleNumbers)
|
||||
}
|
||||
|
||||
function H(a, b) {
|
||||
ia && (k(ia, e.cssClasses.active), ia = !1), a.cursor && (document.body.style.cursor = "", document.body.removeEventListener("selectstart", document.body.noUiListener)), document.documentElement.noUiListeners.forEach(function(a) {
|
||||
document.documentElement.removeEventListener(a[0], a[1])
|
||||
}), k(fa, e.cssClasses.drag), P(), b.handleNumbers.forEach(function(a) {
|
||||
E("set", a), E("change", a), E("end", a)
|
||||
})
|
||||
}
|
||||
|
||||
function I(a, b) {
|
||||
if (1 === b.handleNumbers.length) {
|
||||
var c = ba[b.handleNumbers[0]];
|
||||
if (c.hasAttribute("disabled")) return !1;
|
||||
ia = c.children[0], j(ia, e.cssClasses.active)
|
||||
}
|
||||
a.preventDefault(), a.stopPropagation();
|
||||
var d = z(ea.move, document.documentElement, G, {
|
||||
startCalcPoint: a.calcPoint,
|
||||
baseSize: y(),
|
||||
pageOffset: a.pageOffset,
|
||||
handleNumbers: b.handleNumbers,
|
||||
buttonsProperty: a.buttons,
|
||||
locations: ga.slice()
|
||||
}),
|
||||
f = z(ea.end, document.documentElement, H, {
|
||||
handleNumbers: b.handleNumbers
|
||||
}),
|
||||
g = z("mouseout", document.documentElement, F, {
|
||||
handleNumbers: b.handleNumbers
|
||||
});
|
||||
if (document.documentElement.noUiListeners = d.concat(f, g), a.cursor) {
|
||||
document.body.style.cursor = getComputedStyle(a.target).cursor, ba.length > 1 && j(fa, e.cssClasses.drag);
|
||||
var h = function() {
|
||||
return !1
|
||||
};
|
||||
document.body.noUiListener = h, document.body.addEventListener("selectstart", h, !1)
|
||||
}
|
||||
b.handleNumbers.forEach(function(a) {
|
||||
E("start", a)
|
||||
})
|
||||
}
|
||||
|
||||
function J(a) {
|
||||
a.stopPropagation();
|
||||
var b = B(a.calcPoint),
|
||||
c = C(b);
|
||||
return c !== !1 && (e.events.snap || f(fa, e.cssClasses.tap, e.animationDuration), Q(c, b, !0, !0), P(), E("slide", c, !0), E("set", c, !0), E("change", c, !0), E("update", c, !0), void(e.events.snap && I(a, {
|
||||
handleNumbers: [c]
|
||||
})))
|
||||
}
|
||||
|
||||
function K(a) {
|
||||
var b = B(a.calcPoint),
|
||||
c = ja.getStep(b),
|
||||
d = ja.fromStepping(c);
|
||||
Object.keys(la).forEach(function(a) {
|
||||
"hover" === a.split(".")[0] && la[a].forEach(function(a) {
|
||||
a.call(da, d)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function L(a) {
|
||||
a.fixed || ba.forEach(function(a, b) {
|
||||
z(ea.start, a.children[0], I, {
|
||||
handleNumbers: [b]
|
||||
})
|
||||
}), a.tap && z(ea.start, aa, J, {}), a.hover && z(ea.move, aa, K, {
|
||||
hover: !0
|
||||
}), a.drag && ca.forEach(function(b, c) {
|
||||
if (b !== !1 && 0 !== c && c !== ca.length - 1) {
|
||||
var d = ba[c - 1],
|
||||
f = ba[c],
|
||||
g = [b];
|
||||
j(b, e.cssClasses.draggable), a.fixed && (g.push(d.children[0]), g.push(f.children[0])), g.forEach(function(a) {
|
||||
z(ea.start, a, I, {
|
||||
handles: [d, f],
|
||||
handleNumbers: [c - 1, c]
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function M(a, b, c, d, f) {
|
||||
return ba.length > 1 && (d && b > 0 && (c = Math.max(c, a[b - 1] + e.margin)), f && b < ba.length - 1 && (c = Math.min(c, a[b + 1] - e.margin))), ba.length > 1 && e.limit && (d && b > 0 && (c = Math.min(c, a[b - 1] + e.limit)), f && b < ba.length - 1 && (c = Math.max(c, a[b + 1] - e.limit))), e.padding && (0 === b && (c = Math.max(c, e.padding)), b === ba.length - 1 && (c = Math.min(c, 100 - e.padding))), c = ja.getStep(c), c = g(c), c !== a[b] && c
|
||||
}
|
||||
|
||||
function N(a) {
|
||||
return a + "%"
|
||||
}
|
||||
|
||||
function O(a, b) {
|
||||
ga[a] = b, ka[a] = ja.fromStepping(b);
|
||||
var c = function() {
|
||||
ba[a].style[e.style] = N(b), S(a), S(a + 1)
|
||||
};
|
||||
window.requestAnimationFrame && e.useRequestAnimationFrame ? window.requestAnimationFrame(c) : c()
|
||||
}
|
||||
|
||||
function P() {
|
||||
ha.forEach(function(a) {
|
||||
var b = ga[a] > 50 ? -1 : 1,
|
||||
c = 3 + (ba.length + b * a);
|
||||
ba[a].childNodes[0].style.zIndex = c
|
||||
})
|
||||
}
|
||||
|
||||
function Q(a, b, c, d) {
|
||||
return b = M(ga, a, b, c, d), b !== !1 && (O(a, b), !0)
|
||||
}
|
||||
|
||||
function S(a) {
|
||||
if (ca[a]) {
|
||||
var b = 0,
|
||||
c = 100;
|
||||
0 !== a && (b = ga[a - 1]), a !== ca.length - 1 && (c = ga[a]), ca[a].style[e.style] = N(b), ca[a].style[e.styleOposite] = N(100 - c)
|
||||
}
|
||||
}
|
||||
|
||||
function T(a, b) {
|
||||
null !== a && a !== !1 && ("number" == typeof a && (a = String(a)), a = e.format.from(a), a === !1 || isNaN(a) || Q(b, ja.toStepping(a), !1, !1))
|
||||
}
|
||||
|
||||
function U(a, b) {
|
||||
var c = h(a),
|
||||
d = void 0 === ga[0];
|
||||
b = void 0 === b || !!b, c.forEach(T), e.animate && !d && f(fa, e.cssClasses.tap, e.animationDuration), ha.forEach(function(a) {
|
||||
Q(a, ga[a], !0, !1)
|
||||
}), P(), ha.forEach(function(a) {
|
||||
E("update", a), null !== c[a] && b && E("set", a)
|
||||
})
|
||||
}
|
||||
|
||||
function V(a) {
|
||||
U(e.start, a)
|
||||
}
|
||||
|
||||
function W() {
|
||||
var a = ka.map(e.format.to);
|
||||
return 1 === a.length ? a[0] : a
|
||||
}
|
||||
|
||||
function X() {
|
||||
for (var a in e.cssClasses) e.cssClasses.hasOwnProperty(a) && k(fa, e.cssClasses[a]);
|
||||
for (; fa.firstChild;) fa.removeChild(fa.firstChild);
|
||||
delete fa.noUiSlider
|
||||
}
|
||||
|
||||
function Y() {
|
||||
return ga.map(function(a, b) {
|
||||
var c = ja.getNearbySteps(a),
|
||||
d = ka[b],
|
||||
e = c.thisStep.step,
|
||||
f = null;
|
||||
e !== !1 && d + e > c.stepAfter.startValue && (e = c.stepAfter.startValue - d), f = d > c.thisStep.startValue ? c.thisStep.step : c.stepBefore.step !== !1 && d - c.stepBefore.highestStep, 100 === a ? e = null : 0 === a && (f = null);
|
||||
var g = ja.countStepDecimals();
|
||||
return null !== e && e !== !1 && (e = Number(e.toFixed(g))), null !== f && f !== !1 && (f = Number(f.toFixed(g))), [f, e]
|
||||
})
|
||||
}
|
||||
|
||||
function Z(a, b) {
|
||||
la[a] = la[a] || [], la[a].push(b), "update" === a.split(".")[0] && ba.forEach(function(a, b) {
|
||||
E("update", b)
|
||||
})
|
||||
}
|
||||
|
||||
function $(a) {
|
||||
var b = a && a.split(".")[0],
|
||||
c = b && a.substring(b.length);
|
||||
Object.keys(la).forEach(function(a) {
|
||||
var d = a.split(".")[0],
|
||||
e = a.substring(d.length);
|
||||
b && b !== d || c && c !== e || delete la[a]
|
||||
})
|
||||
}
|
||||
|
||||
function _(a, b) {
|
||||
var c = W(),
|
||||
d = ["margin", "limit", "padding", "range", "animate", "snap", "step", "format"];
|
||||
d.forEach(function(b) {
|
||||
void 0 !== a[b] && (i[b] = a[b])
|
||||
});
|
||||
var f = R(i);
|
||||
d.forEach(function(b) {
|
||||
void 0 !== a[b] && (e[b] = f[b])
|
||||
}), f.spectrum.direction = ja.direction, ja = f.spectrum, e.margin = f.margin, e.limit = f.limit, e.padding = f.padding, ga = [], U(a.start || c, b)
|
||||
}
|
||||
var aa, ba, ca, da, ea = n(),
|
||||
fa = c,
|
||||
ga = [],
|
||||
ha = [],
|
||||
ia = !1,
|
||||
ja = e.spectrum,
|
||||
ka = [],
|
||||
la = {};
|
||||
if (fa.noUiSlider) throw new Error("Slider was already initialized.");
|
||||
return r(fa), q(e.connect, aa), da = {
|
||||
destroy: X,
|
||||
steps: Y,
|
||||
on: Z,
|
||||
off: $,
|
||||
get: W,
|
||||
set: U,
|
||||
reset: V,
|
||||
__moveHandles: function(a, b, c) {
|
||||
D(a, b, ga, c)
|
||||
},
|
||||
options: i,
|
||||
updateOptions: _,
|
||||
target: fa,
|
||||
pips: x
|
||||
}, L(e.events), U(e.start), e.pips && x(e.pips), e.tooltips && t(), da
|
||||
}
|
||||
|
||||
function T(a, b) {
|
||||
if (!a.nodeName) throw new Error("noUiSlider.create requires a single element.");
|
||||
var c = R(b, a),
|
||||
d = S(a, c, b);
|
||||
return a.noUiSlider = d, d
|
||||
}
|
||||
y.prototype.getMargin = function(a) {
|
||||
var b = this.xNumSteps[0];
|
||||
if (b && a / b % 1 !== 0) throw new Error("noUiSlider: 'limit', 'margin' and 'padding' must be divisible by step.");
|
||||
return 2 === this.xPct.length && p(this.xVal, a)
|
||||
}, y.prototype.toStepping = function(a) {
|
||||
return a = t(this.xVal, this.xPct, a)
|
||||
}, y.prototype.fromStepping = function(a) {
|
||||
return u(this.xVal, this.xPct, a)
|
||||
}, y.prototype.getStep = function(a) {
|
||||
return a = v(this.xPct, this.xSteps, this.snap, a)
|
||||
}, y.prototype.getNearbySteps = function(a) {
|
||||
var b = s(a, this.xPct);
|
||||
return {
|
||||
stepBefore: {
|
||||
startValue: this.xVal[b - 2],
|
||||
step: this.xNumSteps[b - 2],
|
||||
highestStep: this.xHighestCompleteStep[b - 2]
|
||||
},
|
||||
thisStep: {
|
||||
startValue: this.xVal[b - 1],
|
||||
step: this.xNumSteps[b - 1],
|
||||
highestStep: this.xHighestCompleteStep[b - 1]
|
||||
},
|
||||
stepAfter: {
|
||||
startValue: this.xVal[b - 0],
|
||||
step: this.xNumSteps[b - 0],
|
||||
highestStep: this.xHighestCompleteStep[b - 0]
|
||||
}
|
||||
}
|
||||
}, y.prototype.countStepDecimals = function() {
|
||||
var a = this.xNumSteps.map(i);
|
||||
return Math.max.apply(null, a)
|
||||
}, y.prototype.convert = function(a) {
|
||||
return this.getStep(this.toStepping(a))
|
||||
};
|
||||
var U = {
|
||||
to: function(a) {
|
||||
return void 0 !== a && a.toFixed(2)
|
||||
},
|
||||
from: Number
|
||||
};
|
||||
return {
|
||||
create: T
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user