wallabag/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/js/restoreScroll.js
Jeremy 32da2a70ef Add LiipThemeBundle
Re-defined the config / user relation to be OneToOne bidirectionnal.
ConfigType is now a service so I can inject the list of available themes that are also used by LiipThemeBundle

Force sqlite for test
In case of people use a different driver in parameter.yml (yes I do :))
2015-03-01 10:49:16 +01:00

25 lines
644 B
JavaScript

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;
}