Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Facebook real time time
- // @match https://www.facebook.com/*
- // @grant none
- // ==/UserScript==
- function update_timestamps () {
- function pretty_time (time) {
- hours = Math.floor(time / 3600)
- minutes = Math.floor(time / 60) - hours * 60;
- seconds = time % 60;
- function pad (n) {return ('0' + n).substr(-2)};
- pretty = pad(hours) + ':' + pad(minutes) + ':' + pad(seconds);
- return pretty;
- }
- abbrs = document.getElementsByTagName('abbr');
- current = new Date().getTime() / 1000 | 0;
- for (i in abbrs) {
- try {
- abbrs[i].attributes['data-utime']
- } catch (e) {
- continue;
- }
- diff = current - parseInt(abbrs[i].attributes['data-utime'].value);
- if (diff < 3 * 60 * 60)
- abbrs[i].innerHTML = pretty_time(diff);
- }
- setTimeout(update_timestamps, 1000);
- }
- update_timestamps();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement