]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - app/Resources/static/themes/_global/js/tools.js
1 const $ = require('jquery');
3 /* Allows inline call qr-code call */
4 import jrQrcode
from 'jr-qrcode'; // eslint-disable-line
6 function supportsLocalStorage() {
8 return 'localStorage' in window
&& window
.localStorage
!== null;
14 function savePercent(id
, percent
) {
15 if (!supportsLocalStorage()) { return false; }
16 localStorage
[`wallabag.article.${id}.percent`] = percent
;
20 function retrievePercent(id
) {
21 if (!supportsLocalStorage()) { return false; }
23 const bheight
= $(document
).height();
24 const percent
= localStorage
[`wallabag.article.${id}.percent`];
25 const scroll
= bheight
* percent
;
27 $('html,body').animate({ scrollTop: scroll
}, 'fast');
32 function initFilters() {
33 // no display if filters not available
34 if ($('div').is('#filters')) {
35 $('#button_filters').show();
36 $('.button-collapse-right').sideNav({ edge: 'right' });
37 $('#clear_form_filters').on('click', () => {
38 $('#filters input').val('');
39 $('#filters :checked').removeAttr('checked');
45 function initExport() {
46 // no display if export not available
47 if ($('div').is('#export')) {
48 $('#button_export').show();
49 $('.button-collapse-right').sideNav({ edge: 'right' });
53 export { savePercent
, retrievePercent
, initFilters
, initExport
};