1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-05 09:36:18 +00:00

Merge branch 'master' into multi-wiki-support

This commit is contained in:
Jeremy Ruston 2024-02-22 17:39:51 +00:00
commit 3c58788e37
2 changed files with 17 additions and 7 deletions

View File

@ -0,0 +1,2 @@
title: $:/config/Performance/Instrumentation
text: yes

View File

@ -25,13 +25,19 @@ exports.startup = function() {
var paramObject = event.paramObject || {},
options = {},
extractNumericParameter = function(name) {
options[name] = paramObject[name] && $tw.utils.parseNumber(paramObject[name]);
if(paramObject[name]) {
options[name] = $tw.utils.parseNumber(paramObject[name]);
}
},
extractListParameter = function(name) {
options[name] = paramObject[name] && $tw.utils.parseStringArray(paramObject[name]);
if(paramObject[name]) {
options[name] = $tw.utils.parseStringArray(paramObject[name]);
}
},
extractBooleanParameter = function(name) {
options[name] = paramObject[name] && paramObject[name] === "yes";
if(paramObject[name]) {
options[name] = paramObject[name] === "yes";
}
};
$tw.utils.each("particleCount angle spread startVelocity decay gravity drift ticks scalar zIndex".split(" "),function(name) {
extractNumericParameter(name);
@ -39,10 +45,12 @@ exports.startup = function() {
$tw.utils.each("colors shapes".split(" "),function(name) {
extractListParameter(name);
});
options.origin = {
x: paramObject.originX && $tw.utils.parseNumber(paramObject.originX),
y: paramObject.originY && $tw.utils.parseNumber(paramObject.originY)
};
if(paramObject.originX && paramObject.originY) {
options.origin = {
x: paramObject.originX && $tw.utils.parseNumber(paramObject.originX),
y: paramObject.originY && $tw.utils.parseNumber(paramObject.originY)
};
}
extractBooleanParameter("disableForReducedMotion");
var delay = paramObject.delay ? $tw.utils.parseNumber(paramObject.delay) : 0;
$tw.confettiManager.launch(delay,options);