mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Highlighting now works with the web worker
This commit is contained in:
parent
8c960f0661
commit
13f07abb8a
10 changed files with 200 additions and 95 deletions
|
@ -215,4 +215,37 @@ Recipe.prototype.fromString = function(recipeStr) {
|
|||
this._parseConfig(recipeConfig);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generates a list of all the highlight functions assigned to operations in the recipe, if the
|
||||
* entire recipe supports highlighting.
|
||||
*
|
||||
* @returns {Object[]} highlights
|
||||
* @returns {function} highlights[].f
|
||||
* @returns {function} highlights[].b
|
||||
* @returns {Object[]} highlights[].args
|
||||
*/
|
||||
Recipe.prototype.generateHighlightList = function() {
|
||||
const highlights = [];
|
||||
|
||||
for (let i = 0; i < this.opList.length; i++) {
|
||||
let op = this.opList[i];
|
||||
if (op.isDisabled()) continue;
|
||||
|
||||
// If any breakpoints are set, do not attempt to highlight
|
||||
if (op.isBreakpoint()) return false;
|
||||
|
||||
// If any of the operations do not support highlighting, fail immediately.
|
||||
if (op.highlight === false || op.highlight === undefined) return false;
|
||||
|
||||
highlights.push({
|
||||
f: op.highlight,
|
||||
b: op.highlightReverse,
|
||||
args: op.getIngValues()
|
||||
});
|
||||
}
|
||||
|
||||
return highlights;
|
||||
};
|
||||
|
||||
export default Recipe;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue