Last active
October 8, 2020 11:50
Star
You must be signed in to star a gist
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>Gist HTML Preview</title> | |
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> | |
<meta http-equiv='Content-Type' content='text/html; charset=utf8'/> | |
<meta name='apple-mobile-web-app-capable' content='yes'/> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'/> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> | |
<style type="text/css"> | |
.container { | |
width: auto; | |
max-width: 680px; | |
padding: 0 15px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<h2>Gist HTML Preview (Fake)</h2> | |
<p class="lead">If <ins>File Name</ins> is empty, it will preview <ins>index.html</ins> or <ins>the first file</ins> as default.</p> | |
<div class="form-inline" role="form"> | |
<div class="form-group"> | |
<label for="gist_id">https://gistpreview.github.io/?</label> | |
<input type="text" class="form-control input-sm" id="gist_id" placeholder="Gist ID"> | |
</div> | |
<div class="form-group"> | |
<label for="file_name">/</label> | |
<input type="text" class="form-control input-sm" id="file_name" placeholder="File Name (optional)"> | |
</div> | |
<button id="submit" class="btn btn-primary">Submit</button> | |
</div> | |
<a href="https://github.com/gistpreview/gistpreview.github.io"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a> | |
</div> | |
<script> | |
(function () { | |
var gistId = document.getElementById('gist_id'); | |
var fileName = document.getElementById('file_name'); | |
function submit () { | |
location.search = gistId.value + (fileName.value ? '/' + fileName.value : ''); | |
} | |
document.getElementById('submit').onclick = submit; | |
document.onkeypress = function (e) { | |
if (e.keyCode === 13) submit(); | |
} | |
// write data to blank | |
var query = location.search.substring(1).split('/'); | |
gistId.value = query[0]; | |
fileName.value = query[1] || ''; | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment