diff --git a/edit/source-editor.js b/edit/source-editor.js index d20fdb2e..2de7b701 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -32,7 +32,7 @@ function SourceEditor() { $('#header').on('wheel', headerOnScroll); $('#sections').textContent = ''; $('#sections').appendChild($create('.single-editor')); - $('#save-button').onauxclick = e => e.detail === 'tpl' && saveTemplate(); + $('#save-button').on('split-btn', saveTemplate); const cm = cmFactory.create($('.single-editor')); const sectionFinder = MozSectionFinder(cm); diff --git a/js/dom-on-load.js b/js/dom-on-load.js index 05e63b9a..89369ef1 100644 --- a/js/dom-on-load.js +++ b/js/dom-on-load.js @@ -98,7 +98,7 @@ prevPedal.classList.remove('active'); window.off('keydown', splitMenuEscape); } - if (pedal && pedal !== prevPedal) { + if (pedal) { const menu = $create(SPLIT_BTN_MENU, Array.from(pedal.attributes, ({name, value}) => name.startsWith('menu-') && @@ -110,13 +110,14 @@ setTimeout(splitMenu); } }); + pedal.on('mousedown', e => e.preventDefault()); pedal.classList.toggle('active'); pedal.after(menu); moveFocus(menu, 0); focusAccessibility.toggle(menu.firstChild, focusAccessibility.get(pedal)); } if (entry) { - prevPedal.previousElementSibling.dispatchEvent(new CustomEvent('auxclick', { + prevPedal.previousElementSibling.dispatchEvent(new CustomEvent('split-btn', { detail: entry.__cmd, bubbles: true, })); diff --git a/manage/import-export.js b/manage/import-export.js index 31afee1e..57d269ab 100644 --- a/manage/import-export.js +++ b/manage/import-export.js @@ -17,8 +17,7 @@ Object.assign($('#file-all-styles'), { onclick: exportToFile, oncontextmenu: exportToFile, - onauxclick: exportToFile, -}); +}).on('split-btn', exportToFile); $('#unfile-all-styles').onclick = () => importFromFile({fileTypeFilter: '.json'}); Object.assign(document.body, { @@ -339,9 +338,6 @@ async function importFromString(jsonString) { /** @param {MouseEvent} e */ async function exportToFile(e) { - if (e.type === 'auxclick' && !e.detail) { - return; - } e.preventDefault(); await require(['/js/storage-util']); const keepDupSections = e.type === 'contextmenu' || e.shiftKey || e.detail === 'compat'; diff --git a/popup/popup.js b/popup/popup.js index 6e028e3f..1b1f12f3 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -103,8 +103,7 @@ async function initPopup(frames) { Object.assign($('#popup-manage-button'), { onclick: Events.openManager, oncontextmenu: Events.openManager, - onauxclick: Events.openManager, - }); + }).on('split-btn', Events.openManager); $('#popup-options-button').onclick = () => { API.openManage({options: true});