Created
December 5, 2013 05:45
-
-
Save nladart/7800658 to your computer and use it in GitHub Desktop.
A Pen by Sonick.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id='container'> | |
<h1>Move :)</h1> | |
<div id='me'><h1>I <span>Love</span></h1> </div> | |
</div> | |
<script> | |
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD | |
* Build: http://modernizr.com/download/#-fontface-backgroundsize-multiplebgs-opacity-rgba-textshadow-cssanimations-csstransforms-csstransitions-canvas-draganddrop-touch-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load | |
*/; | |
window.Modernizr = function (a, b, c) { | |
function A(a) { | |
j.cssText = a | |
} | |
function B(a, b) { | |
return A(m.join(a + ";") + (b || "")) | |
} | |
function C(a, b) { | |
return typeof a === b | |
} | |
function D(a, b) { | |
return !!~ ("" + a).indexOf(b) | |
} | |
function E(a, b) { | |
for (var d in a) { | |
var e = a[d]; | |
if (!D(e, "-") && j[e] !== c) return b == "pfx" ? e : !0 | |
} | |
return !1 | |
} | |
function F(a, b, d) { | |
for (var e in a) { | |
var f = b[a[e]]; | |
if (f !== c) return d === !1 ? a[e] : C(f, "function") ? f.bind(d || b) : f | |
} | |
return !1 | |
} | |
function G(a, b, c) { | |
var d = a.charAt(0).toUpperCase() + a.slice(1), | |
e = (a + " " + o.join(d + " ") + d).split(" "); | |
return C(b, "string") || C(b, "undefined") ? E(e, b) : (e = (a + " " + p.join(d + " ") + d).split(" "), F(e, b, c)) | |
} | |
var d = "2.6.2", | |
e = {}, f = !0, | |
g = b.documentElement, | |
h = "modernizr", | |
i = b.createElement(h), | |
j = i.style, | |
k, l = {}.toString, | |
m = " -webkit- -moz- -o- -ms- ".split(" "), | |
n = "Webkit Moz O ms", | |
o = n.split(" "), | |
p = n.toLowerCase().split(" "), | |
q = {}, r = {}, s = {}, t = [], | |
u = t.slice, | |
v, w = function (a, c, d, e) { | |
var f, i, j, k, l = b.createElement("div"), | |
m = b.body, | |
n = m || b.createElement("body"); | |
if (parseInt(d, 10)) while (d--) j = b.createElement("div"), j.id = e ? e[d] : h + (d + 1), l.appendChild(j); | |
return f = ["­", '<style id="s', h, '">', a, "</style>"].join(""), l.id = h, (m ? l : n).innerHTML += f, n.appendChild(l), m || (n.style.background = "", n.style.overflow = "hidden", k = g.style.overflow, g.style.overflow = "hidden", g.appendChild(n)), i = c(l, a), m ? l.parentNode.removeChild(l) : (n.parentNode.removeChild(n), g.style.overflow = k), !! i | |
}, x = function () { | |
function d(d, e) { | |
e = e || b.createElement(a[d] || "div"), d = "on" + d; | |
var f = d in e; | |
return f || (e.setAttribute || (e = b.createElement("div")), e.setAttribute && e.removeAttribute && (e.setAttribute(d, ""), f = C(e[d], "function"), C(e[d], "undefined") || (e[d] = c), e.removeAttribute(d))), e = null, f | |
} | |
var a = { | |
select: "input", | |
change: "input", | |
submit: "form", | |
reset: "form", | |
error: "img", | |
load: "img", | |
abort: "img" | |
}; | |
return d | |
}(), | |
y = {}.hasOwnProperty, | |
z; | |
!C(y, "undefined") && !C(y.call, "undefined") ? z = function (a, b) { | |
return y.call(a, b) | |
} : z = function (a, b) { | |
return b in a && C(a.constructor.prototype[b], "undefined") | |
}, Function.prototype.bind || (Function.prototype.bind = function (b) { | |
var c = this; | |
if (typeof c != "function") throw new TypeError; | |
var d = u.call(arguments, 1), | |
e = function () { | |
if (this instanceof e) { | |
var a = function () {}; | |
a.prototype = c.prototype; | |
var f = new a, | |
g = c.apply(f, d.concat(u.call(arguments))); | |
return Object(g) === g ? g : f | |
} | |
return c.apply(b, d.concat(u.call(arguments))) | |
}; | |
return e | |
}), q.canvas = function () { | |
var a = b.createElement("canvas"); | |
return !!a.getContext && !! a.getContext("2d") | |
}, q.touch = function () { | |
var c; | |
return "ontouchstart" in a || a.DocumentTouch && b instanceof DocumentTouch ? c = !0 : w(["@media (", m.join("touch-enabled),("), h, ")", "{#modernizr{top:9px;position:absolute}}"].join(""), function (a) { | |
c = a.offsetTop === 9 | |
}), c | |
}, q.draganddrop = function () { | |
var a = b.createElement("div"); | |
return "draggable" in a || "ondragstart" in a && "ondrop" in a | |
}, q.rgba = function () { | |
return A("background-color:rgba(150,255,150,.5)"), D(j.backgroundColor, "rgba") | |
}, q.multiplebgs = function () { | |
return A("background:url(../https@/),url(https://),red url(https://)"), /(url\s*\(.*?){3}/.test(j.background) | |
}, q.backgroundsize = function () { | |
return G("backgroundSize") | |
}, q.textshadow = function () { | |
return b.createElement("div").style.textShadow === "" | |
}, q.opacity = function () { | |
return B("opacity:.55"), /^0.55$/.test(j.opacity) | |
}, q.cssanimations = function () { | |
return G("animationName") | |
}, q.csstransforms = function () { | |
return !!G("transform") | |
}, q.csstransitions = function () { | |
return G("transition") | |
}, q.fontface = function () { | |
var a; | |
return w('@font-face {font-family:"font";src:url("https://")}', function (c, d) { | |
var e = b.getElementById("smodernizr"), | |
f = e.sheet || e.styleSheet, | |
g = f ? f.cssRules && f.cssRules[0] ? f.cssRules[0].cssText : f.cssText || "" : ""; | |
a = /src/i.test(g) && g.indexOf(d.split(" ")[0]) === 0 | |
}), a | |
}; | |
for (var H in q) z(q, H) && (v = H.toLowerCase(), e[v] = q[H](), t.push((e[v] ? "" : "no-") + v)); | |
return e.addTest = function (a, b) { | |
if (typeof a == "object") for (var d in a) z(a, d) && e.addTest(d, a[d]); | |
else { | |
a = a.toLowerCase(); | |
if (e[a] !== c) return e; | |
b = typeof b == "function" ? b() : b, typeof f != "undefined" && f && (g.className += " " + (b ? "" : "no-") + a), e[a] = b | |
} | |
return e | |
}, A(""), i = k = null, | |
function (a, b) { | |
function k(a, b) { | |
var c = a.createElement("p"), | |
d = a.getElementsByTagName("head")[0] || a.documentElement; | |
return c.innerHTML = "x<style>" + b + "</style>", d.insertBefore(c.lastChild, d.firstChild) | |
} | |
function l() { | |
var a = r.elements; | |
return typeof a == "string" ? a.split(" ") : a | |
} | |
function m(a) { | |
var b = i[a[g]]; | |
return b || (b = {}, h++, a[g] = h, i[h] = b), b | |
} | |
function n(a, c, f) { | |
c || (c = b); | |
if (j) return c.createElement(a); | |
f || (f = m(c)); | |
var g; | |
return f.cache[a] ? g = f.cache[a].cloneNode() : e.test(a) ? g = (f.cache[a] = f.createElem(a)).cloneNode() : g = f.createElem(a), g.canHaveChildren && !d.test(a) ? f.frag.appendChild(g) : g | |
} | |
function o(a, c) { | |
a || (a = b); | |
if (j) return a.createDocumentFragment(); | |
c = c || m(a); | |
var d = c.frag.cloneNode(), | |
e = 0, | |
f = l(), | |
g = f.length; | |
for (; e < g; e++) d.createElement(f[e]); | |
return d | |
} | |
function p(a, b) { | |
b.cache || (b.cache = {}, b.createElem = a.createElement, b.createFrag = a.createDocumentFragment, b.frag = b.createFrag()), a.createElement = function (c) { | |
return r.shivMethods ? n(c, a, b) : b.createElem(c) | |
}, a.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + l().join().replace(/\w+/g, function (a) { | |
return b.createElem(a), b.frag.createElement(a), 'c("' + a + '")' | |
}) + ");return n}")(r, b.frag) | |
} | |
function q(a) { | |
a || (a = b); | |
var c = m(a); | |
return r.shivCSS && !f && !c.hasCSS && (c.hasCSS = !! k(a, "article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")), j || p(a, c), a | |
} | |
var c = a.html5 || {}, d = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i, | |
e = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i, | |
f, g = "_html5shiv", | |
h = 0, | |
i = {}, j; | |
(function () { | |
try { | |
var a = b.createElement("a"); | |
a.innerHTML = "<xyz></xyz>", f = "hidden" in a, j = a.childNodes.length == 1 || function () { | |
b.createElement("a"); | |
var a = b.createDocumentFragment(); | |
return typeof a.cloneNode == "undefined" || typeof a.createDocumentFragment == "undefined" || typeof a.createElement == "undefined" | |
}() | |
} catch (c) { | |
f = !0, j = !0 | |
} | |
})(); | |
var r = { | |
elements: c.elements || "abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video", | |
shivCSS: c.shivCSS !== !1, | |
supportsUnknownElements: j, | |
shivMethods: c.shivMethods !== !1, | |
type: "default", | |
shivDocument: q, | |
createElement: n, | |
createDocumentFragment: o | |
}; | |
a.html5 = r, q(b) | |
}(this, b), e._version = d, e._prefixes = m, e._domPrefixes = p, e._cssomPrefixes = o, e.hasEvent = x, e.testProp = function (a) { | |
return E([a]) | |
}, e.testAllProps = G, e.testStyles = w, g.className = g.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (f ? " js " + t.join(" ") : ""), e | |
}(this, this.document), | |
function (a, b, c) { | |
function d(a) { | |
return "[object Function]" == o.call(a) | |
} | |
function e(a) { | |
return "string" == typeof a | |
} | |
function f() {} | |
function g(a) { | |
return !a || "loaded" == a || "complete" == a || "uninitialized" == a | |
} | |
function h() { | |
var a = p.shift(); | |
q = 1, a ? a.t ? m(function () { | |
("c" == a.t ? B.injectCss : B.injectJs)(a.s, 0, a.a, a.x, a.e, 1) | |
}, 0) : (a(), h()) : q = 0 | |
} | |
function i(a, c, d, e, f, i, j) { | |
function k(b) { | |
if (!o && g(l.readyState) && (u.r = o = 1, !q && h(), l.onload = l.onreadystatechange = null, b)) { | |
"img" != a && m(function () { | |
t.removeChild(l) | |
}, 50); | |
for (var d in y[c]) y[c].hasOwnProperty(d) && y[c][d].onload() | |
} | |
} | |
var j = j || B.errorTimeout, | |
l = b.createElement(a), | |
o = 0, | |
r = 0, | |
u = { | |
t: d, | |
s: c, | |
e: f, | |
a: i, | |
x: j | |
}; | |
1 === y[c] && (r = 1, y[c] = []), "object" == a ? l.data = c : (l.src = c, l.type = a), l.width = l.height = "0", l.onerror = l.onload = l.onreadystatechange = function () { | |
k.call(this, r) | |
}, p.splice(e, 0, u), "img" != a && (r || 2 === y[c] ? (t.insertBefore(l, s ? null : n), m(k, j)) : y[c].push(l)) | |
} | |
function j(a, b, c, d, f) { | |
return q = 0, b = b || "j", e(a) ? i("c" == b ? v : u, a, b, this.i++, c, d, f) : (p.splice(this.i++, 0, a), 1 == p.length && h()), this | |
} | |
function k() { | |
var a = B; | |
return a.loader = { | |
load: j, | |
i: 0 | |
}, a | |
} | |
var l = b.documentElement, | |
m = a.setTimeout, | |
n = b.getElementsByTagName("script")[0], | |
o = {}.toString, | |
p = [], | |
q = 0, | |
r = "MozAppearance" in l.style, | |
s = r && !! b.createRange().compareNode, | |
t = s ? l : n.parentNode, | |
l = a.opera && "[object Opera]" == o.call(a.opera), | |
l = !! b.attachEvent && !l, | |
u = r ? "object" : l ? "script" : "img", | |
v = l ? "script" : u, | |
w = Array.isArray || function (a) { | |
return "[object Array]" == o.call(a) | |
}, x = [], | |
y = {}, z = { | |
timeout: function (a, b) { | |
return b.length && (a.timeout = b[0]), a | |
} | |
}, A, B; | |
B = function (a) { | |
function b(a) { | |
var a = a.split("!"), | |
b = x.length, | |
c = a.pop(), | |
d = a.length, | |
c = { | |
url: c, | |
origUrl: c, | |
prefixes: a | |
}, e, f, g; | |
for (f = 0; f < d; f++) g = a[f].split("="), (e = z[g.shift()]) && (c = e(c, g)); | |
for (f = 0; f < b; f++) c = x[f](c); | |
return c | |
} | |
function g(a, e, f, g, h) { | |
var i = b(a), | |
j = i.autoCallback; | |
i.url.split(".").pop().split("?").shift(), i.bypass || (e && (e = d(e) ? e : e[a] || e[g] || e[a.split("/").pop().split("?")[0]]), i.instead ? i.instead(a, e, f, g, h) : (y[i.url] ? i.noexec = !0 : y[i.url] = 1, f.load(i.url, i.forceCSS || !i.forceJS && "css" == i.url.split(".").pop().split("?").shift() ? "c" : c, i.noexec, i.attrs, i.timeout), (d(e) || d(j)) && f.load(function () { | |
k(), e && e(i.origUrl, h, g), j && j(i.origUrl, h, g), y[i.url] = 2 | |
}))) | |
} | |
function h(a, b) { | |
function c(a, c) { | |
if (a) { | |
if (e(a)) c || (j = function () { | |
var a = [].slice.call(arguments); | |
k.apply(this, a), l() | |
}), g(a, j, b, 0, h); | |
else if (Object(a) === a) for (n in m = function () { | |
var b = 0, | |
c; | |
for (c in a) a.hasOwnProperty(c) && b++; | |
return b | |
}(), a) a.hasOwnProperty(n) && (!c && !--m && (d(j) ? j = function () { | |
var a = [].slice.call(arguments); | |
k.apply(this, a), l() | |
} : j[n] = function (a) { | |
return function () { | |
var b = [].slice.call(arguments); | |
a && a.apply(this, b), l() | |
} | |
}(k[n])), g(a[n], j, b, n, h)) | |
} else !c && l() | |
} | |
var h = !! a.test, | |
i = a.load || a.both, | |
j = a.callback || f, | |
k = j, | |
l = a.complete || f, | |
m, n; | |
c(h ? a.yep : a.nope, !! i), i && c(i) | |
} | |
var i, j, l = this.yepnope.loader; | |
if (e(a)) g(a, 0, l, 0); | |
else if (w(a)) for (i = 0; i < a.length; i++) j = a[i], e(j) ? g(j, 0, l, 0) : w(j) ? B(j) : Object(j) === j && h(j, l); | |
else Object(a) === a && h(a, l) | |
}, B.addPrefix = function (a, b) { | |
z[a] = b | |
}, B.addFilter = function (a) { | |
x.push(a) | |
}, B.errorTimeout = 1e4, null == b.readyState && b.addEventListener && (b.readyState = "loading", b.addEventListener("DOMContentLoaded", A = function () { | |
b.removeEventListener("DOMContentLoaded", A, 0), b.readyState = "complete" | |
}, 0)), a.yepnope = k(), a.yepnope.executeStack = h, a.yepnope.injectJs = function (a, c, d, e, i, j) { | |
var k = b.createElement("script"), | |
l, o, e = e || B.errorTimeout; | |
k.src = a; | |
for (o in d) k.setAttribute(o, d[o]); | |
c = j ? h : c || f, k.onreadystatechange = k.onload = function () { | |
!l && g(k.readyState) && (l = 1, c(), k.onload = k.onreadystatechange = null) | |
}, m(function () { | |
l || (l = 1, c(1)) | |
}, e), i ? k.onload() : n.parentNode.insertBefore(k, n) | |
}, a.yepnope.injectCss = function (a, c, d, e, g, i) { | |
var e = b.createElement("link"), | |
j, c = i ? h : c || f; | |
e.href = a, e.rel = "stylesheet", e.type = "text/css"; | |
for (j in d) e.setAttribute(j, d[j]); | |
g || (n.parentNode.insertBefore(e, n), m(c, 0)) | |
} | |
}(this, document), Modernizr.load = function () { | |
yepnope.apply(window, [].slice.call(arguments, 0)) | |
}; | |
</script> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (t, e, s) { | |
"use strict"; | |
var i = "pep", | |
o = e.document, | |
n = { | |
debug: false, | |
activeClass: "pep-active", | |
multiplier: 1, | |
shouldPreventDefault: true, | |
stopEvents: "", | |
hardwareAccelerate: true, | |
useCSSTranslation: true, | |
disableSelect: true, | |
cssEaseString: "cubic-bezier(0.190, 1.000, 0.220, 1.000)", | |
cssEaseDuration: 750, | |
shouldEase: true, | |
droppable: false, | |
droppableActiveClass: "pep-dpa", | |
overlapFunction: false, | |
constrainTo: false, | |
removeMargins: true, | |
axis: null, | |
forceNonCSS3Movement: false, | |
drag: function () {}, | |
start: function () {}, | |
stop: function () {}, | |
rest: function () {} | |
}; | |
function a(s, i) { | |
this.el = s; | |
this.$el = t(s); | |
this.options = t.extend({}, n, i); | |
this.$document = t(o); | |
this.$window = t(e); | |
this._defaults = n; | |
this._name = "Pep"; | |
this.moveTrigger = this.isTouch() ? "touchmove" : "mousemove"; | |
this.startTrigger = this.isTouch() ? "touchstart" : "mousedown"; | |
this.stopTrigger = this.isTouch() ? "touchend" : "mouseup"; | |
this.stopEvents = [this.stopTrigger, this.options.stopEvents].join(" "); | |
this.$container = this.options.constrainTo && this.options.constrainTo === "parent" ? this.$el.parent() : this.$document; | |
this.CSSEaseHash = this.getCSSEaseHash(); | |
this.velocityQueue = new Array(5); | |
this.scale = 1; | |
this.disabled = false; | |
this.init() | |
} | |
a.prototype.init = function () { | |
var t = this; | |
if (this.options.debug) this.buildDebugDiv(); | |
if (this.options.disableSelect) this.disableSelect(); | |
this.positionParent(); | |
this.placeObject(); | |
this.ev = {}; | |
this.pos = {}; | |
this.subscribe() | |
}; | |
a.prototype.subscribe = function () { | |
var t = this; | |
this.$el.bind(this.startTrigger, function (e) { | |
t.handleStart(e) | |
}); | |
this.$document.bind(this.stopEvents, function (e) { | |
t.handleStop(e) | |
}); | |
this.$document.bind(this.moveTrigger, function (e) { | |
t.moveEvent = e | |
}) | |
}; | |
a.prototype.handleStart = function (e) { | |
var s = this; | |
if (this.isValidMoveEvent(e) && !this.disabled) { | |
this.log({ | |
type: "event", | |
event: e.type | |
}); | |
if (this.options.hardwareAccelerate && !this.hardwareAccelerated) { | |
this.hardwareAccelerate(); | |
this.hardwareAccelerated = true | |
} | |
this.options.start(e, this); | |
clearTimeout(this.restTimeout); | |
this.$el.addClass(this.options.activeClass); | |
this.removeCSSEasing(); | |
this.ev.x = this.isTouch() ? e.originalEvent.pageX : e.pageX; | |
this.ev.y = this.isTouch() ? e.originalEvent.pageY : e.pageY; | |
this.moveEvent = e; | |
this.active = true; | |
if (this.options.shouldPreventDefault) e.preventDefault(); | |
(function i() { | |
if (!s.active) return; | |
s.handleMove(); | |
s.requestAnimationFrame(i) | |
})(t, s) | |
} | |
}; | |
a.prototype.handleMove = function () { | |
var t = this.moveEvent; | |
if (typeof t === "undefined") return; | |
var e = this.isTouch() ? t.originalEvent.touches[0].pageX : t.pageX; | |
var s = this.isTouch() ? t.originalEvent.touches[0].pageY : t.pageY; | |
this.addToLIFO({ | |
time: t.timeStamp, | |
x: e, | |
y: s | |
}); | |
var i, o; | |
if (t.type === this.startTrigger) { | |
i = 0; | |
o = 0 | |
} else { | |
i = e - this.ev.x; | |
o = s - this.ev.y | |
} | |
this.dx = i; | |
this.dy = o; | |
this.ev.x = e; | |
this.ev.y = s; | |
if (i === 0 && o === 0) { | |
this.log({ | |
type: "event", | |
event: "** stopped **" | |
}); | |
return | |
} | |
if (this.options.droppable) { | |
this.calculateActiveDropRegions() | |
} | |
var n = this.options.drag(t, this); | |
if (n === false) return; | |
this.log({ | |
type: "event", | |
event: t.type | |
}); | |
this.log({ | |
type: "event-coords", | |
x: this.ev.x, | |
y: this.ev.y | |
}); | |
this.log({ | |
type: "velocity" | |
}); | |
var a = this.handleConstraint(i, o); | |
if (!this.shouldUseCSSTranslation()) { | |
var r = i >= 0 ? "+=" + Math.abs(i / this.scale) * this.options.multiplier : "-=" + Math.abs(i / this.scale) * this.options.multiplier; | |
var p = o >= 0 ? "+=" + Math.abs(o / this.scale) * this.options.multiplier : "-=" + Math.abs(o / this.scale) * this.options.multiplier; | |
if (this.options.constrainTo) { | |
r = a.x !== false ? a.x : r; | |
p = a.y !== false ? a.y : p | |
} | |
this.moveTo(r, p) | |
} else { | |
i = i / this.scale * this.options.multiplier; | |
o = o / this.scale * this.options.multiplier; | |
if (this.options.constrainTo) { | |
i = a.x === false ? i : 0; | |
o = a.y === false ? o : 0 | |
} | |
this.moveToUsingTransforms(i, o) | |
} | |
}; | |
a.prototype.handleStop = function (t) { | |
if (!this.active) return; | |
this.log({ | |
type: "event", | |
event: t.type | |
}); | |
this.active = false; | |
if (this.options.droppable) { | |
this.calculateActiveDropRegions() | |
} | |
if (this.options.shouldEase) this.ease(t); | |
this.options.stop(t, this); | |
this.velocityQueue = new Array(5) | |
}; | |
a.prototype.moveTo = function (t, e, s) { | |
s = s === false || typeof s === "undefined" ? false : true; | |
if (this.options.axis === "x") { | |
e = "+=0" | |
} else if (this.options.axis === "y") { | |
t = "+=0" | |
} | |
var i = 300; | |
this.log({ | |
type: "delta", | |
x: t, | |
y: e | |
}); | |
if (s) { | |
this.$el.animate({ | |
top: e, | |
left: t | |
}, i, "easeOutCirc", { | |
queue: false | |
}) | |
} else { | |
this.$el.stop(true, false).css({ | |
top: e, | |
left: t | |
}) | |
} | |
}; | |
a.prototype.moveToUsingTransforms = function (t, e) { | |
if (this.options.axis === "x") { | |
e = 0 | |
} else if (this.options.axis === "y") { | |
t = 0 | |
} | |
this.cssX = this.cssX ? this.cssX + t : t; | |
this.cssY = this.cssY ? this.cssY + e : e; | |
this.log({ | |
type: "delta", | |
x: t, | |
y: e | |
}); | |
this.translation = "translate(" + this.cssX + "px, " + this.cssY + "px)"; | |
this.$el.css({ | |
"-webkit-transform": this.translation, | |
"-moz-transform": this.translation, | |
"-ms-transform": this.translation, | |
"-o-transform": this.translation, | |
transform: this.translation | |
}) | |
}; | |
a.prototype.addToLIFO = function (t) { | |
var e = this.velocityQueue; | |
e = e.slice(1, e.length); | |
e.push(t); | |
this.velocityQueue = e | |
}; | |
a.prototype.ease = function (t) { | |
var e = this.$el.position(); | |
var s = this.velocity(); | |
var i = this.dt; | |
var o = s.x / this.scale * this.options.multiplier; | |
var n = s.y / this.scale * this.options.multiplier; | |
var a = this.handleConstraint(o, n); | |
if (this.cssAnimationsSupported()) this.$el.css(this.getCSSEaseHash()); | |
var r = s.x > 0 ? "+=" + o : "-=" + Math.abs(o); | |
var p = s.y > 0 ? "+=" + n : "-=" + Math.abs(n); | |
if (this.options.constrainTo) { | |
r = a.x !== false ? a.x : r; | |
p = a.y !== false ? a.y : p | |
} | |
var h = !this.cssAnimationsSupported() || this.options.forceNonCSS3Movement; | |
this.moveTo(r, p, h); | |
var l = this; | |
this.restTimeout = setTimeout(function () { | |
if (l.options.droppable) { | |
l.calculateActiveDropRegions() | |
} | |
l.options.rest(t, l); | |
l.$el.removeClass(l.options.activeClass) | |
}, this.options.cssEaseDuration) | |
}; | |
a.prototype.velocity = function () { | |
var t = 0; | |
var e = 0; | |
for (var s = 0; s < this.velocityQueue.length - 1; s++) { | |
if (this.velocityQueue[s]) { | |
t = t + (this.velocityQueue[s + 1].x - this.velocityQueue[s].x); | |
e = e + (this.velocityQueue[s + 1].y - this.velocityQueue[s].y); | |
this.dt = this.velocityQueue[s + 1].time - this.velocityQueue[s].time | |
} | |
} | |
var i = 1.6; | |
return { | |
x: t * i, | |
y: e * i | |
} | |
}; | |
a.prototype.requestAnimationFrame = function (t) { | |
return e.requestAnimationFrame && e.requestAnimationFrame(t) || e.webkitRequestAnimationFrame && e.webkitRequestAnimationFrame(t) || e.mozRequestAnimationFrame && e.mozRequestAnimationFrame(t) || e.oRequestAnimationFrame && e.mozRequestAnimationFrame(t) || e.msRequestAnimationFrame && e.msRequestAnimationFrame(t) || e.setTimeout(t, 1e3 / 60) | |
}; | |
a.prototype.positionParent = function () { | |
if (!this.options.constrainTo || this.parentPositioned) return; | |
this.parentPositioned = true; | |
if (this.options.constrainTo === "parent") { | |
this.$container.css({ | |
position: "relative" | |
}) | |
} else { | |
this.$container.css({ | |
position: "static" | |
}) | |
} | |
}; | |
a.prototype.placeObject = function () { | |
if (this.objectPlaced) return; | |
this.objectPlaced = true; | |
this.offset = this.options.constrainTo === "parent" || this.hasNonBodyRelative() ? this.$el.position() : this.$el.offset(); | |
if (this.options.removeMargins) this.$el.css({ | |
margin: 0 | |
}); | |
this.$el.css({ | |
position: "absolute", | |
top: this.offset.top, | |
left: this.offset.left | |
}) | |
}; | |
a.prototype.hasNonBodyRelative = function () { | |
return this.$el.parents().filter(function () { | |
var e = t(this); | |
return e.is("body") || e.css("position") === "relative" | |
}).length > 1 | |
}; | |
a.prototype.setScale = function (t) { | |
this.scale = t | |
}; | |
a.prototype.setMultiplier = function (t) { | |
this.options.multiplier = t | |
}; | |
a.prototype.removeCSSEasing = function () { | |
if (this.cssAnimationsSupported()) this.$el.css(this.getCSSEaseHash(true)) | |
}; | |
a.prototype.disableSelect = function () { | |
this.$el.css({ | |
"-webkit-touch-callout": "none", | |
"-webkit-user-select": "none", | |
"-khtml-user-select": "none", | |
"-moz-user-select": "none", | |
"-ms-user-select": "none", | |
"user-select": "none" | |
}) | |
}; | |
a.prototype.handleConstraint = function (t, e) { | |
var s = this.$el.position(); | |
this.pos.x = s.left; | |
this.pos.y = s.top; | |
this.log({ | |
type: "pos-coords", | |
x: this.pos.x, | |
y: this.pos.y | |
}); | |
var i = this.$container.width() - this.$el.outerWidth(); | |
var o = this.$container.height() - this.$el.outerHeight(); | |
var n = { | |
x: false, | |
y: false | |
}; | |
if (this.pos.x + t > i) n.x = i; | |
if (this.pos.x + t < 0) n.x = 0; | |
if (this.pos.y + e > o) n.y = o; | |
if (this.pos.y + e < 0) n.y = 0; | |
return n | |
}; | |
a.prototype.getCSSEaseHash = function (t) { | |
if (typeof t === "undefined") t = false; | |
var e; | |
if (t) { | |
e = "" | |
} else if (this.CSSEaseHash) { | |
return this.CSSEaseHash | |
} else { | |
e = ["all", this.options.cssEaseDuration + "ms", this.options.cssEaseString].join(" ") | |
} | |
return { | |
"-webkit-transition": e, | |
"-moz-transition": e, | |
"-ms-transition": e, | |
"-o-transition": e, | |
transition: e | |
} | |
}; | |
a.prototype.calculateActiveDropRegions = function () { | |
var e = this; | |
this.activeDropRegions = []; | |
t.each(t(this.options.droppable), function (s, i) { | |
var o = t(i); | |
if (e.isOverlapping(o, e.$el)) { | |
o.addClass(e.options.droppableActiveClass); | |
e.activeDropRegions.push(o) | |
} else { | |
o.removeClass(e.options.droppableActiveClass) | |
} | |
}) | |
}; | |
a.prototype.isOverlapping = function (t, e) { | |
if (this.options.overlapFunction) { | |
return this.options.overlapFunction(t, e) | |
} | |
var s = t[0].getBoundingClientRect(); | |
var i = e[0].getBoundingClientRect(); | |
return !(s.right < i.left || s.left > i.right || s.bottom < i.top || s.top > i.bottom) | |
}; | |
a.prototype.isTouch = function (t) { | |
if (typeof Modernizr !== "undefined") return Modernizr.touch; | |
if ("ontouchstart" in e || e.DocumentTouch && o instanceof DocumentTouch) { | |
return true | |
} else { | |
return false | |
} | |
}; | |
a.prototype.isValidMoveEvent = function (t) { | |
if (!this.isTouch() || this.isTouch() && t.originalEvent.hasOwnProperty("touches") && t.originalEvent.touches.length === 1) { | |
return true | |
} else { | |
return false | |
} | |
}; | |
a.prototype.shouldUseCSSTranslation = function () { | |
if (typeof this.useCSSTranslation !== "undefined") return this.useCSSTranslation; | |
var t = false; | |
if (!this.options.useCSSTranslation || typeof Modernizr !== "undefined" && !Modernizr.csstransforms) { | |
t = false | |
} else { | |
t = true | |
} | |
this.useCSSTranslation = t; | |
return t | |
}; | |
a.prototype.cssAnimationsSupported = function () { | |
if (typeof this.cssAnimationsSupport !== "undefined") { | |
return this.cssAnimationsSupport | |
} | |
if (typeof Modernizr !== "undefined" && Modernizr.cssanimations) { | |
this.cssAnimationsSupport = true; | |
return true | |
} | |
var t = false, | |
e = o.createElement("div"), | |
i = "animation", | |
n = "", | |
a = "Webkit Moz O ms Khtml".split(" "), | |
r = ""; | |
if (e.style.animationName) { | |
t = true | |
} | |
if (t === false) { | |
for (var p = 0; p < a.length; p++) { | |
if (e.style[a[p] + "AnimationName"] !== s) { | |
r = a[p]; | |
i = r + "Animation"; | |
n = "-" + r.toLowerCase() + "-"; | |
t = true; | |
break | |
} | |
} | |
} | |
this.cssAnimationsSupport = t; | |
return t | |
}; | |
a.prototype.hardwareAccelerate = function () { | |
this.$el.css({ | |
"-webkit-transform": "translateZ(0)", | |
transform: "translateZ(0)", | |
"-webkit-perspective": 1e3, | |
perspective: 1e3, | |
"-webkit-backface-visibility": "hidden", | |
"backface-visibility": "hidden" | |
}) | |
}; | |
a.prototype.getMovementValues = function () { | |
return { | |
ev: this.ev, | |
pos: this.pos, | |
velocity: this.velocity() | |
} | |
}; | |
a.prototype.buildDebugDiv = function () { | |
var e; | |
if (t("#pep-debug").length === 0) { | |
e = t("<div></div>"); | |
e.attr("id", "pep-debug").append("<div style='font-weight:bold; background: red; color: white;'>DEBUG MODE</div>").append("<div id='pep-debug-event'>no event</div>").append("<div id='pep-debug-ev-coords'>event coords: <span class='pep-x'>-</span>, <span class='pep-y'>-</span></div>").append("<div id='pep-debug-pos-coords'>position coords: <span class='pep-x'>-</span>, <span class='pep-y'>-</span></div>").append("<div id='pep-debug-velocity'>velocity: <span class='pep-x'>-</span>, <span class='pep-y'>-</span></div>").append("<div id='pep-debug-delta'>Δ movement: <span class='pep-x'>-</span>, <span class='pep-y'>-</span></div>").css({ | |
position: "fixed", | |
bottom: 5, | |
right: 5, | |
zIndex: 99999, | |
textAlign: "right", | |
fontFamily: "Arial, sans", | |
fontSize: 10, | |
border: "1px solid #DDD", | |
padding: "3px", | |
background: "white", | |
color: "#333" | |
}) | |
} | |
var s = this; | |
setTimeout(function () { | |
s.debugElements = { | |
$event: t("#pep-debug-event"), | |
$velocityX: t("#pep-debug-velocity .pep-x"), | |
$velocityY: t("#pep-debug-velocity .pep-y"), | |
$dX: t("#pep-debug-delta .pep-x"), | |
$dY: t("#pep-debug-delta .pep-y"), | |
$evCoordsX: t("#pep-debug-ev-coords .pep-x"), | |
$evCoordsY: t("#pep-debug-ev-coords .pep-y"), | |
$posCoordsX: t("#pep-debug-pos-coords .pep-x"), | |
$posCoordsY: t("#pep-debug-pos-coords .pep-y") | |
} | |
}, 0); | |
t("body").append(e) | |
}; | |
a.prototype.log = function (t) { | |
if (!this.options.debug) return; | |
switch (t.type) { | |
case "event": | |
this.debugElements.$event.text(t.event); | |
break; | |
case "pos-coords": | |
this.debugElements.$posCoordsX.text(t.x); | |
this.debugElements.$posCoordsY.text(t.y); | |
break; | |
case "event-coords": | |
this.debugElements.$evCoordsX.text(t.x); | |
this.debugElements.$evCoordsY.text(t.y); | |
break; | |
case "delta": | |
this.debugElements.$dX.text(t.x); | |
this.debugElements.$dY.text(t.y); | |
break; | |
case "velocity": | |
var e = this.velocity(); | |
this.debugElements.$velocityX.text(Math.round(e.x)); | |
this.debugElements.$velocityY.text(Math.round(e.y)); | |
break | |
} | |
}; | |
t.extend(t.easing, { | |
easeOutQuad: function (t, e, s, i, o) { | |
return -i * (e /= o) * (e - 2) + s | |
}, | |
easeOutCirc: function (t, e, s, i, o) { | |
return i * Math.sqrt(1 - (e = e / o - 1) * e) + s | |
}, | |
easeOutExpo: function (t, e, s, i, o) { | |
return e === o ? s + i : i * (-Math.pow(2, -10 * e / o) + 1) + s | |
} | |
}); | |
a.prototype.toggle = function (t) { | |
if (typeof t === "undefined") { | |
this.disabled = !this.disabled | |
} else { | |
this.disabled = !t | |
} | |
}; | |
t.fn[i] = function (e) { | |
return this.each(function () { | |
if (!t.data(this, "plugin_" + i)) { | |
var s = new a(this, e); | |
t.data(this, "plugin_" + i, s); | |
t.pep.peps.push(s) | |
} | |
}) | |
}; | |
t.pep = {}; | |
t.pep.peps = []; | |
t.pep.toggleAll = function (e) { | |
t.each(this.peps, function (t, s) { | |
s.toggle(e) | |
}) | |
} | |
})(jQuery, window); | |
/* jQuery Mobile Events by Ben Major (www.ben-major.co.uk) */ (function (e) { | |
function d() { | |
var e = o(); | |
if (e !== u) { | |
u = e; | |
i.trigger("orientationchange") | |
} | |
} | |
function E(t, n, r, i) { | |
var s = r.type; | |
r.type = n; | |
e.event.dispatch.call(t, r, i); | |
r.type = s | |
} | |
e.attrFn = e.attrFn || {}; | |
var t = navigator.userAgent.toLowerCase(), | |
n = t.indexOf("chrome") > -1 && (t.indexOf("windows") > -1 || t.indexOf("macintosh") > -1 || t.indexOf("linux") > -1) && t.indexOf("chrome") < 0, | |
r = { | |
swipe_h_threshold: 50, | |
swipe_v_threshold: 50, | |
taphold_threshold: 750, | |
doubletap_int: 500, | |
touch_capable: document.documentElement.hasOwnProperty("ontouchstart") && !n, | |
orientation_support: window.hasOwnProperty("orientation") && window.hasOwnProperty("onorientationchange"), | |
startevent: document.documentElement.hasOwnProperty("ontouchstart") && !n ? "touchstart" : "mousedown", | |
endevent: document.documentElement.hasOwnProperty("ontouchstart") && !n ? "touchend" : "mouseup", | |
moveevent: document.documentElement.hasOwnProperty("ontouchstart") && !n ? "touchmove" : "mousemove", | |
tapevent: document.documentElement.hasOwnProperty("ontouchstart") && !n ? "tap" : "click", | |
scrollevent: document.documentElement.hasOwnProperty("ontouchstart") && !n ? "touchmove" : "scroll", | |
hold_timer: null, | |
tap_timer: null | |
}; | |
e.each(["tapstart", "tapend", "tap", "singletap", "doubletap", "taphold", "swipe", "swipeup", "swiperight", "swipedown", "swipeleft", "swipeend", "scrollstart", "scrollend", "orientationchange"], function (t, n) { | |
e.fn[n] = function (e) { | |
return e ? this.bind(n, e) : this.trigger(n) | |
}; | |
e.attrFn[n] = true | |
}); | |
e.event.special.tapstart = { | |
setup: function () { | |
var t = this, | |
n = e(t); | |
n.bind(r.startevent, function (e) { | |
n.data("callee", arguments.callee); | |
if (e.which && e.which !== 1) { | |
return false | |
} | |
var i = e.originalEvent, | |
s = { | |
position: { | |
x: r.touch_capable ? i.touches[0].screenX : e.screenX, | |
y: r.touch_capable ? i.touches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? i.touches[0].pageX - i.touches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? i.touches[0].pageY - i.touches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
E(t, "tapstart", e, s); | |
return true | |
}) | |
}, | |
remove: function () { | |
e(this).unbind(r.startevent, e(this).data.callee) | |
} | |
}; | |
e.event.special.tapend = { | |
setup: function () { | |
var t = this, | |
n = e(t); | |
n.bind(r.endevent, function (e) { | |
n.data("callee", arguments.callee); | |
var i = e.originalEvent; | |
var s = { | |
position: { | |
x: r.touch_capable ? i.changedTouches[0].screenX : e.screenX, | |
y: r.touch_capable ? i.changedTouches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? i.changedTouches[0].pageX - i.changedTouches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? i.changedTouches[0].pageY - i.changedTouches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
E(t, "tapend", e, s); | |
return true | |
}) | |
}, | |
remove: function () { | |
e(this).unbind(r.endevent, e(this).data.callee) | |
} | |
}; | |
e.event.special.taphold = { | |
setup: function () { | |
var t = this, | |
n = e(t), | |
i, s, o = { | |
x: 0, | |
y: 0 | |
}; | |
n.bind(r.startevent, function (e) { | |
if (e.which && e.which !== 1) { | |
return false | |
} else { | |
n.data("tapheld", false); | |
i = e.target; | |
var s = e.originalEvent; | |
var u = (new Date).getTime(), | |
a = { | |
x: r.touch_capable ? s.touches[0].screenX : e.screenX, | |
y: r.touch_capable ? s.touches[0].screenY : e.screenY | |
}, f = { | |
x: r.touch_capable ? s.touches[0].pageX - s.touches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? s.touches[0].pageY - s.touches[0].target.offsetTop : e.offsetY | |
}; | |
o.x = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageX : e.pageX; | |
o.y = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageY : e.pageY; | |
r.hold_timer = window.setTimeout(function () { | |
var l = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageX : e.pageX, | |
c = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageY : e.pageY; | |
if (e.target == i && o.x == l && o.y == c) { | |
n.data("tapheld", true); | |
var h = (new Date).getTime(), | |
p = { | |
x: r.touch_capable ? s.touches[0].screenX : e.screenX, | |
y: r.touch_capable ? s.touches[0].screenY : e.screenY | |
}, d = { | |
x: r.touch_capable ? s.touches[0].pageX - s.touches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? s.touches[0].pageY - s.touches[0].target.offsetTop : e.offsetY | |
}; | |
duration = h - u; | |
var v = { | |
startTime: u, | |
endTime: h, | |
startPosition: a, | |
startOffset: f, | |
endPosition: p, | |
endOffset: d, | |
duration: duration, | |
target: e.target | |
}; | |
n.data("callee1", arguments.callee); | |
E(t, "taphold", e, v) | |
} | |
}, r.taphold_threshold); | |
return true | |
} | |
}).bind(r.endevent, function () { | |
n.data("callee2", arguments.callee); | |
n.data("tapheld", false); | |
window.clearTimeout(r.hold_timer) | |
}) | |
}, | |
remove: function () { | |
e(this).unbind(r.startevent, e(this).data.callee1).unbind(r.endevent, e(this).data.callee2) | |
} | |
}; | |
e.event.special.doubletap = { | |
setup: function () { | |
var t = this, | |
n = e(t), | |
i, s, o, u; | |
n.bind(r.startevent, function (e) { | |
if (e.which && e.which !== 1) { | |
return false | |
} else { | |
n.data("doubletapped", false); | |
i = e.target; | |
n.data("callee1", arguments.callee); | |
u = e.originalEvent; | |
o = { | |
position: { | |
x: r.touch_capable ? u.touches[0].screenX : e.screenX, | |
y: r.touch_capable ? u.touches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? u.touches[0].pageX - u.touches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? u.touches[0].pageY - u.touches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
return true | |
} | |
}).bind(r.endevent, function (e) { | |
var a = (new Date).getTime(); | |
var f = n.data("lastTouch") || a + 1; | |
var l = a - f; | |
window.clearTimeout(s); | |
n.data("callee2", arguments.callee); | |
if (l < r.doubletap_int && l > 0 && e.target == i && l > 100) { | |
n.data("doubletapped", true); | |
window.clearTimeout(r.tap_timer); | |
var c = { | |
position: { | |
x: r.touch_capable ? u.touches[0].screenX : e.screenX, | |
y: r.touch_capable ? u.touches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? u.touches[0].pageX - u.touches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? u.touches[0].pageY - u.touches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
var h = { | |
firstTap: o, | |
secondTap: c, | |
interval: c.time - o.time | |
}; | |
E(t, "doubletap", e, h) | |
} else { | |
n.data("lastTouch", a); | |
s = window.setTimeout(function (e) { | |
window.clearTimeout(s) | |
}, r.doubletap_int, [e]) | |
} | |
n.data("lastTouch", a) | |
}) | |
}, | |
remove: function () { | |
e(this).unbind(r.startevent, e(this).data.callee1).unbind(r.endevent, e(this).data.callee2) | |
} | |
}; | |
e.event.special.singletap = { | |
setup: function () { | |
var t = this, | |
n = e(t), | |
i = null, | |
s = null, | |
o = { | |
x: 0, | |
y: 0 | |
}; | |
n.bind(r.startevent, function (e) { | |
if (e.which && e.which !== 1) { | |
return false | |
} else { | |
s = (new Date).getTime(); | |
i = e.target; | |
n.data("callee1", arguments.callee); | |
o.x = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageX : e.pageX; | |
o.y = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageY : e.pageY; | |
return true | |
} | |
}).bind(r.endevent, function (e) { | |
n.data("callee2", arguments.callee); | |
if (e.target == i) { | |
end_pos_x = e.originalEvent.changedTouches ? e.originalEvent.changedTouches[0].pageX : e.pageX; | |
end_pos_y = e.originalEvent.changedTouches ? e.originalEvent.changedTouches[0].pageY : e.pageY; | |
r.tap_timer = window.setTimeout(function () { | |
if (!n.data("doubletapped") && !n.data("tapheld") && o.x == end_pos_x && o.y == end_pos_y) { | |
var i = e.originalEvent; | |
var s = { | |
position: { | |
x: r.touch_capable ? i.changedTouches[0].screenX : e.screenX, | |
y: r.touch_capable ? i.changedTouches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? i.changedTouches[0].pageX - i.changedTouches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? i.changedTouches[0].pageY - i.changedTouches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
E(t, "singletap", e, s) | |
} | |
}, r.doubletap_int) | |
} | |
}) | |
}, | |
remove: function () { | |
e(this).unbind(r.startevent, e(this).data.callee1).unbind(r.endevent, e(this).data.callee2) | |
} | |
}; | |
e.event.special.tap = { | |
setup: function () { | |
var t = this, | |
n = e(t), | |
i = false, | |
s = null, | |
o, u = { | |
x: 0, | |
y: 0 | |
}; | |
n.bind(r.startevent, function (e) { | |
n.data("callee1", arguments.callee); | |
if (e.which && e.which !== 1) { | |
return false | |
} else { | |
i = true; | |
u.x = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageX : e.pageX; | |
u.y = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageY : e.pageY; | |
o = (new Date).getTime(); | |
s = e.target; | |
return true | |
} | |
}).bind(r.endevent, function (e) { | |
n.data("callee2", arguments.callee); | |
var a = e.originalEvent.targetTouches ? e.originalEvent.changedTouches[0].pageX : e.pageX, | |
f = e.originalEvent.targetTouches ? e.originalEvent.changedTouches[0].pageY : e.pageY; | |
if (s == e.target && i && (new Date).getTime() - o < r.taphold_threshold && u.x == a && u.y == f) { | |
var l = e.originalEvent; | |
var c = { | |
position: { | |
x: r.touch_capable ? l.changedTouches[0].screenX : e.screenX, | |
y: r.touch_capable ? l.changedTouches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? l.changedTouches[0].pageX - l.changedTouches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? l.changedTouches[0].pageY - l.changedTouches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
E(t, "tap", e, c) | |
} | |
}) | |
}, | |
remove: function () { | |
e(this).unbind(r.startevent, e(this).data.callee1).unbind(r.endevent, e(this).data.callee2) | |
} | |
}; | |
e.event.special.swipe = { | |
setup: function () { | |
function f(e) { | |
n.data("callee1", arguments.callee); | |
o.x = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageX : e.pageX; | |
o.y = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageY : e.pageY; | |
u.x = o.x; | |
u.y = o.y; | |
i = true; | |
var t = e.originalEvent; | |
a = { | |
position: { | |
x: r.touch_capable ? t.touches[0].screenX : e.screenX, | |
y: r.touch_capable ? t.touches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? t.touches[0].pageX - t.touches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? t.touches[0].pageY - t.touches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
var s = new Date; | |
while (new Date - s < 100) {} | |
} | |
function l(e) { | |
n.data("callee2", arguments.callee); | |
u.x = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageX : e.pageX; | |
u.y = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0].pageY : e.pageY; | |
window.clearTimeout(r.hold_timer); | |
var t; | |
var f = n.data("xthreshold"), | |
l = n.data("ythreshold"), | |
c = typeof f !== "undefined" && f !== false && parseInt(f) ? parseInt(f) : r.swipe_h_threshold, | |
h = typeof l !== "undefined" && l !== false && parseInt(l) ? parseInt(l) : r.swipe_v_threshold; | |
if (o.y > u.y && o.y - u.y > h) { | |
t = "swipeup" | |
} | |
if (o.x < u.x && u.x - o.x > c) { | |
t = "swiperight" | |
} | |
if (o.y < u.y && u.y - o.y > h) { | |
t = "swipedown" | |
} | |
if (o.x > u.x && o.x - u.x > c) { | |
t = "swipeleft" | |
} | |
if (t != undefined && i) { | |
o.x = 0; | |
o.y = 0; | |
u.x = 0; | |
u.y = 0; | |
i = false; | |
var p = e.originalEvent; | |
endEvnt = { | |
position: { | |
x: r.touch_capable ? p.touches[0].screenX : e.screenX, | |
y: r.touch_capable ? p.touches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? p.touches[0].pageX - p.touches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? p.touches[0].pageY - p.touches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
var d = Math.abs(a.position.x - endEvnt.position.x), | |
v = Math.abs(a.position.y - endEvnt.position.y); | |
var m = { | |
startEvnt: a, | |
endEvnt: endEvnt, | |
direction: t.replace("swipe", ""), | |
xAmount: d, | |
yAmount: v, | |
duration: endEvnt.time - a.time | |
}; | |
s = true; | |
n.trigger("swipe", m).trigger(t, m) | |
} | |
} | |
function c(e) { | |
n.data("callee3", arguments.callee); | |
if (s) { | |
var t = n.data("xthreshold"), | |
o = n.data("ythreshold"), | |
u = typeof t !== "undefined" && t !== false && parseInt(t) ? parseInt(t) : r.swipe_h_threshold, | |
f = typeof o !== "undefined" && o !== false && parseInt(o) ? parseInt(o) : r.swipe_v_threshold; | |
var l = e.originalEvent; | |
endEvnt = { | |
position: { | |
x: r.touch_capable ? l.changedTouches[0].screenX : e.screenX, | |
y: r.touch_capable ? l.changedTouches[0].screenY : e.screenY | |
}, | |
offset: { | |
x: r.touch_capable ? l.changedTouches[0].pageX - l.changedTouches[0].target.offsetLeft : e.offsetX, | |
y: r.touch_capable ? l.changedTouches[0].pageY - l.changedTouches[0].target.offsetTop : e.offsetY | |
}, | |
time: (new Date).getTime(), | |
target: e.target | |
}; | |
if (a.position.y > endEvnt.position.y && a.position.y - endEvnt.position.y > f) { | |
swipedir = "swipeup" | |
} | |
if (a.position.x < endEvnt.position.x && endEvnt.position.x - a.position.x > u) { | |
swipedir = "swiperight" | |
} | |
if (a.position.y < endEvnt.position.y && endEvnt.position.y - a.position.y > f) { | |
swipedir = "swipedown" | |
} | |
if (a.position.x > endEvnt.position.x && a.position.x - endEvnt.position.x > u) { | |
swipedir = "swipeleft" | |
} | |
var c = Math.abs(a.position.x - endEvnt.position.x), | |
h = Math.abs(a.position.y - endEvnt.position.y); | |
var p = { | |
startEvnt: a, | |
endEvnt: endEvnt, | |
direction: swipedir.replace("swipe", ""), | |
xAmount: c, | |
yAmount: h, | |
duration: endEvnt.time - a.time | |
}; | |
n.trigger("swipeend", p) | |
} | |
i = false; | |
s = false | |
} | |
var t = this, | |
n = e(t), | |
i = false, | |
s = false, | |
o = { | |
x: 0, | |
y: 0 | |
}, u = { | |
x: 0, | |
y: 0 | |
}, a; | |
n.bind(r.startevent, f); | |
n.bind(r.moveevent, l); | |
n.bind(r.endevent, c) | |
}, | |
remove: function () { | |
e(this).unbind(r.startevent, e(this).data.callee1).unbind(r.moveevent, e(this).data.callee2).unbind(r.endevent, e(this).data.callee3) | |
} | |
}; | |
e.event.special.scrollstart = { | |
setup: function () { | |
function o(e, n) { | |
i = n; | |
E(t, i ? "scrollstart" : "scrollend", e) | |
} | |
var t = this, | |
n = e(t), | |
i, s; | |
n.bind(r.scrollevent, function (e) { | |
n.data("callee", arguments.callee); | |
if (!i) { | |
o(e, true) | |
} | |
clearTimeout(s); | |
s = setTimeout(function () { | |
o(e, false) | |
}, 50) | |
}) | |
}, | |
remove: function () { | |
e(this).unbind(r.scrollevent, e(this).data.callee) | |
} | |
}; | |
var i = e(window), | |
s, o, u, a, f, l = { | |
0: true, | |
180: true | |
}; | |
if (r.orientation_support) { | |
var c = window.innerWidth || e(window).width(), | |
h = window.innerHeight || e(window).height(), | |
p = 50; | |
a = c > h && c - h > p; | |
f = l[window.orientation]; | |
if (a && f || !a && !f) { | |
l = { | |
"-90": true, | |
90: true | |
} | |
} | |
} | |
e.event.special.orientationchange = s = { | |
setup: function () { | |
if (r.orientation_support) { | |
return false | |
} | |
u = o(); | |
i.bind("throttledresize", d); | |
return true | |
}, | |
teardown: function () { | |
if (r.orientation_support) { | |
return false | |
} | |
i.unbind("throttledresize", d); | |
return true | |
}, | |
add: function (e) { | |
var t = e.handler; | |
e.handler = function (e) { | |
e.orientation = o(); | |
return t.apply(this, arguments) | |
} | |
} | |
}; | |
e.event.special.orientationchange.orientation = o = function () { | |
var e = true, | |
t = document.documentElement; | |
if (r.orientation_support) { | |
e = l[window.orientation] | |
} else { | |
e = t && t.clientWidth / t.clientHeight < 1.1 | |
} | |
return e ? "portrait" : "landscape" | |
}; | |
e.event.special.throttledresize = { | |
setup: function () { | |
e(this).bind("resize", m) | |
}, | |
teardown: function () { | |
e(this).unbind("resize", m) | |
} | |
}; | |
var v = 250, | |
m = function () { | |
b = (new Date).getTime(); | |
w = b - g; | |
if (w >= v) { | |
g = b; | |
e(this).trigger("throttledresize") | |
} else { | |
if (y) { | |
window.clearTimeout(y) | |
} | |
y = window.setTimeout(d, v - w) | |
} | |
}, g = 0, | |
y, b, w; | |
e.each({ | |
scrollend: "scrollstart", | |
swipeup: "swipe", | |
swiperight: "swipe", | |
swipedown: "swipe", | |
swipeleft: "swipe", | |
swipeend: "swipe" | |
}, function (t, n, r) { | |
e.event.special[t] = { | |
setup: function () { | |
e(this).bind(n, e.noop) | |
} | |
} | |
}) | |
})(jQuery) | |
/* jQuery custom functions */ | |
var icons = document.getElementsByClassName("icon"), | |
len = icons.length; | |
while (len--) { | |
var me = icons[len]; | |
me.addEventListener("mouseover", function (event) { | |
document.body.className = this.className.replace("icon ", "") | |
}, false) | |
} | |
var hit = $("#container h1"); | |
var bg = $("body"); | |
hit.dblclick(function () { | |
bg.toggleClass("basic") | |
}); | |
$(document).ready(function () { | |
if ($(window).width() >= 980) if (!Modernizr.touch) $("#container #me").pep() | |
}); | |
var me = $("#container #me"); | |
me.bind("doubletap", function (e) { | |
me.toggleClass("dog") | |
}); | |
(function ($) { | |
$.fn.list_ticker = function (options) { | |
var defaults = { | |
speed: 9500, | |
effect: "fade" | |
}; | |
var options = $.extend(defaults, options); | |
return this.each(function () { | |
var obj = $(this); | |
var list = obj.children(); | |
list.not(":first").hide(); | |
setInterval(function () { | |
list = obj.children(); | |
list.not(":first").hide(); | |
var first_li = list.eq(0); | |
var second_li = list.eq(1); | |
if (options.effect == "fade") first_li.fadeOut(function () { | |
second_li.fadeIn(); | |
first_li.remove().appendTo(obj) | |
}) | |
}, options.speed) | |
}) | |
} | |
})(jQuery); | |
$(document).ready(function () { | |
$("#container ul#about").list_ticker({ | |
speed: 7600, | |
effect: "fade" | |
}) | |
}); | |
$(document).ready(function () { | |
$("li.icon").each(function () { | |
$(this).hover(function () { | |
$(this).stop().animate({ | |
opacity: 1 | |
}, 510) | |
}, function () { | |
$(this).stop().animate({ | |
opacity: 0.75 | |
}, 810) | |
}) | |
}) | |
}); | |
(function (window, undefined) { | |
var konami_keys = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65], | |
konami_index = 0, | |
handler = function (e) { | |
if (e.keyCode === konami_keys[konami_index++]) { | |
if (konami_index === konami_keys.length) { | |
$(document).unbind("keydown", handler); | |
$.getScript("http://boeddo.com/assets/js/unicorn.js?", function () {}) | |
} | |
} else konami_index = 0 | |
}; | |
$(document).bind("keydown", handler) | |
})(this); | |
(function ($) { | |
$.fn.konami = function (options) { | |
var opts, masterKey, controllerCode, code, bIsValid, i, l; | |
var opts = $.extend({}, $.fn.konami.defaults, options); | |
return this.each(function () { | |
masterKey = [80, 69, 78]; | |
controllerCode = []; | |
$(window).keyup(function (evt) { | |
code = evt.keyCode ? evt.keyCode : evt.which; | |
controllerCode.push(code); | |
if (3 === controllerCode.length) { | |
bIsValid = true; | |
for (i = 0, l = masterKey.length; i < l; i++) if (masterKey[i] !== controllerCode[i]) bIsValid = false; | |
if (bIsValid) opts.cheat(); | |
controllerCode = [] | |
} | |
}) | |
}) | |
}; | |
$.fn.konami.defaults = { | |
cheat: null | |
} | |
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url(http://fonts.googleapis.com/css?family=Bangers); | |
* { | |
margin: 0; | |
padding: 0; | |
border: none; | |
text-decoration: none; | |
} | |
html, body { | |
background:url(http://web-sonick.zz.mu/images/BG/bgtab-cont.jpg); | |
width: 100%; | |
height: 100%; | |
-webkit-font-smoothing: antialiased; | |
font-family: 'Open Sans', Helvetica Neue, Helvetica, Verdana, Arial, sans-serif; | |
} | |
#container { | |
max-width: 980px; | |
min-height: 500px; | |
width: 100%; | |
position: relative; | |
margin: auto; | |
top: 50%; | |
margin-top: -250px; | |
-webkit-animation: fade-in 1.3s; | |
-moz-animation: fade-in 1.3s; | |
-o-animation: fade-in 1.3s; | |
-ms-animation: fade-in 1.3s; | |
animation: fade-in 1.3s; | |
} | |
#container #me h1 { | |
font-family: 'Bangers', cursive; | |
margin-top:40%; | |
margin-left:-50%; | |
} | |
#container #me span { | |
color:red; | |
} | |
#container #me { | |
cursor:move; | |
width: 160px; | |
height: 160px; | |
background: url(http://wpmu.org/wp-content/uploads/2013/01/codepen.png); | |
background-size: 160px 160px !important; | |
position: absolute; | |
top: 0; | |
right: 0; | |
z-index: 999; | |
-webkit-transition: background .7s ease-in-out; | |
-moz-transition: background .7s ease-in-out; | |
-o-transition: background .7s ease-in-out; | |
transition: background .7s ease-in-out; | |
-webkit-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
-o-user-select: none; | |
user-select: none; | |
} | |
#container #me.dog { | |
background: url(http://wpmu.org/wp-content/uploads/2013/01/codepen.png); | |
} | |
::selection { | |
background: #f0f0f0; | |
} | |
::-moz-selection { | |
background: #f0f0f0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment