您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
automates the granting of a badge to multiple names
当前为
// ==UserScript== // @name badge granter // @include https://www.imvu.com/catalog/web_manage_badges.php?action=grant-revoke&* // @namespace oribadgegranter // @version 0.3 // @description automates the granting of a badge to multiple names // @author ori@imvu // @grant GM_setValue // @grant GM_getValue // persistent variables: count, shouldRun, grantMessages, names // ==/UserScript== (function() { 'use strict'; //text area and buttons document.body.innerHTML = document.body.innerHTML + "<textarea id=\"textstuff\" name=\"textstuff\" rows=\"20\"cols=\"25\"></textarea> <br><input type=\"button\" value=\" send \" id=\"load\" /> <input type=\"button\" value=\" results \" id=\"results\" />"; //event listeners for buttons document.getElementById("load").addEventListener ("click", loadNames, false); document.getElementById("results").addEventListener ("click", showResults, false); //testing output console.log('count: ' + GM_getValue('count')); console.log('shouldRun: ' + GM_getValue('shouldRun')); //populate grantMessages array with message from page //this is skipped while count is 0 so will populate last, first, second, ect-- solved in showResults if(document.getElementsByClassName('grant-message').length > 0) { GM_setValue('grantMessages'[GM_getValue('count')],document.getElementsByClassName('grant-message')[0].innerHTML); } //continue sending badges after page refresh if(GM_getValue('shouldRun',false)) sendBadges(); //places names into array -- delimited by new line function loadNames() { var textArea = document.getElementById("textstuff"); GM_setValue('names',textArea.value.split("\n")); console.log("successfully created array of names"); GM_setValue('grantMessages', new Array(GM_getValue('names').length)); sendBadges(); } //iterates through array and calls form .send() function sendBadges() { GM_setValue('shouldRun', true); while (GM_getValue('count',0) < GM_getValue('names').length) { document.getElementById('grant-userid').value = GM_getValue('names')[GM_getValue('count',0)]; GM_setValue('count',(GM_getValue('count',0)+1)); //count++ if(GM_getValue('count') == GM_getValue('names').length) { resetValues(); } document.querySelectorAll('input[type="submit"]')[0].click(); break; } } //display contents of grantMessages -- shows imvu 'result' message function showResults() { //to do: if contents are "" don't clear run. var lastInArray = parseInt(GM_getValue('grantMessages').length)-1; //element - not value if (GM_getValue('grantMessages'[0]) !== "") { for(var a=1; a < GM_getValue('grantMessages').length; a++) { document.getElementById('textstuff').innerHTML += GM_getValue('grantMessages'[a]) + '\n\n'; } //the last value is added first to the array because it's skipped when count is 0 but added after resetValues() is called document.getElementById('textstuff').innerHTML += GM_getValue('grantMessages'[0]) + '\n\n'; var b = 0; while(b < GM_getValue('grantMessages').length) { GM_setValue('grantMessages'[b],""); b++; } } } //clears out persistent variables function resetValues() { GM_setValue('count',0); GM_setValue('shouldRun',false); for(var i=0; i < GM_getValue('names').length; i++) { GM_setValue('names',""); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址