aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/default/js/shaarli.js
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/default/js/shaarli.js')
-rw-r--r--tpl/default/js/shaarli.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js
index 3afec7f3..24d11cdb 100644
--- a/tpl/default/js/shaarli.js
+++ b/tpl/default/js/shaarli.js
@@ -53,20 +53,6 @@ function getParentByClass(el, className) {
53 window.addEventListener(WINDOW_CHANGE_EVENT, closeMenu); 53 window.addEventListener(WINDOW_CHANGE_EVENT, closeMenu);
54})(this, this.document); 54})(this, this.document);
55 55
56
57/**
58 * Expend search fields on focus.
59 */
60var searchInputs = document.querySelectorAll('#search input[type="text"]');
61[].forEach.call(searchInputs, function(searchInput) {
62 searchInput.addEventListener('focus', function(event) {
63 event.target.style.width = '250px';
64 });
65 searchInput.addEventListener('blur', function(event) {
66 event.target.style.width = '140px';
67 });
68});
69
70/** 56/**
71 * Fold/Expand shaares description and thumbnail. 57 * Fold/Expand shaares description and thumbnail.
72 */ 58 */
@@ -184,4 +170,18 @@ if (hiddenReturnurl != null) {
184var autofocusElements = document.querySelector('.autofocus'); 170var autofocusElements = document.querySelector('.autofocus');
185if (autofocusElements != null) { 171if (autofocusElements != null) {
186 autofocusElements.focus(); 172 autofocusElements.focus();
187} \ No newline at end of file 173}
174
175/**
176 * Hide search bar, and display it on search click.
177 */
178var searchBar = document.getElementById('search');
179var searchButton = document.getElementById('search-button');
180if (searchBar != null && searchButton != null) {
181 searchBar.classList.toggle('closed');
182 searchButton.addEventListener('click', function(event) {
183 event.preventDefault();
184 searchBar.classList.toggle('closed');
185 searchBar.classList.toggle('open');
186 });
187}