mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 08:02:54 +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.egg-info
|
||||
|
|
|
@ -5,7 +5,7 @@ dpaste
|
|||
dpaste is a Django based pastebin. It's intended to run separatly or installed
|
||||
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
|
||||
|
|
|
@ -47,16 +47,16 @@
|
|||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<div class="clearfix"/>
|
||||
<hr class="clearfix"/>
|
||||
<div class="clearfix"></div>
|
||||
<hr class="clearfix">
|
||||
|
||||
<h3>Imprint</h3>
|
||||
|
||||
<p><strong>Address:</strong></p>
|
||||
<p>
|
||||
Martin Mahner<br/>
|
||||
Lauterbacher Str. 4<br/>
|
||||
DE-18581 Putbus<br/>
|
||||
Martin Mahner<br>
|
||||
Lauterbacher Str. 4<br>
|
||||
DE-18581 Putbus<br>
|
||||
Germany
|
||||
</p>
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>dpaste.de: {% block title %}{% trans "New snippet" %}{% endblock %}</title>
|
||||
<link href="{% static "dpaste/bootstrap/css/bootstrap.min.css" %}" rel="stylesheet" media="screen">
|
||||
<link href="{% static "dpaste/theme.css" %}" rel="stylesheet" media="screen">
|
||||
<link rel="stylesheet" href="{% static "dpaste/bootstrap/css/bootstrap.min.css" %}">
|
||||
<link rel="stylesheet" href="{% static "dpaste/theme.css" %}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
{% block extrahead %}{% endblock %}
|
||||
</head>
|
||||
|
@ -28,20 +28,28 @@
|
|||
|
||||
|
||||
{% 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 type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#guess_lexer_btn').click(function(){
|
||||
$.getJSON('{% url "snippet_guess_lexer" %}',
|
||||
{'codestring': $('#id_content').val()},
|
||||
function(data){
|
||||
if(data.lexer == "unknown"){
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
var lexerReq;
|
||||
$('#guess_lexer_btn').click(function() {
|
||||
// Cancel previous request if it is still pending
|
||||
if (lexerReq) {
|
||||
lexerReq.abort();
|
||||
}
|
||||
|
||||
lexerReq = $.getJSON('{% url "snippet_guess_lexer" %}', {
|
||||
codestring: $('#id_content').val()
|
||||
}).done(function(data) {
|
||||
if (data.lexer === 'unknown') {
|
||||
$('#guess_lexer_btn').css('color', 'red');
|
||||
}else{
|
||||
} else {
|
||||
$('#id_lexer').val(data.lexer);
|
||||
$('#guess_lexer_btn').css('color', 'inherit');
|
||||
}
|
||||
}).complete(function() {
|
||||
lexerReq = null;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
{% if structure.new_level %}<ul><li>{% else %}</li><li>{% endif %}
|
||||
<div>
|
||||
<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="b" value="{{ tree_item.id }}" {% ifequal snippet tree_item %}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 %}>
|
||||
</span>
|
||||
{% ifequal snippet tree_item %}
|
||||
<strong>#{{ tree_item.id }}</strong>
|
||||
|
@ -36,7 +36,7 @@
|
|||
{% for level in structure.closed_levels %}</li></ul>{% endfor %}
|
||||
{% endfor %}
|
||||
<div class="submit">
|
||||
<input type="submit" value="{% trans "Compare" %}"/>
|
||||
<input type="submit" value="{% trans "Compare" %}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -66,7 +66,7 @@
|
|||
<!-- ======================================================================
|
||||
Snippet Reply
|
||||
======================================================================= -->
|
||||
<hr/>
|
||||
<hr>
|
||||
|
||||
<div class="snippet-reply snippet-reply-hidden">
|
||||
<h3>{% trans "Reply to this snippet" %} →</h3>
|
||||
|
@ -77,45 +77,56 @@
|
|||
|
||||
{% block script_footer %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.snippet-reply-hidden').click(function(e){
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
var diffReq;
|
||||
|
||||
$('.snippet-reply-hidden').click(function(e) {
|
||||
$(this).removeClass('snippet-reply-hidden');
|
||||
});
|
||||
|
||||
/**
|
||||
* Diff Ajax Call
|
||||
*/
|
||||
$('.snippet-diff-trigger').click(function(e){
|
||||
$('.snippet-diff-trigger').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#snippet-diff').slideDown('fast');
|
||||
$('#snippet-diff form').submit();
|
||||
});
|
||||
|
||||
|
||||
$("form#diffform").submit(function() {
|
||||
var a = $("input[name=a]:checked").val(),
|
||||
b = $("input[name=b]:checked").val(),
|
||||
hash = 'D'+a+','+b;
|
||||
$.get("{% url "snippet_diff" %}", {
|
||||
$('#diffform').submit(function() {
|
||||
var a = $('input[name="a"]:checked').val(),
|
||||
b = $('input[name="b"]:checked').val();
|
||||
|
||||
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,
|
||||
b: b
|
||||
}, function(data){
|
||||
}).done(function(data) {
|
||||
$('#diff').html(data).slideDown('fast');
|
||||
}).complete(function() {
|
||||
diffReq = null;
|
||||
});
|
||||
window.location.hash = hash;
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
var curLine = document.location.hash,
|
||||
hashlist;
|
||||
|
||||
if(curLine.substring(0,2) == '#D'){
|
||||
if (curLine.substring(0, 2) === '#D') {
|
||||
hashlist = curLine.substring(2).split(',');
|
||||
if (hashlist.length == 2) {
|
||||
if (hashlist.length === 2) {
|
||||
console.log(hashlist);
|
||||
$('form#diffform input[name=a][value='+hashlist[0]+']').attr('checked', true);
|
||||
$('form#diffform input[name=b][value='+hashlist[1]+']').attr('checked', true);
|
||||
$('#diffform input[name="a"][value="' + hashlist[0] + '"]').prop('checked', true);
|
||||
$('#diffform input[name="b"][value="' + hashlist[1] + '"]').prop('checked', true);
|
||||
$('#snippet-diff').slideDown('fast');
|
||||
$('#snippet-diff form').submit();
|
||||
}
|
||||
|
@ -124,30 +135,24 @@ $(document).ready(function(){
|
|||
/**
|
||||
* 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(',');
|
||||
if (hashlist.length > 0 && hashlist[0] !== "") {
|
||||
if (hashlist.length > 0 && hashlist[0] !== '') {
|
||||
$.each(hashlist, function(index, elem){
|
||||
$('.linenums li#' + elem).addClass('marked');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('.linenums li').click(function(e){
|
||||
$('.linenums li').click(function(e) {
|
||||
var line = $(this),
|
||||
hash = 'L';
|
||||
|
||||
if (line.hasClass('marked')) {
|
||||
line.removeClass('marked');
|
||||
} else {
|
||||
line.addClass('marked');
|
||||
}
|
||||
line.toggleClass('marked');
|
||||
|
||||
$('.linenums li.marked').each(function (index, elem) {
|
||||
if (hash !== "L") hash += ',';
|
||||
if (hash !== 'L') hash += ',';
|
||||
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>
|
||||
</div>
|
||||
{% 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>
|
||||
</form>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</a>
|
||||
</h4>
|
||||
{% include "dpaste/snippet_pre.html" %}
|
||||
{% if not forloop.last %}<hr/>{% endif %}
|
||||
{% if not forloop.last %}<hr>{% endif %}
|
||||
{% empty %}
|
||||
<p>{% trans "No snippets saved. Either all your snippets are expired or your cookie has changed." %}</p>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in a new issue