twintail-scripts/threads/counting.user.js

22 lines
762 B
JavaScript

// ==UserScript==
// @name Twintail Counting
// @version v1
// @description COUNT
// @author kaitou
// @match https://twintail.cafe/showthread.php?tid=5
// @match https://twintail.cafe/showthread.php?tid=5&*
// @icon https://twintail.cafe/favicon-dark.ico
// @grant none
// ==/UserScript==
(function() {
'use strict';
let reply_box = document.getElementById("quick_reply_form").querySelector("div > textarea");
let counts = document.querySelectorAll('[title="RE: Count to One Million"]');
let curr_count = Number(counts[counts.length-1].innerHTML.slice(1)); // #120 -> 120
let next_count = curr_count + 1;
let text = "[color=#1198F5]" + next_count + "[/color]\n\n";
reply_box.value = text;
})();