// ==UserScript== // @name Extend "AO3: Kudosed and seen history"@Min_ & standalone Light/Dark skin toggle // @description Add buttons to Export-Import the kudos history and settings. Rename+color the confusing Seen/Unseen buttons and the Title. Enhanced "Mark as seen on open" from AO3 only. :: Standalone feature: Light/Dark site skin toggle button. // @author C89sd // @version 1.11 // @match https://archiveofourown.org/* // @grant GM_xmlhttpRequest // @namespace https://greasyfork.org/users/1376767 // @downloadURL none // ==/UserScript== const MARK_SEEN_FROM_AO3_ONLY = true; const WORK_SKIN_NAMES = [ "Default", "Reversi" ]; // Function to fetch the preferences form, extract the authenticity token, and get the skin_id function getPreferencesForm(user) { // GET the preferences fetch(`https://archiveofourown.org/users/${user}/preferences`, { method: 'GET', headers: { 'Content-Type': 'text/html' } }) .then(response => response.text()) .then(responseText => { const doc = new DOMParser().parseFromString(responseText, 'text/html'); // Extract the authenticity token const authenticity_token = doc.querySelector('input[name="authenticity_token"]')?.value; if (authenticity_token) { // console.log('authenticity_token: ', authenticity_token); // Log the token } else { alert('[userscript:AO3 Toggle Site Skin] Error\n[authenticity_token] not found!'); return; } // Find the