Skip to content

Commit 9139655

Browse files
committed
Mainframe: Removed legacy coveo js
1 parent 6264fd1 commit 9139655

File tree

1 file changed

+1
-66
lines changed

1 file changed

+1
-66
lines changed

assets/js/coveo.js

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -72,71 +72,6 @@ async function atomicCoveo() {
7272
await searchBarHeader.executeFirstSearch();
7373
}
7474

75-
async function legacyCoveo() {
76-
const token = localStorage.getItem('coveo_jwt_v1');
77-
const org_id = localStorage.getItem('coveo_org_id_v1');
78-
let searchObj = { token, org_id };
79-
if (token === null || org_id === null || isJwtExpired(token)) {
80-
searchObj = await getsearchObj();
81-
localStorage.setItem('coveo_jwt_v1', searchObj.token);
82-
localStorage.setItem('coveo_org_id_v1', searchObj.org_id);
83-
}
84-
85-
Coveo.SearchEndpoint.configureCloudV2Endpoint(
86-
searchObj.org_id,
87-
searchObj.token,
88-
`https://${searchObj.org_id}.org.coveo.com/rest/search`
89-
);
90-
91-
const analyticsElement = document.querySelector('.CoveoAnalytics');
92-
if (analyticsElement) {
93-
const analyticsEndpoint = `https://${searchObj.org_id}.analytics.org.coveo.com/rest/ua`;
94-
analyticsElement.setAttribute('data-endpoint', analyticsEndpoint);
95-
}
96-
97-
const root = document.getElementById('search');
98-
const searchBoxRoot = document.getElementById('searchbox');
99-
Coveo.initSearchbox(searchBoxRoot, '/search.html');
100-
const resetbtn = document.querySelector('#reset_btn');
101-
if (resetbtn) {
102-
resetbtn.onclick = () => {
103-
document.querySelector('.coveo-facet-header-eraser').click();
104-
};
105-
}
106-
Coveo.$$(root).on('querySuccess', (e, args) => {
107-
resetbtn.style.display = 'block';
108-
});
109-
Coveo.$$(root).on('afterComponentsInitialization', (e, data) => {
110-
setTimeout(() => {
111-
document.querySelector('.CoveoOmnibox input').value = Coveo.state(
112-
root,
113-
'q'
114-
);
115-
}, 1000);
116-
});
117-
Coveo.$('#search').on('newResultsDisplayed', (e, args) => {
118-
for (let i = 0; i < e.target.lastChild.children.length; i++) {
119-
//Remove the title for tooltip box
120-
Coveo.$('.CoveoResultLink').removeAttr('title');
121-
}
122-
});
123-
Coveo.init(root, {
124-
f5_product_module: {
125-
dependsOn: '@f5_product',
126-
dependsOnCondition: (parentFacet) => {
127-
const id = parentFacet.options.id;
128-
const value = 'NGINX Management Suite';
129-
const selected = parentFacet.queryStateModel.get(`f:${id}`);
130-
return selected.includes(value);
131-
},
132-
},
133-
});
134-
}
135-
13675
document.addEventListener('DOMContentLoaded', async () => {
137-
if (localStorage.getItem('useNewTheme') === 'true') {
138-
atomicCoveo();
139-
} else {
140-
legacyCoveo();
141-
}
76+
atomicCoveo();
14277
});

0 commit comments

Comments
 (0)