mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
merge
This commit is contained in:
@@ -16,7 +16,7 @@ font-size: 48px;
|
||||
line-height: 0;
|
||||
|
||||
}
|
||||
.brand p {
|
||||
.brand em {
|
||||
display: inline;
|
||||
color: #D40202;
|
||||
margin: 0px !important;
|
||||
@@ -42,6 +42,10 @@ padding: 9px 0;
|
||||
float:right;
|
||||
}
|
||||
|
||||
#paste-content {
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
select {
|
||||
width: 135px;
|
||||
}
|
||||
|
||||
84
static/css/vs.css
Normal file
84
static/css/vs.css
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
|
||||
Visual Studio-like style based on original C# coloring by Jason Diamond <jason@diamond.name>
|
||||
|
||||
*/
|
||||
pre code {
|
||||
display: block; padding: 0.5em;
|
||||
}
|
||||
|
||||
pre .comment,
|
||||
pre .annotation,
|
||||
pre .template_comment,
|
||||
pre .diff .header,
|
||||
pre .chunk,
|
||||
pre .apache .cbracket {
|
||||
color: rgb(0, 128, 0);
|
||||
}
|
||||
|
||||
pre .keyword,
|
||||
pre .id,
|
||||
pre .title,
|
||||
pre .built_in,
|
||||
pre .aggregate,
|
||||
pre .smalltalk .class,
|
||||
pre .winutils,
|
||||
pre .bash .variable,
|
||||
pre .tex .command {
|
||||
color: rgb(0, 0, 255);
|
||||
}
|
||||
|
||||
pre .string,
|
||||
pre .title,
|
||||
pre .parent,
|
||||
pre .tag .value,
|
||||
pre .rules .value,
|
||||
pre .rules .value .number,
|
||||
pre .ruby .symbol,
|
||||
pre .ruby .symbol .string,
|
||||
pre .ruby .symbol .keyword,
|
||||
pre .ruby .symbol .keymethods,
|
||||
pre .instancevar,
|
||||
pre .aggregate,
|
||||
pre .template_tag,
|
||||
pre .django .variable,
|
||||
pre .addition,
|
||||
pre .flow,
|
||||
pre .stream,
|
||||
pre .apache .tag,
|
||||
pre .date,
|
||||
pre .tex .formula {
|
||||
color: rgb(163, 21, 21);
|
||||
}
|
||||
|
||||
pre .ruby .string,
|
||||
pre .decorator,
|
||||
pre .filter .argument,
|
||||
pre .localvars,
|
||||
pre .array,
|
||||
pre .attr_selector,
|
||||
pre .pseudo,
|
||||
pre .pi,
|
||||
pre .doctype,
|
||||
pre .deletion,
|
||||
pre .envvar,
|
||||
pre .shebang,
|
||||
pre .preprocessor,
|
||||
pre .userType,
|
||||
pre .apache .sqbracket,
|
||||
pre .nginx .built_in,
|
||||
pre .tex .special,
|
||||
pre .input_number {
|
||||
color: rgb(43, 145, 175);
|
||||
}
|
||||
|
||||
pre .phpdoc,
|
||||
pre .javadoc,
|
||||
pre .xmlDocTag {
|
||||
color: rgb(128, 128, 128);
|
||||
}
|
||||
|
||||
pre .vhdl .type { font-weight: bold; }
|
||||
pre .vhdl .string { color: #666666; }
|
||||
pre .vhdl .literal { color: rgb(163, 21, 21); }
|
||||
|
||||
@@ -1,11 +1,52 @@
|
||||
;
|
||||
|
||||
// Start random number generator seeding ASAP
|
||||
sjcl.random.startCollectors();
|
||||
|
||||
var zerobin = {
|
||||
encrypt: function(key, content) {
|
||||
return sjcl.encrypt(key, lzw.compress(content));
|
||||
},
|
||||
decrypt: function(key, content) {
|
||||
return lzw.decompress(sjcl.decrypt(key, content));
|
||||
},
|
||||
make_key: function() {
|
||||
return sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
|
||||
}
|
||||
};
|
||||
|
||||
$(function(){
|
||||
|
||||
$('button[type=submit]').click(function(e){
|
||||
|
||||
e.preventDefault();
|
||||
var paste = $('textarea').val();
|
||||
|
||||
if (paste.trim()) {
|
||||
var expiration = $('#expiration').val();
|
||||
var key = zerobin.make_key();
|
||||
var data = {content: zerobin.encrypt(key, paste), expiration: expiration}
|
||||
|
||||
$.post('/paste/create', data)
|
||||
.error(function(error) {
|
||||
alert('Paste could not be saved. Please try again later.');
|
||||
})
|
||||
.success(function(data) {
|
||||
window.location = ('/paste/' + data['paste'] + '#' + key);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var content = $('#paste-content').text().trim();
|
||||
var key = window.location.hash.substring(1);
|
||||
if (content && key) {
|
||||
try {
|
||||
$('#paste-content').text(zerobin.decrypt(key, content));
|
||||
hljs.highlightBlock($('#paste-content')[0]);
|
||||
} catch(err) {
|
||||
alert('Could not decrypt data (Wrong key ?)');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
1
static/js/highlight.pack.js
Normal file
1
static/js/highlight.pack.js
Normal file
File diff suppressed because one or more lines are too long
4
static/js/jquery-1.7.2.min.js
vendored
Normal file
4
static/js/jquery-1.7.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
111
static/js/lzw.js
Normal file
111
static/js/lzw.js
Normal file
@@ -0,0 +1,111 @@
|
||||
// Author: Anthony McKale
|
||||
//
|
||||
// Note: modifed to javascript from orginal as2 found below
|
||||
// basically identical actual to as2
|
||||
//
|
||||
// http://www.razorberry.com/blog/archives/2004/08/22/lzw-compression-methods-in-as2/
|
||||
//
|
||||
// A class for LZW compression modified from code posted at the following URL's
|
||||
// http://www.shoe-box.org/blog/index.php/2004/05/05/13-CompressionLzw
|
||||
// http://www.lalex.com/blog/comments/200405/164-compression-lzw-actionscript-2.html
|
||||
//
|
||||
var lzw = {
|
||||
// Change this variable to output an xml safe string
|
||||
xmlsafe : false,
|
||||
compress : function(str){
|
||||
var dico = new Array();
|
||||
var skipnum = lzw.xmlsafe?5:0;
|
||||
for (var i = 0; i < 256; i++)
|
||||
{
|
||||
dico[String.fromCharCode(i)] = i;
|
||||
}
|
||||
if (lzw.xmlsafe)
|
||||
{
|
||||
dico["<"] = 256;
|
||||
dico[">"] = 257;
|
||||
dico["&"] = 258;
|
||||
dico["\""] = 259;
|
||||
dico["'"] = 260;
|
||||
}
|
||||
var res = "";
|
||||
var txt2encode = str;
|
||||
var splitStr = txt2encode.split("");
|
||||
var len = splitStr.length;
|
||||
var nbChar = 256+skipnum;
|
||||
var buffer = "";
|
||||
for (var i = 0; i <= len; i++)
|
||||
{
|
||||
var current = splitStr[i];
|
||||
if (dico[buffer + current] !== undefined)
|
||||
{
|
||||
buffer += current;
|
||||
}
|
||||
else
|
||||
{
|
||||
res += String.fromCharCode(dico[buffer]);
|
||||
dico[buffer + current] = nbChar;
|
||||
nbChar++;
|
||||
buffer = current;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
},
|
||||
decompress : function (str)
|
||||
{
|
||||
var dico = new Array();
|
||||
var skipnum = lzw.xmlsafe?5:0;
|
||||
for (var i = 0; i < 256; i++)
|
||||
{
|
||||
var c = String.fromCharCode(i);
|
||||
dico[i] = c;
|
||||
}
|
||||
if (lzw.xmlsafe)
|
||||
{
|
||||
dico[256] = "<";
|
||||
dico[257] = ">";
|
||||
dico[258] = "&";
|
||||
dico[259] = "\"";
|
||||
dico[260] = "'";
|
||||
}
|
||||
var txt2encode = str;
|
||||
var splitStr = txt2encode.split("");
|
||||
var length = splitStr.length;
|
||||
var nbChar = 256+skipnum;
|
||||
var buffer = "";
|
||||
var chaine = "";
|
||||
var result = "";
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
var code = txt2encode.charCodeAt(i);
|
||||
var current = dico[code];
|
||||
if (buffer == "")
|
||||
{
|
||||
buffer = current;
|
||||
result += current;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (code <= 255+skipnum)
|
||||
{
|
||||
result += current;
|
||||
chaine = buffer + current;
|
||||
dico[nbChar] = chaine;
|
||||
nbChar++;
|
||||
buffer = current;
|
||||
}
|
||||
else
|
||||
{
|
||||
chaine = dico[code];
|
||||
if (chaine == undefined) chaine = buffer + buffer.slice(0,1);
|
||||
result += chaine;
|
||||
dico[nbChar] = buffer + chaine.slice(0, 1);
|
||||
nbChar++;
|
||||
buffer = chaine;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user