mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 15:56:16 -04:00
Downloadble version is now a .zip file instead of a single .htm file
This commit is contained in:
parent
b3ae0e577a
commit
8f450501cc
9 changed files with 631 additions and 433 deletions
|
@ -178,7 +178,7 @@ self.loadRequiredModules = function(recipeConfig) {
|
|||
if (!OpModules.hasOwnProperty(module)) {
|
||||
log.info(`Loading ${module} module`);
|
||||
self.sendStatusMessage(`Loading ${module} module`);
|
||||
self.importScripts(`${self.docURL}/${module}.js`);
|
||||
self.importScripts(`${self.docURL}/modules/${module}.js`);
|
||||
self.sendStatusMessage("");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -230,6 +230,7 @@ function regexHighlight (input, regex, displayTotal) {
|
|||
title = "",
|
||||
hl = 1,
|
||||
total = 0;
|
||||
const captureGroups = [];
|
||||
|
||||
output = input.replace(regex, (match, ...args) => {
|
||||
args.pop(); // Throw away full string
|
||||
|
@ -247,9 +248,15 @@ function regexHighlight (input, regex, displayTotal) {
|
|||
// Switch highlight
|
||||
hl = hl === 1 ? 2 : 1;
|
||||
|
||||
total++;
|
||||
// Store highlighted match and replace with a placeholder
|
||||
captureGroups.push(`<span class='hl${hl}' title='${title}'>${Utils.escapeHtml(match)}</span>`);
|
||||
return `[cc_capture_group_${total++}]`;
|
||||
});
|
||||
|
||||
return `<span class='hl${hl}' title='${title}'>${Utils.escapeHtml(match)}</span>`;
|
||||
// Safely escape all remaining text, then replace placeholders
|
||||
output = Utils.escapeHtml(output);
|
||||
output = output.replace(/\[cc_capture_group_(\d+)\]/g, (_, i) => {
|
||||
return captureGroups[i];
|
||||
});
|
||||
|
||||
if (displayTotal)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue