Pastebin Improved

Some improvements to Pastebin.com, colored buttons etc.

  1. // ==UserScript==
  2. // @name Pastebin Improved
  3. // @namespace https://greatest.deepsurf.us/users/166103
  4. // @version 0.41
  5. // @description Some improvements to Pastebin.com, colored buttons etc.
  6. // @author https://github.com/Amarok24
  7. // @match https://pastebin.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.  
  13. "use strict";
  14.  
  15.  
  16. var pbButtons = document.querySelectorAll(".buttonsm");
  17. var nightModeAdvert = document.getElementById("pro_promo_text");
  18.  
  19. if (pbButtons) {
  20.  
  21. var setButtonStyle = function(innerText, styleNameAndProperty) {
  22. var indexOfButton = null;
  23.  
  24. for (let i = 0; i < pbButtons.length; i++) {
  25. if (pbButtons[i].innerText == innerText) {
  26. indexOfButton = i;
  27. break;
  28. }
  29. }
  30.  
  31. if (indexOfButton !== null) {
  32. console.log("button found, index = " + indexOfButton);
  33.  
  34. for (let z=0; z<styleNameAndProperty.length; z++) {
  35. for (let j in styleNameAndProperty[z]) {
  36. //console.log(j);
  37. //console.log(styleNameAndProperty[z][j]);
  38. pbButtons[indexOfButton].style[j] = styleNameAndProperty[z][j];
  39. }
  40. }
  41.  
  42. }
  43. };
  44.  
  45. setButtonStyle("edit", [ {"backgroundColor" : "coral"}, {"fontWeight" : "700"}, {"color" : "white"} ] );
  46. setButtonStyle("raw", [ {"backgroundColor" : "darkgreen"}, {"color" : "white"} ] );
  47. }
  48.  
  49. if (nightModeAdvert && nightModeAdvert.innerText.indexOf("Night")) {
  50. document.getElementById("float-box-frame").style.display = "none";
  51. }
  52.  
  53. })();