1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

added clone option

This commit is contained in:
max 2012-04-29 00:55:00 +07:00
parent af3d088ea4
commit 685e6f6984
6 changed files with 199 additions and 33 deletions

View File

@ -42,9 +42,6 @@ body {
float:right; float:right;
} }
#paste-content {
background-color:white;
}
select { select {
width: 135px; width: 135px;
@ -63,6 +60,11 @@ ul, ol {
margin: 0; margin: 0;
} }
li {
margin-left: -4px;
}
p { p {
margin: 0 0 20px; margin: 0 0 20px;
} }
@ -85,6 +87,11 @@ p {
list-style-type: none; list-style-type: none;
} }
#paste-content {
background-color: white;
}
form textarea { form textarea {
overflow-y:auto; overflow-y:auto;
} }
@ -93,6 +100,10 @@ button.btn, input[type="submit"].btn {
margin-left: 5px; margin-left: 5px;
} }
.submit-form {
display: none;
}
.well { .well {
padding-bottom: 40px; padding-bottom: 40px;
padding-right: 17px; padding-right: 17px;
@ -142,5 +153,5 @@ li.L0, li.L1, li.L2, li.L3, li.L4,
li.L5, li.L6, li.L7, li.L8, li.L9 li.L5, li.L6, li.L7, li.L8, li.L9
{ {
list-style-type: decimal; list-style-type: decimal;
background:inherit; background: inherit;
} }

118
static/css/sunburst.css Normal file
View File

@ -0,0 +1,118 @@
/*
* Derived from einaros's Sons of Obsidian theme at
* http://studiostyl.es/schemes/son-of-obsidian by
* Alex Ford of CodeTunnel:
* http://CodeTunnel.com/blog/post/71/google-code-prettify-obsidian-theme
*/
.str
{
color: #EC7600;
}
.kwd
{
color: #93C763;
}
.com
{
color: #66747B;
}
.typ
{
color: #678CB1;
}
.lit
{
color: #FACD22;
}
.pun
{
color: #F1F2F3;
}
.pln
{
color: #F1F2F3;
}
.tag
{
color: #8AC763;
}
.atn
{
color: #E0E2E4;
}
.atv
{
color: #EC7600;
}
.dec
{
color: purple;
}
pre.prettyprint
{
border: 0px solid #888;
}
ol.linenums
{
margin-top: 0;
margin-bottom: 0;
}
.prettyprint {
background: #000;
}
li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9
{
color: #555;
list-style-type: decimal;
}
li.L1, li.L3, li.L5, li.L7, li.L9 {
background: #111;
}
@media print
{
.str
{
color: #060;
}
.kwd
{
color: #006;
font-weight: bold;
}
.com
{
color: #600;
font-style: italic;
}
.typ
{
color: #404;
font-weight: bold;
}
.lit
{
color: #044;
}
.pun
{
color: #440;
}
.pln
{
color: #000;
}
.tag
{
color: #006;
font-weight: bold;
}
.atn
{
color: #404;
}
.atv
{
color: #060;
}
}

View File

@ -65,10 +65,12 @@ zerobin = {
{ {
if (localStorage.getItem(i).split(';')[0].split(' ')[0] == zerobin.get_date()){ if (localStorage.getItem(i).split(';')[0].split(' ')[0] == zerobin.get_date()){
var display_date = localStorage.getItem(i).split(';')[0].split(' ')[1]; var display_date = localStorage.getItem(i).split(';')[0].split(' ')[1];
var on_at = 'at ';
}else{ }else{
var display_date = zerobin.get_date(); var display_date = zerobin.get_date();
var on_at = 'on ';
} }
pastes = pastes + '<li><a class="items" href="' + localStorage.getItem(i).split(';')[1] + '">' + display_date + '</a></li>'; pastes = pastes + '<li><a class="items" href="' + localStorage.getItem(i).split(';')[1] + '">' + on_at + display_date + '</a></li>';
} }
if (!pastes){ 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 '<i class="grey">Your previous pastes will be saved in your browser <a href="http://www.w3.org/TR/webstorage/">localStorage</a>.</i>';
@ -150,6 +152,21 @@ $('#content').live('keyup change', function(){
$('.previous-pastes .items').html(zerobin.get_pastes()); $('.previous-pastes .items').html(zerobin.get_pastes());
/* clone a paste */
$('.btn-clone').click(function(e){
e.preventDefault();
content_clone = '' ;
$("#paste-content li").each(function(index) {
content_clone = content_clone + $(this).text() + '\n';
});
$('.submit-form').show();
$('.paste-form').hide();
$('#content').val(content_clone);
$('#content').resize();
});
}); });

View File

@ -1,5 +1,4 @@
<form class="well" method="post" action="/paste/create"> <form class="well" method="post" action="/paste/create">
<p class="paste-option"> <p class="paste-option">
<label for="expiration" >Expiration:</label> <label for="expiration" >Expiration:</label>
<select id="expiration" name="expiration"> <select id="expiration" name="expiration">
@ -10,14 +9,12 @@
</select> </select>
<button type="submit" class="btn btn-primary">Submit</button> <button type="submit" class="btn btn-primary">Submit</button>
<p> <p>
<p> <p>
<textarea rows="10" style="width:100%;" <textarea rows="10" style="width:100%;"
class="input-xlarge" class="input-xlarge"
id="content" name="content"></textarea> id="content" name="content"></textarea>
</p> </p>
</form> </form>
%rebase base %rebase base

View File

@ -13,29 +13,52 @@
%end %end
%end %end
<div class="well"> <div class="well paste-form">
<form action="/" method="get" accept-charset="utf-8"> <form action="/" method="get" accept-charset="utf-8">
<p> <p>
<a href="#">Download</a> <a href="#">Download</a>
<span class="paste-option btn-group top"> <span class="paste-option btn-group top">
<button class="btn"><i class="icon-camera"></i>&nbsp;Clone</button> <button class="btn btn-clone"><i class="icon-camera"></i>&nbsp;Clone</button>
<button class="btn">New Paste</button> <button class="btn">New Paste</button>
</span> </span>
</p> </p>
<p> <p>
<pre id="paste-content" class="prettyprint linenums"> <pre id="paste-content" class="prettyprint linenums">
<code> <code>
{{ paste.content }} {{ paste.content }}
</code> </code>
</pre> </pre>
</p> </p>
<p class="paste-option btn-group bottom"> <p class="paste-option btn-group bottom">
<button class="btn"><i class="icon-camera"></i>&nbsp;Clone</button> <button class="btn btn-clone"><i class="icon-camera"></i>&nbsp;Clone</button>
<button class="btn">New Paste</button> <button class="btn">New Paste</button>
</p> </p>
</form> </form>
</div> </div>
<!-- For cloning -->
<span class="submit-form">
<form class="well" method="post" action="/paste/create">
<p class="paste-option">
<label for="expiration" >Expiration:</label>
<select id="expiration" name="expiration">
<option value="burn_after_reading">Burn after reading</option>
<option selected value="1_day">1 day</option>
<option value="1_month">1 month</option>
<option value="never">Never</option>
</select>
<button type="submit" class="btn btn-primary">Submit</button>
<p>
<p>
<textarea rows="10" style="width:100%;"
class="input-xlarge"
id="content" name="content"></textarea>
</p>
</form>
</span>
%rebase base %rebase base