forked from wallabag/wallabag
Move assets to assets/ root folder "as is"
This commit is contained in:
4
assets/_global/js/bookmarklet.js
Normal file
4
assets/_global/js/bookmarklet.js
Normal file
@ -0,0 +1,4 @@
|
||||
top['bookmarklet-url@wallabag.org'] = '<!DOCTYPE html><html><head><title>bag it!</title>'
|
||||
+ '<link rel="icon" href="tpl/img/favicon.ico" />'
|
||||
+ '</head><body><script>window.onload=function(){window.setTimeout'
|
||||
+ '(function(){history.back();},250);};</script></body></html>';
|
||||
8
assets/_global/js/highlight.js
Normal file
8
assets/_global/js/highlight.js
Normal file
@ -0,0 +1,8 @@
|
||||
import 'highlight.js/styles/atom-one-light.css';
|
||||
import hljs from 'highlight.js';
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
document.querySelectorAll('pre').forEach((element) => {
|
||||
hljs.highlightElement(element);
|
||||
});
|
||||
});
|
||||
0
assets/_global/js/shortcuts/entry.js
Normal file
0
assets/_global/js/shortcuts/entry.js
Normal file
15
assets/_global/js/shortcuts/main.js
Normal file
15
assets/_global/js/shortcuts/main.js
Normal file
@ -0,0 +1,15 @@
|
||||
import Mousetrap from 'mousetrap';
|
||||
|
||||
/* Shortcuts */
|
||||
|
||||
/* Go to */
|
||||
Mousetrap.bind('g u', () => { window.location.href = Routing.generate('homepage'); });
|
||||
Mousetrap.bind('g s', () => { window.location.href = Routing.generate('starred'); });
|
||||
Mousetrap.bind('g r', () => { window.location.href = Routing.generate('archive'); });
|
||||
Mousetrap.bind('g a', () => { window.location.href = Routing.generate('all'); });
|
||||
Mousetrap.bind('g t', () => { window.location.href = Routing.generate('tag'); });
|
||||
Mousetrap.bind('g c', () => { window.location.href = Routing.generate('config'); });
|
||||
Mousetrap.bind('g i', () => { window.location.href = Routing.generate('import'); });
|
||||
Mousetrap.bind('g d', () => { window.location.href = Routing.generate('developer'); });
|
||||
Mousetrap.bind('?', () => { window.location.href = Routing.generate('howto'); });
|
||||
Mousetrap.bind('g l', () => { window.location.href = Routing.generate('fos_user_security_logout'); });
|
||||
36
assets/_global/js/tools.js
Normal file
36
assets/_global/js/tools.js
Normal file
@ -0,0 +1,36 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user