Last active
August 29, 2015 14:20
-
-
Save theo-armour/7ac33739ce0f6c74ff74 to your computer and use it in GitHub Desktop.
This file contains 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
<!doctype html> | |
<html lang=en > | |
<head> | |
<title></title> | |
<meta charset=utf-8 /> | |
</head> | |
<body> | |
<script> | |
// copyright 2015 Theo Armour ~ MIT License | |
var script = document.body.appendChild( document.createElement( 'script' ) ); | |
script.onload = init; | |
script.src = 'http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js'; | |
function init() { | |
document.body.style.cssText = ' font: bold 12pt monospace; left: 0; margin: 0 auto; max-width: 800px; position: absolute; right: 0; '; | |
var content = document.body.appendChild( document.createElement( 'div' ) ); | |
var fileName = location.hash ? location.hash.split( '#' )[1] : 'readme.md'; | |
document.title = document.title ? document.title : fileName; | |
var xmlHttp = new XMLHttpRequest(); | |
xmlHttp.open( 'GET', fileName, true ); | |
xmlHttp.onreadystatechange = function() { | |
content.innerHTML = xmlHttp.readyState === 4 ? new Showdown.converter().makeHtml( xmlHttp.responseText ) : ''; | |
}; | |
xmlHttp.send( null ); | |
} | |
/* | |
View only on GitHub | |
<span style=display:none; >[View as web page]( http://wikihouse.github.io/viewer-experiments/ "view the file as a web page." ) </span> | |
View the following only on the web page | |
<input type=button value='Source code on GitHub' onclick=window.location.href='http://github.com/wikihouse/viewer-experiments/tree/gh-pages/'; /> | |
*/ | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment