E-H Colour Conversion

Gives E-Hentai the Exhentai colour scheme.

  1. // ==UserScript==
  2. // @name E-H Colour Conversion
  3. // @description Gives E-Hentai the Exhentai colour scheme.
  4. // @author Hen Tie
  5. // @homepage https://hen-tie.tumblr.com/
  6. // @namespace https://greasyfork.org/en/users/8336
  7. // @include /https://(.*\.)?e-hentai.org.*/
  8. // @exclude https://forums.e-hentai.org/*
  9. // @grant none
  10. // @icon https://i.imgur.com/pMMVGRx.png
  11. // @version 1.6
  12. // ==/UserScript==
  13.  
  14. var ehCss = 'https://e-hentai.org/z/0347/g.css';
  15. var exCss = 'https://exhentai.org/z/0347/x.css';
  16.  
  17. var addStyle = (function() {
  18. var style = document.createElement("style");
  19. style.setAttribute('data-jqstyle','ehColourConversion');
  20. style.appendChild(document.createTextNode("")); // WebKit hack
  21. document.head.appendChild(style);
  22. return style.sheet;
  23. })();
  24. function addLink(url, name) {
  25. var link = document.createElement('link');
  26. link.type = 'text/css';
  27. link.rel = 'stylesheet';
  28. link.href = url;
  29. if (name !== "undefined") {
  30. link.setAttribute('data-jqlink', name);
  31. }
  32. document.head.appendChild(link);
  33. }
  34. function removeLink(url) {
  35. if (document.querySelector('link[href="' + url + '"]')) {
  36. document.querySelectorAll('link[href="' + url + '"]')[0].disabled = true;
  37. }
  38. }
  39. function inlineStyle(selector, css) {
  40. if (document.querySelector(selector)) {
  41. document.querySelector(selector).style.cssText += ';' + css;
  42. }
  43. }
  44.  
  45. addLink(exCss, "ehColourConversion");
  46. removeLink(ehCss);
  47.  
  48. // bounty pages
  49. addStyle.insertRule('.stuffbox #x {background: none; border-color: #000;}');
  50. // events
  51. addStyle.insertRule('#eventpane {background: #4f535b !important; border-color: #000 !important;}');
  52. // E-H MiniMenu script compatibility
  53. addStyle.insertRule('.nav-submenu {background: #34353b !important; border: 2px solid #8d8d8d !important;}');