Skip to content

Commit 0f38cde

Browse files
committed
Release version 2.0.0-rc.9
1 parent 9bbc87a commit 0f38cde

File tree

6 files changed

+1613
-1651
lines changed

6 files changed

+1613
-1651
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "diff2html",
3-
"version": "2.0.0-rc.8",
3+
"version": "2.0.0-rc.9",
44
"homepage": "http://rtfpessoa.github.io/diff2html/",
55
"description": "Fast Diff to colorized HTML",
66
"keywords": [

dist/diff2html-ui.js

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
/*global $, hljs, Diff2Html*/
1414

1515
(function() {
16-
1716
var highlightJS = require('./highlight.js-internals.js').HighlightJS;
1817

1918
var diffJson = null;
20-
var defaultTarget = "body";
19+
var defaultTarget = 'body';
2120
var currentSelectionColumnId = -1;
2221

2322
function Diff2HtmlUI(config) {
@@ -42,13 +41,11 @@
4241

4342
function synchronisedScroll($target, config) {
4443
if (config.synchronisedScroll) {
45-
46-
$target.find(".d2h-file-side-diff").scroll(function() {
44+
$target.find('.d2h-file-side-diff').scroll(function() {
4745
var $this = $(this);
48-
$this.closest(".d2h-file-wrapper").find(".d2h-file-side-diff")
46+
$this.closest('.d2h-file-wrapper').find('.d2h-file-side-diff')
4947
.scrollLeft($this.scrollLeft());
5048
});
51-
5249
}
5350
}
5451

@@ -57,9 +54,9 @@
5754

5855
var hashTag = this._getHashTag();
5956

60-
var $showBtn = $target.find(".d2h-show");
61-
var $hideBtn = $target.find(".d2h-hide");
62-
var $fileList = $target.find(".d2h-file-list");
57+
var $showBtn = $target.find('.d2h-show');
58+
var $hideBtn = $target.find('.d2h-hide');
59+
var $fileList = $target.find('.d2h-file-list');
6360

6461
if (hashTag === 'files-summary-show') show();
6562
else if (hashTag === 'files-summary-hide') hide();
@@ -88,32 +85,32 @@
8885
var $target = that._getTarget(targetId);
8986

9087
// collect all the diff files and execute the highlight on their lines
91-
var $files = $target.find(".d2h-file-wrapper");
88+
var $files = $target.find('.d2h-file-wrapper');
9289
$files.map(function(_i, file) {
9390
var oldLinesState;
9491
var newLinesState;
9592
var $file = $(file);
96-
var language = $file.data("lang");
93+
var language = $file.data('lang');
9794

9895
// collect all the code lines and execute the highlight on them
99-
var $codeLines = $file.find(".d2h-code-line-ctn");
96+
var $codeLines = $file.find('.d2h-code-line-ctn');
10097
$codeLines.map(function(_j, line) {
10198
var $line = $(line);
10299
var text = line.textContent;
103100
var lineParent = line.parentNode;
104101

105102
var lineState;
106-
if (lineParent.className.indexOf("d2h-del") !== -1) {
103+
if (lineParent.className.indexOf('d2h-del') !== -1) {
107104
lineState = oldLinesState;
108105
} else {
109106
lineState = newLinesState;
110107
}
111108

112109
var result = hljs.getLanguage(language) ? hljs.highlight(language, text, true, lineState) : hljs.highlightAuto(text);
113110

114-
if (lineParent.className.indexOf("d2h-del") !== -1) {
111+
if (lineParent.className.indexOf('d2h-del') !== -1) {
115112
oldLinesState = result.top;
116-
} else if (lineParent.className.indexOf("d2h-ins") !== -1) {
113+
} else if (lineParent.className.indexOf('d2h-ins') !== -1) {
117114
newLinesState = result.top;
118115
} else {
119116
oldLinesState = result.top;
@@ -127,7 +124,7 @@
127124
result.value = highlightJS.mergeStreams(originalStream, highlightJS.nodeStream(resultNode), text);
128125
}
129126

130-
$line.addClass("hljs");
127+
$line.addClass('hljs');
131128
$line.addClass(result.language);
132129
$line.html(result.value);
133130
});
@@ -143,7 +140,7 @@
143140
$target = $(targetId);
144141
} else {
145142
console.error("Wrong target provided! Falling back to default value 'body'.");
146-
console.log("Please provide a jQuery object or a valid DOM query string.");
143+
console.log('Please provide a jQuery object or a valid DOM query string.');
147144
$target = $(defaultTarget);
148145
}
149146

@@ -195,7 +192,6 @@
195192
});
196193
};
197194

198-
199195
Diff2HtmlUI.prototype._getSelectedText = function() {
200196
var sel = window.getSelection();
201197
var range = sel.getRangeAt(0);
@@ -220,7 +216,6 @@
220216

221217
// Expose diff2html in the browser
222218
global.Diff2HtmlUI = Diff2HtmlUI;
223-
224219
})();
225220

226221
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
@@ -233,7 +228,6 @@
233228
*/
234229

235230
(function() {
236-
237231
function HighlightJS() {
238232
}
239233

@@ -258,9 +252,9 @@
258252
var result = [];
259253
(function _nodeStream(node, offset) {
260254
for (var child = node.firstChild; child; child = child.nextSibling) {
261-
if (child.nodeType == 3)
255+
if (child.nodeType === 3) {
262256
offset += child.nodeValue.length;
263-
else if (child.nodeType == 1) {
257+
} else if (child.nodeType === 1) {
264258
result.push({
265259
event: 'start',
266260
offset: offset,
@@ -293,7 +287,7 @@
293287
if (!original.length || !highlighted.length) {
294288
return original.length ? original : highlighted;
295289
}
296-
if (original[0].offset != highlighted[0].offset) {
290+
if (original[0].offset !== highlighted[0].offset) {
297291
return (original[0].offset < highlighted[0].offset) ? original : highlighted;
298292
}
299293

@@ -310,7 +304,7 @@
310304
return highlighted;
311305
... which is collapsed to:
312306
*/
313-
return highlighted[0].event == 'start' ? original : highlighted;
307+
return highlighted[0].event === 'start' ? original : highlighted;
314308
}
315309

316310
function open(node) {
@@ -326,15 +320,14 @@
326320
}
327321

328322
function render(event) {
329-
(event.event == 'start' ? open : close)(event.node);
323+
(event.event === 'start' ? open : close)(event.node);
330324
}
331325

332326
while (original.length || highlighted.length) {
333327
var stream = selectStream();
334328
result += escape(value.substr(processed, stream[0].offset - processed));
335329
processed = stream[0].offset;
336-
if (stream == original) {
337-
330+
if (stream === original) {
338331
/*
339332
On any opening or closing tag of the original markup we first close
340333
the entire highlighted node stack, then render the original tag along
@@ -345,10 +338,10 @@
345338
do {
346339
render(stream.splice(0, 1)[0]);
347340
stream = selectStream();
348-
} while (stream == original && stream.length && stream[0].offset == processed);
341+
} while (stream === original && stream.length && stream[0].offset === processed);
349342
nodeStack.reverse().forEach(open);
350343
} else {
351-
if (stream[0].event == 'start') {
344+
if (stream[0].event === 'start') {
352345
nodeStack.push(stream[0].node);
353346
} else {
354347
nodeStack.pop();
@@ -362,7 +355,6 @@
362355
/* **** Highlight.js Private API **** */
363356

364357
module.exports.HighlightJS = new HighlightJS();
365-
366358
})();
367359

368360
},{}]},{},[1]);

dist/diff2html-ui.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)