|
| 1 | +// ==UserScript== |
| 2 | +// @name BGA Bug report canned replies |
| 3 | +// @namespace https://boardgamearena.com/ |
| 4 | +// @version 0.1 |
| 5 | +// @description select canned reply |
| 6 | +// @author elaskavaia |
| 7 | +// @match https://boardgamearena.com/bug?id=* |
| 8 | +// @icon https://www.google.com/s2/favicons?sz=64&domain=boardgamearena.com |
| 9 | +// @downloadURL https://raw.githubusercontent.com/elaskavaia/bga-sharedcode/master/userscripts/bugcannedanswers.user.js |
| 10 | +// @updateURL https://raw.githubusercontent.com/elaskavaia/bga-sharedcode/master/userscripts/bugcannedanswers.user.js |
| 11 | +// @run-at document-idle |
| 12 | +// @grant none |
| 13 | +// ==/UserScript== |
| 14 | + |
| 15 | +(function () { |
| 16 | + "use strict"; |
| 17 | + |
| 18 | + // Your code here... |
| 19 | + //debugger; |
| 20 | + let table = [ |
| 21 | + { |
| 22 | + title: "Rule X", |
| 23 | + text: "Not a bug. Please conslult the rule book.", |
| 24 | + resolution: "notabug", |
| 25 | + acton: "change_bug_status" |
| 26 | + }, |
| 27 | + { |
| 28 | + title: "Missing screenshot", |
| 29 | + text: "Insufficient information. Please provide table number, move number and screenshot", |
| 30 | + resolution: "infoneeded", |
| 31 | + acton: "change_bug_status" |
| 32 | + }, |
| 33 | + { |
| 34 | + title: "Missing move", |
| 35 | + text: "Insufficient information. Please provide table number, move number and/or log details", |
| 36 | + resolution: "infoneeded", |
| 37 | + acton: "change_bug_status" |
| 38 | + } |
| 39 | + ]; |
| 40 | + let tools = document.querySelector("#moderator_quicktools .pagesection__content"); |
| 41 | + tools.innerHTML += "<p>Canned answers:</p>"; |
| 42 | + const report_log = document.getElementById("report_log"); |
| 43 | + for (let i in table) { |
| 44 | + const id = `${table[i].acton}_${table[i].resolution}`; |
| 45 | + const a = document.createElement("a"); |
| 46 | + a.id = id; |
| 47 | + a.classList.add("bgabutton", "bgabutton_blue", table[i].acton); |
| 48 | + a.innerHTML = table[i].title; |
| 49 | + tools.appendChild(a); |
| 50 | + tools.appendChild(document.createTextNode(" ")); |
| 51 | + const text = table[i].text; |
| 52 | + |
| 53 | + a.addEventListener("click", (event) => { |
| 54 | + report_log.innerHTML = text; |
| 55 | + }); |
| 56 | + } |
| 57 | +})(); |
0 commit comments