Unused code is removed

* refactor: Remove unused code and update js dependencies
* Remove unused code from footer-scripts.hbs
This commit is contained in:
Julio C. Estrada
2024-07-03 11:51:21 -04:00
committed by GitHub
parent fc2c49c85d
commit 8f50b5035f
8 changed files with 1 additions and 266 deletions

View File

@@ -1,67 +0,0 @@
.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] {
overscroll-behavior: none;
max-height: calc(100vh - 3.25rem);
}
.algolia-autocomplete .algolia-docsearch-suggestion--title {
font-weight: 500;
}
.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column {
font-weight: normal;
}
@media screen and (max-width: 768px) {
.algolia-autocomplete .ds-dropdown-menu {
min-width: calc(100vw - 2.75rem) !important;
}
}
.doc .image.conum > img {
height: 0.9em;
width: auto;
vertical-align: -0.1em;
}
#search-input-algolia-algolia {
color: #333;
font-family: inherit;
font-size: 0.95rem;
width: 150px;
border: 1px solid #dbdbdb;
border-radius: 0.1em;
line-height: 1.5;
padding: 0.25em;
}
#search-input-algolia {
color: #333;
font-family: inherit;
font-size: 0.95rem;
width: 150px;
border: 1px solid #dbdbdb;
border-radius: 0.1em;
line-height: 1.5;
padding: 0 0.25em;
}
#search-input-algolia:disabled {
background-color: #dbdbdb;
/* disable cursor */
cursor: not-allowed;
pointer-events: all !important;
}
#search-input-algolia:disabled::placeholder {
color: #4c4c4c;
}
#search-input-algolia:focus {
outline: none;
}
@media screen and (min-width: 769px) {
#search-input-algolia {
width: 200px;
}
}

View File

@@ -18,4 +18,3 @@
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
@import "algolia-extra.css";

View File

@@ -2,146 +2,10 @@
<html lang="en">
<head>
{{> head defaultPageTitle='Untitled'}}
<style>
.algolia-autocomplete .ds-dropdown-menu:before {
display: block;
position: absolute;
content: "";
width: 14px;
height: 14px;
background: #fff;
z-index: 2;
top: 9px;
left: -7px !important;
border-top: 1px solid #d9d9d9;
border-right: 1px solid #d9d9d9;
-webkit-transform: rotate(-136deg);
transform: rotate(-136deg);
border-radius: 2px;
}
.search-result-dropdown-menu:before {
display: block;
position: absolute;
content: "";
width: 14px;
height: 14px;
background: #fff !important;
z-index: 2;
top: 9px;
border-top: 1px solid #d9d9d9;
border-right: 1px solid #d9d9d9;
-webkit-transform: rotate(-136deg);
transform: rotate(-136deg);
border-radius: 2px;
left: -7px;
}
.nav-container .search-result-dropdown-menu {
position: fixed;
top: 65px;
left: 13.5rem;
width: 50%;
overflow: visible;
max-height: calc(100vh - 5.25rem);
line-height: 1.5;
z-index: 9999;
}
.nav-container .button {
padding: 0px 14px;
background-color: #FF9F00;
color: #fff;
}
.algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu {
position: fixed !important;
top: 65px !important;
left: 13.5rem !important;
z-index: 99 !important;
}
.search-selector {
margin-right: 133px;
text-transform: none;
}
@media screen and (max-width: 1024px) {
.nav-container .search-result-dropdown-menu {
top: 103px;
left: 14.5rem;
}
}
@media screen and (max-width: 768px) {
.search-result-dropdown-menu:before {
top: -6px;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
left: 35px;
}
.nav-container .search-result-dropdown-menu {
top: 100%;
left: 0;
width: 90vw;
position: absolute !important;
}
.algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu {
position: absolute !important;
top: 100% !important;
left: 0px !important;
z-index: 99 !important;
}
.algolia-autocomplete .ds-dropdown-menu:before{
top: -6px;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
left: 35px !important;
}
}
</style>
</head>
<body class="article{{#with (or page.attributes.role page.role)}} {{{this}}}{{/with}}">
{{> header}}
{{> body}}
<script>
var element = document.querySelector('.search-result-dropdown-menu');
if (element) {
// Apply styles and additional class to element
element.style.display = 'none';
var element = document.querySelector('.search-result-dropdown-menu');
var arrow = document.createElement('div');
arrow.classList.add('search-result-dropdown-menu');
element.appendChild(arrow);
}
function onSearch() {
var searchInput = document.getElementById('search-input');
if (searchInput.value) {
element.style.display = 'block';
} else {
element.style.display = 'none';
}
}
function onSearchChange(search_active) {
var searchInputAlgolia = document.getElementById('search-input-algolia');
var searchInput = document.getElementById('search-input');
if (search_active === "algolia") {
searchInputAlgolia.style.display = 'block';
// searchInputAlgolia.style.lineHeight = '2.001';
searchInput.style.display = 'none';
setupAlgoliaDocsearch();
} else {
searchInputAlgolia.style.display = 'none';
searchInput.style.display = 'block';
}
}
// Add an event listener to the document
document.addEventListener("click", function(event) {
var searchInput = document.getElementById('search-input');
// Check if the click was outside of the modal
if (event.target !== element && event.target !== searchInput) {
// Hide the modal
searchInput.value = "";
onSearch();
}
});
</script>
{{> footer}}
</body>
</html>

View File

@@ -1,41 +1,3 @@
{{#if env.ALGOLIA_API_KEY}}
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2.5.2/dist/cdn/docsearch.min.js"></script>
<script>
function setupAlgoliaDocsearch(){
document.getElementById('search-input').hidden = true;
document.getElementById('search-input-algolia').hidden = false;
var search = docsearch({
{{#with env.ALGOLIA_APP_ID}}
appId: '{{this}}',
{{/with}}
apiKey: '{{env.ALGOLIA_API_KEY}}',
indexName: '{{env.ALGOLIA_IDX_NAME}}',
inputSelector: '#search-input-algolia',
autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
algoliaOptions: { hitsPerPage: 10 ,facetFilters: ['version:{{page.componentVersion.displayVersion}}'] },
}).autocomplete
search.on('autocomplete:closed', function () { search.autocomplete.setVal() });
}
function setCookie(name, value) {
document.cookie = name + "=" + (value || "") + "; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
</script>
{{/if}}
<script id="site-script" src="{{{uiRootPath}}}/js/site.js" data-ui-root-path="{{{uiRootPath}}}"></script>
<script async src="{{{uiRootPath}}}/js/vendor/highlight.js"></script>
{{#if env.SITE_SEARCH_PROVIDER}}
{{> search-scripts}}
{{/if}}
<script async src="{{{uiRootPath}}}/js/vendor/tabs.js" data-sync-storage-key="preferred-tab"></script>

View File

@@ -1,2 +1 @@
{{> footer-content}}
{{> footer-scripts}}

View File

@@ -2,6 +2,5 @@
{{> head-title}}
{{> head-info}}
{{> head-styles}}
{{> head-meta}}
{{> head-scripts}}
{{> head-icons}}

View File

@@ -1,21 +1,5 @@
{{#with page.navigation}}
<div class="nav-panel-menu is-active" data-panel="menu">
<div class="navbar-item search hide-for-print">
<div id="search-field" class="field has-filter">
<div style="display: flex; flex-direction: column;">
<div style="display: flex; margin-bottom: 10px; position: relative;">
<input id="search-input" type="text" placeholder="Search the docs"{{#if page.home}} autofocus{{/if}} style="flex: 1; padding: 0 0.25em" onkeyup="onSearch()">
<input id="search-input-algolia" type="text" placeholder="Search the docs"{{#if page.home}} autofocus{{/if}} hidden style="flex: 1;">
</div>
<div style="display: flex; margin-bottom: 10px; justify-content: space-evenly;">
<select class="search-selector" onchange="onSearchChange(this.value)">
<option value="lunr">Lunr</option>
<option value="algolia">Algolia</option>
</select>
</div>
</div>
</div>
</div>
<nav class="nav-menu">
{{#with @root.page.componentVersion}}
<h3 class="title"><a href="{{{relativize ./url}}}">{{./title}}</a></h3>

View File

@@ -77,11 +77,6 @@ if [ ! -d "node_modules" ] || [ "$(find package.json -prune -printf '%T@\n' | cu
npm ci
fi
# TODO: Find a better way of setting these
export ALGOLIA_APP_ID="HXFFX7FZYE"
export ALGOLIA_API_KEY="6a58e88f13574fdb9b18ca0159e896b4"
export ALGOLIA_IDX_NAME="cppalliancedocs"
echo $ANTORA_CMD --fetch --attribute page-boost-branch="$1" --attribute page-commit-id="$commit_id" site.playbook.yml
$ANTORA_CMD --fetch --attribute page-boost-branch="$1" --attribute page-commit-id="$commit_id" site.playbook.yml