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

View File

@ -14,6 +14,7 @@ Transclude macro
exports.info = {
name: "transclude",
dependentAll: true, // Tiddlers containing <<transclude>> macro are dependent on every tiddler
params: {
filter: {byPos: 0, type: "filter"},
title: {byPos: 1, type: "tiddler"},
@ -24,6 +25,7 @@ exports.info = {
};
exports.executeMacro = function() {
console.log("Executing transclude macro",this.params.filter,this.tiddlerTitle);
var titles,templateTiddler,templateText,t,title,templateParseTree,
nodes,node,c,
parents = this.parents.slice(0);

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" : "";

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");
};
})();

View File

@ -12,6 +12,12 @@
"title": "$:/core/lib/bootstrap-responsive.css",
"type": "text/css"
}
}, {
"file": "pulse.css",
"fields": {
"title": "$:/core/lib/pulse.css",
"type": "text/css"
}
}
]
}