aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/default/js
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/default/js')
-rw-r--r--tpl/default/js/shaarli.js31
1 files changed, 22 insertions, 9 deletions
diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js
index f24aff73..e5425486 100644
--- a/tpl/default/js/shaarli.js
+++ b/tpl/default/js/shaarli.js
@@ -146,16 +146,29 @@ if (newVersionDismiss != null) {
146var loginButton = document.getElementById('login-button'); 146var loginButton = document.getElementById('login-button');
147var loginBlock = document.getElementById('header-login-form'); 147var loginBlock = document.getElementById('header-login-form');
148 148
149loginButton.addEventListener('click', function(event) { 149if (loginButton != null) {
150 event.preventDefault(); 150 loginButton.addEventListener('click', function(event) {
151 loginBlock.classList.toggle('open'); 151 event.preventDefault();
152 document.getElementById('content').style.boxShadow = 'none'; 152 loginBlock.classList.toggle('open');
153}); 153 document.getElementById('content').style.boxShadow = 'none';
154 });
155}
154 156
155// Focus on login field. 157// Focus on login field.
156loginBlock.addEventListener('transitionend', function() { 158if (loginBlock != null) {
157 loginBlock.firstElementChild.focus(); 159 loginBlock.addEventListener('transitionend', function () {
158}); 160 loginBlock.firstElementChild.focus();
161 });
162}
159 163
160var hiddenReturnurl = document.getElementsByName('returnurl'); 164var hiddenReturnurl = document.getElementsByName('returnurl');
161hiddenReturnurl.value = window.location.href; \ No newline at end of file 165if (hiddenReturnurl != null) {
166 hiddenReturnurl.value = window.location.href;
167}
168
169
170var autofocusElements = document.querySelector('.autofocus');
171console.log(autofocusElements);
172if (autofocusElements != null) {
173 autofocusElements.focus();
174} \ No newline at end of file