您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a textarea for pasting in scientist names to select for a given project
// ==UserScript== // @name WF science paste to select box // @namespace http://www.war-facts.com/ // @description Adds a textarea for pasting in scientist names to select for a given project // @include http://www.war-facts.com/science.php // @version 1 // @grant none // ==/UserScript== $(document).ready(function () { var textarea = '<textarea id="pasted-scientists-box" rows="4" cols="50" placeholder="Paste your scientists names here"></textarea>' var button = '<button id="pasted-scientists-btn">Select from textarea</button>' var newDiv = '<div>' + textarea + button + '</div>' $('#scitable').before(newDiv) $('#pasted-scientists-btn').on('click', function () { if ($('#location').val() == 0) { console.log('Unable to select scientists. You must pick a lab first') } var text = $('#pasted-scientists-box').val() if (text == '') return false var scientistsSplit = text.split(/[\n\t]+/) try { var added = 0 for (var i = 0; i < scientistsSplit.length; i++) { var scientist = scientistsSplit[i] var scientistRow = $('#scitable').find('a') .filter(function(index) { return $.trim($(this).text()).toLowerCase() === $.trim(scientist).toLowerCase(); }) .parents('tr') .first() if (scientistRow.length == 0) { console.log('We cant find the row for ' + scientist) continue } var id = scientistRow.attr('id').replace(/[a-zA-Z]/g, "") addSci(id) added++ } console.log('Added %d scientists to project', added) } catch (err) { console.log('Error executing scientists selection from textarea') console.log(err) } return false // don't submit the form }) })
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址