Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/src/main/assets/eruda.css
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ h2.eruda-title {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
> span {
.eruda-command,
.eruda-script {
padding: 0.3em;
margin: 0.3em;
border: 0.5px solid violet;
Expand Down
31 changes: 24 additions & 7 deletions app/src/main/assets/eruda.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,31 @@ eruda.Resources = class extends eruda.Resources {
}
refreshCommand() {
this._command = ChromeXt.commands.filter((m) => m.enabled);
const commands = this._command
.map(function (cmd, index) {
let title = cmd.title.toString();
if (typeof cmd.title == "function") {
title = cmd.title(index);
}
return `<span data-index=${index} class="${c("command")}">${title}</span>`;
const commands = Map.groupBy(this._command
.map(function (cmd, index) {
cmd["index"] = index;
return cmd;
}),
function (cmd) {
return cmd.id
})
.entries()
.map(function (entry) {
let cmds = entry[1]
.map(function (cmd) {
let title = cmd.title.toString();
if (typeof cmd.title == "function") {
title = cmd.title(cmd.index);
}
return `<span data-index="${cmd.index}" class="${c("command")}">${title}</span>`;
})
.join("")
return `<div class="${c("command-group")}">` +
`<h3 class="${c("title")}">${entry[0].split(':').at(-1)}</h3>` +
`${cmds}` +
`</div>`;
})
.toArray()
.join("");
this._$command.html(
`<h2 class="${c("title")}">UserScript Commands</h2>` +
Expand Down