// ==UserScript== // @name FB: Full Timestamps 2018 // @match https://www.facebook.com/* // @match https://*.facebook.com/* // @match http://www.facebook.com/* // @match http://*.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 // @version 2.5E2 // @namespace https://greasyfork.org/users/95175 // @description Shows full timestamps on Facebook posts // @downloadURL none // ==/UserScript== var options = { weekday: 'long', year: 'numeric', month: 'numeric', day: '2-digit' }; GM_addStyle( '.full-timestamp { opacity: 0.85; color: #09f; }' + '.full-timestamp:hover { opacity: 1.0; }' + '.full-timestamp:before { content: ""; }' + '.full-timestamp:after { content: ""; }' + '.timestampContent {display: none; }' ); // 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', '' + abbr.title.substr(11, abbr.title.substr.length0).replace('am', ':').replace('pm', ':') + (moment(new Date(abbr.dataset.utime * 1000)).format('ssa') + ' on ' + abbr.title.substr(0,10) .replace('at', '') .replace('Sunday,', '') .replace('Monday,', '') .replace('Tuesday,', '') .replace('Wednesday,', '') .replace('Thursday,', '') .replace('Friday,', '') .replace('Saturday,', '') .replace('2004', '2004').replace('2005', '2005') .replace('2006', '2006').replace('2007', '2007') .replace('2008', '2008').replace('2009', '2009') .replace('2010', '2010').replace('2011', '2011') .replace('2012', '2012').replace('2013', '2013') .replace('2014', '2014').replace('2015', '2015') .replace('2016', '2016').replace('2017', '2017') .replace('2018', '2018').replace('2019', '2019') .replace('2020', '2020').replace('2021', '2021').replace('ch 4', 'xxx') + (moment(new Date(abbr.dataset.utime * 1000)).format(' [UTC]Z ')))); } }