initial commit
This commit is contained in:
commit
ce937728a5
60
.gitignore
vendored
Normal file
60
.gitignore
vendored
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/js/mysql.js
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Typescript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Paste
|
||||||
|
paste.tooth.yt
|
||||||
|
|
||||||
|
/js/mysql.js must export a mysql connection object like so
|
||||||
|
```
|
||||||
|
var mysql = require('mysql');
|
||||||
|
|
||||||
|
var connection = mysql.createConnection({
|
||||||
|
host: '127.0.0.1',
|
||||||
|
database: 'database',
|
||||||
|
user: 'username',
|
||||||
|
password: 'password'
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = connection;
|
||||||
|
```
|
||||||
199
app.js
Normal file
199
app.js
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
var bodyParser = require('body-parser');
|
||||||
|
var express = require('express');
|
||||||
|
var fs = require('fs');
|
||||||
|
var connection = require("./js/mysql.js");
|
||||||
|
|
||||||
|
var rhg = require('random-hash-generator');
|
||||||
|
|
||||||
|
var pastesThisSession = 0;
|
||||||
|
|
||||||
|
function PlayRocketLeague() {
|
||||||
|
pastesThisSession++;
|
||||||
|
return new Date().toString() + pastesThisSession / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
var app = express();
|
||||||
|
|
||||||
|
app.use(bodyParser.urlencoded({
|
||||||
|
extended: true
|
||||||
|
}));
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
|
const PORT = 8081;
|
||||||
|
var types;
|
||||||
|
|
||||||
|
function connect() {
|
||||||
|
// if (connection !== undefined && connection !== null) {
|
||||||
|
// connection.destroy();
|
||||||
|
// }
|
||||||
|
|
||||||
|
connection.connect(function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
connect();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
connection.on('error', function(err) {
|
||||||
|
console.log('db error', err);
|
||||||
|
if (err.code === 'PROTOCOL_CONNECTION_LOST') { // Connection to the MySQL server is usually
|
||||||
|
connect();
|
||||||
|
}
|
||||||
|
else { // connnection idle timeout (the wait_timeout
|
||||||
|
throw err; // server variable configures this)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
connect();
|
||||||
|
|
||||||
|
function query(str, callback) {
|
||||||
|
query(str, [], callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
function query(str, arg, callback) {
|
||||||
|
var isConnected = true;
|
||||||
|
|
||||||
|
connection.query(str, arg, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
query("SELECT * FROM types", function(err, result) {
|
||||||
|
types = result;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.port = PORT;
|
||||||
|
app.host = "127.0.0.1";
|
||||||
|
|
||||||
|
function generateId(data) {
|
||||||
|
pastesThisSession++;
|
||||||
|
return rhg.calc(data, 8, PlayRocketLeague()).replace('/', '-').replace('+', '_');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContentId(data, callback) {
|
||||||
|
var id = generateId(data);
|
||||||
|
query("SELECT id FROM pastes WHERE id = '?'", [id], function(err, result) {
|
||||||
|
if (err === null && result.length > 0) {
|
||||||
|
getContentId(data, callback);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
callback(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertPaste(data, type, callback) {
|
||||||
|
if (data !== null && type !== null) {
|
||||||
|
|
||||||
|
query("SELECT * FROM types WHERE id = ?", [type], function(err, result) {
|
||||||
|
if (err === null && result.length > 0) {
|
||||||
|
getContentId(data, function(id) {
|
||||||
|
query("INSERT INTO pastes (id, type, content) VALUES (?, ?, ?)", [id, type, data], function(err, result) {
|
||||||
|
if (err === null) {
|
||||||
|
callback(id, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
callback(null, "Content or Type not defined.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function readFile(path, callback) {
|
||||||
|
if (!path.match(/\.\./g)) {
|
||||||
|
fs.readFile('./static/' + path, (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
readFile("404.html", callback);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
callback(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
callback("Nope");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRequest(request, response) {
|
||||||
|
console.log(request.params.path);
|
||||||
|
|
||||||
|
var type = request.params.option;
|
||||||
|
|
||||||
|
var id = request.params.path.match(/^[a-zA-Z 0-9\_\-]*$/g);
|
||||||
|
|
||||||
|
console.log(id);
|
||||||
|
|
||||||
|
if (id !== null && id[0] != null && id[0].length == 8) {
|
||||||
|
|
||||||
|
query("SELECT * FROM pastes WHERE id = ?", [id], function(err, result) {
|
||||||
|
if (err === null && result.length > 0) {
|
||||||
|
if (type == "raw") {
|
||||||
|
response.end(result[0].content);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
readFile("get.html", function(data) {
|
||||||
|
response.end(data.toString().replace("%JSONStuff%", JSON.stringify({
|
||||||
|
types: types,
|
||||||
|
type: result[0].type,
|
||||||
|
pasteId: result[0].id,
|
||||||
|
content: result[0].content
|
||||||
|
})));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
readFile("404.html", function(data) {
|
||||||
|
response.end(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
readFile("404.html", function(data) {
|
||||||
|
response.end(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
app.get("/", function(request, response) {
|
||||||
|
readFile("insert.html", function(data) {
|
||||||
|
response.end(data.toString().replace("%JSONStuff%", JSON.stringify({
|
||||||
|
types: types
|
||||||
|
})));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/static/:filename", function(request, response) {
|
||||||
|
|
||||||
|
readFile(request.params.filename, function(data) {
|
||||||
|
response.end(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post("/fritten", function(request, response) {
|
||||||
|
|
||||||
|
insertPaste(request.body.content, request.body.type, function(id, error) {
|
||||||
|
response.status(200).json({
|
||||||
|
id: id,
|
||||||
|
err: error
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/:path", handleRequest);
|
||||||
|
app.get("/:path/:option", handleRequest);
|
||||||
|
|
||||||
|
app.listen(PORT, "127.0.0.1", 511, function() {
|
||||||
|
|
||||||
|
});
|
||||||
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%;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user