mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Merge pull request #17 from Krinkle/cleanup
Merge Krinkle's cleanup branch
This commit is contained in:
commit
9df90ad73c
7 changed files with 73 additions and 59 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
|
*.pyc
|
||||||
dpaste/settings_local.py
|
dpaste/settings_local.py
|
||||||
dpaste.egg-info
|
dpaste.egg-info
|
||||||
|
|
|
@ -5,7 +5,7 @@ dpaste
|
||||||
dpaste is a Django based pastebin. It's intended to run separatly or installed
|
dpaste is a Django based pastebin. It's intended to run separatly or installed
|
||||||
into an existing Django project.
|
into an existing Django project.
|
||||||
|
|
||||||
You can find a live example on http://www.dpaste.de/
|
You can find a live example on http://dpaste.de/
|
||||||
|
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
|
|
|
@ -47,16 +47,16 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="clearfix"/>
|
<div class="clearfix"></div>
|
||||||
<hr class="clearfix"/>
|
<hr class="clearfix">
|
||||||
|
|
||||||
<h3>Imprint</h3>
|
<h3>Imprint</h3>
|
||||||
|
|
||||||
<p><strong>Address:</strong></p>
|
<p><strong>Address:</strong></p>
|
||||||
<p>
|
<p>
|
||||||
Martin Mahner<br/>
|
Martin Mahner<br>
|
||||||
Lauterbacher Str. 4<br/>
|
Lauterbacher Str. 4<br>
|
||||||
DE-18581 Putbus<br/>
|
DE-18581 Putbus<br>
|
||||||
Germany
|
Germany
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>dpaste.de: {% block title %}{% trans "New snippet" %}{% endblock %}</title>
|
<title>dpaste.de: {% block title %}{% trans "New snippet" %}{% endblock %}</title>
|
||||||
<link href="{% static "dpaste/bootstrap/css/bootstrap.min.css" %}" rel="stylesheet" media="screen">
|
<link rel="stylesheet" href="{% static "dpaste/bootstrap/css/bootstrap.min.css" %}">
|
||||||
<link href="{% static "dpaste/theme.css" %}" rel="stylesheet" media="screen">
|
<link rel="stylesheet" href="{% static "dpaste/theme.css" %}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
{% block extrahead %}{% endblock %}
|
{% block extrahead %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
@ -28,20 +28,28 @@
|
||||||
|
|
||||||
|
|
||||||
{% block script_footer %}
|
{% block script_footer %}
|
||||||
<script src="http://code.jquery.com/jquery.js"></script>
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
|
||||||
<script src="{% static "dpaste/bootstrap/js/bootstrap.min.js" %}"></script>
|
<script src="{% static "dpaste/bootstrap/js/bootstrap.min.js" %}"></script>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(document).ready(function(){
|
jQuery(function($) {
|
||||||
|
var lexerReq;
|
||||||
$('#guess_lexer_btn').click(function() {
|
$('#guess_lexer_btn').click(function() {
|
||||||
$.getJSON('{% url "snippet_guess_lexer" %}',
|
// Cancel previous request if it is still pending
|
||||||
{'codestring': $('#id_content').val()},
|
if (lexerReq) {
|
||||||
function(data){
|
lexerReq.abort();
|
||||||
if(data.lexer == "unknown"){
|
}
|
||||||
|
|
||||||
|
lexerReq = $.getJSON('{% url "snippet_guess_lexer" %}', {
|
||||||
|
codestring: $('#id_content').val()
|
||||||
|
}).done(function(data) {
|
||||||
|
if (data.lexer === 'unknown') {
|
||||||
$('#guess_lexer_btn').css('color', 'red');
|
$('#guess_lexer_btn').css('color', 'red');
|
||||||
} else {
|
} else {
|
||||||
$('#id_lexer').val(data.lexer);
|
$('#id_lexer').val(data.lexer);
|
||||||
$('#guess_lexer_btn').css('color', 'inherit');
|
$('#guess_lexer_btn').css('color', 'inherit');
|
||||||
}
|
}
|
||||||
|
}).complete(function() {
|
||||||
|
lexerReq = null;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
{% if structure.new_level %}<ul><li>{% else %}</li><li>{% endif %}
|
{% if structure.new_level %}<ul><li>{% else %}</li><li>{% endif %}
|
||||||
<div>
|
<div>
|
||||||
<span class="diff">
|
<span class="diff">
|
||||||
<input type="radio" name="a" value="{{ tree_item.id }}" {% ifequal tree_item.id snippet.parent_id %}checked="checked"{% endifequal %}/>
|
<input type="radio" name="a" value="{{ tree_item.id }}" {% ifequal tree_item.id snippet.parent_id %}checked="checked"{% endifequal %}>
|
||||||
<input type="radio" name="b" value="{{ tree_item.id }}" {% ifequal snippet tree_item %}checked="checked"{% endifequal %}/>
|
<input type="radio" name="b" value="{{ tree_item.id }}" {% ifequal snippet tree_item %}checked="checked"{% endifequal %}>
|
||||||
</span>
|
</span>
|
||||||
{% ifequal snippet tree_item %}
|
{% ifequal snippet tree_item %}
|
||||||
<strong>#{{ tree_item.id }}</strong>
|
<strong>#{{ tree_item.id }}</strong>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
{% for level in structure.closed_levels %}</li></ul>{% endfor %}
|
{% for level in structure.closed_levels %}</li></ul>{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="submit">
|
<div class="submit">
|
||||||
<input type="submit" value="{% trans "Compare" %}"/>
|
<input type="submit" value="{% trans "Compare" %}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
<!-- ======================================================================
|
<!-- ======================================================================
|
||||||
Snippet Reply
|
Snippet Reply
|
||||||
======================================================================= -->
|
======================================================================= -->
|
||||||
<hr/>
|
<hr>
|
||||||
|
|
||||||
<div class="snippet-reply snippet-reply-hidden">
|
<div class="snippet-reply snippet-reply-hidden">
|
||||||
<h3>{% trans "Reply to this snippet" %} →</h3>
|
<h3>{% trans "Reply to this snippet" %} →</h3>
|
||||||
|
@ -77,8 +77,10 @@
|
||||||
|
|
||||||
{% block script_footer %}
|
{% block script_footer %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(document).ready(function(){
|
jQuery(function($) {
|
||||||
|
var diffReq;
|
||||||
|
|
||||||
$('.snippet-reply-hidden').click(function(e) {
|
$('.snippet-reply-hidden').click(function(e) {
|
||||||
$(this).removeClass('snippet-reply-hidden');
|
$(this).removeClass('snippet-reply-hidden');
|
||||||
});
|
});
|
||||||
|
@ -93,29 +95,38 @@ $(document).ready(function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("form#diffform").submit(function() {
|
$('#diffform').submit(function() {
|
||||||
var a = $("input[name=a]:checked").val(),
|
var a = $('input[name="a"]:checked').val(),
|
||||||
b = $("input[name=b]:checked").val(),
|
b = $('input[name="b"]:checked').val();
|
||||||
hash = 'D'+a+','+b;
|
|
||||||
$.get("{% url "snippet_diff" %}", {
|
window.location.hash = 'D' + a + ',' + b;
|
||||||
|
|
||||||
|
// Cancel previous request if it is still pending
|
||||||
|
if (diffReq) {
|
||||||
|
diffReq.abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
diffReq = $.get("{% url "snippet_diff" %}", {
|
||||||
a: a,
|
a: a,
|
||||||
b: b
|
b: b
|
||||||
}, function(data){
|
}).done(function(data) {
|
||||||
$('#diff').html(data).slideDown('fast');
|
$('#diff').html(data).slideDown('fast');
|
||||||
|
}).complete(function() {
|
||||||
|
diffReq = null;
|
||||||
});
|
});
|
||||||
window.location.hash = hash;
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
var curLine = document.location.hash,
|
var curLine = document.location.hash,
|
||||||
hashlist;
|
hashlist;
|
||||||
|
|
||||||
if(curLine.substring(0,2) == '#D'){
|
if (curLine.substring(0, 2) === '#D') {
|
||||||
hashlist = curLine.substring(2).split(',');
|
hashlist = curLine.substring(2).split(',');
|
||||||
if (hashlist.length == 2) {
|
if (hashlist.length === 2) {
|
||||||
console.log(hashlist);
|
console.log(hashlist);
|
||||||
$('form#diffform input[name=a][value='+hashlist[0]+']').attr('checked', true);
|
$('#diffform input[name="a"][value="' + hashlist[0] + '"]').prop('checked', true);
|
||||||
$('form#diffform input[name=b][value='+hashlist[1]+']').attr('checked', true);
|
$('#diffform input[name="b"][value="' + hashlist[1] + '"]').prop('checked', true);
|
||||||
$('#snippet-diff').slideDown('fast');
|
$('#snippet-diff').slideDown('fast');
|
||||||
$('#snippet-diff form').submit();
|
$('#snippet-diff form').submit();
|
||||||
}
|
}
|
||||||
|
@ -124,12 +135,10 @@ $(document).ready(function(){
|
||||||
/**
|
/**
|
||||||
* Line Highlighting
|
* Line Highlighting
|
||||||
*/
|
*/
|
||||||
var curLine = document.location.hash,
|
|
||||||
hashlist;
|
|
||||||
|
|
||||||
if(curLine.substring(0,2) == '#L'){
|
if (curLine.substring(0, 2) === '#L') {
|
||||||
hashlist = curLine.substring(2).split(',');
|
hashlist = curLine.substring(2).split(',');
|
||||||
if (hashlist.length > 0 && hashlist[0] !== "") {
|
if (hashlist.length > 0 && hashlist[0] !== '') {
|
||||||
$.each(hashlist, function(index, elem){
|
$.each(hashlist, function(index, elem){
|
||||||
$('.linenums li#' + elem).addClass('marked');
|
$('.linenums li#' + elem).addClass('marked');
|
||||||
});
|
});
|
||||||
|
@ -140,14 +149,10 @@ $(document).ready(function(){
|
||||||
var line = $(this),
|
var line = $(this),
|
||||||
hash = 'L';
|
hash = 'L';
|
||||||
|
|
||||||
if (line.hasClass('marked')) {
|
line.toggleClass('marked');
|
||||||
line.removeClass('marked');
|
|
||||||
} else {
|
|
||||||
line.addClass('marked');
|
|
||||||
}
|
|
||||||
|
|
||||||
$('.linenums li.marked').each(function (index, elem) {
|
$('.linenums li.marked').each(function (index, elem) {
|
||||||
if (hash !== "L") hash += ',';
|
if (hash !== 'L') hash += ',';
|
||||||
hash += $(elem).attr('id');
|
hash += $(elem).attr('id');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,6 @@
|
||||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input tabindex="0" type="submit"class="btn btn-primary" value="{% trans "Paste it" %}"/>
|
<input tabindex="0" type="submit"class="btn btn-primary" value="{% trans "Paste it" %}">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
{% include "dpaste/snippet_pre.html" %}
|
{% include "dpaste/snippet_pre.html" %}
|
||||||
{% if not forloop.last %}<hr/>{% endif %}
|
{% if not forloop.last %}<hr>{% endif %}
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<p>{% trans "No snippets saved. Either all your snippets are expired or your cookie has changed." %}</p>
|
<p>{% trans "No snippets saved. Either all your snippets are expired or your cookie has changed." %}</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue