LeetCode-Default-Font

Always use the default monospace font in the codemirror editor.

  1. // ==UserScript==
  2. // @name LeetCode-Default-Font
  3. // @namespace leetcode-default-font
  4. // @version 0.3
  5. // @description Always use the default monospace font in the codemirror editor.
  6. // @author fenghaolw@gmail.com
  7. // @include *://leetcode.com/*
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12. function addGlobalStyle(css) {
  13. var head, style;
  14. head = document.getElementsByTagName('head')[0];
  15. if (!head) { return; }
  16. style = document.createElement('style');
  17. style.type = 'text/css';
  18. style.innerHTML = css;
  19. head.appendChild(style);
  20. }
  21. addGlobalStyle('.CodeMirror { font-family: monospace !important; }');
  22. addGlobalStyle('pre, code, kbd, samp { font-family: monospace !important; }');
  23. })();