Greasy Fork is available in English.
Some improvements to Pastebin.com, colored buttons etc.
当前为
// ==UserScript==
// @name Pastebin Improved
// @namespace http://greasyfork.icu/users/166103
// @version 0.4
// @description Some improvements to Pastebin.com, colored buttons etc.
// @author https://github.com/Amarok24
// @match https://pastebin.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var pbButtons = document.querySelectorAll(".buttonsm");
if (pbButtons) {
function setButtonStyle(innerText, styleNameAndProperty) {
var indexOfButton = null;
for (let i = 0; i < pbButtons.length; i++) {
if (pbButtons[i].innerText == innerText) {
indexOfButton = i;
break;
}
}
if (indexOfButton !== null) {
console.log("button found, index = " + indexOfButton);
for (let z=0; z<styleNameAndProperty.length; z++) {
for (let j in styleNameAndProperty[z]) {
//console.log(j);
//console.log(styleNameAndProperty[z][j]);
pbButtons[indexOfButton].style[j] = styleNameAndProperty[z][j];
}
}
}
}
setButtonStyle("edit", [ {"backgroundColor" : "coral"}, {"fontWeight" : "700"}, {"color" : "white"} ] );
setButtonStyle("raw", [ {"backgroundColor" : "darkgreen"}, {"color" : "white"} ] );
}
})();