From 30d81a47c689e1d7d963fcd3fd42af9958805e31 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 22 Jan 2016 13:45:10 +0100 Subject: Move public assets for themes So they can be installed using the `assets:install` command and there'll no longer symlink in the repo They moved from `web/themes/...` to `bundles/wallabagcore/themes/...` --- .../public/themes/baggy/js/restoreScroll.js | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Resources/public/themes/baggy/js/restoreScroll.js (limited to 'src/Wallabag/CoreBundle/Resources/public/themes/baggy/js/restoreScroll.js') diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/baggy/js/restoreScroll.js b/src/Wallabag/CoreBundle/Resources/public/themes/baggy/js/restoreScroll.js new file mode 100644 index 00000000..331c9e19 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/public/themes/baggy/js/restoreScroll.js @@ -0,0 +1,25 @@ +function supportsLocalStorage() { + try { + return 'localStorage' in window && window['localStorage'] !== null; + } catch (e) { + return false; + } +} + +function savePercent(id, percent) { + if (!supportsLocalStorage()) { return false; } + localStorage["poche.article." + id + ".percent"] = percent; + return true; +} + +function retrievePercent(id) { + if (!supportsLocalStorage()) { return false; } + + var bheight = $(document).height(); + var percent = localStorage["poche.article." + id + ".percent"]; + var scroll = bheight * percent; + + $('html,body').animate({scrollTop: scroll}, 'fast'); + + return true; +} \ No newline at end of file -- cgit v1.2.3