mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-10 09:24:49 +00:00
display shortcuts in the menu
This commit is contained in:
parent
1db3b504ec
commit
062f95f7c9
2 changed files with 42 additions and 9 deletions
|
@ -30,7 +30,7 @@
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 8px 0;
|
padding: 4px 0;
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
@ -119,6 +119,10 @@
|
||||||
#includeStyleCheck {
|
#includeStyleCheck {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
.shortcut {
|
||||||
|
font-size: 10px;
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -138,11 +142,23 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<button id="savePage" type="button" name="button"></button>
|
<button id="savePage" type="button" name="button">
|
||||||
<button id="saveSelection" type="button" name="button"></button>
|
<div id="savePageLabel"></div>
|
||||||
|
<div id="savePageShortcut" class="shortcut"></div>
|
||||||
|
</button>
|
||||||
|
<button id="saveSelection" type="button" name="button">
|
||||||
|
<div id="saveSelectionLabel"></div>
|
||||||
|
<div id="saveSelectionShortcut" class="shortcut"></div>
|
||||||
|
</button>
|
||||||
<hr/>
|
<hr/>
|
||||||
<button id="pageChapter" type="button" name="button"></button>
|
<button id="pageChapter" type="button" name="button">
|
||||||
<button id="selectionChapter" type="button" name="button"></button>
|
<div id="pageChapterLabel"></div>
|
||||||
|
<div id="pageChapterShortcut" class="shortcut"></div>
|
||||||
|
</button>
|
||||||
|
<button id="selectionChapter" type="button" name="button">
|
||||||
|
<div id="selectionChapterLabel"></div>
|
||||||
|
<div id="selectionChapterShortcut" class="shortcut"></div>
|
||||||
|
</button>
|
||||||
<hr/>
|
<hr/>
|
||||||
<button id="editChapters" type="button" name="button"></button>
|
<button id="editChapters" type="button" name="button"></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,10 +9,10 @@ document.getElementById('includeStyle').innerHTML = chrome.i18n.getMessage('incl
|
||||||
document.getElementById('styleLabel').innerHTML = chrome.i18n.getMessage('styleLabel');
|
document.getElementById('styleLabel').innerHTML = chrome.i18n.getMessage('styleLabel');
|
||||||
document.getElementById('applyStyle').innerHTML = chrome.i18n.getMessage('applyStyle');
|
document.getElementById('applyStyle').innerHTML = chrome.i18n.getMessage('applyStyle');
|
||||||
document.getElementById('editStyles').innerHTML = chrome.i18n.getMessage('editStyles');
|
document.getElementById('editStyles').innerHTML = chrome.i18n.getMessage('editStyles');
|
||||||
document.getElementById('savePage').innerHTML = chrome.i18n.getMessage('savePage');
|
document.getElementById('savePageLabel').innerHTML = chrome.i18n.getMessage('savePage');
|
||||||
document.getElementById('saveSelection').innerHTML = chrome.i18n.getMessage('saveSelection');
|
document.getElementById('saveSelectionLabel').innerHTML = chrome.i18n.getMessage('saveSelection');
|
||||||
document.getElementById('pageChapter').innerHTML = chrome.i18n.getMessage('pageChapter');
|
document.getElementById('pageChapterLabel').innerHTML = chrome.i18n.getMessage('pageChapter');
|
||||||
document.getElementById('selectionChapter').innerHTML = chrome.i18n.getMessage('selectionChapter');
|
document.getElementById('selectionChapterLabel').innerHTML = chrome.i18n.getMessage('selectionChapter');
|
||||||
document.getElementById('editChapters').innerHTML = chrome.i18n.getMessage('editChapters');
|
document.getElementById('editChapters').innerHTML = chrome.i18n.getMessage('editChapters');
|
||||||
document.getElementById('waitMessage').innerHTML = chrome.i18n.getMessage('waitMessage');
|
document.getElementById('waitMessage').innerHTML = chrome.i18n.getMessage('waitMessage');
|
||||||
|
|
||||||
|
@ -244,3 +244,20 @@ document.getElementById('pageChapter').onclick = function() {
|
||||||
document.getElementById('selectionChapter').onclick = function() {
|
document.getElementById('selectionChapter').onclick = function() {
|
||||||
dispatch('extract-selection', true);
|
dispatch('extract-selection', true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// get all shortcuts and display them in the menuTitle
|
||||||
|
chrome.commands.getAll((commands) => {
|
||||||
|
for (let command of commands) {
|
||||||
|
if (command.name === 'save-page') {
|
||||||
|
document.getElementById('savePageShortcut').appendChild(document.createTextNode(command.shortcut));
|
||||||
|
} else if (command.name === 'save-selection') {
|
||||||
|
document.getElementById('saveSelectionShortcut').appendChild(document.createTextNode(command.shortcut));
|
||||||
|
} else if (command.name === 'add-page') {
|
||||||
|
document.getElementById('pageChapterShortcut').appendChild(document.createTextNode(command.shortcut));
|
||||||
|
} else if (command.name === 'add-selection') {
|
||||||
|
document.getElementById('selectionChapterShortcut').appendChild(document.createTextNode(command.shortcut));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
console.log('ALl commands', commands);
|
||||||
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue