Codewars helper

Removes unlock solution buttons and AD under the kata description

  1. // ==UserScript==
  2. // @name Codewars helper
  3. // @author Murka
  4. // @description Removes unlock solution buttons and AD under the kata description
  5. // @icon https://i.imgur.com/LKAcLYO.png
  6. // @version 0.1
  7. // @match *://www.codewars.com/*
  8. // @run-at document-end
  9. // @grant none
  10. // @license MIT
  11. // @namespace https://greasyfork.org/users/919633
  12. // ==/UserScript==
  13. /* jshint esversion:6 */
  14.  
  15. /*
  16. Author: Murka
  17. Github: https://github.com/Murka007
  18. Discord: https://discord.gg/sG9cyfGPj5
  19. Greasyfork: https://greasyfork.org/en/users/919633
  20. */
  21.  
  22. (function() {
  23. "use strict";
  24.  
  25. // Removes unlock solution button, right under sample tests
  26. const HIDE_SOLUTION_TRAIN = true;
  27.  
  28. // Removes unlock solution button in the kata preview
  29. const HIDE_SOLUTION_PREVIEW = false;
  30.  
  31. // Removes AD banner under kata description
  32. const HIDE_DESCRIPTION_BANNER = true;
  33.  
  34. const styles = [];
  35.  
  36. if (HIDE_SOLUTION_TRAIN) {
  37. styles.push(`
  38. #view_solutions, #surrender_btn {
  39. display: none!important;
  40. }
  41. `)
  42. }
  43.  
  44. if (HIDE_SOLUTION_PREVIEW) {
  45. styles.push(`
  46. .w-full.mt-2:not(.clear-both) > * > ul.flex.flex-row.justify-center.items-center.space-x-2.px-0.border-0.h-10 > li:nth-child(2) {
  47. display: none!important;
  48. }
  49. `)
  50. }
  51.  
  52. if (HIDE_DESCRIPTION_BANNER) {
  53. styles.push(`
  54. .description.h-full {
  55. height: auto!important;
  56. }
  57.  
  58. .description.h-full > .description-footer {
  59. display: none!important;
  60. }
  61. `)
  62. }
  63.  
  64. const style = document.createElement("style");
  65. style.innerHTML = styles.join("\n");
  66. document.head.appendChild(style);
  67.  
  68. })();