Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Commit 70c0337

Browse files
committed
defer entry script
1 parent 5e39106 commit 70c0337

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

js/entry.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,25 @@
1313
// limitations under the License.
1414

1515
(function() {
16-
var placeholder = '**********';
17-
var showingPassword = false;
18-
new Clipboard(document.getElementById('copypassword'));
19-
document.getElementById('showpassword').addEventListener('click', function(e) {
20-
showingPassword = !showingPassword;
21-
var el = document.getElementById('password');
22-
if (showingPassword) {
23-
e.target.textContent = 'Hide';
24-
el.textContent = el.dataset.value;
25-
} else {
26-
e.target.textContent = 'Show';
27-
el.textContent = placeholder;
28-
}
29-
});
16+
var onload = function() {
17+
var placeholder = '**********';
18+
var showingPassword = false;
19+
new Clipboard(document.getElementById('copypassword'));
20+
document.getElementById('showpassword').addEventListener('click', function(e) {
21+
showingPassword = !showingPassword;
22+
var el = document.getElementById('password');
23+
if (showingPassword) {
24+
e.target.textContent = 'Hide';
25+
el.textContent = el.dataset.value;
26+
} else {
27+
e.target.textContent = 'Show';
28+
el.textContent = placeholder;
29+
}
30+
});
31+
};
32+
if (document.readyState != 'loading') {
33+
onload();
34+
} else {
35+
document.addEventListener('DOMContentLoaded', onload);
36+
}
3037
})();

0 commit comments

Comments
 (0)