1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-06-03 19:22:27 +00:00

Added $tw.utils.pulse() for animating elements

To make it easier to see things while debugging
This commit is contained in:
Jeremy Ruston
2012-10-15 17:18:32 +01:00
parent 7ee48626ab
commit fd4ff10bf3
4 changed files with 30 additions and 0 deletions
+7
View File
@@ -28,6 +28,13 @@ exports.getBrowserInfo = function(info) {
"Moz": "transitionend",
"webkit": "webkitTransitionEnd"
}[info.prefix];
info.animationEnd = {
"": "animationEnd",
"O": "oAnimationEnd",
"MS": "msAnimationEnd",
"Moz": "animationend",
"webkit": "webkitAnimationEnd"
}[info.prefix];
info.requestFullScreen = document.body.webkitRequestFullScreen !== undefined ? "webkitRequestFullScreen" :
document.body.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
document.body.requestFullScreen !== undefined ? "requestFullScreen" : "";
+15
View File
@@ -112,4 +112,19 @@ exports.forceLayout = function(element) {
var dummy = element.offsetWidth;
};
/*
Pulse an element for debugging purposes
*/
exports.pulseElement = function(element) {
// Event handler to remove the class at the end
element.addEventListener($tw.browser.animationEnd,function handler(event) {
element.removeEventListener($tw.browser.animationEnd,handler,false);
$tw.utils.removeClass(element,"pulse");
},false);
// Apply the pulse class
$tw.utils.removeClass(element,"pulse");
element.offsetWidth;
$tw.utils.addClass(element,"pulse");
};
})();