example// ==UserScript==
// @name Show Exact Image Posting Date
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Replace relative time with exact posting date for images
// @match https://example.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function convertToExactDate(element) {
// This function will convert the relative time to an exact date
// You'll need to implement this based on the website's HTML structure
// For example:
// let timestamp = element.getAttribute('data-timestamp');
// let date = new Date(parseInt(timestamp) * 1000);
// element.textContent = date.toLocaleString();
}
function processImageDates() {
// Select all elements that contain the relative time
// You'll need to adjust this selector based on the website's HTML structure
let dateElements = document.querySelectorAll('.relative-time-class');
dateElements.forEach(element => {
convertToExactDate(element);
});
}
// Run the script when the page loads
window.addEventListener('load', processImageDates);
// If the website uses AJAX to load more content, you might need to run the script periodically
// Uncomment the following line if needed:
// setInterval(processImageDates, 5000); // Run every 5 seconds
})();
Hello,
Does anyone have a script that shows the exact date posted on images? Or is someone able to do it?
How I would imagine it: Under all pictures is line saying “Posted X days/weeks/months/years ago” so instead of that there will be exact time posted. It’s in the source html, but you need to inspect the site to see it. Its a long process if you’re on a phone or need the timestamp for multiple images.
Any help will be appreciated. Thank you!