Release version 2.0.12

This commit is contained in:
Rodrigo Fernandes 2017-01-15 19:15:20 +00:00
parent 523f2109fc
commit 21c4e720e1
7 changed files with 44 additions and 28 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "diff2html", "name": "diff2html",
"version": "2.0.11", "version": "2.0.12",
"homepage": "https://diff2html.xyz", "homepage": "https://diff2html.xyz",
"description": "Fast Diff to colorized HTML", "description": "Fast Diff to colorized HTML",
"keywords": [ "keywords": [

31
dist/diff2html-ui.js vendored
View file

@ -37,18 +37,19 @@
var $target = this._getTarget(targetId); var $target = this._getTarget(targetId);
$target.html(Diff2Html.getPrettyHtml(diffJson, cfg)); $target.html(Diff2Html.getPrettyHtml(diffJson, cfg));
synchronisedScroll($target, cfg); if (cfg.synchronisedScroll) {
this.synchronisedScroll($target, cfg);
}
}; };
function synchronisedScroll($target, config) { Diff2HtmlUI.prototype.synchronisedScroll = function(targetId) {
if (config.synchronisedScroll) { var $target = this._getTarget(targetId);
$target.find('.d2h-file-side-diff').scroll(function() { $target.find('.d2h-file-side-diff').scroll(function() {
var $this = $(this); var $this = $(this);
$this.closest('.d2h-file-wrapper').find('.d2h-file-side-diff') $this.closest('.d2h-file-wrapper').find('.d2h-file-side-diff')
.scrollLeft($this.scrollLeft()); .scrollLeft($this.scrollLeft());
}); });
} };
}
Diff2HtmlUI.prototype.fileListCloseable = function(targetId, startVisible) { Diff2HtmlUI.prototype.fileListCloseable = function(targetId, startVisible) {
var $target = this._getTarget(targetId); var $target = this._getTarget(targetId);
@ -237,6 +238,10 @@
* Will be removed when this part of the API is exposed * Will be removed when this part of the API is exposed
*/ */
/* Utility vars */
var ArrayProto = [];
/* Utility functions */ /* Utility functions */
function escape(value) { function escape(value) {
@ -309,11 +314,11 @@
} }
function open(node) { function open(node) {
function attrStr(a) { function attr_str(a) {
return ' ' + a.nodeName + '="' + escape(a.value) + '"'; return ' ' + a.nodeName + '="' + escape(a.value) + '"';
} }
result += '<' + tag(node) + Array.prototype.map.call(node.attributes, attrStr).join('') + '>'; result += '<' + tag(node) + ArrayProto.map.call(node.attributes, attr_str).join('') + '>';
} }
function close(node) { function close(node) {
@ -326,7 +331,7 @@
while (original.length || highlighted.length) { while (original.length || highlighted.length) {
var stream = selectStream(); var stream = selectStream();
result += escape(value.substr(processed, stream[0].offset - processed)); result += escape(value.substring(processed, stream[0].offset));
processed = stream[0].offset; processed = stream[0].offset;
if (stream === original) { if (stream === original) {
/* /*

File diff suppressed because one or more lines are too long

22
dist/diff2html.js vendored
View file

@ -396,15 +396,24 @@ jsonDiff.useLongestToken = true;
jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff. /*istanbul ignore end*/tokenize; jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff. /*istanbul ignore end*/tokenize;
jsonDiff.castInput = function (value) { jsonDiff.castInput = function (value) {
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), undefined, ' '); /*istanbul ignore start*/var /*istanbul ignore end*/undefinedReplacement = this.options.undefinedReplacement;
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), function (k, v) {
if (typeof v === 'undefined') {
return undefinedReplacement;
}
return v;
}, ' ');
}; };
jsonDiff.equals = function (left, right) { jsonDiff.equals = function (left, right) {
return (/*istanbul ignore start*/_base2['default']. /*istanbul ignore end*/prototype.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')) return (/*istanbul ignore start*/_base2['default']. /*istanbul ignore end*/prototype.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
); );
}; };
function diffJson(oldObj, newObj, callback) { function diffJson(oldObj, newObj, options) {
return jsonDiff.diff(oldObj, newObj, callback); return jsonDiff.diff(oldObj, newObj, options);
} }
// This function handles the presence of circular references by bailing out when encountering an // This function handles the presence of circular references by bailing out when encountering an
@ -885,10 +894,13 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
/*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
if (!options) { if (!options) {
options = { context: 4 }; options = {};
}
if (typeof options.context === 'undefined') {
options.context = 4;
} }
var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr); var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
function contextLines(lines) { function contextLines(lines) {

File diff suppressed because one or more lines are too long

View file

@ -33,7 +33,7 @@
<!-- Custom styles for this template --> <!-- Custom styles for this template -->
<link href="main.min.css" rel="stylesheet"> <link href="main.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/github.min.css"> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css">
<!-- diff2html --> <!-- diff2html -->
<link rel="stylesheet" type="text/css" href="assets/diff2html.min.css"> <link rel="stylesheet" type="text/css" href="assets/diff2html.min.css">
@ -240,8 +240,8 @@
} }
</script> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/languages/scala.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/languages/scala.min.js"></script>
<!-- diff2html --> <!-- diff2html -->
<script type="text/javascript" src="assets/diff2html.min.js"></script> <script type="text/javascript" src="assets/diff2html.min.js"></script>

View file

@ -1,6 +1,6 @@
{ {
"name": "diff2html", "name": "diff2html",
"version": "2.0.11", "version": "2.0.12",
"homepage": "https://diff2html.xyz", "homepage": "https://diff2html.xyz",
"description": "Fast Diff to colorized HTML", "description": "Fast Diff to colorized HTML",
"keywords": [ "keywords": [