correction in js

This commit is contained in:
Rafał Jaworski 2019-01-22 15:06:14 +01:00
parent 66a51192a7
commit 7178a7f5db

View File

@ -221,33 +221,6 @@ function htmlEncode(value){
function renderFragment(fragment, number) { function renderFragment(fragment, number) {
var result = '<div style="display:none" id="fragment'+number+'" class="fragmentDetails">'; var result = '<div style="display:none" id="fragment'+number+'" class="fragmentDetails">';
for (j=0;j<fragment['occurrences'].length;j++) {
var occurence = fragment['occurrences'][j];
result += '<table class="example"><tr><td>';
// source segment
var sourceSegment = occurence['sourceSegment'];
result += sourceSegment.slice(0, occurence['matchedExampleStart']);
result += '<span class="matchedFragment">';
result += sourceSegment.slice(occurence['matchedExampleStart'], occurence['matchedExampleEnd']);
result += '</span>';
result += sourceSegment.slice(occurence['matchedExampleEnd']);
// target segment
result += '</td></tr><tr><td>';
var targetSegment = occurence['targetSegment'];
var currStart = 0;
for (i=0;i<occurence['targetFragments'].length;i++) {
result += targetSegment.slice(currStart, occurence['targetFragments'][i][0]);
result += '<span class="matchedFragment">';
result += targetSegment.slice(occurence['targetFragments'][i][0], occurence['targetFragments'][i][1]);
result += '</span>';
currStart = occurence['targetFragments'][i][1];
}
result += targetSegment.slice(currStart);
result += '</td></tr></table>';
}
result += '</div>'; result += '</div>';
return result; return result;
} }