]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - app/Resources/static/themes/_global/js/tools.js
1 const $ = require('jquery');
3 function supportsLocalStorage() {
5 return 'localStorage' in window
&& window
.localStorage
!== null;
11 function savePercent(id
, percent
) {
12 if (!supportsLocalStorage()) { return false; }
13 localStorage
[`wallabag.article.${id}.percent`] = percent
;
17 function retrievePercent(id
) {
18 if (!supportsLocalStorage()) { return false; }
20 const bheight
= $(document
).height();
21 const percent
= localStorage
[`wallabag.article.${id}.percent`];
22 const scroll
= bheight
* percent
;
24 $('html,body').animate({ scrollTop: scroll
}, 'fast');
29 function initFilters() {
30 // no display if filters not available
31 if ($('div').is('#filters')) {
32 $('#button_filters').show();
33 $('.button-collapse-right').sideNav({ edge: 'right' });
34 $('#clear_form_filters').on('click', () => {
35 $('#filters input').val('');
36 $('#filters :checked').removeAttr('checked');
42 function initExport() {
43 // no display if export not available
44 if ($('div').is('#export')) {
45 $('#button_export').show();
46 $('.button-collapse-right').sideNav({ edge: 'right' });
50 export { savePercent
, retrievePercent
, initFilters
, initExport
};