mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-06 14:37:11 -04:00
rewrite comments for handlers
This commit is contained in:
parent
068811a6bf
commit
1b877ca482
2 changed files with 13 additions and 7 deletions
|
@ -148,7 +148,7 @@ class Manager {
|
||||||
document.getElementById("edit-favourites").addEventListener("click", this.ops.editFavouritesClick.bind(this.ops));
|
document.getElementById("edit-favourites").addEventListener("click", this.ops.editFavouritesClick.bind(this.ops));
|
||||||
document.getElementById("save-favourites").addEventListener("click", this.ops.saveFavouritesClick.bind(this.ops));
|
document.getElementById("save-favourites").addEventListener("click", this.ops.saveFavouritesClick.bind(this.ops));
|
||||||
document.getElementById("categories").addEventListener("keydown", this.ops.onKeyPress.bind(this.ops));
|
document.getElementById("categories").addEventListener("keydown", this.ops.onKeyPress.bind(this.ops));
|
||||||
this.addDynamicListener(".op-list li.operation","keydown", this.ops.ddlEnter.bind(this.ops));
|
this.addDynamicListener(".op-list li.operation","keydown", this.ops.operationPopulateRecipe.bind(this.ops));
|
||||||
document.getElementById("reset-favourites").addEventListener("click", this.ops.resetFavouritesClick.bind(this.ops));
|
document.getElementById("reset-favourites").addEventListener("click", this.ops.resetFavouritesClick.bind(this.ops));
|
||||||
this.addDynamicListener(".op-list", "oplistcreate", this.ops.opListCreate, this.ops);
|
this.addDynamicListener(".op-list", "oplistcreate", this.ops.opListCreate, this.ops);
|
||||||
this.addDynamicListener("li.operation", "operationadd", this.recipe.opAdd, this.recipe);
|
this.addDynamicListener("li.operation", "operationadd", this.recipe.opAdd, this.recipe);
|
||||||
|
|
|
@ -284,7 +284,8 @@ class OperationsWaiter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for Enter/Space events.
|
* Handler for on key press events.
|
||||||
|
* Get the children of categories and add event listener to them.
|
||||||
*/
|
*/
|
||||||
onKeyPress() {
|
onKeyPress() {
|
||||||
let cat = document.getElementById("categories");
|
let cat = document.getElementById("categories");
|
||||||
|
@ -295,8 +296,8 @@ class OperationsWaiter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for Enter/Space events.
|
* Handler for keyboard enter/space events.
|
||||||
* When "Enter" or "Space" if pressed it will mimick the click function and open the operations panels .
|
* Uses "Enter" or "Space" to mimick the click function and open the operations panels .
|
||||||
* @param {Event} ev
|
* @param {Event} ev
|
||||||
*/
|
*/
|
||||||
EventHandler(ev){
|
EventHandler(ev){
|
||||||
|
@ -313,20 +314,25 @@ class OperationsWaiter {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
operationDblEnter(){
|
/**
|
||||||
|
* Handler to populate recipe.
|
||||||
|
* Get the children of op-list and add event listener to them.
|
||||||
|
*/
|
||||||
|
operationPopulateRecipe(){
|
||||||
let cat = document.querySelectorAll(".op-list li.operation");
|
let cat = document.querySelectorAll(".op-list li.operation");
|
||||||
console.log("cat=" , cat);
|
console.log("cat=" , cat);
|
||||||
for(let i = 0; i < cat.children.length; i++){
|
for(let i = 0; i < cat.children.length; i++){
|
||||||
cat.children[i].addEventListener("keydown", this.ddlEnter, false);
|
cat.children[i].addEventListener("keydown", this.keysPopulateRecipe, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler to add operators to recipe with keyboard.
|
* Handler to add operators to recipe with keyboard.
|
||||||
|
* Uses keyboard shortcut "CTRl + Enter" to mimick operationDblClick handler function
|
||||||
* @param {Event} ev
|
* @param {Event} ev
|
||||||
*/
|
*/
|
||||||
ddlEnter(ev){
|
keysPopulateRecipe(ev){
|
||||||
if(ev.ctrlKey && ev.key ==="Enter"){
|
if(ev.ctrlKey && ev.key ==="Enter"){
|
||||||
const li = ev.target
|
const li = ev.target
|
||||||
this.manager.recipe.addOperation(li.textContent);
|
this.manager.recipe.addOperation(li.textContent);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue