//console.log(loopIndex)
diffEditor.dataset.loaded = true
url.searchParams.append('ajax', '1')
url.searchParams.append('filename', diffEditor.dataset.filename)
const loader = $(`#p3x-gitlist-commit-diff-loader-${loopIndex}`)
const loaderAjax = $(`#p3x-gitlist-commit-diff-loader-ajax-${loopIndex}`)
const loaderWebworker = $(`#p3x-gitlist-commit-diff-loader-webworker-${loopIndex}`)
const scroller = $(`#p3x-gitlist-commit-diff-scroller-${loopIndex}`)
scroller.css('max-height', window.gitlist.editorMaxHeight)
$.ajax(url.toString()).then(function (diffsResponseJson) {
if (typeof diffsResponseJson !== 'object') {
const sendErrorMessage = `${window.gitlist.basepath}/json-error`;
console.log(sendErrorMessage);
$.redirect(sendErrorMessage, {
error: diffsResponseJson,
})
} else {
const diffs = diffsResponseJson[0];
loaderAjax.hide()
loaderWebworker.show()
const worker = new Worker(`${window.gitlist.basepath}/web-worker/commit-diff.js`);
worker.addEventListener('message', function (event) {
loader.hide();
scroller.append(event.data)
worker.terminate()
//console.log('worker.onmessage', event.data)
})