Generates 6 random numbers
< 腳本Lottery Ticket Generator的回應
wouldn't show on the site and threw in some errors post http tp https change so added in a line// ==UserScript==// @name Lottery Ticket Generator// @namespace neopets// @version 2020.01.18.2// @description Generates 6 random numbers// @match https://www.neopets.com/games/lottery.phtml// @require https://code.jquery.com/jquery-3.5.1.min.js// ==/UserScript==/* eslint-disable */$("form[action='process_lottery.phtml'] table").css({"width" : "auto"}).find("tbody tr").append(` Random`);const genNum = (min, max) => Math.floor(Math.random() * max) + min;const genTicket = () => { let ticket = []; for (let i = 0; i < 6; i++) { let randomNumber = genNum(1, 30); while (ticket.includes(randomNumber)) { randomNumber = genNum(1, 30); } ticket.push(randomNumber); } ticket.sort((a, b) => a - b); return ticket;};$("#randomTicket").on("click", function (event) { event.preventDefault(); const ticket = genTicket(); $("form[action='process_lottery.phtml'] table input").each(function (index, element) { $(element).val(ticket[index]); });}).click();
thank you! I noticed the same error with http instead of https.
登入以回復
土豆服务器,请按需使用
镜像地址随时可能被墙,建议加群获取最新地址
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址
wouldn't show on the site and threw in some errors post http tp https change so added in a line
// ==UserScript==
// @name Lottery Ticket Generator
// @namespace neopets
// @version 2020.01.18.2
// @description Generates 6 random numbers
// @match https://www.neopets.com/games/lottery.phtml
// @require https://code.jquery.com/jquery-3.5.1.min.js
// ==/UserScript==
/* eslint-disable */
$("form[action='process_lottery.phtml'] table").css({"width" : "auto"}).find("tbody tr").append(` Random`);
const genNum = (min, max) => Math.floor(Math.random() * max) + min;
const genTicket = () => {
let ticket = [];
for (let i = 0; i < 6; i++) {
let randomNumber = genNum(1, 30);
while (ticket.includes(randomNumber)) {
randomNumber = genNum(1, 30);
}
ticket.push(randomNumber);
}
ticket.sort((a, b) => a - b);
return ticket;
};
$("#randomTicket").on("click", function (event) {
event.preventDefault();
const ticket = genTicket();
$("form[action='process_lottery.phtml'] table input").each(function (index, element) {
$(element).val(ticket[index]);
});
}).click();