Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions deps/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $( document ).ready(function() {
var
$showoriginal = $('.menuoption#showoriginal'),
$showmodified = $('.menuoption#showmodified'),
$showchangesonly = $('.menuoption#showchangesonly'),
$codeprintmargin = $('.menuoption#codeprintmargin'),
$highlight = $('.menuoption#highlight'),
$dosyntaxhighlight = $('.menuoption#dosyntaxhighlight');
Expand Down Expand Up @@ -46,6 +47,25 @@ $( document ).ready(function() {
}
});

$showchangesonly.state = true
$showchangesonly.on("click", function(){
switch ($showchangesonly.state) {
case true:
$('.lineno_leftnodiff').hide()
$('.lineno_rightnodiff').hide()
$('.left_nodiff').hide()
$('.right_nodiff').hide()
$showchangesonly.state = false
break;
case false:
$('.lineno_leftnodiff').show()
$('.lineno_rightnodiff').show()
$('.left_nodiff').show()
$('.right_nodiff').show()
$showchangesonly.state = true
break;
}
});

$codeprintmargin.state = true
$codeprintmargin.on("click", function(){
Expand Down
12 changes: 10 additions & 2 deletions diff2HtmlCompare.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
<input id="showmodified" class="toggle toggle-yes-no menuoption" type="checkbox" checked>
<label for="showmodified" data-on="&#10004; Modified" data-off="Modified"></label>
</div>
<div class="switch">
<input id="showchangesonly" class="toggle toggle-yes-no menuoption" type="checkbox" unchecked>
<label for="showchangesonly" data-on="&#10004; Changes Only" data-off="Changes Only"></label>
</div>
<div class="switch">
<input id="highlight" class="toggle toggle-yes-no menuoption" type="checkbox" checked>
<label for="highlight" data-on="&#10004; Highlight" data-off="Highlight"></label>
Expand Down Expand Up @@ -163,7 +167,7 @@ def getDiffLineNos(self):
elif not isinstance(left_no, int) and isinstance(right_no, int):
no = '<span class="lineno_q lineno_leftadd"> </span>'
else:
no = '<span class="lineno_q">' + str(left_no) + "</span>"
no = '<span class="lineno_q lineno_leftnodiff">' + str(left_no) + "</span>"
else:
if change:
if isinstance(left_no, int) and isinstance(right_no, int):
Expand All @@ -175,7 +179,7 @@ def getDiffLineNos(self):
no = '<span class="lineno_q lineno_rightadd">' + \
str(right_no) + "</span>"
else:
no = '<span class="lineno_q">' + str(right_no) + "</span>"
no = '<span class="lineno_q lineno_rightnodiff">' + str(right_no) + "</span>"

retlinenos.append(no)

Expand Down Expand Up @@ -204,9 +208,11 @@ def _wrap_code(self, source):
else:
if left_no <= len(source):
i, t = source[left_no - 1]
t = '<span class="left_nodiff">' + t + "</span>"
else:
i = 1
t = left_line
t = '<span class="left_nodiff">' + t + "</span>"
else:
if change:
if isinstance(left_no, int) and isinstance(right_no, int) and right_no <= len(source):
Expand All @@ -223,9 +229,11 @@ def _wrap_code(self, source):
else:
if right_no <= len(source):
i, t = source[right_no - 1]
t = '<span class="right_nodiff">' + t + "</span>"
else:
i = 1
t = right_line
t = '<span class="right_nodiff">' + t + "</span>"
yield i, t
except:
# print "WARNING! failed to enumerate diffs fully!"
Expand Down