top | item 4199745

Githtml - View Html Files from Github Repos On The Fly

53 points| gcoins | 13 years ago |github.com | reply

21 comments

order
[+] skrebbel|13 years ago|reply
Shouldn't it be called Githubhtml?

I mean, it has virtually nothing to do with git.

[+] samwillis|13 years ago|reply
This has a really big security flaw, if the creator wanted to be mischievous he could change his js file to do things to your logged in github account, for example set your privet repositories public.

If you want to use it you should fork it and change to bookmarklet to use your fork of the js file.

[+] redment|13 years ago|reply
Though I'd never do such a thing, your point is completely valid.
[+] sente|13 years ago|reply
A few months back I created a bookmarklet to render the html when looking at the raw html page -- https://gist.github.com/1831405

I've ended up using this bookmarklet on a lot of non-github.com sites too.

For instance, you can see how it renders http://c.sente.cc/hcVg/xkcd.txt here: http://i.imgur.com/DNVqd.png

here's the code in snippet form:

  javascript:function write_window(content) {top.consoleRef=window.open(%27%27,%27git-r-done%27,+%27,menubar=1%27+%27,toolbar=1%27+%27,status=1%27+%27,scrollbars=1%27+%27,resizable=1%27);top.consoleRef.document.writeln(content);top.consoleRef.document.close();}function dostuff() {$.ajax({url: document.location.href,dataType:%27html%27,success: function(content){setTimeout(function(){write_window(content)},500);}});}function add_jquery(attempt) {var jq=document.createElement(%27script%27);jq.type=%27text/javascript%27;jq.async=false;jq.src=%27https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js%27;var s=document.getElementsByTagName(%27script%27)[0];s.parentNode.insertBefore(jq,s);try{var foo=$(%27*%27);dostuff();}catch(err){if(attempt < 5){attempt = attempt + 1;setTimeout("add_jquery("+attempt+")",1000)}else{alert(%27could not load jquery..try again!%27);}}}add_jquery(0);
[+] rcfox|13 years ago|reply
This seems like a lot of code... Here's what I use:

    javascript:void(document.body.innerHTML = document.getElementsByTagName("pre")[0].innerHTML.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," "));
(Note: I've only tested this on Chrome.)
[+] albertoavila|13 years ago|reply
This is great!,

There has ben more than a few times that I've wished to be able to do this while browsing trough random github repos, kudos to the developer, this looks very handy!

[+] kmfrk|13 years ago|reply
Pretty cool. Can't wait until someone converts this to an extension.
[+] redment|13 years ago|reply
I'm working on that right now. Both for Chrome and FF.
[+] gauravsc|13 years ago|reply
the rendered pages are not very accurate, they seem deformed.
[+] redment|13 years ago|reply
Edit: I'm working on a fix for this. I see the bootstrap page is deformed.