mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-15 10:36:52 -04:00
Merge branch 'master' into push-input-through-postmessage
This commit is contained in:
commit
85a3a18570
34 changed files with 4499 additions and 538 deletions
|
@ -160,18 +160,37 @@ class OptionsWaiter {
|
|||
|
||||
// Update theme selection
|
||||
const themeSelect = document.getElementById("theme");
|
||||
themeSelect.selectedIndex = themeSelect.querySelector(`option[value="${theme}"`).index;
|
||||
let themeOption = themeSelect.querySelector(`option[value="${theme}"]`);
|
||||
|
||||
if (!themeOption) {
|
||||
const preferredColorScheme = this.getPreferredColorScheme();
|
||||
document.querySelector(":root").className = preferredColorScheme;
|
||||
themeOption = themeSelect.querySelector(`option[value="${preferredColorScheme}"]`);
|
||||
}
|
||||
|
||||
themeSelect.selectedIndex = themeOption.index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the user's preferred color scheme using the `prefers-color-scheme` media query.
|
||||
*/
|
||||
applyPreferredColorScheme() {
|
||||
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
const theme = prefersDarkScheme ? "dark" : "classic";
|
||||
const themeFromStorage = this.app?.options?.theme;
|
||||
let theme = themeFromStorage;
|
||||
if (!theme) {
|
||||
theme = this.getPreferredColorScheme();
|
||||
}
|
||||
this.changeTheme(theme);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user's preferred color scheme using the `prefers-color-scheme` media query.
|
||||
*/
|
||||
getPreferredColorScheme() {
|
||||
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
return prefersDarkScheme ? "dark" : "classic";
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the console logging level.
|
||||
*
|
||||
|
|
|
@ -8,6 +8,7 @@ import HTMLOperation from "../HTMLOperation.mjs";
|
|||
import Sortable from "sortablejs";
|
||||
import Utils from "../../core/Utils.mjs";
|
||||
import {escapeControlChars} from "../utils/editorUtils.mjs";
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -435,7 +436,9 @@ class RecipeWaiter {
|
|||
const item = document.createElement("li");
|
||||
|
||||
item.classList.add("operation");
|
||||
item.innerHTML = name;
|
||||
const clean = DOMPurify.sanitize(name);
|
||||
item.innerHTML = clean;
|
||||
|
||||
this.buildRecipeOperation(item);
|
||||
document.getElementById("rec-list").appendChild(item);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue