mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Fix setting the CTFd theme color (#1482)
* Fix setting the CTFd theme color in the Admin Panel by properly getting the current theme header value
This commit is contained in:
@@ -231,19 +231,25 @@ function insertTimezones(target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(() => {
|
$(() => {
|
||||||
CodeMirror.fromTextArea(document.getElementById("theme-header"), {
|
const theme_header_editor = CodeMirror.fromTextArea(
|
||||||
|
document.getElementById("theme-header"),
|
||||||
|
{
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
mode: "htmlmixed",
|
mode: "htmlmixed",
|
||||||
htmlMode: true
|
htmlMode: true
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
CodeMirror.fromTextArea(document.getElementById("theme-footer"), {
|
const theme_footer_editor = CodeMirror.fromTextArea(
|
||||||
|
document.getElementById("theme-footer"),
|
||||||
|
{
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
mode: "htmlmixed",
|
mode: "htmlmixed",
|
||||||
htmlMode: true
|
htmlMode: true
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
insertTimezones($("#start-timezone"));
|
insertTimezones($("#start-timezone"));
|
||||||
insertTimezones($("#end-timezone"));
|
insertTimezones($("#end-timezone"));
|
||||||
@@ -256,7 +262,7 @@ $(() => {
|
|||||||
$("#import-button").click(importConfig);
|
$("#import-button").click(importConfig);
|
||||||
$("#config-color-update").click(function() {
|
$("#config-color-update").click(function() {
|
||||||
const hex_code = $("#config-color-picker").val();
|
const hex_code = $("#config-color-picker").val();
|
||||||
const user_css = $("#theme-header").val();
|
const user_css = theme_header_editor.getValue();
|
||||||
let new_css;
|
let new_css;
|
||||||
if (user_css.length) {
|
if (user_css.length) {
|
||||||
let css_vars = `theme-color: ${hex_code};`;
|
let css_vars = `theme-color: ${hex_code};`;
|
||||||
@@ -269,7 +275,7 @@ $(() => {
|
|||||||
`.jumbotron{background-color: var(--theme-color) !important;}\n` +
|
`.jumbotron{background-color: var(--theme-color) !important;}\n` +
|
||||||
`</style>\n`;
|
`</style>\n`;
|
||||||
}
|
}
|
||||||
$("#theme-header").val(new_css);
|
theme_header_editor.getDoc().setValue(new_css);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".start-date").change(function() {
|
$(".start-date").change(function() {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user