// ==UserScript== // @name Show Accurate View Count, Asked timestamp and Modified timestamp of StackExchange question // @namespace http://tampermonkey.net/ // @version 0.1.2 // @license MIT // @description Show Accurate View Count, Asked timestamp and Modified timestamp of StackExchange question. // @author aspen138 // @match *://*.stackoverflow.com/questions/* // @match *://superuser.com/questions/* // @match *://meta.superuser.com/questions/* // @match *://serverfault.com/questions/* // @match *://meta.serverfault.com/questions/* // @match *://askubuntu.com/questions/* // @match *://meta.askubuntu.com/questions/* // @match *://mathoverflow.net/questions/* // @match *://meta.mathoverflow.net/questions/* // @match *://*.stackexchange.com/questions/* // @match *://answers.onstartups.com/questions/* // @match *://meta.answers.onstartups.com/questions/* // @match *://stackapps.com/questions/* // @match *://*.stackoverflow.com/review/* // @match *://superuser.com/review/* // @match *://meta.superuser.com/review/* // @match *://serverfault.com/review/* // @match *://meta.serverfault.com/review/* // @match *://askubuntu.com/review/* // @match *://meta.askubuntu.com/review/* // @match *://mathoverflow.net/review/* // @match *://meta.mathoverflow.net/review/* // @match *://*.stackexchange.com/review/* // @match *://answers.onstartups.com/review/* // @match *://meta.answers.onstartups.com/review/* // @match *://stackapps.com/review/* // @match *://*.stackoverflow.com/search* // @match *://superuser.com/search* // @match *://meta.superuser.com/search* // @match *://serverfault.com/search* // @match *://meta.serverfault.com/search* // @match *://askubuntu.com/search* // @match *://meta.askubuntu.com/search* // @match *://mathoverflow.net/search* // @match *://meta.mathoverflow.net/search* // @match *://*.stackexchange.com/search* // @match *://answers.onstartups.com/search* // @match *://meta.answers.onstartups.com/search* // @match *://stackapps.com/search* // @grant none // @downloadURL none // ==/UserScript== // @match *://*.stackexchange.com/* (function() { 'use strict'; // Define a function to format the date function formatDate(date) { return date.toISOString().replace('T', ' ').replace(/\..*$/, 'Z'); } // Update Asked time const askedTimeElement = document.querySelector('time[itemprop="dateCreated"]'); if (askedTimeElement) { const askedDate = new Date(askedTimeElement.getAttribute('datetime')); console.log("askedDate=", askedDate); askedTimeElement.innerText = formatDate(askedDate); } // Update Modified time const modifiedTimeElement = document.querySelector('a[href*="?lastactivity"]'); if (modifiedTimeElement) { const modifiedDate = new Date(modifiedTimeElement.getAttribute('title')); console.log("modifiedDate=", modifiedDate); modifiedTimeElement.innerText = formatDate(modifiedDate); } // Update Viewed count const viewedElement = document.querySelector('div[title*="Viewed"]'); if (viewedElement) { const viewCount = viewedElement.getAttribute('title').match(/Viewed ([\d,]+) times/); if (viewCount && viewCount[1]) { viewedElement.innerText = 'Viewed ' + viewCount[1].replace(/,/g, '') + ' times'; } } })();