// ==UserScript== // @name Full timestamps on Facebook posts // @description Shows full timestamps on Facebook posts // @match *://www.facebook.com/* // @run-at document-start // @grant GM_addStyle // @author wOxxOm & JZersche // @require https://greasyfork.org/scripts/12228/code/setMutationHandler.js // @ require http://momentjs.com/downloads/moment.min.js ~Script requires this, remove the space between the @ and the r. // @version 1.00 // @namespace https://greasyfork.org/users/95175 // @downloadURL none // ==/UserScript== GM_addStyle( '.full-timestamp { opacity: 0.56; color: #f00; }' + '.full-timestamp:hover { opacity: 1.0; }' + '.full-timestamp:before { content: " ("; }' + '.full-timestamp:after { content: ")"; }' ); // process the already loaded portion of the page if any expandDates(document.querySelectorAll('abbr[data-utime]')); // process the stuff added from now on setMutationHandler(document, 'abbr[data-utime]', expandDates); function expandDates(nodes) { for (var i = 0, abbr; (abbr = nodes[i++]); ) { if (abbr.querySelector('.full-timestamp')) { // already processed continue; } abbr.insertAdjacentHTML('beforeend', '' + (moment(new Date(abbr.dataset.utime * 1000)).format('dddd, M/DD/YYYY []')) + '' + abbr.title.substr(+15, abbr.title.substr.length0) .replace('January','').replace('February','') .replace('March','').replace('April','') .replace('May','').replace('June','') .replace('July','').replace('August','') .replace('September','').replace('October','') .replace('November','').replace('December','') .replace('at','') .replace('pm','PM') .replace('ber','').replace(' 31,','').replace('ry 21,','') .replace('12,','').replace('','') .replace('am','AM') .replace('2017','') .replace('2016','').replace(' 9','9') .replace('017','').replace('016','') .replace(' 18','').replace(' 19','') .replace('ary','').replace('ry','') .replace('er 4','').replace(' 13','') .replace(' 15','').replace('y 10','') .replace(' 20','').replace(' 14','') .replace(' 11,','').replace(' 12','12') .replace('15 ','').replace('er','') .replace(' 27','').replace('r 28','') .replace('30, ','').replace('14 ','') .replace(',','').replace('','') + //':' + ( moment(new Date(abbr.dataset.utime * 1000) ) .format(' · [UTC]Z')) + ''); } } /* Method #1 (moment(abbr.dataset.utime * 1000).format('dddd, M/DD/YYYY, h:mm:ss A · [UTC]-05:00')) + ''); ~ Problematic, because old posts end up showing 3 hours ahead, while recent posts show correct time for some unknown reason.*/ /* Method #2 (moment(abbr.dataset.utime * 1000).utcOffset.format('dddd, M/DD/YYYY, h:mm:ss A · [UTC]-05:00')) + ''); ~ Use this to subtract 3 hours, resulting in accurate older posts but newer posts show 3 hours behind. */