
* i18n * My last menubar edit Based on : https://developer.apple.com/design/human-interface-guidelines/macos/menus/menu-bar-menus/ And : https://www.electronjs.org/docs/latest/api/menu make changes about how work on linux and let the mac untouched for more native options * Linux Only * some fixes * alt everywhere * im stupid * im stupid pt2 * popup fix * Zoom * Fixes * Zoom and other things Update * Hardcoded Changes * i18N "es_ES" * Windows/MacOS Fixes * Some test * test2 * MacOS * Sorry MacOS * PT2 * i suposse * Test Changes * Pre test * finally * Last * documentation * Update es_ES * Now stores ZoomFactor * Deprecated UI Scale to Zoom Built in Electron Feature. Its more easy, native and more compatible. * I hate Git * best methods * Plz * SVG * finally fixes
98 lines
No EOL
3.1 KiB
JavaScript
98 lines
No EOL
3.1 KiB
JavaScript
const Events = {
|
|
InitEvents() {
|
|
const app = window.app
|
|
|
|
// add event listener for when window.location.hash changes
|
|
window.addEventListener("hashchange", function () {
|
|
app.page = "blank"
|
|
setTimeout(()=>{
|
|
app.appRoute(window.location.hash)
|
|
}, 100)
|
|
});
|
|
|
|
window.addEventListener("mouseup", (e) => {
|
|
if (e.button === 3) {
|
|
e.preventDefault()
|
|
app.navigateBack()
|
|
} else if (e.button === 4) {
|
|
e.preventDefault()
|
|
app.navigateForward()
|
|
}
|
|
});
|
|
|
|
document.addEventListener('keydown', async function (event) {
|
|
// CTRL + R
|
|
if (event.keyCode === 82 && event.ctrlKey) {
|
|
event.preventDefault()
|
|
bootbox.confirm(app.getLz('term.reload'), (res)=>{
|
|
if (res) {
|
|
window.location.reload()
|
|
}
|
|
})
|
|
}
|
|
// CTRL + SHIFT + R
|
|
if (event.keyCode === 82 && event.ctrlKey && event.shiftKey) {
|
|
event.preventDefault()
|
|
window.location.reload()
|
|
}
|
|
// CTRL + E
|
|
if (event.keyCode === 69 && event.ctrlKey) {
|
|
app.invokeDrawer('queue')
|
|
}
|
|
// CTRL+H
|
|
if (event.keyCode === 72 && event.ctrlKey) {
|
|
app.appRoute("home")
|
|
}
|
|
// CTRL+SHIFT+H
|
|
if (event.ctrlKey && event.shiftKey && event.keyCode == 72) {
|
|
let hist = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, {
|
|
l: app.mklang
|
|
})
|
|
app.showCollection(hist.data, app.getLz('term.history'))
|
|
}
|
|
if (event.ctrlKey && event.keyCode == 121) {
|
|
try {
|
|
app.mk._services.mediaItemPlayback._currentPlayer.stop()
|
|
} catch (e) {
|
|
}
|
|
try {
|
|
app.mk._services.mediaItemPlayback._currentPlayer.destroy()
|
|
} catch (e) {
|
|
}
|
|
}
|
|
if (event.ctrlKey && event.keyCode == 122) {
|
|
try {
|
|
ipcRenderer.send('detachDT', '')
|
|
} catch (e) {
|
|
}
|
|
}
|
|
// Prevent Scrolling on spacebar
|
|
if (event.keyCode === 32 && event.target === document.body) {
|
|
event.preventDefault()
|
|
app.SpacePause()
|
|
|
|
}
|
|
});
|
|
|
|
// Hang Timer
|
|
app.hangtimer = setTimeout(() => {
|
|
if (confirm("Cider is not responding. Reload the app?")) {
|
|
window.location.reload()
|
|
}
|
|
}, 10000)
|
|
|
|
// Refresh Focus
|
|
function refreshFocus() {
|
|
if (document.hasFocus() == false) {
|
|
app.windowFocus(false)
|
|
} else {
|
|
app.windowFocus(true)
|
|
}
|
|
setTimeout(refreshFocus, 200);
|
|
}
|
|
|
|
refreshFocus();
|
|
}
|
|
}
|
|
|
|
export {Events} |