if (index < lines.length - 1) {
addLine();
}
})
*/
$timeout(() => {
$scope.diff.lines.push(lines[index])
index++
if (index < lines.length ) {
if (show) {
addLine();
}
}
})
}
const generateDiff = async (options) => {
const { loading, toggle} = options;
if (toggle) {
show = !show;
if(show && originalSizeLine > maxSizeLine && index < lines.length ) {
addLine();
};
}
if (!loading) {
return;
}
try {
const url = new URL(location)
url.searchParams.append('ajax', '1')
url.searchParams.append('filename', this.filename)
const response = await $http.get(url.toString());
if (typeof(response.data) === 'string') {
throw new Error(response.data)
}
//console.log(response.data);
diff = response.data[0];
$scope.$apply(() => {
originalSizeLine = diff.lines.length
if (originalSizeLine > maxSizeLine) {
// console.log('original', diff.lines.length)
lines = diff.lines.splice(maxSizeLine);
$scope.diff = diff;
// console.log('first allowed', diff.lines.length)
// console.log('left', lines.length)
// console.log(lines.length + diff.lines.length, 'result total' )
addLine()
} else {
$scope.diff = diff;
}
});