Skip to content

Instantly share code, notes, and snippets.

@XORwell
Created December 24, 2011 11:05
Show Gist options
  • Save XORwell/1517138 to your computer and use it in GitHub Desktop.
Save XORwell/1517138 to your computer and use it in GitHub Desktop.
Adds time of Facebook-Wall items as li-title (hover-text)
// ==UserScript==
// @name Facebook Timestamp Viewer
// @description Adds time of Facebook-Wall items as li-title (hover-text)
// @namespace Facebook Timestamp Viewer
// @version 0.1.1
// @include http*://*.facebook.com/*sk=wall
//
// ==/UserScript==
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
function main() {
$('li').each(function(){
if(typeof($(this).attr('data-ft')) !== 'undefined' ) {
data = jQuery.parseJSON($(this).attr('data-ft'));
if(typeof(data.pub_time) !== 'undefined') {
$(this).attr('title', new Date(data.pub_time*1000));
}
}
});
}
addJQuery(main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment