Skip to content

Commit d2eacbd

Browse files
committed
Fix bug in record-fixer
1 parent 061ae3d commit d2eacbd

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

bbox/bbox.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<script type="text/javascript">
2323
$(document).ready(function(){
2424
const viewer = document.querySelector('fs-single-image-viewer');
25+
let params = window.location.search;
26+
let urlParams = new URLSearchParams(params);
27+
let sessionId = urlParams.get('sessionId');
28+
2529
if (window.opener && window.opener.getCurrentGx()) {
2630
window.opener.imageChildWindow = document;
2731
let doc = window.opener.getCurrentGx();
@@ -32,7 +36,7 @@
3236
// Not opened from a parent window, so use hard-coded sample json.
3337
$.getJSON("sample.json", function (sampleGx) {
3438
sampleGx = fixGedcomx(sampleGx);
35-
overlayBoxes(viewer, sampleGx);
39+
overlayBoxes(viewer, sampleGx, sessionId);
3640
});
3741
}
3842
});

graph/view/RelChartBuilder.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -494,16 +494,16 @@ RelChartBuilder.prototype.correlateHighlights = function(doc, relToGx, imgToGx)
494494
return reversedMap;
495495
}
496496

497-
function highlight(elements, myElement, elementsClass, myClass) {
498-
if (!isEmpty(this.relChart.highlightsToProcess)) {
497+
function highlight(relChart, elements, myElement, elementsClass, myClass) {
498+
if (!isEmpty(relChart.highlightsToProcess)) {
499499
// Image viewer highlight elements don't exist when the graph is first being built, so wait until the first highlight is
500500
// done before triggering that.
501-
for (let h of this.relChart.highlightsToProcess) {
501+
for (let h of relChart.highlightsToProcess) {
502502
$("#" + h.imgElement).hover(
503-
function() {h(h.relElements, h.imgElement, "record-highlight", null);},
503+
function() {highlight(relChart, h.relElements, h.imgElement, "record-highlight", null);},
504504
function() {unhighlight(h.relElements, h.imgElement, "record-highlight", null);});
505505
}
506-
this.relChart.highlightsToProcess = []; // now handled, so clear it.
506+
relChart.highlightsToProcess = []; // now handled, so clear it.
507507
}
508508
if (elements) {
509509
for (let element of elements) {
@@ -554,7 +554,7 @@ RelChartBuilder.prototype.correlateHighlights = function(doc, relToGx, imgToGx)
554554
else {
555555
let relElements = gxToRel[gxId];
556556
if (!empty(relElements)) {
557-
highlightsToProcess.push({imgElement: imgElement, relElements: relElements});
557+
this.relChart.highlightsToProcess.push({imgElement: imgElement, relElements: relElements});
558558
// Add this imgElement to the list of imgElements associated with each of these relElements, so
559559
// we can do highlighting in the reverse direction.
560560
for (let relElement of relElements) {
@@ -575,9 +575,10 @@ RelChartBuilder.prototype.correlateHighlights = function(doc, relToGx, imgToGx)
575575
for (let relElement in relToImg) {
576576
if (relToImg.hasOwnProperty(relElement)) {
577577
let imgElements = relToImg[relElement];
578+
let relChart = this.relChart;
578579
if (!empty(imgElements)) {
579580
$("#" + relElement).hover(
580-
function() {highlight(imgElements, relElement, "img-highlight", "record-highlight");},
581+
function() {highlight(relChart, imgElements, relElement, "img-highlight", "record-highlight");},
581582
function() {unhighlight(imgElements, relElement, "img-highlight", "record-highlight");});
582583
}
583584
}

record-fixer/record-fixer.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
}
7575
}
7676

77-
let sessionId = urlParams.get('access_token');
77+
let sessionId = urlParams.get('access_token') || urlParams.get('sessionId');
7878
if (sessionId) {
7979
url += "?access_token=" + sessionId;
8080
}

0 commit comments

Comments
 (0)