Created
December 24, 2011 11:05
-
-
Save XORwell/1517138 to your computer and use it in GitHub Desktop.
Adds time of Facebook-Wall items as li-title (hover-text)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==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