diff options
Diffstat (limited to 'tpl/default/js')
-rw-r--r-- | tpl/default/js/shaarli.js | 31 |
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) { | |||
146 | var loginButton = document.getElementById('login-button'); | 146 | var loginButton = document.getElementById('login-button'); |
147 | var loginBlock = document.getElementById('header-login-form'); | 147 | var loginBlock = document.getElementById('header-login-form'); |
148 | 148 | ||
149 | loginButton.addEventListener('click', function(event) { | 149 | if (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. |
156 | loginBlock.addEventListener('transitionend', function() { | 158 | if (loginBlock != null) { |
157 | loginBlock.firstElementChild.focus(); | 159 | loginBlock.addEventListener('transitionend', function () { |
158 | }); | 160 | loginBlock.firstElementChild.focus(); |
161 | }); | ||
162 | } | ||
159 | 163 | ||
160 | var hiddenReturnurl = document.getElementsByName('returnurl'); | 164 | var hiddenReturnurl = document.getElementsByName('returnurl'); |
161 | hiddenReturnurl.value = window.location.href; \ No newline at end of file | 165 | if (hiddenReturnurl != null) { |
166 | hiddenReturnurl.value = window.location.href; | ||
167 | } | ||
168 | |||
169 | |||
170 | var autofocusElements = document.querySelector('.autofocus'); | ||
171 | console.log(autofocusElements); | ||
172 | if (autofocusElements != null) { | ||
173 | autofocusElements.focus(); | ||
174 | } \ No newline at end of file | ||