Reddit Enhancement Suite Custom Toggle Visibility

Toggle a comment's visibility by clicking text on its tagline or the comment's body.

目前為 2016-02-28 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Reddit Enhancement Suite Custom Toggle Visibility
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Toggle a comment's visibility by clicking text on its tagline or the comment's body.
  6. // @author You
  7. // @match https://*.reddit.com/r/*/comments/*
  8. // @grant none
  9. // ==/UserScript==
  10. /* jshint -W097 */
  11. 'use strict';
  12.  
  13. Array.prototype.forEach.call(
  14. document.querySelectorAll(".usertext, .usertext :not(a), .usertext-body, .entry, .tagline span, .tagline time"),
  15. function(elem) {
  16. elem.onclick = function(event) {
  17. console.log(event);
  18. if(event.target == this) {
  19. return togglecomment(this);
  20. }
  21. };
  22. }
  23. );
  24. Array.prototype.forEach.call(
  25. document.querySelectorAll(".expand"),
  26. function(elem) {
  27. elem.style.display = "none";
  28. }
  29. );