Changeset View
Changeset View
Standalone View
Standalone View
assets/src/bundles/revision/diff-utils.js
Show All 12 Lines | |||||
import diffPanelTemplate from './diff-panel.ejs'; | import diffPanelTemplate from './diff-panel.ejs'; | ||||
// number of changed files in the revision | // number of changed files in the revision | ||||
let changes = null; | let changes = null; | ||||
let nbChangedFiles = 0; | let nbChangedFiles = 0; | ||||
// to track the number of already computed files diffs | // to track the number of already computed files diffs | ||||
let nbDiffsComputed = 0; | let nbDiffsComputed = 0; | ||||
// the no newline at end of file marker from Github | const noNewLineMarker = | ||||
const noNewLineMarker = '<span class="no-nl-marker" title="No newline at end of file">' + | '<span class="no-nl-marker" style="color: red;" title="No newline at end of file">' + | ||||
'<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">' + | '<i class="mdi mdi-rotate-90 mdi-cancel" aria-hidden="true">' + | ||||
'<path fill-rule="evenodd" d="M16 5v3c0 .55-.45 1-1 1h-3v2L9 8l3-3v2h2V5h2zM8 8c0 2.2-1.8 4-4 4s-4-1.8-4-4 1.8-4 4-4 4 1.8 4 4zM1.5 9.66L5.66 5.5C5.18 5.19 4.61 5 4 5 2.34 5 1 6.34 1 8c0 .61.19 1.17.5 1.66zM7 8c0-.61-.19-1.17-.5-1.66L2.34 10.5c.48.31 1.05.5 1.66.5 1.66 0 3-1.34 3-3z"></path>' + | '<i class="mdi mdi-keyboard-return" aria-hidden="true">' + | ||||
'</svg>' + | |||||
'</span>'; | '</span>'; | ||||
// to track the total number of added lines in files diffs | // to track the total number of added lines in files diffs | ||||
let nbAdditions = 0; | let nbAdditions = 0; | ||||
// to track the total number of deleted lines in files diffs | // to track the total number of deleted lines in files diffs | ||||
let nbDeletions = 0; | let nbDeletions = 0; | ||||
// to track the already computed diffs by id | // to track the already computed diffs by id | ||||
const computedDiffs = {}; | const computedDiffs = {}; | ||||
// map a diff id to its computation url | // map a diff id to its computation url | ||||
▲ Show 20 Lines • Show All 759 Lines • Show Last 20 Lines |