Skip to content

Instantly share code, notes, and snippets.

@shu8
Created July 23, 2015 11:18
Show Gist options
  • Save shu8/e96e44fe1e7f41eb22e7 to your computer and use it in GitHub Desktop.
Save shu8/e96e44fe1e7f41eb22e7 to your computer and use it in GitHub Desktop.
Adds a tooltip to the 'modified'/'answered' parts of questions on the homepage that tells you when the question was asked.
// ==UserScript==
// @name Get asked date
// @namespace http://stackexchange.com/users/4337810/
// @version 1.0
// @description Adds a tooltip to the 'modified'/'answered' parts of questions on the homepage that tells you when the question was asked.
// @author ᔕᖺᘎᕊ (http://stackexchange.com/users/4337810/)
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
// @match *://*.superuser.com/*
// @match *://*.serverfault.com/*
// @match *://*.askubuntu.com/*
// @match *://*.stackapps.com/*
// @match *://*.mathoverflow.net/*
// @grant none
// ==/UserScript==
function getDate(url, $that) {
$.get(url, function(responseText, textStatus, XMLHttpRequest) {
$that.find('.shub-asked-date').attr('title', $(XMLHttpRequest.responseText).find('#question > table > tbody > tr:nth-child(1) > td.postcell > div > table > tbody > tr > td.post-signature.owner > div > div.user-action-time').text().trim());
});
}
$('.started').each(function() {
$that = $(this);
$(this).find('a:eq(0)').wrapInner("<span class='shub-asked-date'></span>");
getDate($(this).parent().parent().find('h3 a').attr('href'), $that);
});
@shu8
Copy link
Author

shu8 commented Jul 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment