diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-02-21 14:16:48 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-02-27 20:01:54 +0100 |
commit | 7040169069322d72cec4276b7b812291b57a0d40 (patch) | |
tree | d038b8d560873852c2cbf0ef147ed71543b255a6 /tpl/default/js | |
parent | 430ff0710265ff281727ef6824cf292d1dfc50f1 (diff) | |
download | Shaarli-7040169069322d72cec4276b7b812291b57a0d40.tar.gz Shaarli-7040169069322d72cec4276b7b812291b57a0d40.tar.zst Shaarli-7040169069322d72cec4276b7b812291b57a0d40.zip |
Multiple minor improvements and bugfixes regarding the new templates:
* Add API settings in `configure.html`
* Fix textarea autoresize
* Load user.css from data folder
* Move fold/expand all button to the right and fix an issue with already folded items
* Reset datetime display to international datetime
* Temporarilly remove JS login panel (need improvement and integration with the plugin system)
* Body background is slightly lighter
* Fix an issue where thumbnails were hidden by description
* Fix an issue where private orange bar wasn't displayed with thumbnails
* Remove the gradient bar behind titles
* Fix empty bookmarklet name in Firefox
Diffstat (limited to 'tpl/default/js')
-rw-r--r-- | tpl/default/js/shaarli.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index d8464aa4..d47c257f 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js | |||
@@ -84,7 +84,13 @@ window.onload = function () { | |||
84 | [].forEach.call(foldAllButtons, function (foldAllButton) { | 84 | [].forEach.call(foldAllButtons, function (foldAllButton) { |
85 | foldAllButton.addEventListener('click', function (event) { | 85 | foldAllButton.addEventListener('click', function (event) { |
86 | event.preventDefault(); | 86 | event.preventDefault(); |
87 | var state = foldAllButton.firstElementChild.getAttribute('class').indexOf('down') != -1 ? 'down' : 'up'; | ||
87 | [].forEach.call(foldButtons, function (foldButton) { | 88 | [].forEach.call(foldButtons, function (foldButton) { |
89 | if (foldButton.firstElementChild.classList.contains('fa-chevron-up') && state == 'down' | ||
90 | || foldButton.firstElementChild.classList.contains('fa-chevron-down') && state == 'up' | ||
91 | ) { | ||
92 | return; | ||
93 | } | ||
88 | // Retrieve description | 94 | // Retrieve description |
89 | var description = null; | 95 | var description = null; |
90 | var thumbnail = null; | 96 | var thumbnail = null; |
@@ -225,4 +231,32 @@ window.onload = function () { | |||
225 | anchor.style.paddingTop = 0; | 231 | anchor.style.paddingTop = 0; |
226 | } | 232 | } |
227 | } | 233 | } |
234 | |||
235 | /** | ||
236 | * Text area resizer | ||
237 | */ | ||
238 | var description = document.getElementById('lf_description'); | ||
239 | var observe = function (element, event, handler) { | ||
240 | element.addEventListener(event, handler, false); | ||
241 | }; | ||
242 | function init () { | ||
243 | function resize () { | ||
244 | description.style.height = 'auto'; | ||
245 | description.style.height = description.scrollHeight+10+'px'; | ||
246 | } | ||
247 | /* 0-timeout to get the already changed text */ | ||
248 | function delayedResize () { | ||
249 | window.setTimeout(resize, 0); | ||
250 | } | ||
251 | observe(description, 'change', resize); | ||
252 | observe(description, 'cut', delayedResize); | ||
253 | observe(description, 'paste', delayedResize); | ||
254 | observe(description, 'drop', delayedResize); | ||
255 | observe(description, 'keydown', delayedResize); | ||
256 | |||
257 | resize(); | ||
258 | } | ||
259 | if (description != null) { | ||
260 | init(); | ||
261 | } | ||
228 | }; | 262 | }; |