]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - app/Resources/static/themes/_global/js/tools.js
1 import $ from 'jquery';
2 import Mousetrap
from 'mousetrap';
3 import './shortcuts/main.js';
4 import './shortcuts/entry.js';
6 /* Allows inline call qr-code call */
7 import jrQrcode
from 'jr-qrcode'; // eslint-disable-line
9 function supportsLocalStorage() {
11 return 'localStorage' in window
&& window
.localStorage
!== null;
17 function savePercent(id
, percent
) {
18 if (!supportsLocalStorage()) { return false; }
19 localStorage
[`wallabag.article.${id}.percent`] = percent
;
23 function retrievePercent(id
) {
24 if (!supportsLocalStorage()) { return false; }
26 const bheight
= $(document
).height();
27 const percent
= localStorage
[`wallabag.article.${id}.percent`];
28 const scroll
= bheight
* percent
;
30 $('html,body').animate({ scrollTop: scroll
}, 'fast');
35 function initFilters() {
36 // no display if filters not available
37 if ($('div').is('#filters')) {
38 $('#button_filters').show();
39 $('.button-collapse-right').sideNav({ edge: 'right' });
40 $('#clear_form_filters').on('click', () => {
41 $('#filters input').val('');
42 $('#filters :checked').removeAttr('checked');
48 function initExport() {
49 // no display if export not available
50 if ($('div').is('#export')) {
51 $('#button_export').show();
52 $('.button-collapse-right').sideNav({ edge: 'right' });
56 export { savePercent
, retrievePercent
, initFilters
, initExport
};