|
741 | 741 | const panelContent = document.getElementById("cy-panel-contents"); |
742 | 742 | const showPanelButton = document.getElementById("show-panel-button"); |
743 | 743 | const hidePanelButton = document.getElementById("hide-panel-button"); |
| 744 | + const searchBoxDiv = document.getElementById('search-box'); |
744 | 745 |
|
745 | 746 | window.showCyPanel = function() { |
746 | 747 | if (fullOrWidget == 'widget') { |
|
766 | 767 | showPanelButton.style.display = 'inline-block'; |
767 | 768 | hidePanelButton.style.display = 'none'; |
768 | 769 | panelContent.style.display = 'none'; |
769 | | - searchBoxDiv.style.display = 'none'; |
| 770 | + if (searchBoxDiv) { |
| 771 | + searchBoxDiv.style.display = 'none'; |
| 772 | + } |
770 | 773 | /* |
771 | 774 | cy.ready(function() { |
772 | 775 | setTimeout(() => { |
|
1010 | 1013 | } |
1011 | 1014 | }); |
1012 | 1015 |
|
1013 | | - const searchBoxDiv = document.getElementById('search-box'); |
1014 | | - |
1015 | 1016 | window.hideSearch = function() { |
1016 | | - searchBoxDiv.style.display = 'none'; |
| 1017 | + if (searchBoxDiv) { |
| 1018 | + searchBoxDiv.style.display = 'none'; |
| 1019 | + } |
1017 | 1020 | } |
1018 | 1021 |
|
1019 | 1022 | cy.elements().bind("click", (event) => { |
|
1025 | 1028 | }); |
1026 | 1029 |
|
1027 | 1030 | window.showSearch = function() { |
| 1031 | + if (!searchBoxDiv) { |
| 1032 | + return; |
| 1033 | + } |
1028 | 1034 | if (searchBoxDiv.style.display == 'none') { |
1029 | 1035 | showCyPanel(); |
1030 | 1036 | searchBoxDiv.style.display = 'block'; |
|
1058 | 1064 | }; |
1059 | 1065 |
|
1060 | 1066 | 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 | | - }); |
1070 | 1067 |
|
| 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 | + } |
1071 | 1079 | }); |
1072 | 1080 | </script> |
1073 | 1081 |
|
|
0 commit comments