Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions jquery.roundabout.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,44 @@

var defaults, internalData, methods;


// compareVersions
// compares a given version string with another
var compareVersions = function(baseVersion, compareVersion) {
var i,
base = baseVersion.split(/\./i),
compare = compareVersion.split(/\./i),
maxVersionSegmentLength = (base.length > compare.length) ? base.length : compare.length;

for (i = 0; i <= maxVersionSegmentLength; i++) {
if (base[i] && !compare[i] && parseInt(base[i], 10) !== 0) {
// base is higher
return 1;
} else if (compare[i] && !base[i] && parseInt(compare[i], 10) !== 0) {
// compare is higher
return -1;
} else if (base[i] === compare[i]) {
// these are the same, next
continue;
}

if (base[i] && compare[i]) {
if (parseInt(base[i], 10) > parseInt(compare[i], 10)) {
// base is higher
return 1;
} else {
// compare is higher
return -1;
}
}
}

// nothing was triggered, versions are the same
return 0;
};

var useUpdatedBearingCalculation = compareVersions.apply(null, [$.fn.jquery, "1.7.2"]) >= 0 && (compareVersions.apply(null, [$.ui.version, "1.9.1"]) >= 0 || !$.easing['easeOutBack']);

// add default shape
$.extend({
roundaboutShapes: {
Expand Down Expand Up @@ -688,9 +726,7 @@
newBearing = $.easing[thisEasingType]((timer / passedData.totalTime), timer, passedData.start, bearing - passedData.start, passedData.totalTime);
}

// fixes issue #24, animation changed as of jQuery 1.7.2
// also addresses issue #29, using easing breaks "linear"
if (methods.compareVersions.apply(null, [$().jquery, "1.7.2"]) >= 0 && !($.easing["easeOutBack"])) {
if (useUpdatedBearingCalculation) {
newBearing = passedData.start + ((bearing - passedData.start) * newBearing);
}

Expand Down Expand Up @@ -1144,42 +1180,6 @@

return (data.childInFocus > -1) ? data.childInFocus : false;
},


// compareVersions
// compares a given version string with another
compareVersions: function(baseVersion, compareVersion) {
var i,
base = baseVersion.split(/\./i),
compare = compareVersion.split(/\./i),
maxVersionSegmentLength = (base.length > compare.length) ? base.length : compare.length;

for (i = 0; i <= maxVersionSegmentLength; i++) {
if (base[i] && !compare[i] && parseInt(base[i], 10) !== 0) {
// base is higher
return 1;
} else if (compare[i] && !base[i] && parseInt(compare[i], 10) !== 0) {
// compare is higher
return -1;
} else if (base[i] === compare[i]) {
// these are the same, next
continue;
}

if (base[i] && compare[i]) {
if (parseInt(base[i], 10) > parseInt(compare[i], 10)) {
// base is higher
return 1;
} else {
// compare is higher
return -1;
}
}
}

// nothing was triggered, versions are the same
return 0;
}
};


Expand All @@ -1193,4 +1193,4 @@
$.error("Method " + method + " does not exist for jQuery.roundabout.");
}
};
})(jQuery);
})(jQuery);
Loading