您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Changes the date of the infraction to the local timezone and makes links clickable. Also adds a namemc link.
// ==UserScript== // @name CubeCraft appeal site improvements // @namespace Violentmonkey Scripts // @match https://appeals.cubecraft.net/find_appeals/* // @grant none // @version 1.4.2 // @author Caliditas // @description Changes the date of the infraction to the local timezone and makes links clickable. Also adds a namemc link. // ==/UserScript== var infractions = document.getElementsByClassName("col-sm-8"); var amountOfInfractions = infractions[0].children.length; for (var i = 0; i < amountOfInfractions; i++) { replaceDate(infractions[0].children[i].firstElementChild); } function replaceDate(element) { var contentString = element.innerHTML; dateStringOld = contentString.slice(contentString.indexOf(" at") + 3, contentString.indexOf(" for")) + " UTC"; var dateOldMs = Date.parse(dateStringOld); var dateOld = new Date(dateOldMs); var contentStringChanged = contentString.slice(0, contentString.indexOf(" at ") + 4) + dateOld.toString().slice(4, 10) + "," + dateOld.toString().slice(10, 25) + initials(new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]) contentStringChanged += contentString.slice(contentString.indexOf(" for")); if (contentStringChanged.includes("http")) { var evidenceLink = contentStringChanged.slice(contentStringChanged.indexOf("http")) // evidenceLink.slice var evidenceLinkShort = evidenceLink.slice(0, evidenceLink.indexOf("\t")); evidenceLinkShort = evidenceLinkShort.slice(0, evidenceLinkShort.indexOf(" ")); // console.log(evidenceLinkShort) contentStringChanged = contentStringChanged.slice(0, contentStringChanged.indexOf("http")) + "<a target=\"_blank\" href=\"" + evidenceLinkShort + "\">" + evidenceLinkShort + "</a>" + contentStringChanged.slice(contentStringChanged.indexOf("http") + evidenceLinkShort.length) //evidenceLink.slice(evidenceLink.indexOf("\t")); } // console.log(contentStringChanged) element.innerHTML = contentStringChanged; } function initials(words) { if (words.includes(" ")) { var wordsArray = words.split(" "); var initials = ""; for (var i = 0; i < wordsArray.length; i++) { initials += wordsArray[i][0]; } return initials; } else { return words; } } var nameElem = document.getElementsByClassName("col-sm-4")[0]; var uuid = nameElem.children[0].outerHTML.slice(nameElem.children[0].outerHTML.indexOf("user=") + 5, nameElem.children[0].outerHTML.indexOf("\" style")); var outer = nameElem.outerHTML; var newOuter = outer.slice(0, outer.indexOf(">")) + "onclick=\"window.open('https://namemc.com/profile/" + uuid + "');\" style=\"cursor: pointer;\"" + outer.slice(outer.indexOf(">")) nameElem.outerHTML = newOuter;