Unhide User ID

Unhide username in Reddit

  1. // ==UserScript==
  2. // @name Unhide User ID
  3. // @namespace UnhideUserID
  4. // @version 0.1.2
  5. // @description Unhide username in Reddit
  6. // @author kusotool
  7. // @match http://*.reddit.com/*
  8. // @match https://*.reddit.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. function addStyleRule(selector, declaration) {
  13. var sheet;
  14. if(document.styleSheets.length){ // 最後のスタイルシートを取得
  15. sheet = document.styleSheets[document.styleSheets.length - 1];
  16. }
  17. else{ // StyleSheetがない場合、StyleSheetを作成
  18. // for FireFox, Opera, Safari, Crome
  19. var head = document.getElementsByTagName('head')[0];
  20. if(head === null){ return; }
  21. var style = document.createElement('style');
  22. head.appendChild(style);
  23. sheet = style.sheet;
  24. }
  25.  
  26. // for FireFox, Opera, Safari, Crome
  27. sheet.insertRule(selector + '{' + declaration + '}', sheet.cssRules.length);
  28. }
  29.  
  30. function addStyleRuleAuthor(author, declaration) {
  31. var classname = ".tagline " + author;
  32. addStyleRule(classname, declaration);
  33. classname = ".comment " + classname;
  34. addStyleRule(classname, declaration);
  35. classname = ".res-nightmode " + classname;
  36. addStyleRule(classname, declaration);
  37. }
  38.  
  39. function start() {
  40. addStyleRuleAuthor(".author" , "font-size: inherit;");
  41. addStyleRuleAuthor(".author::before", "content: \"\";");
  42. addStyleRuleAuthor(".author::after" , "content: \"\";");
  43. }
  44.  
  45. start();