2017-04-26 22:57:46 +02:00

116 lines
4.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Toothpaste: Show your pastes</title>
<link rel="icon" type="image/png" href="//cdn.tooth.yt/paste.png">
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="/static/style.css" crossorigin="anonymous">
<link rel="stylesheet" href="/static/jquery.qtip.min.css" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="fill">
<div id="head">
<div id="headline">
<span>Your Paste: </span>
<span id="copy" type="text" data-bind=" text: pasteId, attr : {'data-clipboard-text' : 'http://paste.tooth.yt/'+pasteId+'/' } " data-clipboard-text="stuff" alt="Copy to your clipboard!"></span>
</div>
<div style="clear: both;">
<button class="btn btn-mini dropdown-toggle " data-bind="html: selectedType.type"></button>
<button class="btn btn-mini"><a href="./raw/">Raw</a></button>
<button class="btn btn-mini dropdown-toggle " id="back">New Paste!</button>
</div>
</div>
<div id="editorContainer">
<pre id="editor" class="editor"></pre>
<input id="fontSizeSpinner" type="number" min="8" max="30" value="16" />
</div>
</div>
<script src="//cdn.tooth.yt/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.session.setMode("ace/mode/javascript");
editor.setShowPrintMargin(false);
editor.setFontSize(16);
</script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.12/clipboard.min.js"></script>
<script src="/static/spinner.js"></script>
<script src="/static/jquery.qtip.min.js"></script>
<script type="text/javascript">
var selectedTypeId;
$('input[type=number]').spinner();
$('#fontSizeSpinner > input').change(function(){
editor.setFontSize(parseInt($(this).val()));
});
$(function(){
$("#copy").qtip({
content: {
text: "Copy to Clipboard",
},
style: {
classes: 'qtip-dark qtip-rounded qtip-shadow'
} ,
position : {
my: 'top center', // Position my top left...
at: 'bottom center', // at the bottom right of...
target: $('#copy') // my target
}
});
selectedTypeId = viewModel.type ;
var selectedType;
viewModel.types.forEach(function(element){
if(element.id == selectedTypeId){
selectedType = element;
}
});
viewModel.selectedType = selectedType;
editor.session.setMode("ace/mode/" + viewModel.selectedType.classname );
ko.applyBindings(viewModel);
editor.setValue(viewModel.content , -1 );
editor.setReadOnly(true);
$("#back").on("click", function(){
window.location = "../";
});
var clipboard = new Clipboard('#copy');
});
var viewModel = %JSONStuff% ;
</script>
</body>
</html>