28 lines
726 B
JavaScript
28 lines
726 B
JavaScript
function diffUsingJS(viewType) {
|
|
"use strict";
|
|
var byId = function (id) { return document.getElementById(id); },
|
|
base = difflib.stringAsLines(byId("baseText").value),
|
|
newtxt = difflib.stringAsLines(byId("newText").value),
|
|
sm = new difflib.SequenceMatcher(base, newtxt),
|
|
opcodes = sm.get_opcodes(),
|
|
diffoutputdiv = byId("diffoutput"),
|
|
contextSize = 100;
|
|
|
|
diffoutputdiv.innerHTML = "";
|
|
contextSize = contextSize || null;
|
|
|
|
diffoutputdiv.appendChild(diffview.buildView({
|
|
baseTextLines: base,
|
|
newTextLines: newtxt,
|
|
opcodes: opcodes,
|
|
baseTextName: "Latest Version",
|
|
newTextName: "This Version",
|
|
contextSize: contextSize,
|
|
viewType: viewType
|
|
}));
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
diffUsingJS(0);
|
|
});
|