您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto remembers and chooses the user's last selection on the training page on grundos.cafe.
// ==UserScript== // @name Grundo's Cafe Remember Training Selection // @namespace http://tampermonkey.net/ // @version 0.4 // @description Auto remembers and chooses the user's last selection on the training page on grundos.cafe. // @author Thornruler // @match https://www.grundos.cafe/island/training/?type=courses // @match https://grundos.cafe/island/training/?type=courses // @match https://www.grundos.cafe/pirates/academy/?type=courses // @match https://grundos.cafe/pirates/academy/?type=courses // @match https://www.grundos.cafe/island/fight_training/?type=courses // @match https://grundos.cafe/island/fight_training/?type=courses // @icon https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe // @grant none // @license MIT // ==/UserScript== // Base keys to store/retrieve selections const BASE_COURSE_TYPE_KEY = 'courseTypeSelection'; const BASE_PET_KEY = 'petSelection'; // Incorporate the current URL into the keys const COURSE_TYPE_KEY = `${BASE_COURSE_TYPE_KEY}_${window.location.pathname}`; const PET_KEY = `${BASE_PET_KEY}_${window.location.pathname}`; const courseTypeSelect = document.querySelector('select[name="course_type"]'); const petSelect = document.querySelector('select[name="pet"]'); // Check if we have a stored selection const storedCourseType = localStorage.getItem(COURSE_TYPE_KEY); const storedPet = localStorage.getItem(PET_KEY); if(storedCourseType) { courseTypeSelect.value = storedCourseType; } if(storedPet) { petSelect.value = storedPet; } // Listen for changes and store the selected option courseTypeSelect.addEventListener('change', function() { localStorage.setItem(COURSE_TYPE_KEY, courseTypeSelect.value); }); petSelect.addEventListener('change', function() { localStorage.setItem(PET_KEY, petSelect.value); });