initial commit
This commit is contained in:
5
static/404.html
Normal file
5
static/404.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
Fail on Toothpaste :D
|
||||
</body>
|
||||
</html>
|
||||
116
static/get.html
Normal file
116
static/get.html
Normal file
@@ -0,0 +1,116 @@
|
||||
<!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>
|
||||
111
static/insert.html
Normal file
111
static/insert.html
Normal file
@@ -0,0 +1,111 @@
|
||||
<!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: Insert HERE</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">
|
||||
<!-- 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" >Insert your Code here!</div>
|
||||
<span>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-mini dropdown-toggle" data-toggle="dropdown" data-bind="attr: {selectedTypeName: selectedTypeIndex}, text: selectedTypeName">Test</button>
|
||||
<button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
|
||||
<ul id="typeList" data-bind="foreach: types" class="dropdown-menu">
|
||||
<li><a href="#" data-bind="attr: {id: $data.id, aceMode: $data.classname, typeindex: $index}, text: $data.type">Test</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<button type="button" class="btn btn-mini" id="pasteButton">Paste dat!</button>
|
||||
</span>
|
||||
</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="/static/spinner.js"></script>
|
||||
<script type="text/javascript">
|
||||
var selectedTypeId;
|
||||
|
||||
$('input[type=number]').spinner();
|
||||
|
||||
$('#fontSizeSpinner > input').change(function(){
|
||||
editor.setFontSize(parseInt($(this).val()));
|
||||
});
|
||||
|
||||
$(function(){
|
||||
|
||||
viewModel.selectedTypeName = ko.observable();
|
||||
viewModel.selectedTypeIndex = ko.observable();
|
||||
|
||||
viewModel.selectedTypeName(viewModel.types[0].type);
|
||||
viewModel.selectedTypeIndex(0);
|
||||
|
||||
$("#pasteButton").on("click", function(){
|
||||
$.ajax({
|
||||
url: "./fritten",
|
||||
type: "POST" ,
|
||||
data: {
|
||||
content: editor.getValue(),
|
||||
type : viewModel.types[viewModel.selectedTypeIndex()].id
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
console.log(data);
|
||||
|
||||
if(data.id !== null){
|
||||
window.location = "./"+data.id+"/";
|
||||
}
|
||||
}
|
||||
})
|
||||
}) ;
|
||||
|
||||
$("#typeList").bind( "click" , function(element){
|
||||
selectedType = viewModel.types[$(element.target).attr("typeindex")];
|
||||
|
||||
viewModel.selectedTypeName(selectedType.type);
|
||||
viewModel.selectedTypeIndex($(element.target).attr("typeindex"));
|
||||
|
||||
editor.session.setMode("ace/mode/" + $(element.target).attr("aceMode"));
|
||||
console.log($(element.target).attr("aceMode"));
|
||||
});
|
||||
|
||||
ko.applyBindings(viewModel);
|
||||
});
|
||||
|
||||
var viewModel = %JSONStuff%;
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
1
static/jquery.qtip.min.css
vendored
Normal file
1
static/jquery.qtip.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
4
static/jquery.qtip.min.js
vendored
Normal file
4
static/jquery.qtip.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
27
static/spinner.js
Normal file
27
static/spinner.js
Normal file
@@ -0,0 +1,27 @@
|
||||
(function($) {
|
||||
$.fn.spinner = function() {
|
||||
this.each(function() {
|
||||
var el = $(this);
|
||||
|
||||
// add elements
|
||||
el.wrap('<span id="'+$(this).attr("id")+'" class="spinner"></span>');
|
||||
el.removeAttr("id");
|
||||
el.before('<span class="sub">-</span>');
|
||||
el.after('<span class="add">+</span>');
|
||||
|
||||
// substract
|
||||
el.parent().on('click', '.sub', function () {
|
||||
if (el.val() > parseInt(el.attr('min')))
|
||||
el.val( function(i, oldval) { return --oldval; });
|
||||
el.trigger("change");
|
||||
});
|
||||
|
||||
// increment
|
||||
el.parent().on('click', '.add', function () {
|
||||
if (el.val() < parseInt(el.attr('max')))
|
||||
el.val( function(i, oldval) { return ++oldval; });
|
||||
el.trigger("change");
|
||||
});
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
159
static/style.css
Normal file
159
static/style.css
Normal file
@@ -0,0 +1,159 @@
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow-y: no-content;
|
||||
overflow-y: no-display;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#head {
|
||||
height: 120px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#editorContainer {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#editor {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
input[type=number] {
|
||||
float: left;
|
||||
width: 53px;
|
||||
height: 27px;
|
||||
padding: 0;
|
||||
font-size: 1.2em;
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
color: #8F908A;
|
||||
border: 2px #8F908A solid;
|
||||
background: none;
|
||||
outline: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
span.spinner {
|
||||
position: absolute;
|
||||
height: 30px;
|
||||
user-select: none;
|
||||
-ms-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
span.spinner > .sub,
|
||||
span.spinner > .add {
|
||||
float: left;
|
||||
display: block;
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
text-align: center;
|
||||
font-family: Lato;
|
||||
font-weight: 700;
|
||||
font-size: 1.2em;
|
||||
line-height: 23px;
|
||||
color: #8F908A;
|
||||
border: 2px #8F908A solid;
|
||||
border-right: 0;
|
||||
|
||||
border-radius: 2px 0 0 2px;
|
||||
cursor: pointer;
|
||||
transition: 0.1s linear;
|
||||
-o-transition: 0.1s linear;
|
||||
-ms-transition: 0.1s linear;
|
||||
-moz-transition: 0.1s linear;
|
||||
-webkit-transition: 0.1s linear;
|
||||
}
|
||||
|
||||
span.spinner > .add {
|
||||
top: 0;
|
||||
border: 2px #8F908A solid;
|
||||
border-left: 0;
|
||||
border-radius: 0 2px 2px 0;
|
||||
}
|
||||
|
||||
span.spinner > .sub:hover,
|
||||
span.spinner > .add:hover {
|
||||
background: #93504C;
|
||||
color: #25323B;
|
||||
}
|
||||
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
#fontSizeSpinner {
|
||||
display: block;
|
||||
position: absolute;
|
||||
bottom: 25px;
|
||||
right: 27px;
|
||||
}
|
||||
.fleft{
|
||||
float: left;
|
||||
}
|
||||
|
||||
.fright{
|
||||
float: right;
|
||||
}
|
||||
|
||||
.mright {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#copy {
|
||||
white-space: nowrap;
|
||||
color: #333;
|
||||
background-color: buttonface;
|
||||
border: 2px solid buttonface;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#typeList {
|
||||
height: 300px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#headline {
|
||||
font-family: "Consolas" ;
|
||||
}
|
||||
|
||||
@media (max-width: 530px) {
|
||||
#headline {
|
||||
font-size: 200%;
|
||||
}
|
||||
#head {
|
||||
left: 10px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
#editorContainer {
|
||||
top: 95px;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (min-width: 531px) {
|
||||
#headline{
|
||||
font-size: 300%;
|
||||
}
|
||||
|
||||
#editorContainer {
|
||||
top: 110px;
|
||||
bottom: 50px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.fill {
|
||||
height: 100%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user