});
/**
- * Fold/Expand shaares description.
+ * Fold/Expand shaares description and thumbnail.
*/
var foldButtons = document.querySelectorAll('.fold-button');
[].forEach.call(foldButtons, function(foldButton) {
// Retrieve description
var description = null;
+ var thumbnail = null;
var linklistItem = getParentByClass(foldButton, 'linklist-item');
if (linklistItem != null) {
description = linklistItem.querySelector('.linklist-item-description');
- if (description != null) {
+ thumbnail = linklistItem.querySelector('.linklist-item-thumbnail');
+ if (description != null || thumbnail != null) {
foldButton.style.display = 'inline';
}
}
// Switch fold/expand - up = fold
if (event.target.classList.contains('fa-chevron-up')) {
event.target.title = 'Expand';
- description.style.display = 'none';
+ if (description != null) {
+ description.style.display = 'none';
+ }
+ if (thumbnail != null) {
+ thumbnail.style.display = 'none';
+ }
}
else {
event.target.title = 'Fold';
- description.style.display = 'block';
+ if (description != null) {
+ description.style.display = 'block';
+ }
+ if (thumbnail != null) {
+ thumbnail.style.display = 'block';
+ }
}
event.target.classList.toggle('fa-chevron-down');
event.target.classList.toggle('fa-chevron-up');
* Login button
*/
var loginButton = document.getElementById('login-button');
-loginButton.addEventListener('click', function(event) {
- event.preventDefault();
- var loginBlock = document.getElementById('header-login-form');
- loginBlock.style.display = 'block';
- loginBlock.classList.toggle('open');
- // Focus on login field.
- loginBlock.firstElementChild.focus();
- document.getElementById('content').style.boxShadow = 'none';
-});
+var loginBlock = document.getElementById('header-login-form');
+
+if (loginButton != null) {
+ loginButton.addEventListener('click', function(event) {
+ event.preventDefault();
+ loginBlock.classList.toggle('open');
+ document.getElementById('content').style.boxShadow = 'none';
+ });
+}
+
+// Focus on login field.
+if (loginBlock != null) {
+ loginBlock.addEventListener('transitionend', function () {
+ loginBlock.firstElementChild.focus();
+ });
+}
+
+var hiddenReturnurl = document.getElementsByName('returnurl');
+if (hiddenReturnurl != null) {
+ hiddenReturnurl.value = window.location.href;
+}
+
+/**
+ * Autofocus text fields
+ */
+var autofocusElements = document.querySelector('.autofocus');
+if (autofocusElements != null) {
+ autofocusElements.focus();
+}
\ No newline at end of file