-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable cookie banner on query param
- Loading branch information
Showing
4 changed files
with
35 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment"; | ||
|
||
export interface DocsConfigWindow extends Window { | ||
displayConfig?: { | ||
cookieBanner: { | ||
forceHide: boolean; | ||
}; | ||
}; | ||
} | ||
|
||
if (ExecutionEnvironment.canUseDOM) { | ||
document.addEventListener("DOMContentLoaded", function () { | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const isEmbedded = urlParams.get("embedded"); | ||
if (!isEmbedded) { | ||
return; | ||
} | ||
|
||
console.log("embedded mode detected"); | ||
|
||
(window as DocsConfigWindow).displayConfig = { | ||
...(window as DocsConfigWindow).displayConfig, | ||
cookieBanner: { | ||
forceHide: true, | ||
}, | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters