Fossil SCM

Less rigid string-to-number conversion for the custom "data-anim-ms" attribute.

florian 2019-01-02 07:03 UTC js-hamburger-menu
Commit e4a18b67028e3c357955082b6520668c2cfbcf50e82f1384fc535a5f90a79b9a
1 file changed +5 -5
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -39,15 +39,15 @@
3939
// is the whole point here.
4040
var animate = panel.style.transition !== null && (typeof(panel.style.transition) == "string");
4141
4242
// The duration of the animation can be overridden from the default skin
4343
// header.txt by setting the "data-anim-ms" attribute of the panel.
44
- var animMS = panel.getAttribute("data-anim-ms");
45
- if (animMS === "0")
46
- animate = false; // disable animation if "data-anim-ms" === "0"
47
- else if (!animMS || animMS>>0 !== Number(animMS) || animMS < 0)
48
- animMS = 400; // set default if missing, empty, non-integer, or negative
44
+ var animMS = parseInt(panel.getAttribute("data-anim-ms"));
45
+ if (isNaN(animMS) || animMs == 0)
46
+ animate = false; // disable animation if non-numeric or zero
47
+ else if (animMS < 0)
48
+ animMS = 400; // set default animation duration if negative
4949
5050
// Calculate panel height despite its being hidden at call time.
5151
// Based on https://stackoverflow.com/a/29047447/142454
5252
var panelHeight; // computed on first panel display
5353
function calculatePanelHeight() {
5454
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -39,15 +39,15 @@
39 // is the whole point here.
40 var animate = panel.style.transition !== null && (typeof(panel.style.transition) == "string");
41
42 // The duration of the animation can be overridden from the default skin
43 // header.txt by setting the "data-anim-ms" attribute of the panel.
44 var animMS = panel.getAttribute("data-anim-ms");
45 if (animMS === "0")
46 animate = false; // disable animation if "data-anim-ms" === "0"
47 else if (!animMS || animMS>>0 !== Number(animMS) || animMS < 0)
48 animMS = 400; // set default if missing, empty, non-integer, or negative
49
50 // Calculate panel height despite its being hidden at call time.
51 // Based on https://stackoverflow.com/a/29047447/142454
52 var panelHeight; // computed on first panel display
53 function calculatePanelHeight() {
54
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -39,15 +39,15 @@
39 // is the whole point here.
40 var animate = panel.style.transition !== null && (typeof(panel.style.transition) == "string");
41
42 // The duration of the animation can be overridden from the default skin
43 // header.txt by setting the "data-anim-ms" attribute of the panel.
44 var animMS = parseInt(panel.getAttribute("data-anim-ms"));
45 if (isNaN(animMS) || animMs == 0)
46 animate = false; // disable animation if non-numeric or zero
47 else if (animMS < 0)
48 animMS = 400; // set default animation duration if negative
49
50 // Calculate panel height despite its being hidden at call time.
51 // Based on https://stackoverflow.com/a/29047447/142454
52 var panelHeight; // computed on first panel display
53 function calculatePanelHeight() {
54

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button