Skip to content

Instantly share code, notes, and snippets.

@anthonysbrown
Last active February 23, 2016 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonysbrown/faa4d1415e4ec98a7e6b to your computer and use it in GitHub Desktop.
Save anthonysbrown/faa4d1415e4ec98a7e6b to your computer and use it in GitHub Desktop.
Remove jqueryui widget from jquery.mobile.customized.min.js for cherry framework 3.1.5
window.define = function() {
Array.prototype.slice.call(arguments).pop()(window.jQuery)
};
define(["jquery", "./jquery.ui.widget"], function(a) {
(function(a, b) {
a.widget("mobile.widget", {
_createWidget: function() {
a.Widget.prototype._createWidget.apply(this, arguments);
this._trigger("init")
},
_getCreateOptions: function() {
var c = this.element,
d = {};
a.each(this.options, function(a) {
var e = c.jqmData(a.replace(/[A-Z]/g, function(a) {
return "-" + a.toLowerCase()
}));
if (e !== b) {
d[a] = e
}
});
return d
},
enhanceWithin: function(b) {
var c = a.mobile.closestPageData(a(b)),
d = c && c.keepNativeSelector() || "";
a(this.options.initSelector, b).not(d)[this.widgetName]()
}
})
})(jQuery)
});
define(["jquery", "./jquery.mobile.core"], function(a) {
(function(a, b) {
var c = a(window),
d = a("html");
a.mobile.media = function() {
var b = {},
c = a("<div id='jquery-mediatest'>"),
e = a("<body>").append(c);
return function(a) {
if (!(a in b)) {
var f = document.createElement("style"),
g = "@media " + a + " { #jquery-mediatest { position:absolute; } }";
f.type = "text/css";
if (f.styleSheet) {
f.styleSheet.cssText = g
} else {
f.appendChild(document.createTextNode(g))
}
d.prepend(e).prepend(f);
b[a] = c.css("position") === "absolute";
e.add(f).remove()
}
return b[a]
}
}()
})(jQuery)
});
define(["jquery", "./jquery.mobile.media"], function(a) {
(function(a, b) {
function m() {
var b = location.protocol + "//" + location.host + location.pathname + "ui-dir/",
d = a("head base"),
e = null,
f = "",
g, h;
if (!d.length) {
d = e = a("<base>", {
href: b
}).appendTo("head")
} else {
f = d.attr("href")
}
g = a("<a href='testurl' />").prependTo(c);
h = g[0].href;
d[0].href = f || location.pathname;
if (e) {
e.remove()
}
return h.indexOf(b) === 0
}
function l() {
var b = "transform-3d";
return k("perspective", "10px", "moz") || a.mobile.media("(-" + e.join("-" + b + "),(-") + "-" + b + "),(" + b + ")")
}
function k(a, b, c) {
var d = document.createElement("div"),
f = function(a) {
return a.charAt(0).toUpperCase() + a.substr(1)
},
g = function(a) {
return "-" + a.charAt(0).toLowerCase() + a.substr(1) + "-"
},
h = function(c) {
var e = g(c) + a + ": " + b + ";",
h = f(c),
i = h + f(a);
d.setAttribute("style", e);
if (!!d.style[i]) {
k = true
}
},
j = c ? [c] : e,
k;
for (i = 0; i < j.length; i++) {
h(j[i])
}
return !!k
}
function j(a) {
var c = a.charAt(0).toUpperCase() + a.substr(1),
f = (a + " " + e.join(c + " ") + c).split(" ");
for (var g in f) {
if (d[f[g]] !== b) {
return true
}
}
}
var c = a("<body>").prependTo("html"),
d = c[0].style,
e = ["Webkit", "Moz", "O"],
f = "palmGetResource" in window,
g = window.operamini && {}.toString.call(window.operamini) === "[object OperaMini]",
h = window.blackberry;
a.extend(a.mobile, {
browser: {}
});
a.mobile.browser.ie = function() {
var a = 3,
b = document.createElement("div"),
c = b.all || [];
while (b.innerHTML = "<!--[if gt IE " + ++a + "]><br><![endif]-->", c[0]) {}
return a > 4 ? a : !a
}();
a.extend(a.support, {
orientation: "orientation" in window && "onorientationchange" in window,
touch: "ontouchend" in document,
cssTransitions: "WebKitTransitionEvent" in window || k("transition", "height 100ms linear"),
pushState: "pushState" in history && "replaceState" in history,
mediaquery: a.mobile.media("only all"),
cssPseudoElement: !!j("content"),
touchOverflow: !!j("overflowScrolling"),
cssTransform3d: l(),
boxShadow: !!j("boxShadow") && !h,
scrollTop: ("pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in c[0]) && !f && !g,
dynamicBaseTag: m()
});
c.remove();
var n = function() {
var a = window.navigator.userAgent;
return a.indexOf("Nokia") > -1 && (a.indexOf("Symbian/3") > -1 || a.indexOf("Series60/5") > -1) && a.indexOf("AppleWebKit") > -1 && a.match(/(BrowserNG|NokiaBrowser)\/7\.[0-3]/)
}();
a.mobile.ajaxBlacklist = window.blackberry && !window.WebKitPoint || g || n;
if (n) {
a(function() {
a("head link[rel='stylesheet']").attr("rel", "alternate stylesheet").attr("rel", "stylesheet")
})
}
if (!a.support.boxShadow) {
a("html").addClass("ui-mobile-nosupport-boxshadow")
}
})(jQuery)
});
define(["jquery"], function(a) {
(function(a, b, c, d) {
function O(b) {
var c = b.substr(1);
return {
setup: function(d, f) {
if (!M(this)) {
a.data(this, e, {})
}
var g = a.data(this, e);
g[b] = true;
k[b] = (k[b] || 0) + 1;
if (k[b] === 1) {
t.bind(c, H)
}
a(this).bind(c, N);
if (s) {
k["touchstart"] = (k["touchstart"] || 0) + 1;
if (k["touchstart"] === 1) {
t.bind("touchstart", I).bind("touchend", L).bind("touchmove", K).bind("scroll", J)
}
}
},
teardown: function(d, f) {
--k[b];
if (!k[b]) {
t.unbind(c, H)
}
if (s) {
--k["touchstart"];
if (!k["touchstart"]) {
t.unbind("touchstart", I).unbind("touchmove", K).unbind("touchend", L).unbind("scroll", J)
}
}
var g = a(this),
h = a.data(this, e);
if (h) {
h[b] = false
}
g.unbind(c, N);
if (!M(this)) {
g.removeData(e)
}
}
}
}
function N() {}
function M(b) {
var c = a.data(b, e),
d;
if (c) {
for (d in c) {
if (c[d]) {
return true
}
}
}
return false
}
function L(a) {
if (r) {
return
}
B();
var b = y(a.target),
c;
G("vmouseup", a, b);
if (!o) {
var d = G("vclick", a, b);
if (d && d.isDefaultPrevented()) {
c = w(a).changedTouches[0];
p.push({
touchID: v,
x: c.clientX,
y: c.clientY
});
q = true
}
}
G("vmouseout", a, b);
o = false;
E()
}
function K(b) {
if (r) {
return
}
var c = w(b).touches[0],
d = o,
e = a.vmouse.moveDistanceThreshold;
o = o || Math.abs(c.pageX - m) > e || Math.abs(c.pageY - n) > e, flags = y(b.target);
if (o && !d) {
G("vmousecancel", b, flags)
}
G("vmousemove", b, flags);
E()
}
function J(a) {
if (r) {
return
}
if (!o) {
G("vmousecancel", a, y(a.target))
}
o = true;
E()
}
function I(b) {
var c = w(b).touches,
d, e;
if (c && c.length === 1) {
d = b.target;
e = y(d);
if (e.hasVirtualBinding) {
v = u++;
a.data(d, f, v);
F();
D();
o = false;
var g = w(b).touches[0];
m = g.pageX;
n = g.pageY;
G("vmouseover", b, e);
G("vmousedown", b, e)
}
}
}
function H(b) {
var c = a.data(b.target, f);
if (!q && (!v || v !== c)) {
var d = G("v" + b.type, b);
if (d) {
if (d.isDefaultPrevented()) {
b.preventDefault()
}
if (d.isPropagationStopped()) {
b.stopPropagation()
}
if (d.isImmediatePropagationStopped()) {
b.stopImmediatePropagation()
}
}
}
}
function G(b, c, d) {
var e;
if (d && d[b] || !d && z(c.target, b)) {
e = x(c, b);
a(c.target).trigger(e)
}
return e
}
function F() {
if (l) {
clearTimeout(l);
l = 0
}
}
function E() {
F();
l = setTimeout(function() {
l = 0;
C()
}, a.vmouse.resetTimerDuration)
}
function D() {
A()
}
function C() {
v = 0;
p.length = 0;
q = false;
B()
}
function B() {
r = true
}
function A() {
r = false
}
function z(b, c) {
var d;
while (b) {
d = a.data(b, e);
if (d && (!c || d[c])) {
return b
}
b = b.parentNode
}
return null
}
function y(b) {
var c = {},
d, f;
while (b) {
d = a.data(b, e);
for (f in d) {
if (d[f]) {
c[f] = c.hasVirtualBinding = true
}
}
b = b.parentNode
}
return c
}
function x(b, c) {
var e = b.type,
f, g, i, k, l, m, n, o;
b = a.Event(b);
b.type = c;
f = b.originalEvent;
g = a.event.props;
if (e.search(/mouse/) > -1) {
g = j
}
if (f) {
for (n = g.length, k; n;) {
k = g[--n];
b[k] = f[k]
}
}
if (e.search(/mouse(down|up)|click/) > -1 && !b.which) {
b.which = 1
}
if (e.search(/^touch/) !== -1) {
i = w(f);
e = i.touches;
l = i.changedTouches;
m = e && e.length ? e[0] : l && l.length ? l[0] : d;
if (m) {
for (o = 0, len = h.length; o < len; o++) {
k = h[o];
b[k] = m[k]
}
}
}
return b
}
function w(a) {
while (a && typeof a.originalEvent !== "undefined") {
a = a.originalEvent
}
return a
}
var e = "virtualMouseBindings",
f = "virtualTouchID",
g = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),
h = "clientX clientY pageX pageY screenX screenY".split(" "),
i = a.event.mouseHooks ? a.event.mouseHooks.props : [],
j = a.event.props.concat(i),
k = {},
l = 0,
m = 0,
n = 0,
o = false,
p = [],
q = false,
r = false,
s = "addEventListener" in c,
t = a(c),
u = 1,
v = 0;
a.vmouse = {
moveDistanceThreshold: 10,
clickDistanceThreshold: 10,
resetTimerDuration: 1500
};
for (var P = 0; P < g.length; P++) {
a.event.special[g[P]] = O(g[P])
}
if (s) {
c.addEventListener("click", function(b) {
var c = p.length,
d = b.target,
e, g, h, i, j, k;
if (c) {
e = b.clientX;
g = b.clientY;
threshold = a.vmouse.clickDistanceThreshold;
h = d;
while (h) {
for (i = 0; i < c; i++) {
j = p[i];
k = 0;
if (h === d && Math.abs(j.x - e) < threshold && Math.abs(j.y - g) < threshold || a.data(h, f) === j.touchID) {
b.preventDefault();
b.stopPropagation();
return
}
}
h = h.parentNode
}
}
}, true)
}
})(jQuery, window, document)
});
define(["jquery", "./jquery.mobile.core", "./jquery.mobile.media", "./jquery.mobile.support", "./jquery.mobile.vmouse"], function(a) {
(function(a, b, c) {
function i(b, c, d) {
var e = d.type;
d.type = c;
a.event.handle.call(b, d);
d.type = e
}
a.each(("touchstart touchmove touchend orientationchange throttledresize " + "tap taphold swipe swipeleft swiperight scrollstart scrollstop").split(" "), function(b, c) {
a.fn[c] = function(a) {
return a ? this.bind(c, a) : this.trigger(c)
};
a.attrFn[c] = true
});
var d = a.support.touch,
e = "touchmove scroll",
f = d ? "touchstart" : "mousedown",
g = d ? "touchend" : "mouseup",
h = d ? "touchmove" : "mousemove";
a.event.special.scrollstart = {
enabled: true,
setup: function() {
function g(a, c) {
d = c;
i(b, d ? "scrollstart" : "scrollstop", a)
}
var b = this,
c = a(b),
d, f;
c.bind(e, function(b) {
if (!a.event.special.scrollstart.enabled) {
return
}
if (!d) {
g(b, true)
}
clearTimeout(f);
f = setTimeout(function() {
g(b, false)
}, 50)
})
}
};
a.event.special.tap = {
setup: function() {
var b = this,
c = a(b);
c.bind("vmousedown", function(d) {
function k(a) {
j();
if (e == a.target) {
i(b, "tap", a)
}
}
function j() {
h();
c.unbind("vclick", k).unbind("vmouseup", h);
a(document).unbind("vmousecancel", j)
}
function h() {
clearTimeout(g)
}
if (d.which && d.which !== 1) {
return false
}
var e = d.target,
f = d.originalEvent,
g;
c.bind("vmouseup", h).bind("vclick", k);
a(document).bind("vmousecancel", j);
g = setTimeout(function() {
i(b, "taphold", a.Event("taphold"))
}, 750)
})
}
};
a.event.special.swipe = {
scrollSupressionThreshold: 10,
durationThreshold: 1e3,
horizontalDistanceThreshold: 30,
verticalDistanceThreshold: 75,
setup: function() {
var b = this,
d = a(b);
d.bind(f, function(b) {
function j(b) {
if (!f) {
return
}
var c = b.originalEvent.touches ? b.originalEvent.touches[0] : b;
i = {
time: (new Date).getTime(),
coords: [c.pageX, c.pageY]
};
if (Math.abs(f.coords[0] - i.coords[0]) > a.event.special.swipe.scrollSupressionThreshold) {
b.preventDefault()
}
}
var e = b.originalEvent.touches ? b.originalEvent.touches[0] : b,
f = {
time: (new Date).getTime(),
coords: [e.pageX, e.pageY],
origin: a(b.target)
},
i;
d.bind(h, j).one(g, function(b) {
d.unbind(h, j);
if (f && i) {
if (i.time - f.time < a.event.special.swipe.durationThreshold && Math.abs(f.coords[0] - i.coords[0]) > a.event.special.swipe.horizontalDistanceThreshold && Math.abs(f.coords[1] - i.coords[1]) < a.event.special.swipe.verticalDistanceThreshold) {
f.origin.trigger("swipe").trigger(f.coords[0] > i.coords[0] ? "swipeleft" : "swiperight")
}
}
f = i = c
})
})
}
};
(function(a, b) {
function j() {
var a = e();
if (a !== f) {
f = a;
c.trigger("orientationchange")
}
}
var c = a(b),
d, e, f, g, h, i = {
0: true,
180: true
};
if (a.support.orientation) {
g = a.mobile.media("all and (orientation: landscape)");
h = i[b.orientation];
if (g && h || !g && !h) {
i = {
"-90": true,
90: true
}
}
}
a.event.special.orientationchange = d = {
setup: function() {
if (a.support.orientation && a.mobile.orientationChangeEnabled) {
return false
}
f = e();
c.bind("throttledresize", j)
},
teardown: function() {
if (a.support.orientation && a.mobile.orientationChangeEnabled) {
return false
}
c.unbind("throttledresize", j)
},
add: function(a) {
var b = a.handler;
a.handler = function(a) {
a.orientation = e();
return b.apply(this, arguments)
}
}
};
a.event.special.orientationchange.orientation = e = function() {
var c = true,
d = document.documentElement;
if (a.support.orientation) {
c = i[b.orientation]
} else {
c = d && d.clientWidth / d.clientHeight < 1.1
}
return c ? "portrait" : "landscape"
}
})(jQuery, b);
(function() {
a.event.special.throttledresize = {
setup: function() {
a(this).bind("resize", c)
},
teardown: function() {
a(this).unbind("resize", c)
}
};
var b = 250,
c = function() {
f = (new Date).getTime();
g = f - d;
if (g >= b) {
d = f;
a(this).trigger("throttledresize")
} else {
if (e) {
clearTimeout(e)
}
e = setTimeout(c, b - g)
}
},
d = 0,
e, f, g
})();
a.each({
scrollstop: "scrollstart",
taphold: "tap",
swipeleft: "swipe",
swiperight: "swipe"
}, function(b, c) {
a.event.special[b] = {
setup: function() {
a(this).bind(c, a.noop)
}
}
})
})(jQuery, this)
});
define(["jquery", "../external/requirejs/text!../version.txt", "./jquery.mobile.widget"], function(a, b) {
(function(a, c, d) {
var e = {};
a.mobile = a.extend({}, {
version: b,
ns: "",
subPageUrlKey: "ui-page",
activePageClass: "ui-page-active",
activeBtnClass: "ui-btn-active",
focusClass: "ui-focus",
ajaxEnabled: true,
hashListeningEnabled: true,
linkBindingEnabled: true,
defaultPageTransition: "fade",
maxTransitionWidth: false,
minScrollBack: 10,
touchOverflowEnabled: false,
defaultDialogTransition: "pop",
loadingMessage: "loading",
pageLoadErrorMessage: "Error Loading Page",
loadingMessageTextVisible: false,
loadingMessageTheme: "a",
pageLoadErrorMessageTheme: "e",
autoInitializePage: true,
pushStateEnabled: true,
orientationChangeEnabled: true,
gradeA: function() {
return a.support.mediaquery || a.mobile.browser.ie && a.mobile.browser.ie >= 7
},
keyCode: {
ALT: 18,
BACKSPACE: 8,
CAPS_LOCK: 20,
COMMA: 188,
COMMAND: 91,
COMMAND_LEFT: 91,
COMMAND_RIGHT: 93,
CONTROL: 17,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
INSERT: 45,
LEFT: 37,
MENU: 93,
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106,
NUMPAD_SUBTRACT: 109,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SHIFT: 16,
SPACE: 32,
TAB: 9,
UP: 38,
WINDOWS: 91
},
silentScroll: function(b) {
if (a.type(b) !== "number") {
b = a.mobile.defaultHomeScroll
}
a.event.special.scrollstart.enabled = false;
setTimeout(function() {
c.scrollTo(0, b);
a(document).trigger("silentscroll", {
x: 0,
y: b
})
}, 20);
setTimeout(function() {
a.event.special.scrollstart.enabled = true
}, 150)
},
nsNormalizeDict: e,
nsNormalize: function(b) {
if (!b) {
return
}
return e[b] || (e[b] = a.camelCase(a.mobile.ns + b))
},
getInheritedTheme: function(a, b) {
var c = a[0],
d = "",
e = /ui-(bar|body)-([a-z])\b/,
f, g;
while (c) {
var f = c.className || "";
if ((g = e.exec(f)) && (d = g[2])) {
break
}
c = c.parentNode
}
return d || b || "a"
},
closestPageData: function(a) {
return a.closest(':jqmData(role="page"), :jqmData(role="dialog")').data("page")
}
}, a.mobile);
a.fn.jqmData = function(b, c) {
var d;
if (typeof b != "undefined") {
d = this.data(b ? a.mobile.nsNormalize(b) : b, c)
}
return d
};
a.jqmData = function(b, c, d) {
var e;
if (typeof c != "undefined") {
e = a.data(b, c ? a.mobile.nsNormalize(c) : c, d)
}
return e
};
a.fn.jqmRemoveData = function(b) {
return this.removeData(a.mobile.nsNormalize(b))
};
a.jqmRemoveData = function(b, c) {
return a.removeData(b, a.mobile.nsNormalize(c))
};
a.fn.removeWithDependents = function() {
a.removeWithDependents(this)
};
a.removeWithDependents = function(b) {
var c = a(b);
(c.jqmData("dependents") || a()).remove();
c.remove()
};
a.fn.addDependents = function(b) {
a.addDependents(a(this), b)
};
a.addDependents = function(b, c) {
var d = a(b).jqmData("dependents") || a();
a(b).jqmData("dependents", a.merge(d, c))
};
a.fn.getEncodedText = function() {
return a("<div/>").text(a(this).text()).html()
};
var f = a.find,
g = /:jqmData\(([^)]*)\)/g;
a.find = function(b, c, d, e) {
b = b.replace(g, "[data-" + (a.mobile.ns || "") + "$1]");
return f.call(this, b, c, d, e)
};
a.extend(a.find, f);
a.find.matches = function(b, c) {
return a.find(b, null, null, c)
};
a.find.matchesSelector = function(b, c) {
return a.find(c, null, null, [b]).length > 0
}
})(jQuery, this)
})
@anthonysbrown
Copy link
Author

Cherry frame work 3.0 for some reason decided to embed jquery ui widget into their mobile menu which will conflict if you have jquery ui running. This removes that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment