mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Adding paste history
This commit is contained in:
commit
37e444017e
@ -11,27 +11,27 @@ text-shadow: 0 1px 0 rgba(255, 255, 255, .1), 0 0 30px rgba(255, 255, 255, .125)
|
|||||||
transition: all .2s linear;
|
transition: all .2s linear;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand span {
|
.brand span {
|
||||||
font-size: 48px;
|
font-size: 48px;
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
.brand em {
|
|
||||||
display: inline;
|
|
||||||
color: #D40202;
|
|
||||||
margin: 0px !important;
|
|
||||||
font-size: 27px;
|
|
||||||
|
|
||||||
|
.brand em {
|
||||||
|
display: inline;
|
||||||
|
color: #D40202;
|
||||||
|
margin: 0px !important;
|
||||||
|
font-size: 27px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* body & other stuff */
|
/* body & other stuff */
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding-top: 60px;
|
padding-top: 60px;
|
||||||
padding-bottom: 40px;
|
padding-bottom: 40px;
|
||||||
}
|
}
|
||||||
.sidebar-nav {
|
.sidebar-nav {
|
||||||
padding: 9px 0;
|
padding: 9px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-group {
|
.btn-group {
|
||||||
@ -43,7 +43,7 @@ padding: 9px 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#paste-content {
|
#paste-content {
|
||||||
background-color:white;
|
background-color:white;
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
@ -51,29 +51,38 @@ select {
|
|||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
|
display: inline;
|
||||||
display: inline;
|
margin-left: 18px;
|
||||||
margin-left: 18px;
|
font-style: italic;
|
||||||
font-style: italic;
|
font-size: 11px;
|
||||||
font-size: 11px;
|
color: #888;
|
||||||
color: #888;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul, ol {
|
ul, ol {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin: 0 0 20px;
|
margin: 0 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grey {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-list {
|
||||||
|
padding-right: 0px !important;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.form-options li{
|
.form-options li{
|
||||||
|
float: left;
|
||||||
float: left;
|
list-style-type: none;
|
||||||
list-style-type: none;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
form textarea {
|
form textarea {
|
||||||
@ -106,19 +115,20 @@ form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
position:relative;
|
position:relative;
|
||||||
top:-4px;
|
top:-4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
padding:1em 20px !important;
|
padding:1em 20px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.linenums {
|
.linenums {
|
||||||
padding-left: 35px;
|
padding-left: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ol.linenums li {
|
ol.linenums li {
|
||||||
line-height:14px;
|
line-height:14px;
|
||||||
}
|
}
|
||||||
@ -126,7 +136,6 @@ ol.linenums li {
|
|||||||
ol.linenums span:first-child {
|
ol.linenums span:first-child {
|
||||||
border-left: solid 1px #999;
|
border-left: solid 1px #999;
|
||||||
padding-left:1em;
|
padding-left:1em;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
li.L0, li.L1, li.L2, li.L3, li.L4,
|
li.L0, li.L1, li.L2, li.L3, li.L4,
|
||||||
|
@ -14,6 +14,57 @@ zerobin = {
|
|||||||
},
|
},
|
||||||
make_key: function() {
|
make_key: function() {
|
||||||
return sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
|
return sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
|
||||||
|
},
|
||||||
|
get_date: function(){
|
||||||
|
var date = new Date();
|
||||||
|
return date.getDate()+"-"+(date.getMonth()+1)+"-"+date.getFullYear();
|
||||||
|
},
|
||||||
|
get_time: function(){
|
||||||
|
var date = new Date();
|
||||||
|
var h=date.getHours();
|
||||||
|
var m=date.getMinutes();
|
||||||
|
var s=date.getSeconds();
|
||||||
|
if (h<10) {h = "0" + h}
|
||||||
|
if (m<10) {m = "0" + m}
|
||||||
|
if (s<10) {s = "0" + s}
|
||||||
|
return h+":"+m+":"+s;
|
||||||
|
},
|
||||||
|
support_localstorage: function(){
|
||||||
|
if (localStorage){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
store_paste: function(url){
|
||||||
|
if (zerobin.support_localstorage){
|
||||||
|
var date = new Date();
|
||||||
|
var paste = zerobin.get_date()+" "+zerobin.get_time()+";"+url;
|
||||||
|
if (localStorage.length > 19)
|
||||||
|
void removeItem(0);
|
||||||
|
localStorage.setItem(localStorage.length, paste);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
get_pastes: function(){
|
||||||
|
if (zerobin.support_localstorage){
|
||||||
|
var pastes = '';
|
||||||
|
|
||||||
|
for (i=localStorage.length-1; i>=0; i--)
|
||||||
|
{
|
||||||
|
if (localStorage.getItem(i).split(';')[0].split(' ')[0] == zerobin.get_date()){
|
||||||
|
var display_date = localStorage.getItem(i).split(';')[0].split(' ')[1];
|
||||||
|
}else{
|
||||||
|
var display_date = zerobin.get_date();
|
||||||
|
}
|
||||||
|
pastes = pastes + '<li><a class="items" href="' + localStorage.getItem(i).split(';')[1] + '">' + display_date + '</a></li>';
|
||||||
|
}
|
||||||
|
if (!pastes){
|
||||||
|
return '<i class="grey">Your previous pastes will be saved in your browser <a href="http://www.w3.org/TR/webstorage/">localStorage</a>.</i>';
|
||||||
|
}
|
||||||
|
return pastes;
|
||||||
|
}else{
|
||||||
|
return 'Sorry your browser does not support LocalStorage, We cannot display your previous pastes.';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -41,7 +92,9 @@ $('button[type=submit]').live("click", function(e){
|
|||||||
alert('Paste could not be saved. Please try again later.');
|
alert('Paste could not be saved. Please try again later.');
|
||||||
})
|
})
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
window.location = ('/paste/' + data['paste'] + '#' + key);
|
var paste_url = '/paste/' + data['paste'] + '#' + key;
|
||||||
|
window.location = (paste_url);
|
||||||
|
zerobin.store_paste(paste_url);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +159,7 @@ $('#content').live('keyup change', function(){
|
|||||||
if ($('.paste-option').length == 1) {
|
if ($('.paste-option').length == 1) {
|
||||||
$('.paste-option').clone().addClass('down').appendTo('form.well');
|
$('.paste-option').clone().addClass('down').appendTo('form.well');
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
@ -52,10 +52,9 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span2">
|
<div class="span2">
|
||||||
<div class="well sidebar-nav">
|
<div class="well sidebar-nav">
|
||||||
<ul class="nav nav-list">
|
<ul class="nav nav-list previous-pastes">
|
||||||
<li class="nav-header">Previous pastes</li>
|
<li class="nav-header">Previous pastes</li>
|
||||||
<li><a href="#">paste 1</a></li>
|
<li class="items"></li>
|
||||||
<li><a href="#">Paste 2</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div><!--/.well -->
|
</div><!--/.well -->
|
||||||
</div><!--/span-->
|
</div><!--/span-->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user