removed dead code
This commit is contained in:
parent
776f430ef7
commit
316fce063a
7 changed files with 314 additions and 938 deletions
|
@ -1,4 +1,84 @@
|
|||
(function ($, undefined) {
|
||||
var props = {
|
||||
"animation": {},
|
||||
"transition": {}
|
||||
},
|
||||
testElement = document.createElement("a"),
|
||||
vendorPrefixes = ["", "webkit-", "moz-", "o-"];
|
||||
|
||||
$.each(["animation", "transition"], function (i, test) {
|
||||
|
||||
// Get correct name for test
|
||||
var testName = (i === 0) ? test + "-" + "name" : test;
|
||||
|
||||
$.each(vendorPrefixes, function (j, prefix) {
|
||||
if (testElement.style[$.camelCase(prefix + testName)] !== undefined) {
|
||||
props[test]["prefix"] = prefix;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Set event and duration names for later use
|
||||
props[test]["duration"] =
|
||||
$.camelCase(props[test]["prefix"] + test + "-" + "duration");
|
||||
props[test]["event"] =
|
||||
$.camelCase(props[test]["prefix"] + test + "-" + "end");
|
||||
|
||||
// All lower case if not a vendor prop
|
||||
if (props[test]["prefix"] === "") {
|
||||
props[test]["event"] = props[test]["event"].toLowerCase();
|
||||
}
|
||||
});
|
||||
|
||||
// Remove the testElement
|
||||
$(testElement).remove();
|
||||
|
||||
// Animation complete callback
|
||||
$.fn.animationComplete = function (callback, type, fallbackTime) {
|
||||
var timer, duration,
|
||||
that = this,
|
||||
eventBinding = function () {
|
||||
|
||||
// Clear the timer so we don't call callback twice
|
||||
clearTimeout(timer);
|
||||
callback.apply(this, arguments);
|
||||
},
|
||||
animationType = (!type || type === "animation") ? "animation" : "transition";
|
||||
|
||||
// If a fallback time was not passed set one
|
||||
if (fallbackTime === undefined) {
|
||||
|
||||
// Make sure the was not bound to document before checking .css
|
||||
if ($(this).context !== document) {
|
||||
|
||||
// Parse the durration since its in second multiple by 1000 for milliseconds
|
||||
// Multiply by 3 to make sure we give the animation plenty of time.
|
||||
duration = parseFloat(
|
||||
$(this).css(props[animationType].duration)
|
||||
) * 3000;
|
||||
}
|
||||
|
||||
// If we could not read a duration use the default
|
||||
if (duration === 0 || duration === undefined || isNaN(duration)) {
|
||||
duration = $.fn.animationComplete.defaultDuration;
|
||||
}
|
||||
}
|
||||
|
||||
// Sets up the fallback if event never comes
|
||||
timer = setTimeout(function () {
|
||||
$(that).off(props[animationType].event, eventBinding);
|
||||
callback.apply(that);
|
||||
}, duration);
|
||||
|
||||
// Bind the event
|
||||
return $(this).one(props[animationType].event, eventBinding);
|
||||
};
|
||||
|
||||
// Allow default callback to be configured on mobileInit
|
||||
$.fn.animationComplete.defaultDuration = 1000;
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
$.widget("mobile.panel", {
|
||||
options: {
|
||||
|
@ -48,7 +128,7 @@
|
|||
this._addPanelClasses();
|
||||
|
||||
// if animating, add the class to do so
|
||||
if ($.support.cssTransform3d && !!this.options.animate) {
|
||||
if (!!this.options.animate) {
|
||||
this.element.addClass(this.options.classes.animate);
|
||||
}
|
||||
|
||||
|
@ -136,12 +216,11 @@
|
|||
_positionPanel: function (scrollToTop) {
|
||||
var self = this,
|
||||
panelInnerHeight = self._panelInner.outerHeight(),
|
||||
expand = panelInnerHeight > $.mobile.getScreenHeight();
|
||||
expand = panelInnerHeight > (window.innerHeight || $(window).height());
|
||||
|
||||
if (expand || !self.options.positionFixed) {
|
||||
if (expand) {
|
||||
self._unfixPanel();
|
||||
$.mobile.resetActivePageHeight(panelInnerHeight);
|
||||
}
|
||||
if (scrollToTop) {
|
||||
this.window[0].scrollTo(0, $.mobile.defaultHomeScroll);
|
||||
|
@ -278,11 +357,11 @@
|
|||
self._off(self.document, "panelclose");
|
||||
self._page().jqmData("panel", "open");
|
||||
|
||||
if ($.support.cssTransform3d && !!o.animate && o.display !== "overlay") {
|
||||
if (!!o.animate && o.display !== "overlay") {
|
||||
self._wrapper.addClass(o.classes.animate);
|
||||
}
|
||||
|
||||
if (!immediate && $.support.cssTransform3d && !!o.animate) {
|
||||
if (!immediate && !!o.animate) {
|
||||
(self._wrapper || self.element)
|
||||
.animationComplete(complete, "transition");
|
||||
} else {
|
||||
|
@ -359,7 +438,7 @@
|
|||
self._wrapper.removeClass(self._pageContentOpenClasses);
|
||||
}
|
||||
|
||||
if (!immediate && $.support.cssTransform3d && !!o.animate) {
|
||||
if (!immediate && !!o.animate) {
|
||||
(self._wrapper || self.element)
|
||||
.animationComplete(complete, "transition");
|
||||
} else {
|
||||
|
@ -384,13 +463,12 @@
|
|||
self._wrapper.removeClass(o.classes.pageContentPrefix + "-open");
|
||||
}
|
||||
|
||||
if ($.support.cssTransform3d && !!o.animate && o.display !== "overlay") {
|
||||
if (!!o.animate && o.display !== "overlay") {
|
||||
self._wrapper.removeClass(o.classes.animate);
|
||||
}
|
||||
|
||||
self._fixPanel();
|
||||
self._unbindFixListener();
|
||||
$.mobile.resetActivePageHeight();
|
||||
|
||||
self._page().jqmRemoveData("panel");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue