created version diff
This commit is contained in:
27
web/app/assets/javascripts/show_file_version.js
Normal file
27
web/app/assets/javascripts/show_file_version.js
Normal file
@@ -0,0 +1,27 @@
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user