mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-05 18:41:02 +00:00
Move global tools to material
This commit is contained in:
parent
e63f7ab12e
commit
953f5ee149
3 changed files with 34 additions and 39 deletions
|
@ -1,5 +1,36 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
/* Allows inline call qr-code call */
|
||||
import jrQrcode from 'jr-qrcode'; // eslint-disable-line
|
||||
|
||||
function supportsLocalStorage() {
|
||||
try {
|
||||
return 'localStorage' in window && window.localStorage !== null;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function savePercent(id, percent) {
|
||||
if (!supportsLocalStorage()) { return false; }
|
||||
localStorage[`wallabag.article.${id}.percent`] = percent;
|
||||
return true;
|
||||
}
|
||||
|
||||
function retrievePercent(id, resized) {
|
||||
if (!supportsLocalStorage()) { return false; }
|
||||
|
||||
const bheight = $(document).height();
|
||||
const percent = localStorage[`wallabag.article.${id}.percent`];
|
||||
const scroll = bheight * percent;
|
||||
|
||||
if (!resized) {
|
||||
$('html,body').animate({ scrollTop: scroll }, 'fast');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function initFilters() {
|
||||
// no display if filters not available
|
||||
if ($('div').is('#filters')) {
|
||||
|
@ -46,6 +77,8 @@ function initPreviewText() {
|
|||
}
|
||||
|
||||
export {
|
||||
savePercent,
|
||||
retrievePercent,
|
||||
initExport,
|
||||
initFilters,
|
||||
initRandom,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue