Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat #22

Merged
merged 2 commits into from
Nov 20, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/publish-handbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: "3.x"
cache: "pip"

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name (e.g., v0.0.0)'
description: "Tag name (e.g., v0.0.0)"
required: true
type: string
publish_tag:
description: 'Publish new tag'
description: "Publish new tag"
required: true
type: boolean
default: true
publish_release:
description: 'Publish new release'
description: "Publish new release"
required: true
type: boolean
default: true
Expand Down
63 changes: 45 additions & 18 deletions docs/overrides/javascript/extra.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
// Apply theme based on user preference
const applyTheme = (isDark) => {
document.body.setAttribute("data-md-color-scheme", isDark ? "slate" : "default");
document.body.setAttribute("data-md-color-primary", isDark ? "black" : "indigo");
document.body.setAttribute(
"data-md-color-scheme",
isDark ? "slate" : "default",
);
document.body.setAttribute(
"data-md-color-primary",
isDark ? "black" : "indigo",
);
};

// Check and apply auto theme
const checkAutoTheme = () => {
const supportedLangCodes = ["en", "zh", "ko", "ja", "ru", "de", "fr", "es", "pt", "it", "tr", "vi", "ar"];
const supportedLangCodes = [
"en",
"zh",
"ko",
"ja",
"ru",
"de",
"fr",
"es",
"pt",
"it",
"tr",
"vi",
"ar",
];
const langCode = window.location.pathname.split("/")[1];
const localStorageKey = `${supportedLangCodes.includes(langCode) ? `/${langCode}` : ""}/.__palette`;
const palette = JSON.parse(localStorage.getItem(localStorageKey) || "{}");
Expand All @@ -33,20 +53,26 @@ document.addEventListener("DOMContentLoaded", () => {

// Iframe navigation
window.onhashchange = () => {
window.parent.postMessage({
type: 'navigation',
hash: window.location.pathname + window.location.search + window.location.hash
}, '*');
window.parent.postMessage(
{
type: "navigation",
hash:
window.location.pathname +
window.location.search +
window.location.hash,
},
"*",
);
};

// Add Inkeep button
// Add Inkeep button
document.addEventListener("DOMContentLoaded", () => {
const inkeepScript = document.createElement("script");
inkeepScript.src = "https://unpkg.com/@inkeep/[email protected].11/dist/embed.js";
inkeepScript.src = "https://unpkg.com/@inkeep/[email protected].18/dist/embed.js";
inkeepScript.type = "module";
inkeepScript.defer = true;
document.head.appendChild(inkeepScript);

// Configure and initialize the widget
const addInkeepWidget = () => {
const inkeepWidget = Inkeep().embed({
Expand Down Expand Up @@ -83,34 +109,35 @@ document.addEventListener("DOMContentLoaded", () => {
},
aiChatSettings: {
chatSubjectName: "Ultralytics",
botAvatarSrcUrl: "https://storage.googleapis.com/organization-image-assets/ultralytics-botAvatarSrcUrl-1729379860806.svg",
botAvatarSrcUrl:
"https://storage.googleapis.com/organization-image-assets/ultralytics-botAvatarSrcUrl-1729379860806.svg",
quickQuestions: [
"What's new in Ultralytics YOLO11?",
"How can I get started with Ultralytics HUB?",
"How does Ultralytics Enterprise Licensing work?"
"How does Ultralytics Enterprise Licensing work?",
],
getHelpCallToActions: [
{
name: "Ask on Ultralytics GitHub",
url: "https://github.com/ultralytics/ultralytics",
icon: {
builtIn: "FaGithub"
}
builtIn: "FaGithub",
},
},
{
name: "Ask on Ultralytics Discourse",
url: "https://community.ultralytics.com/",
icon: {
builtIn: "FaDiscourse"
}
builtIn: "FaDiscourse",
},
},
{
name: "Ask on Ultralytics Discord",
url: "https://discord.com/invite/ultralytics",
icon: {
builtIn: "FaDiscord"
}
}
builtIn: "FaDiscord",
},
},
],
},
},
Expand Down
79 changes: 40 additions & 39 deletions docs/overrides/partials/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,51 @@
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>

<!-- Insert Giscus code snippet from https://giscus.app/ here -->
<script async
crossorigin="anonymous"
data-emit-metadata="0"
data-input-position="top"
data-lang="en"
data-loading="lazy"
data-mapping="pathname"
data-reactions-enabled="1"
data-repo="ultralytics/handbook"
data-repo-id="R_kgDOM_shTw"
data-category="General"
data-category-id="DIC_kwDOM_shT84CjVFQ"
data-strict="1"
data-theme="preferred_color_scheme"
src="https://giscus.app/client.js">
</script>
<script
async
crossorigin="anonymous"
data-emit-metadata="0"
data-input-position="top"
data-lang="en"
data-loading="lazy"
data-mapping="pathname"
data-reactions-enabled="1"
data-repo="ultralytics/handbook"
data-repo-id="R_kgDOM_shTw"
data-category="General"
data-category-id="DIC_kwDOM_shT84CjVFQ"
data-strict="1"
data-theme="preferred_color_scheme"
src="https://giscus.app/client.js"
></script>

<!-- Synchronize Giscus theme with palette -->
<script>
var giscus = document.querySelector("script[src*=giscus]")
var giscus = document.querySelector("script[src*=giscus]");

/* Set palette on initial load */
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
giscus.setAttribute("data-theme", theme)
}
/* Set palette on initial load */
var palette = __md_get("__palette");
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light";
giscus.setAttribute("data-theme", theme);
}

/* Register event handlers after documented loaded */
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
ref.addEventListener("change", function() {
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
/* Register event handlers after documented loaded */
document.addEventListener("DOMContentLoaded", function () {
var ref = document.querySelector("[data-md-component=palette]");
ref.addEventListener("change", function () {
var palette = __md_get("__palette");
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light";

/* Instruct Giscus to change theme */
var frame = document.querySelector(".giscus-frame")
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app"
)
}
})
})
/* Instruct Giscus to change theme */
var frame = document.querySelector(".giscus-frame");
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app",
);
}
});
});
</script>
{% endif %}