Skip to content

Commit

Permalink
Merge pull request #94 from Alokit-Innovations/tr/bb/highlightNormalLine
Browse files Browse the repository at this point in the history
Change item to items array and highlight all lines in unified view except with + symbol
  • Loading branch information
avikalpg authored Mar 7, 2024
2 parents ca1d116 + af0925c commit 788f8ca
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Vibinex Code Review",
"version": "1.1.2",
"version": "1.1.3",
"manifest_version": 3,
"description": "Personalization and context for pull requests on GitHub & Bitbucket",
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsRm6EaBdHDBxVjt9o9WKeL9EDdz1X+knDAU5uoZaRsXTmWjslhJN9DhSd7/Ys4aJOSN+s+5/HnIHcKV63P4GYaUM5FhETHEWORHlwIgjcV/1h6wD6bNbvXi06gtiygE+yMrCzzD93/Z+41XrwMElYiW2U5owNpat2Yfq4p9FDX1uBJUKsRIMp6LbRQla4vAzH/HMUtHWmeuUsmPVzcq1b6uB1QmuJqIQ1GrntIHw3UBWUlqRZ5OtxI1DCP3knglvqz26WT5Pc4GBDNlcI9+3F0vhwqwHqrdyjZpIKZ7iaQzcrovOqUKuXs1J3hDtXq8WoJELIqfIisY7rhAvq6b8jQIDAQAB",
Expand Down
53 changes: 26 additions & 27 deletions scripts/highlighting.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,45 +323,44 @@ const bitBucketHunkHighlight = (apiResponses) => {

if (statusDetail[1] == 'side-by-side') {
// for split view
allChunkLines.forEach((item) => {
const scanEachLine = item.querySelectorAll('span[data-line-type]');
allChunkLines.forEach((items) => {
items.forEach((item) => {
const scanEachLine = item.querySelectorAll('span[data-line-type]');
scanEachLine.forEach((line) => {
const symbol = line.getAttribute('data-line-type');

scanEachLine.forEach((line) => {
const symbol = line.getAttribute('data-line-type');

if (symbol == '-') {
const lineNumber = getLineNumber(item);
if (lineNumber >= lineStart && lineNumber <= lineEnd) {
const firstElement = item.firstElementChild;
const secondChild = firstElement.children[2];
secondChild.style.borderLeft = 'solid 6px #eaee32';
}
} else if (symbol == '+') {
const lineNumber = getLineNumber(item);
if (lineNumber >= lineStart && lineNumber <= lineEnd) {
const secondElement = item.children[1];
const secondChild = secondElement.children[2];
secondChild.style.borderLeft = 'solid 6px #f1f549';
if (symbol == '-') {
const lineNumber = getLineNumber(item);
if (lineNumber >= lineStart && lineNumber <= lineEnd) {
const firstElement = item.firstElementChild;
const secondChild = firstElement.children[2];
secondChild.style.borderLeft = 'solid 6px #eaee32';
}
} else if (symbol == '+') {
const lineNumber = getLineNumber(item);
if (lineNumber >= lineStart && lineNumber <= lineEnd) {
const secondElement = item.children[1];
const secondChild = secondElement.children[2];
secondChild.style.borderLeft = 'solid 6px #f1f549';
}
}
}
});
});

});

} else {
// for unified view
allChunkLines.forEach((item) => {
const eachLine = item.querySelector('span[data-line-type]');
const symbol = eachLine.getAttribute('data-line-type');

if (symbol == '-' || symbol == '+') {
allChunkLines.forEach((items) => {
items.forEach((item) => {
const lineNumberElement = item.querySelector('a[aria-label]');
const lineNumberText = lineNumberElement.getAttribute('aria-label');
const lineNumber = getLineNumber(item);
if (lineNumber >= lineStart && lineNumber <= lineEnd && symbol == '-') {
if (lineNumber >= lineStart && lineNumber <= lineEnd && lineNumberText.includes("From")) {
const firstElement = item.firstElementChild;
const secondChild = firstElement.children[2];
secondChild.style.borderLeft = 'solid 6px #eaee32';
}
}
});
});
}
}
Expand Down

0 comments on commit 788f8ca

Please sign in to comment.