Skip to content

Commit 6d764dd

Browse files
authored
Merge pull request #34 from comphy-lab/coderabbitai/docstrings/ed3c21a
📝 Add docstrings to `vs-branch-6`
2 parents bd54fbf + e4879f0 commit 6d764dd

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/assets/js/shortcut-key.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
document.addEventListener('DOMContentLoaded', function() {
22
// Platform detection is now handled by platform-utils.js
3-
// Update the displayed shortcut text is now handled by platform-utils.js
3+
/**
4+
* Dynamically loads a stylesheet into the document's head.
5+
*
6+
* Creates a <link> element with the specified URL, sets attributes necessary for secure loading,
7+
* and appends it to the document's head. If the stylesheet fails to load, an error is logged
8+
* to the console.
9+
*
10+
* @param {string} href - The URL of the stylesheet to be loaded.
11+
* @returns {HTMLLinkElement} The created and appended link element.
12+
*/
413

514
function loadStylesheet(href) {
615
const link = document.createElement('link');

assets/js/platform-utils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ function isMacPlatform() {
99
}
1010

1111
/**
12-
* Update UI elements based on platform (Mac vs non-Mac)
12+
* Updates UI elements to reflect the user's platform.
13+
*
14+
* This function determines whether the current platform is a Mac by calling `isMacPlatform()`
15+
* and adjusts the visibility of UI elements accordingly:
16+
* - Elements with the class `.default-theme-text` are hidden on Mac platforms.
17+
* - Elements with the class `.mac-theme-text` are shown on Mac platforms.
18+
* On non-Mac platforms, the visibility settings are reversed.
1319
*/
1420
function updatePlatformSpecificElements() {
1521
const isMac = isMacPlatform();

0 commit comments

Comments
 (0)