Skip to content

Commit

Permalink
fixed problem with loadTrackingPixels where when there are no trackin…
Browse files Browse the repository at this point in the history
…g pixels, it fails to update the UI because of an early return statement instead of an if statement
anirvinv committed Jan 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent fc93192 commit fc9f7ea
Showing 3 changed files with 18 additions and 9 deletions.
11 changes: 11 additions & 0 deletions src/taskpane/taskpane.css
Original file line number Diff line number Diff line change
@@ -178,6 +178,16 @@ b {
padding: 20px;
}

.container h2 {
margin-bottom: 5px;
}

.container em {
margin-bottom: 5px;
font-size: small;
color: gray
}

#inserted-tracking-pixels-container {
width: 100%;
}
@@ -209,6 +219,7 @@ b {
text-overflow: ellipsis;
overflow: hidden;
font-size: small;
text-wrap: nowrap;
}

#inserted-tracking-pixels-container button {
8 changes: 4 additions & 4 deletions src/taskpane/taskpane.html
Original file line number Diff line number Diff line change
@@ -36,11 +36,11 @@ <h2 class="ms-font-xl bold"> Enter Tracking Pixel URL </h2>
</div>
</div>
<div class="container">
<h2 style="margin-bottom:5px;">Inserted Tracking Pixels:</h2>
<em style="margin-bottom:5px; font-size: small; color:gray" id="no-inserted-detected">
No inserted tracking pixels detected.
<h2>Inserted Tracking Pixels:</h2>
<em id="no-inserted-detected">
None detected
</em>
<em style="margin-bottom:5px; font-size: small; color:gray" id="inserted-detection-instruction">(Click the box to highlight the pixel)</em>
<em id="inserted-detection-instruction">(Click the box to highlight the pixel)</em>
<div id="inserted-tracking-pixels-container">
</div>
</div>
8 changes: 3 additions & 5 deletions src/taskpane/taskpane.ts
Original file line number Diff line number Diff line change
@@ -60,13 +60,11 @@ function loadTrackingPixels() {
if (trackingPixels.length == 0) {
document.getElementById("no-inserted-detected").style.display = "block";
document.getElementById("inserted-detection-instruction").style.display = "none";
loadLock = false;
return;
} else {
document.getElementById("no-inserted-detected").style.display = "none";
document.getElementById("inserted-detection-instruction").style.display = "block";
}

document.getElementById("no-inserted-detected").style.display = "none";
document.getElementById("inserted-detection-instruction").style.display = "block";

trackingPixels.forEach((trackingPixel) => {
let url = trackingPixel.getAttribute("src");
let newTrackingPixel = getTrackingPixelDiv(url);

0 comments on commit fc9f7ea

Please sign in to comment.