Skip to content

Commit 4400874

Browse files
committed
Fixed undefinded var. in gene page GO-CAM viewer
Refs pombase/pombase-gocam#109
1 parent 1dca160 commit 4400874

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

gocam_view/templates/gocam_view/index.html

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@
741741
const panelContent = document.getElementById("cy-panel-contents");
742742
const showPanelButton = document.getElementById("show-panel-button");
743743
const hidePanelButton = document.getElementById("hide-panel-button");
744+
const searchBoxDiv = document.getElementById('search-box');
744745

745746
window.showCyPanel = function() {
746747
if (fullOrWidget == 'widget') {
@@ -766,7 +767,9 @@
766767
showPanelButton.style.display = 'inline-block';
767768
hidePanelButton.style.display = 'none';
768769
panelContent.style.display = 'none';
769-
searchBoxDiv.style.display = 'none';
770+
if (searchBoxDiv) {
771+
searchBoxDiv.style.display = 'none';
772+
}
770773
/*
771774
cy.ready(function() {
772775
setTimeout(() => {
@@ -1010,10 +1013,10 @@
10101013
}
10111014
});
10121015

1013-
const searchBoxDiv = document.getElementById('search-box');
1014-
10151016
window.hideSearch = function() {
1016-
searchBoxDiv.style.display = 'none';
1017+
if (searchBoxDiv) {
1018+
searchBoxDiv.style.display = 'none';
1019+
}
10171020
}
10181021

10191022
cy.elements().bind("click", (event) => {
@@ -1025,6 +1028,9 @@
10251028
});
10261029

10271030
window.showSearch = function() {
1031+
if (!searchBoxDiv) {
1032+
return;
1033+
}
10281034
if (searchBoxDiv.style.display == 'none') {
10291035
showCyPanel();
10301036
searchBoxDiv.style.display = 'block';
@@ -1058,16 +1064,18 @@
10581064
};
10591065

10601066
const searchInput = document.getElementById('search-input');
1061-
searchInput.addEventListener("input", (e) => {
1062-
const searchText = e.target.value.trim().toLowerCase();
1063-
cy.$().unselect();
1064-
currentData = undefined;
1065-
if (searchText.length >= 2) {
1066-
doSearch(searchText);
1067-
}
1068-
updateDetails();
1069-
});
10701067

1068+
if (searchInput) {
1069+
searchInput.addEventListener("input", (e) => {
1070+
const searchText = e.target.value.trim().toLowerCase();
1071+
cy.$().unselect();
1072+
currentData = undefined;
1073+
if (searchText.length >= 2) {
1074+
doSearch(searchText);
1075+
}
1076+
updateDetails();
1077+
});
1078+
}
10711079
});
10721080
</script>
10731081

0 commit comments

Comments
 (0)