Greasy Fork

Greasy Fork is available in English.

FB: Full Timestamps 2018

Shows full timestamps on Facebook posts

当前为 2018-03-05 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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  http://greasyfork.icu/scripts/12228/code/setMutationHandler.js
// @ require  http://momentjs.com/downloads/moment.min.js
// @version 3.0B
// @namespace http://greasyfork.icu/users/95175
// @description Shows full timestamps on Facebook posts
// ==/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', '<span class="full-timestamp">' +
        ' on ' + abbr.title.substr(1)
        .replace('am', ':').replace('pm', ':')

        .replace('at', '')

        .replace('Sunday,', '').replace('unday,', 'Sunday,')
        .replace('Monday,', '').replace('onday,', 'Monday,')
        .replace('Tuesday,', '').replace('uesday,', 'Tuesday,')
        .replace('Wednesday,', '').replace('ednesday,', 'Wednesday,')
        .replace('Thursday,', '').replace('hursday,', 'Thursday,')
        .replace('Friday,', '').replace('riday,', 'Friday,')
        .replace('Saturday,', '').replace('urday,', 'Saturday,')

        .replace('2004', '2004 at').replace('2005', '2005 at')
        .replace('2006', '2006 at').replace('2007', '2007 at')
        .replace('2008', '2008 at').replace('2009', '2009 at')
        .replace('2010', '2010 at').replace('2011', '2011 at')
        .replace('2012', '2012 at').replace('2013', '2013 at')
        .replace('2014', '2014 at').replace('2015', '2015 at')
        .replace('2016', '2016 at').replace('2017', '2017 at')
        .replace('2018', '2018 at').replace('2019', '2019 at')
        .replace('2020', '2020 at').replace('2021', '2021 at') +

        (moment(new Date(abbr.dataset.utime * 1000)).format('ssa') +

        (moment(new Date(abbr.dataset.utime * 1000)).format(' [UTC]Z '))));
    }
}