diff --git a/dpaste/static/dpaste/theme.css b/dpaste/static/dpaste/theme.css index 773b3f2..fb9fbbc 100644 --- a/dpaste/static/dpaste/theme.css +++ b/dpaste/static/dpaste/theme.css @@ -155,8 +155,8 @@ ol.linenums li.marked { /* ---------------------------------------------------------------------------- Pygments ---------------------------------------------------------------------------- */ -pre .gd { background-color: #d68c83; display: block; } -pre .gi { background-color: #a7cb7d; display: block; } +pre .gd { background-color: rgba(226, 12, 19, .5); display: block; } +pre .gi { background-color: rgba(23, 189, 10, .5); display: block; } pre .hll { background-color: #49483e } diff --git a/dpaste/templates/dpaste/snippet_details.html b/dpaste/templates/dpaste/snippet_details.html index 5433647..0001000 100644 --- a/dpaste/templates/dpaste/snippet_details.html +++ b/dpaste/templates/dpaste/snippet_details.html @@ -83,26 +83,44 @@ $(document).ready(function(){ $(this).removeClass('snippet-reply-hidden'); }); - + /** + * Diff Ajax Call + */ $('.snippet-diff-trigger').click(function(e){ e.preventDefault(); $('#snippet-diff').slideDown('fast'); $('#snippet-diff form').submit(); }); - /** - * Diff Ajax Call - */ + $("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" %}", { - a: $("input[name=a]:checked").val(), - b: $("input[name=b]:checked").val() + a: a, + b: b }, function(data){ $('#diff').html(data).slideDown('fast'); }); + window.location.hash = hash; return false; }); + var curLine = document.location.hash, + hashlist; + + if(curLine.substring(0,2) == '#D'){ + hashlist = curLine.substring(2).split(','); + 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); + $('#snippet-diff').slideDown('fast'); + $('#snippet-diff form').submit(); + } + } + /** * Line Highlighting */