mirror of
https://github.com/docker/docs.git
synced 2026-06-19 07:35:16 +00:00
a6c2209c7f
Introduces @docker/marlin-sdk-web-public for first-party pageview and click analytics, bundled into scripts.js via Hugo's existing js.Build pipeline. Config is emitted to window.__marlinConfig from head.html and gated to prod/staging only. Renames data-heap-id attributes on the markdown-dropdown buttons to marlin-action so they are picked up by the SDK's auto-click tracking. TODO: replace the REPLACE-ME endpoint placeholders in hugo.yaml with the canonical Marlin ingestion URLs from the data-platform team. TODO: heap.track() calls in youtube-script.html are left in place — the public SDK exposes no equivalent track() method, so video play/pause events cannot be migrated yet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
86 lines
2.7 KiB
HTML
86 lines
2.7 KiB
HTML
<div class="not-prose mt-4">
|
|
<div class="flex flex-wrap items-center gap-x-6 gap-y-2 text-sm">
|
|
<button
|
|
onclick="askGordon()"
|
|
marlin-action="ask-gordon-button"
|
|
class="inline-flex cursor-pointer items-center gap-1.5 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100"
|
|
>
|
|
<span class="icon-svg icon-sm -translate-y-px">
|
|
{{ partialCached "icon" "gordon" "gordon" }}
|
|
</span>
|
|
<span>Ask Gordon</span>
|
|
</button>
|
|
|
|
<button
|
|
onclick="copyMarkdown()"
|
|
marlin-action="copy-markdown-button"
|
|
class="inline-flex cursor-pointer items-center gap-1.5 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100"
|
|
>
|
|
<span class="icon-svg icon-sm">
|
|
{{ partialCached "icon" "document-duplicate" "document-duplicate" }}
|
|
</span>
|
|
<span class="icon-svg icon-sm hidden">
|
|
{{ partialCached "icon" "check-circle" "check-circle" }}
|
|
</span>
|
|
<span>Copy Markdown</span>
|
|
</button>
|
|
|
|
<button
|
|
onclick="viewPlainText()"
|
|
marlin-action="view-markdown-button"
|
|
class="inline-flex cursor-pointer items-center gap-1.5 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100"
|
|
>
|
|
<span class="icon-svg icon-sm">
|
|
{{ partialCached "icon" "arrow-top-right-on-square" "arrow-top-right-on-square" }}
|
|
</span>
|
|
<span>View Markdown</span>
|
|
</button>
|
|
</div>
|
|
<hr class="mt-4 mb-6 border-t border-gray-200 dark:border-gray-700" />
|
|
</div>
|
|
|
|
<script>
|
|
function getCurrentPlaintextUrl() {
|
|
const url = window.location.href.split("#")[0].replace(/\/$/, "");
|
|
return `${url}.md`;
|
|
}
|
|
|
|
function copyMarkdown() {
|
|
fetch(getCurrentPlaintextUrl())
|
|
.then((response) => response.text())
|
|
.then((text) => {
|
|
navigator.clipboard.writeText(text).then(() => {
|
|
const button = document.querySelector(
|
|
'[marlin-action="copy-markdown-button"]',
|
|
);
|
|
if (!button) return;
|
|
|
|
const icons = button.querySelectorAll(".icon-svg");
|
|
const copyIcon = icons[0];
|
|
const checkIcon = icons[1];
|
|
|
|
copyIcon.classList.add("hidden");
|
|
checkIcon.classList.remove("hidden");
|
|
|
|
setTimeout(() => {
|
|
copyIcon.classList.remove("hidden");
|
|
checkIcon.classList.add("hidden");
|
|
}, 2000);
|
|
});
|
|
})
|
|
.catch((err) => {
|
|
console.error("Error copying markdown:", err);
|
|
});
|
|
}
|
|
|
|
function viewPlainText() {
|
|
window.open(getCurrentPlaintextUrl(), "_blank");
|
|
}
|
|
|
|
function askGordon() {
|
|
if (window.Alpine && window.Alpine.store("gordon")) {
|
|
window.Alpine.store("gordon").toggle();
|
|
}
|
|
}
|
|
</script>
|