Fossil SCM

Moved a single-use variable interpolation inline with its use point. Also improved some comments.

wyoung 2018-09-12 12:32 trunk
Commit 56db6170e8da959f39d2b9c6c9086feb4627d530090d2a145336fd68c7455df2
1 file changed +5 -6
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -1,7 +1,6 @@
11
(function() {
2
- var home='$home';
32
var panel = document.getElementById("hbdrop");
43
if (!panel) return; // site admin might've nuked it
54
var panelBorder = panel.style.border;
65
var animate = panel.style.hasOwnProperty('transition');
76
var animMS = 400;
@@ -30,14 +29,14 @@
3029
3130
// Show the panel by changing the panel height, which kicks off the
3231
// slide-open/closed transition set up in the XHR onload handler.
3332
//
3433
// Schedule the change for a near-future time in case this is the
35
- // first call, where the div was initially invisible. That causes
36
- // the browser to consider the height change as part of the same
37
- // state change as the visibility change, so it doesn't see a state
38
- // *transition*, hence never kicks off the *CSS* transition:
34
+ // first call, where the div was initially invisible. If we were
35
+ // to change the panel's visibility and height at the same time
36
+ // instead, that would prevent the browser from seeing the height
37
+ // change as a state transition, so it'd skip the CSS transition:
3938
//
4039
// https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions#JavaScript_examples
4140
function showPanel() {
4241
if (animate) {
4342
setTimeout(function() {
@@ -108,15 +107,15 @@
108107
panel.style.display = 'block';
109108
}
110109
}
111110
// else, can't parse response as HTML or XML
112111
}
113
- xhr.open("POST", home + "/sitemap");
112
+ xhr.open("POST", "$home/sitemap"); // note the TH1 substitution!
114113
xhr.responseType = "document";
115114
xhr.send("popup=1");
116115
}
117116
else {
118117
showPanel(); // just show what we built above
119118
}
120119
return false; // prevent browser from acting on <a> click
121120
}
122121
})();
123122
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -1,7 +1,6 @@
1 (function() {
2 var home='$home';
3 var panel = document.getElementById("hbdrop");
4 if (!panel) return; // site admin might've nuked it
5 var panelBorder = panel.style.border;
6 var animate = panel.style.hasOwnProperty('transition');
7 var animMS = 400;
@@ -30,14 +29,14 @@
30
31 // Show the panel by changing the panel height, which kicks off the
32 // slide-open/closed transition set up in the XHR onload handler.
33 //
34 // Schedule the change for a near-future time in case this is the
35 // first call, where the div was initially invisible. That causes
36 // the browser to consider the height change as part of the same
37 // state change as the visibility change, so it doesn't see a state
38 // *transition*, hence never kicks off the *CSS* transition:
39 //
40 // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions#JavaScript_examples
41 function showPanel() {
42 if (animate) {
43 setTimeout(function() {
@@ -108,15 +107,15 @@
108 panel.style.display = 'block';
109 }
110 }
111 // else, can't parse response as HTML or XML
112 }
113 xhr.open("POST", home + "/sitemap");
114 xhr.responseType = "document";
115 xhr.send("popup=1");
116 }
117 else {
118 showPanel(); // just show what we built above
119 }
120 return false; // prevent browser from acting on <a> click
121 }
122 })();
123
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -1,7 +1,6 @@
1 (function() {
 
2 var panel = document.getElementById("hbdrop");
3 if (!panel) return; // site admin might've nuked it
4 var panelBorder = panel.style.border;
5 var animate = panel.style.hasOwnProperty('transition');
6 var animMS = 400;
@@ -30,14 +29,14 @@
29
30 // Show the panel by changing the panel height, which kicks off the
31 // slide-open/closed transition set up in the XHR onload handler.
32 //
33 // Schedule the change for a near-future time in case this is the
34 // first call, where the div was initially invisible. If we were
35 // to change the panel's visibility and height at the same time
36 // instead, that would prevent the browser from seeing the height
37 // change as a state transition, so it'd skip the CSS transition:
38 //
39 // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions#JavaScript_examples
40 function showPanel() {
41 if (animate) {
42 setTimeout(function() {
@@ -108,15 +107,15 @@
107 panel.style.display = 'block';
108 }
109 }
110 // else, can't parse response as HTML or XML
111 }
112 xhr.open("POST", "$home/sitemap"); // note the TH1 substitution!
113 xhr.responseType = "document";
114 xhr.send("popup=1");
115 }
116 else {
117 showPanel(); // just show what we built above
118 }
119 return false; // prevent browser from acting on <a> click
120 }
121 })();
122

Keyboard Shortcuts

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