Skip to content

Commit

Permalink
Refactor code by adding trailing commas in multiple JavaScript files
Browse files Browse the repository at this point in the history
This commit includes the addition of trailing commas in function calls and methods in multiple JavaScript files. This formatting change leads to more readable and more version control friendly code.
  • Loading branch information
reatlat committed Apr 13, 2024
1 parent 15c4004 commit d722ab7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ window.addEventListener("DOMContentLoaded", () => {
if (entry.isIntersecting) {
// load the script
asyncLoadScripts(
"//cpwebassets.codepen.io/assets/embed/ei.js"
"//cpwebassets.codepen.io/assets/embed/ei.js",
);
// stop observing
codepenObserver.disconnect();
Expand All @@ -49,7 +49,7 @@ window.addEventListener("DOMContentLoaded", () => {
const target = event.target.getAttribute("href");
// copy the target to the clipboard
navigator.clipboard.writeText(
location.origin + location.pathname + target
location.origin + location.pathname + target,
);
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/assets/js/modules/Alpine.data/DOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default () => {
localStorage.setItem("theme", this.theme.name);
document.documentElement.setAttribute(
"data-theme",
this.theme.name
this.theme.name,
);
},

Expand All @@ -46,7 +46,7 @@ export default () => {
document.documentElement.classList.remove("dark");
document.documentElement.setAttribute(
"data-theme",
this.getThemeName()
this.getThemeName(),
);
},
};
Expand Down
24 changes: 12 additions & 12 deletions src/assets/js/modules/_detectColorScheme.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = () => {
if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
) {
return "dark";
} else if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: light)").matches
) {
return "light";
}
return "no_preference";
if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
) {
return "dark";
} else if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: light)").matches
) {
return "light";
}
return "no_preference";
};
2 changes: 1 addition & 1 deletion src/assets/js/modules/_getSearchParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = (param = false, url = false) => {
/[?&]+([^=&]+)=?([^&]*)?/gi,
(m, key, value) => {
vars[key] = value !== void 0 ? value : "";
}
},
);

if (param) {
Expand Down

0 comments on commit d722ab7

Please sign in to comment.