Last active
          April 19, 2016 14:36 
        
      - 
      
 - 
        
Save notthatnathan/98a77aed188db3f0c2d6 to your computer and use it in GitHub Desktop.  
    Style old Github issues
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var how_far_back = 60; //time in days | |
| var css = '.old-issue { background-color: #ddd; opacity: 0.1; filter: blur(2px); -webkit-filter: blur(2px); }'; //your css | |
| // don't edit below! | |
| var $rows = document.querySelectorAll('.js-issue-row'); //all issues | |
| //check for old issues | |
| for (var i = 0, l = $rows.length; i < l; i++) { | |
| var current_time = new Date(); | |
| var $issue = $rows[i]; | |
| var $issue_time = $issue.getElementsByTagName('relative-time'); | |
| var issue_time = new Date($issue_time[0].getAttribute('datetime')); | |
| current_time.setDate(current_time.getDate() - how_far_back); | |
| if (issue_time < current_time) { | |
| $issue.className += ' old-issue'; | |
| } | |
| } | |
| // insert stylesheet in head | |
| var $head = document.head || document.getElementsByTagName('head')[0]; | |
| var $style = document.createElement('style'); | |
| $style.type = 'text/css'; | |
| if ($style.styleSheet){ | |
| $style.styleSheet.cssText = css; | |
| } else { | |
| $style.appendChild(document.createTextNode(css)); | |
| } | |
| $head.appendChild($style); | 
Updated:
- Removed jQuery requirement
 - Handles Github's change from 
timeelement torelative-time 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Use CJS or another extension to run this script automatically when on github.com.
Requires jQuery, which Github is already including.Usage
how_far_backto the number of days back that you consider "old" or "outdated." Default: 60cssto your desired styles. Default: blurred