mirror of
https://github.com/gchq/CyberChef
synced 2024-12-29 14:03:10 +00:00
Added operation counts to categories and ops list with option to hide by default for categories.
This commit is contained in:
parent
bbebba6481
commit
57c8c6dbc6
8 changed files with 45 additions and 2 deletions
|
@ -42,6 +42,9 @@ class HTMLCategory {
|
|||
let html = `<div class="panel category">
|
||||
<a class="category-title" data-toggle="collapse" data-target="#${catName}">
|
||||
${this.name}
|
||||
<span class="op-count hidden">
|
||||
${this.opList.length}
|
||||
</span>
|
||||
</a>
|
||||
<div id="${catName}" class="panel-collapse collapse ${(this.selected ? " show" : "")}" data-parent="#categories">
|
||||
<ul class="op-list">`;
|
||||
|
|
|
@ -229,6 +229,7 @@ class Manager {
|
|||
this.addDynamicListener(".option-item input[type=checkbox]", "change", this.options.switchChange, this.options);
|
||||
this.addDynamicListener(".option-item input[type=checkbox]#wordWrap", "change", this.options.setWordWrap, this.options);
|
||||
this.addDynamicListener(".option-item input[type=checkbox]#useMetaKey", "change", this.bindings.updateKeybList, this.bindings);
|
||||
this.addDynamicListener(".option-item input[type=checkbox]#showCatCount", "change", this.ops.setCatCount, this.ops);
|
||||
this.addDynamicListener(".option-item input[type=number]", "keyup", this.options.numberChange, this.options);
|
||||
this.addDynamicListener(".option-item input[type=number]", "change", this.options.numberChange, this.options);
|
||||
this.addDynamicListener(".option-item select", "change", this.options.selectChange, this.options);
|
||||
|
|
|
@ -171,6 +171,7 @@
|
|||
<div id="operations" class="split split-horizontal no-select">
|
||||
<div class="title no-select" data-help-title="Operations list" data-help="<p>The Operations list contains all the operations in CyberChef arranged into categories. Some operations may be present in multiple categories. You can search for operations using the search box.</p><p>To use an operation, either double click it, or drag it into the Recipe pane. You will then be able to configure its arguments (or 'Ingredients' in CyberChef terminology).</p>">
|
||||
Operations
|
||||
<span class="op-count"></span>
|
||||
</div>
|
||||
<input id="search" type="search" class="form-control" placeholder="Search..." autocomplete="off" tabindex="2" data-help-title="Searching for operations" data-help="<p>Use the search box to find useful operations.</p><p>Both operation names and descriptions are queried using a fuzzy matching algorithm.</p>">
|
||||
<ul id="search-results" class="op-list"></ul>
|
||||
|
@ -521,6 +522,13 @@
|
|||
Keep the current tab in sync between the input and output
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox option-item">
|
||||
<label for="showCatCount">
|
||||
<input type="checkbox" option="showCatCount" id="showCatCount">
|
||||
Show the number of operations in each category
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" id="reset-options">Reset options to default</button>
|
||||
|
|
|
@ -51,7 +51,8 @@ function main() {
|
|||
logLevel: "info",
|
||||
autoMagic: true,
|
||||
imagePreview: true,
|
||||
syncTabs: true
|
||||
syncTabs: true,
|
||||
showCatCount: false,
|
||||
};
|
||||
|
||||
document.removeEventListener("DOMContentLoaded", main, false);
|
||||
|
|
|
@ -40,4 +40,13 @@
|
|||
margin: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.op-count {
|
||||
float: right;
|
||||
color: var(--subtext-font-colour);
|
||||
font-weight: normal;
|
||||
font-size: xx-small;
|
||||
opacity: 0.5;
|
||||
padding-left: .5em;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,10 @@ body {
|
|||
line-height: 0;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.blur {
|
||||
color: transparent !important;
|
||||
text-shadow: rgba(0, 0, 0, 0.95) 0 0 10px !important;
|
||||
|
|
|
@ -168,6 +168,10 @@ class OperationsWaiter {
|
|||
*/
|
||||
opListCreate(e) {
|
||||
this.manager.recipe.createSortableSeedList(e.target);
|
||||
|
||||
// Populate ops total
|
||||
document.querySelector("#operations .title .op-count").innerText = Object.keys(this.app.operations).length;
|
||||
|
||||
this.enableOpsListPopovers(e.target);
|
||||
}
|
||||
|
||||
|
@ -293,6 +297,18 @@ class OperationsWaiter {
|
|||
this.app.resetFavourites();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether operation counts are displayed next to a category title
|
||||
*/
|
||||
setCatCount() {
|
||||
if (this.app.options.showCatCount) {
|
||||
document.querySelectorAll(".category-title .op-count").forEach(el => el.classList.remove("hidden"));
|
||||
} else {
|
||||
document.querySelectorAll(".category-title .op-count").forEach(el => el.classList.add("hidden"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default OperationsWaiter;
|
||||
|
|
|
@ -50,6 +50,7 @@ class OptionsWaiter {
|
|||
|
||||
// Initialise options
|
||||
this.setWordWrap();
|
||||
this.manager.ops.setCatCount();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue