您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Select the next option available for each select dropdown, removes excess clicks
当前为
// ==UserScript== // @name Flight Rising: Predict Morphology (Scry) - Next Option // @description Select the next option available for each select dropdown, removes excess clicks // @namespace https://greasyfork.org/en/users/547396 // @author https://greasyfork.org/en/users/547396 // @match *://*.flightrising.com/scrying/predict* // @grant none // @version 0.1 // ==/UserScript== (function() { 'use strict'; const container = document.getElementById('predict-morphology'), optionsBlock = container.getElementsByClassName('scry-options')[0], commonRows = optionsBlock.getElementsByClassName('common-row'), predictBtn = document.getElementById('scry-button'); // do it! init(); function init() { console.log(predictBtn); for ( let row of commonRows ) { let selector = row.getElementsByTagName('select')[0], selectName = selector.name, col = selector.parentNode; selector.style.width = '80%'; appendDownSelect( col, selector, selectName ); } } // append next button function appendDownSelect( col, selector, name ) { const downAction = document.createElement('button'); downAction.innerHTML = '↡'; downAction.name = name; col.appendChild(downAction); downAction.addEventListener('click', changeSelect.bind( event, selector, name ), false); } // select next option, ignoring all disabled options function changeSelect( selector, name, e ){ const select = selector; let currentIndex = select.selectedIndex, collection = [...select.options], collectionArr = [], i = 0, nextItemIndex; for ( i; i < collection.length; i++ ) { if ( collection[i].disabled == false ) { collectionArr.push( collection[i].index ); } } nextItemIndex = collectionArr.indexOf(currentIndex) + 1; select.selectedIndex = collectionArr[nextItemIndex]; predict(); } // trigger predict function predict() { predictBtn.click(); } })();