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