Skip to content

Instantly share code, notes, and snippets.

@mneil
Created February 13, 2015 00:24
Show Gist options
  • Save mneil/044bf07cc4fa9b237ac7 to your computer and use it in GitHub Desktop.
Save mneil/044bf07cc4fa9b237ac7 to your computer and use it in GitHub Desktop.

Revisions

  1. mneil created this gist Feb 13, 2015.
    25 changes: 25 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    (function(){
    MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

    function time(target){
    target.innerHTML = target.time;
    }
    moot("format", function(body, post) {

    var $ = jQuery;
    var $post = $(body).parents('.m-post')[0];
    var t = $(".m-time", $post)[0];

    //alternatively you can manipulate post.time into a datetime you want
    t.time = $(".m-tooltip", $post).text();

    new MutationObserver(function(mutations) {
    time(mutations[0].target);
    }).observe(t, {
    subtree: true,
    attributes: true
    });

    });

    })();