Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions _includes/argohub-docs-navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@

{% if page.layout != "home" %}
<button
onclick="window.CommandBar.openHelpHub(); setTimeout(() => {
document.querySelector('input[data-testid=helphub-input]').focus()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the search input has a focused state by default when you open the amplitude's guides and surveys.

}, 100)"
onclick="window.engagement.rc.open();"
class="helpbub-toggler helpbub-toggler-small order-2 order-md-2"
aria-label="Search Codefresh Documentation"
type="button"
Expand Down
4 changes: 1 addition & 3 deletions _includes/docs-navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@

{% if page.layout != "home" %}
<button
onclick="window.CommandBar.openHelpHub(); setTimeout(() => {
document.querySelector('input[data-testid=helphub-input]').focus()
}, 100)"
onclick="window.engagement.rc.open();"
class="helpbub-toggler helpbub-toggler-small order-2 order-md-2"
aria-label="Search Codefresh Documentation"
type="button"
Expand Down
51 changes: 32 additions & 19 deletions _includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,37 @@
<!-- End of Doc Search Embed Code -->

<script>
const commandbarSegment = IS_GITOPS_DOC_COOKIE_SET ? '43836ac3': '3033bf7f'

var o=commandbarSegment,n=["Object.assign","Symbol","Symbol.for"].join("%2C"),a=window;function r(o,n){void 0===n&&(n=!1),"complete"!==document.readyState&&window.addEventListener("load",r.bind(null,o,n),{capture:!1,once:!0});var a=document.createElement("script");a.type="text/javascript",a.async=n,a.src=o,document.head.appendChild(a)}function t(){var n;if(void 0===a.CommandBar){delete a.__CommandBarBootstrap__;var t=Symbol.for("CommandBar::configuration"),e=Symbol.for("CommandBar::orgConfig"),i=Symbol.for("CommandBar::disposed"),c=Symbol.for("CommandBar::isProxy"),m=Symbol.for("CommandBar::queue"),d=Symbol.for("CommandBar::unwrap"),l=Symbol.for("CommandBar::eventSubscriptions"),s=[],u=localStorage.getItem("commandbar.lc"),f=u&&u.includes("local")?"http://localhost:8000":"https://api.commandbar.com",p=Object.assign(((n={})[t]={uuid:o},n[e]={},n[i]=!1,n[c]=!0,n[m]=new Array,n[d]=function(){return p},n[l]=void 0,n),a.CommandBar),b=["addCommand","boot","addEventSubscriber","addRecordAction","setFormFactor"],y=p;Object.assign(p,{shareCallbacks:function(){return{}},shareContext:function(){return{}}}),a.CommandBar=new Proxy(p,{get:function(o,n){return n in y?p[n]:"then"!==n?b.includes(n)?function(){var o=Array.prototype.slice.call(arguments);return new Promise((function(a,r){o.unshift(n,a,r),p[m].push(o)}))}:function(){var o=Array.prototype.slice.call(arguments);o.unshift(n),p[m].push(o)}:void 0}}),null!==u&&s.push("lc=".concat(u)),s.push("version=2"),r("".concat(f,"/latest/").concat(o,"?").concat(s.join("&")),!0)}}void 0===Object.assign||"undefined"==typeof Symbol||void 0===Symbol.for?(a.__CommandBarBootstrap__=t,r("https://polyfill.io/v3/polyfill.min.js?version=3.101.0&callback=__CommandBarBootstrap__&features="+n)):t();
window.CommandBar.setThemeMode('dark_mode')
window.CommandBar.boot(
"",
{},
{ canOpenEditor: false, products: ["help_hub"] }
);

document.addEventListener("keydown", function (event) {
const isMac = navigator.userAgent.includes('Mac');
if ((event.key === "k") && ((isMac && event.metaKey) || (!isMac && event.ctrlKey))) {
event.preventDefault();
window.CommandBar.openHelpHub();
setTimeout(() => {
document.querySelector('input[data-testid=helphub-input]').focus()
}, 100);
const apiKey = '42885a887590b9e28cce52518224850b';

const amplitudeScript = document.createElement('script');
amplitudeScript.src = `https://cdn.amplitude.com/script/${apiKey}.engagement.js`;

amplitudeScript.onload = async function() {
if (typeof window.engagement !== 'undefined') {
window.engagement.init(apiKey);

const userId = 'docs-site-user';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the user_id param is required in order to boot the integration, so we have to use some dummy value here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to verify whether Amplitude offers any features that allow user customization.
For example, if there is a “recent activity” section, it could create a serious privacy risk, as search results might be recorded and shared with all users of the documentation site.

await window.engagement.boot({
user: {
user_id: userId,
},
});

document.addEventListener("keydown", function (event) {
const isMac = navigator.userAgent.includes('Mac');
if ((event.key === "k") && ((isMac && event.metaKey) || (!isMac && event.ctrlKey))) {
event.preventDefault();
window.engagement.rc.open();
}
});
} else {
console.warn('Amplitude engagement is not available.');
}
});
};

amplitudeScript.onerror = function() {
console.error('Failed to load Amplitude engagement script');
};

document.head.appendChild(amplitudeScript);
</script>
4 changes: 1 addition & 3 deletions gitops/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ <h2 class="mb-3 bd-text-white text-uppercase">
</p>
<!-- <div id="searchbar"></div>-->
<button
onclick="window.CommandBar.openHelpHub(); setTimeout(() => {
document.querySelector('input[data-testid=helphub-input]').focus()
}, 100)"
onclick="window.engagement.rc.open();"
class="helpbub-toggler mb-3"
aria-label="Search Codefresh Documentation"
type="button"
Expand Down
4 changes: 1 addition & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ <h2 class="mb-3 bd-text-white text-uppercase">
</p>
<!-- <div id="searchbar"></div>-->
<button
onclick="window.CommandBar.openHelpHub(); setTimeout(() => {
document.querySelector('input[data-testid=helphub-input]').focus()
}, 100)"
onclick="window.engagement.rc.open();"
class="helpbub-toggler mb-3"
aria-label="Search Codefresh Documentation"
type="button"
Expand Down