diff --git a/main.js b/main.js
index 94c44c48056acbda016942b9413bdaa62dbc508b..45f6ba80a20fb3bd7b4947e52af0c008c9429a1d 100644
--- a/main.js
+++ b/main.js
@@ -12,7 +12,7 @@ function loadEditor() {
editor.setTheme("ace/theme/tomorrow_night");
editor.session.setMode("ace/mode/css");
const langTools = ace.require('ace/ext/language_tools');
-
+
const cssTemplate = {
getCompletions: (editor, session, pos, prefix, callback) => {
// note, won't fire if caret is at a word that does not have these letters
@@ -35,6 +35,7 @@ function loadEditor() {
{ value: '[onset:A]', score: 1, meta: 'Audio note A' },
{ value: '[onset:A#]', score: 1, meta: 'Audio note A#' },
{ value: '[onset:B]', score: 1, meta: 'Audio note B' },
+ { value: '[attack]', score: 1, meta: 'Audio attack' },
{ value: '[note:24,0,1]', score: 1, meta: 'MIDI Note C between 0 and 1.' },
{ value: '[note:26,0,1]', score: 1, meta: 'MIDI Note D between 0 and 1.' },
{ value: '[note:28,0,1]', score: 1, meta: 'MIDI Note E between 0 and 1.' },
@@ -148,6 +149,46 @@ $('#save').on('click', function () {
updateCss();
});
+$(document).keydown(function (event) {
+ // If Control or Command key is pressed and the S key is pressed
+ // run save function. 83 is the key code for S.
+ if ((event.ctrlKey || event.metaKey) && event.which == 83) {
+ // Save Function
+ event.preventDefault();
+ updateCss();
+ return false;
+ }
+}
+);
+$(document).keydown(function (event) {
+ // If Control or Command key is pressed and the S key is pressed
+ // run save function. 83 is the key code for S.
+ if ((event.ctrlKey || event.metaKey) && event.which == 79) {
+ // Save Function
+ event.preventDefault();
+ activateButton = !activateButton;
+ chrome.storage.sync.set({ activate: activateButton }, function () {
+ if (activateButton) {
+ $('#onOff').text('Désactiver');
+ var API = chrome || browser;
+ API.tabs.query({ active: true, currentWindow: true }, function (tabs) {
+ if (tabs[0] && tabs[0].favIconUrl) {
+ chrome.storage.sync.set({ activateFav: tabs[0].favIconUrl });
+ }
+ });
+ } else {
+ $('#onOff').text('Activer');
+ }
+ chrome.tabs.query({ active: true, currentWindow: true },
+ function (tabs) {
+ chrome.tabs.sendMessage(tabs[0].id, { type: 'start', data: activateButton });
+ }
+ );
+ });
+ return false;
+ }
+}
+);
$('#onOff').on('click', function () {
activateButton = !activateButton;
diff --git a/popup.html b/popup.html
index 9d79d0c43b9d51d9df8cd0c6ffdc175350d77798..6a2967ba87722f9d7023ea5cdaf2fbb13de493bb 100644
--- a/popup.html
+++ b/popup.html
@@ -15,8 +15,8 @@
Audio : <div class="audioI"></div>
</div>
<div class="actions">
- <button id="onOff">Activer</button>
- <button id="save">Enregister</button>
+ <button id="onOff">Activer<br><kbd>CTR</kbd> + <kbd>O</kbd></button>
+ <button id="save">Enregister<br><kbd>CTR</kbd> + <kbd>S</kbd></button>
<p>Appareils MIDI :<br><span id="midiDevices">Aucun</span></p>
<p>Controle MIDI ID :<br><span id="midiEvent">Aucun</span></p>
</div>
diff --git a/style.css b/style.css
index 2169c8d1e0c69d9166e3f641272915ebd45d3e0e..a1ce1d87f63af9cdd87ed3dae914d7a2846a4151 100644
--- a/style.css
+++ b/style.css
@@ -86,4 +86,18 @@ body {
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
- }
\ No newline at end of file
+ }
+
+ kbd {
+ background-color: rgb(17, 17, 17);
+ border-radius: 3px;
+ border: 1px solid #353535;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .2), 0 2px 0 0 rgba(255, 255, 255, .7) inset;
+ color: rgb(202, 202, 202);
+ display: inline-block;
+ font-size: .85em;
+ font-weight: 700;
+ line-height: 1;
+ padding: 2px 4px;
+ white-space: nowrap;
+ }