mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-31 18:31: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,36 +0,0 @@
|
||||||
import $ from 'jquery';
|
|
||||||
import './shortcuts/main';
|
|
||||||
import './shortcuts/entry';
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { savePercent, retrievePercent };
|
|
|
@ -22,11 +22,9 @@ import '@fontsource/oswald';
|
||||||
/* Highlight */
|
/* Highlight */
|
||||||
import './js/highlight';
|
import './js/highlight';
|
||||||
|
|
||||||
import { savePercent, retrievePercent } from '../_global/js/tools';
|
|
||||||
|
|
||||||
/* Tools */
|
/* Tools */
|
||||||
import {
|
import {
|
||||||
initExport, initFilters, initRandom, initPreviewText,
|
savePercent, retrievePercent, initExport, initFilters, initRandom, initPreviewText,
|
||||||
} from './js/tools';
|
} from './js/tools';
|
||||||
|
|
||||||
/* Import shortcuts */
|
/* Import shortcuts */
|
||||||
|
|
|
@ -1,5 +1,36 @@
|
||||||
import $ from 'jquery';
|
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() {
|
function initFilters() {
|
||||||
// no display if filters not available
|
// no display if filters not available
|
||||||
if ($('div').is('#filters')) {
|
if ($('div').is('#filters')) {
|
||||||
|
@ -46,6 +77,8 @@ function initPreviewText() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
savePercent,
|
||||||
|
retrievePercent,
|
||||||
initExport,
|
initExport,
|
||||||
initFilters,
|
initFilters,
|
||||||
initRandom,
|
initRandom,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue