mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-25 17:26:17 -04:00
Added more help topics and added filetype detection to the 'save output' button
This commit is contained in:
parent
4c7fe147bc
commit
7419009745
3 changed files with 63 additions and 40 deletions
|
@ -270,23 +270,36 @@ class BindingsWaiter {
|
|||
* Shows contextual help message based on where the mouse pointer is
|
||||
*/
|
||||
contextualHelp() {
|
||||
const hoveredHelpEls = document.querySelectorAll(":hover[data-help]");
|
||||
const hoveredHelpEls = document.querySelectorAll(":hover[data-help],:hover[data-help-proxy]");
|
||||
if (!hoveredHelpEls.length) return;
|
||||
|
||||
if (hoveredHelpEls.length) {
|
||||
const helpEl = hoveredHelpEls[hoveredHelpEls.length - 1],
|
||||
helpText = helpEl.getAttribute("data-help");
|
||||
let helpTitle = helpEl.getAttribute("data-help-title");
|
||||
|
||||
if (helpTitle)
|
||||
helpTitle = "<span class='text-muted'>Help topic:</span> " + helpTitle;
|
||||
else
|
||||
helpTitle = "<span class='text-muted'>Help topic</span>";
|
||||
|
||||
document.querySelector("#help-modal .modal-body").innerHTML = helpText;
|
||||
document.querySelector("#help-modal #help-title").innerHTML = helpTitle;
|
||||
|
||||
$("#help-modal").modal();
|
||||
let helpEl = hoveredHelpEls[hoveredHelpEls.length - 1];
|
||||
const helpElSelector = helpEl.getAttribute("data-help-proxy");
|
||||
if (helpElSelector) {
|
||||
// A hovered element is directing us to another element for its help text
|
||||
helpEl = document.querySelector(helpElSelector);
|
||||
}
|
||||
this.displayHelp(helpEl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the help pane populated with help text associated with the given element
|
||||
*
|
||||
* @param {Element} el
|
||||
*/
|
||||
displayHelp(el) {
|
||||
const helpText = el.getAttribute("data-help");
|
||||
let helpTitle = el.getAttribute("data-help-title");
|
||||
|
||||
if (helpTitle)
|
||||
helpTitle = "<span class='text-muted'>Help topic:</span> " + helpTitle;
|
||||
else
|
||||
helpTitle = "<span class='text-muted'>Help topic</span>";
|
||||
|
||||
document.querySelector("#help-modal .modal-body").innerHTML = helpText;
|
||||
document.querySelector("#help-modal #help-title").innerHTML = helpTitle;
|
||||
|
||||
$("#help-modal").modal();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue