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