Change note colours to new ones instead of default
目前為
// ==UserScript==
// @name gpop note colour changer
// @namespace http://tampermonkey.net/
// @version 1.1.2
// @description Change note colours to new ones instead of default
// @author Commensalism
// @match http*://gpop.io/settings/
// @match http*://gpop.io/settings
// @match http*://gpop.io/play/*
// @match http*://gpop.io/room/*
// @match http*://gpop.io/create/
// @match http*://gpop.io/create
// @icon https://gpop.io/icon.ico?v=1.16.40
// @grant none
// @license MIT
// ==/UserScript==
function readcookies()
{
var properties = document.cookie.split('; ');
var obj = {};
properties.forEach(function(property) {
var tup = property.split('=');
obj[tup[0]] = tup[1];
});
return obj
}
(function() {
if (document.location.href == "http://gpop.io/settings/" || document.location.href == "https://gpop.io/settings/" || document.location.href == "http://gpop.io/settings" || document.location.href == "https://gpop.io/settings")
{
let panel = document.createElement("div")
document.querySelector("#main > div:nth-child(5)").after(panel)
panel.outerHTML = `<div class="settingspage-section">
<div class="settingspage-section-title">Classic Mode: Key Colors <span style="background: linear-gradient(to right, #8803fc, #ff0090); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 1.25em;">MOD</span></div>
<div class="settingspage-section-row">
<div class="settingspage-section-row-1">Key [A]:</div>
<input id="setting-c-a" value="ffffff" maxlength="6">
</div>
<div class="settingspage-section-row">
<div class="settingspage-section-row-1">Key [S]:</div>
<input id="setting-c-s" value="ffffff" maxlength="6">
</div>
<div class="settingspage-section-row">
<div class="settingspage-section-row-1">Key [D]:</div>
<input id="setting-c-d" value="ffffff" maxlength="6">
</div>
<div class="settingspage-section-row">
<div class="settingspage-section-row-1">Key [F]:</div>
<input id="setting-c-f" value="ffffff" maxlength="6">
</div>
<div class="settingspage-section-note">Note: Only hex color format is supported<br>Made by <a href="https://gpop.io/profile/@Commensalism" style="background: linear-gradient(to right, #8803fc, #ff0090); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">@Commensalism</a></div>
</div>`
document.querySelector("#setting-c-a").onkeypress = null
document.querySelector("#setting-c-a").addEventListener('change', function() {document.querySelector("#setting-c-a").parentElement.style.color = "#" + document.querySelector("#setting-c-a").value})
document.querySelector("#setting-c-s").onkeypress = null
document.querySelector("#setting-c-s").addEventListener('change', function() {document.querySelector("#setting-c-s").parentElement.style.color = "#" + document.querySelector("#setting-c-s").value})
document.querySelector("#setting-c-d").onkeypress = null
document.querySelector("#setting-c-d").addEventListener('change', function() {document.querySelector("#setting-c-d").parentElement.style.color = "#" + document.querySelector("#setting-c-d").value})
document.querySelector("#setting-c-f").onkeypress = null
document.querySelector("#setting-c-f").addEventListener('change', function() {document.querySelector("#setting-c-f").parentElement.style.color = "#" + document.querySelector("#setting-c-f").value})
document.querySelector("#settings-save").addEventListener("click", function() {document.cookie = "notecolor=" + encodeURIComponent(`${document.querySelector("#setting-c-a").value};${document.querySelector("#setting-c-s").value};${document.querySelector("#setting-c-d").value};${document.querySelector("#setting-c-f").value};`) + "; path=/; max-age=9999999"})
let colors = decodeURIComponent(readcookies().notecolor).split(";")
document.querySelector("#setting-c-a").value = colors[0]
document.querySelector("#setting-c-s").value = colors[1]
document.querySelector("#setting-c-d").value = colors[2]
document.querySelector("#setting-c-f").value = colors[3]
}
else if (document.location.href.startsWith("http://gpop.io/play/") || document.location.href.startsWith("https://gpop.io/play/"))
{
let colors = decodeURIComponent(readcookies().notecolor).split(";")
// Getting the stylesheet
let stylesheet = document.styleSheets[5];
let elementRules;
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(1) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[0]);
elementRules.style.setProperty('background-color', "#" + colors[0] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(2) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[1]);
elementRules.style.setProperty('background-color', "#" + colors[1] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(3) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[2]);
elementRules.style.setProperty('background-color', "#" + colors[2] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(4) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[3]);
elementRules.style.setProperty('background-color', "#" + colors[3] + "33");
}
else if (document.location.href.startsWith("http://gpop.io/room/") || document.location.href.startsWith("https://gpop.io/room/"))
{
let colors = decodeURIComponent(readcookies().notecolor).split(";")
// Getting the stylesheet
let stylesheet = document.styleSheets[7];
let elementRules;
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(1) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[0]);
elementRules.style.setProperty('background-color', "#" + colors[0] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(2) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[1]);
elementRules.style.setProperty('background-color', "#" + colors[1] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(3) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[2]);
elementRules.style.setProperty('background-color', "#" + colors[2] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(4) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[3]);
elementRules.style.setProperty('background-color', "#" + colors[3] + "33");
}
else if (document.location.href.startsWith("http://gpop.io/create/") || document.location.href.startsWith("https://gpop.io/create/") || document.location.href.startsWith("http://gpop.io/create") || document.location.href.startsWith("https://gpop.io/create"))
{
let colors = decodeURIComponent(readcookies().notecolor).split(";")
// Getting the stylesheet
let stylesheet = document.styleSheets[4];
let elementRules;
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(1) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[0]);
elementRules.style.setProperty('background-color', "#" + colors[0] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(2) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[1]);
elementRules.style.setProperty('background-color', "#" + colors[1] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(3) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[2]);
elementRules.style.setProperty('background-color', "#" + colors[2] + "33");
for(let i = 0; i < stylesheet.cssRules.length; i++) {
if(stylesheet.cssRules[i].selectorText === '.pp-notes2:nth-child(4) .pp-note') {
elementRules = stylesheet.cssRules[i];
}
}
elementRules.style.setProperty('color', "#" + colors[3]);
elementRules.style.setProperty('background-color', "#" + colors[3] + "33");
}
})();