gavin19

Reddit - Timestamp

May 11th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           Reddit - Timestamp
  3. // @author        gavin19
  4. // @description    Show timestamp in the user bar
  5. // @match          http://*.reddit.com/*
  6. // @include          http://*.reddit.com/*
  7. // @version    0.1
  8. // ==/UserScript==
  9. if(!!document.querySelector('.pref-lang')){
  10.     var timeStamp = document.createElement('span'),
  11.         userBar = document.querySelector('#header-bottom-right'),
  12.         prefLang = document.querySelector('#header-bottom-right .flat-list'),
  13.         dt = new Date(),
  14.         hn = dt.getHours(),
  15.         mn = dt.getMinutes();
  16.     if(hn.toString().length === 1)hn = "0"+hn;
  17.     if(mn.toString().length === 1)mn = "0"+mn;
  18.     timeStamp.textContent = hn+":"+mn+" | ";
  19.     userBar.insertBefore(timeStamp,prefLang);
  20. }
Add Comment
Please, Sign In to add comment