Greasy Fork is available in English.
ボタンを押すと乱数を作成してくれるスクリプトです。
当前为
// ==UserScript==
// @name 乱数ジェネレーター(Feederチャット)
// @author 初投稿です。
// @namespace https://www.x-feeder.info/
// @version 0.2
// @description ボタンを押すと乱数を作成してくれるスクリプトです。
// @match *.x-feeder.info/*/
// @match *.x-feeder.info/*/sp/
// @exclude *.x-feeder.info/*/settings/**
// @grant GM.setValue
// @grant GM.getValue
// @require http://greasyfork.icu/scripts/387509-yaju1919-library/code/yaju1919_library.js?version=724212
// @require http://greasyfork.icu/scripts/388005-managed-extensions/code/Managed_Extensions.js?version=720959
// ==/UserScript==
(() => {
'use strict';
const yaju1919 = yaju1919_library;
let input_a, input_b, result;
const main = () => {
let min = input_a();
let max = input_b();
if(min > max){
const copy = max;
max = min;
min = copy;
}
const r = Math.floor(Math.random()*(max-min))+min;
result.text(r);
};
const setConfig = () => {
const h = $("<div>");
const h2 = $("<div>").appendTo(h);
input_a = yaju1919.appendInputNumber(h2,{
title: "範囲",
explain: "最小値",
value: 1,
save: "a",
enter: main
});
h2.append("~ ");
input_b = yaju1919.appendInputNumber(h2,{
explain: "最大値",
value: 100,
save: "b",
enter: main
});
$("<button>",{text:"乱数生成"}).appendTo(h2).click(main);
result = $("<div>").appendTo(h);
return h;
};
win.Managed_Extensions["乱数ジェネレーター"] = {
config: setConfig,
};
})();