Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- </head>
- <body>
- <input type="text" id="IN" placeholder="Paste command here!" onchange="processCMD();"> Min:
- <input type="text" id="bot" value="1" style="width:30px;" onchange="processCMD();"> Max:
- <input type="text" id="top" value="30" style="width:30px;" onchange="processCMD();">
- <p id="OUT"></p>
- <script>
- var n, b, t, elem, accept, text, IN, OUT = document.getElementById("OUT");
- function update(tag) {
- n = Number(document.getElementById(tag).value);
- return(n);
- }
- function processCMD() {
- userIN = document.getElementById("IN").value;
- modIN = userIN;
- modIN = modIN.replace(/ID=\d+/g, 'ID=x');
- modIN = modIN.replace(/ID_min=\d+/g, 'ID_min=x');
- text = modIN + "<hr>";
- b = update("bot");
- t = update("top") + 1;
- for(i=b;i<t;i++) {
- cmd = modIN;
- cmd = cmd.replace(/ID=x/g, 'ID=' + i);
- cmd = cmd.replace(/ID_min=x/g, 'ID_min=' + i);
- text += "<span id='"+ i +"' data-clicked='' onmouseover='this.style.background=\"lightgreen\"' onmouseout='removeColour("+ i +");' onclick='copyPrompt("+ i +");'>"+ cmd +"</span><br>";
- }
- OUT.innerHTML = text;
- }
- function removeColour(id) {
- elem = document.getElementById(id);
- if(elem.getAttribute("data-clicked") == "true") {
- elem.style.background = "#F75D59";
- } else {
- elem.style.background = "none";
- }
- }
- function copyPrompt(id) {
- elem = document.getElementById(id);
- accept = prompt("Copy "+ id +" to clipboard: Ctrl+C, Enter", elem.innerHTML);
- if (accept != null) {
- setTimeout(function(){elem.style.background = "#F75D59"; elem.setAttribute("data-clicked", "true");}, 1);
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement