Keep your place in the stories you're reading!
// ==UserScript==
// @name Literotica Scroll Position Tracking
// @description Keep your place in the stories you're reading!
// @version 2.0.0
// @author Anonymous
// @namespace 861ddd094884eac5bea7a3b12e074f34
// @license MIT
// @require https://update.greasyfork.org/scripts/583749/1856870/Scroll%20Position%20Tracking%20Library.js
// @match https://www.literotica.com/s/*
// @match https://classic.literotica.com/s/*
// @match https://web.archive.org/web/*/https://www.literotica.com/s/*
// @match https://web.archive.org/web/*/https://classic.literotica.com/s/*
// @match https://archive.today/*
// @match https://archive.is/*
// @match https://archive.ph/*
// @icon https://external-content.duckduckgo.com/ip3/literotica.com.ico
// @run-at document-end
// @inject-into content
// @grant none
// ==/UserScript==
/* Attribution
****************
- Adapted from spin-drift's AO3 Bunker, itself adapted from code by jcunews
https://greasyfork.org/en/scripts/567423-ao3-bunker
https://greasyfork.org/en/users/85671-jcunews
*/
(async function () {
'use strict';
let CONFIG = {
origins: [{
host: 'www.literotica.com',
path: /^\/s\/([^\/]+)/,
params: [{ key: 'page' }],
spa: true
}, {
host: 'classic.literotica.com',
path: /^\/s\/([^\/]+)/,
params: [{ key: 'page' }]
}],
// Delay between ceasing scroll and saving position (ms)
save_delay: 500,
// Lifetime of individually cached scroll positions (days)
ttl: 42,
// Smooth-scroll to saved position on restore
animate_restore: true,
// Duration of the scroll animation (ms)
animation_length: 1000,
// Max waiting period for page height check (s)
// https://backlinko.com/page-speed-stats
timeout: 30,
// Verbose logging
debug: false,
};
await ScrollPositionTracker.init(CONFIG);
})();