NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Equestria Daily - fix empty post dates // @namespace http://vcsajen.com/fix_dates_on_equestria_daily // @version 1.0 // @description Fixes empty dates on EqD // @author VcSaJen // @license MIT // @match https://www.equestriadaily.com/* // @grant none // ==/UserScript== (function() { 'use strict'; let timestampNodes = document.querySelectorAll(".post-timestamp"); for (let timestampNode of timestampNodes) { let textNode = document.evaluate('text()[contains(.,"op")]', timestampNode, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue; let timeNode = timestampNode.querySelector('.timestamp-link > .published'); if (textNode !== null && timeNode !== null) { if (!textNode.nodeValue.includes(',')) { let date = new Date(timeNode.title.replace(/[+-]\d\d:\d\d$/i, '') + "Z"); var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' }; textNode.nodeValue = date.toLocaleDateString("en-US", options) + " op"; } } } })();