mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-23 07:04:27 +01:00
Squashed 'CTFd/themes/core-beta/' changes from 9126d77d..5ce3003b
5ce3003b Merge pull request #47 from aCursedComrade/patch-1 c9887cb1 Fix team template git-subtree-dir: CTFd/themes/core-beta git-subtree-split: 5ce3003b4d68352e629ee2d390bc999e7d6b071e
This commit is contained in:
12
assets/js/theme/highlight.js
Normal file
12
assets/js/theme/highlight.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import CTFd from "../index";
|
||||
import lolight from "lolight";
|
||||
|
||||
export default () => {
|
||||
if (
|
||||
// default to true if config is not defined yet
|
||||
!CTFd.config.themeSettings.hasOwnProperty("use_builtin_code_highlighter") ||
|
||||
CTFd.config.themeSettings.use_builtin_code_highlighter === true
|
||||
) {
|
||||
lolight("pre code");
|
||||
}
|
||||
};
|
||||
27
assets/js/theme/styles.js
Normal file
27
assets/js/theme/styles.js
Normal file
@@ -0,0 +1,27 @@
|
||||
export default () => {
|
||||
document.querySelectorAll(".form-control").forEach($el => {
|
||||
$el.addEventListener("onfocus", () => {
|
||||
$el.classList.remove("input-filled-invalid");
|
||||
$el.classList.add("input-filled-valid");
|
||||
});
|
||||
|
||||
$el.addEventListener("onblur", () => {
|
||||
if ($el.nodeValue === "") {
|
||||
$el.classList.remove("input-filled-valid");
|
||||
$el.classList.remove("input-filled-invalid");
|
||||
}
|
||||
});
|
||||
|
||||
if ($el.nodeValue) {
|
||||
$el.classList.add("input-filled-valid");
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll(".page-select").forEach($el => {
|
||||
if ($el.nodeValue) {
|
||||
const url = new URL(window.location);
|
||||
url.searchParams.set("page", $el.nodeValue);
|
||||
window.location.href = url.toString();
|
||||
}
|
||||
});
|
||||
};
|
||||
12
assets/js/theme/times.js
Normal file
12
assets/js/theme/times.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import dayjs from "dayjs";
|
||||
import advancedFormat from "dayjs/plugin/advancedFormat";
|
||||
|
||||
dayjs.extend(advancedFormat);
|
||||
|
||||
export default () => {
|
||||
document.querySelectorAll("[data-time]").forEach($el => {
|
||||
const time = $el.getAttribute("data-time");
|
||||
const format = $el.getAttribute("data-time-format") || "MMMM Do, h:mm:ss A";
|
||||
$el.innerText = dayjs(time).format(format);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user