mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 21:42:46 +01:00
feat: added custom CSS settings. fixes #213
This commit is contained in:
parent
fc6adc25ca
commit
07be74af9f
@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
|
||||||
|
- You can now add custom CSS in the "advanced" settings tab
|
||||||
- You can now configure the updateFrequency in the settings window
|
- You can now configure the updateFrequency in the settings window
|
||||||
- Default value is set to 500 and will overwrite the hardcoded value of 100
|
- Default value is set to 500 and will overwrite the hardcoded value of 100
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ const settings = {
|
|||||||
root: "apiSettings",
|
root: "apiSettings",
|
||||||
port: "apiSettings.port",
|
port: "apiSettings.port",
|
||||||
},
|
},
|
||||||
|
customCSS: "customCSS",
|
||||||
disableBackgroundThrottle: "disableBackgroundThrottle",
|
disableBackgroundThrottle: "disableBackgroundThrottle",
|
||||||
disableHardwareMediaKeys: "disableHardwareMediaKeys",
|
disableHardwareMediaKeys: "disableHardwareMediaKeys",
|
||||||
enableCustomHotkeys: "enableCustomHotkeys",
|
enableCustomHotkeys: "enableCustomHotkeys",
|
||||||
|
@ -172,7 +172,6 @@ app.on("ready", async () => {
|
|||||||
store.get(settings.trayIcon) && addTray(mainWindow, { icon }) && refreshTray();
|
store.get(settings.trayIcon) && addTray(mainWindow, { icon }) && refreshTray();
|
||||||
store.get(settings.api) && expressModule.run(mainWindow);
|
store.get(settings.api) && expressModule.run(mainWindow);
|
||||||
store.get(settings.enableDiscord) && discordModule.initRPC();
|
store.get(settings.enableDiscord) && discordModule.initRPC();
|
||||||
// mainWindow.webContents.openDevTools();
|
|
||||||
} else {
|
} else {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
let adBlock,
|
let adBlock,
|
||||||
api,
|
api,
|
||||||
|
customCSS,
|
||||||
disableBackgroundThrottle,
|
disableBackgroundThrottle,
|
||||||
disableHardwareMediaKeys,
|
disableHardwareMediaKeys,
|
||||||
enableCustomHotkeys,
|
enableCustomHotkeys,
|
||||||
@ -28,6 +29,7 @@ const { app } = remote;
|
|||||||
function refreshSettings() {
|
function refreshSettings() {
|
||||||
adBlock.checked = store.get(settings.adBlock);
|
adBlock.checked = store.get(settings.adBlock);
|
||||||
api.checked = store.get(settings.api);
|
api.checked = store.get(settings.api);
|
||||||
|
customCSS.value = store.get(settings.customCSS);
|
||||||
disableBackgroundThrottle.checked = store.get("disableBackgroundThrottle");
|
disableBackgroundThrottle.checked = store.get("disableBackgroundThrottle");
|
||||||
disableHardwareMediaKeys.checked = store.get(settings.flags.disableHardwareMediaKeys);
|
disableHardwareMediaKeys.checked = store.get(settings.flags.disableHardwareMediaKeys);
|
||||||
enableCustomHotkeys.checked = store.get(settings.enableCustomHotkeys);
|
enableCustomHotkeys.checked = store.get(settings.enableCustomHotkeys);
|
||||||
@ -113,6 +115,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
adBlock = get("adBlock");
|
adBlock = get("adBlock");
|
||||||
api = get("apiCheckbox");
|
api = get("apiCheckbox");
|
||||||
|
customCSS = get("customCSS");
|
||||||
disableBackgroundThrottle = get("disableBackgroundThrottle");
|
disableBackgroundThrottle = get("disableBackgroundThrottle");
|
||||||
disableHardwareMediaKeys = get("disableHardwareMediaKeys");
|
disableHardwareMediaKeys = get("disableHardwareMediaKeys");
|
||||||
enableCustomHotkeys = get("enableCustomHotkeys");
|
enableCustomHotkeys = get("enableCustomHotkeys");
|
||||||
@ -134,6 +137,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
addInputListener(adBlock, settings.adBlock);
|
addInputListener(adBlock, settings.adBlock);
|
||||||
addInputListener(api, settings.api);
|
addInputListener(api, settings.api);
|
||||||
|
addTextAreaListener(customCSS, settings.customCSS);
|
||||||
addInputListener(disableBackgroundThrottle, settings.disableBackgroundThrottle);
|
addInputListener(disableBackgroundThrottle, settings.disableBackgroundThrottle);
|
||||||
addInputListener(disableHardwareMediaKeys, settings.flags.disableHardwareMediaKeys);
|
addInputListener(disableHardwareMediaKeys, settings.flags.disableHardwareMediaKeys);
|
||||||
addInputListener(enableCustomHotkeys, settings.enableCustomHotkeys);
|
addInputListener(enableCustomHotkeys, settings.enableCustomHotkeys);
|
||||||
|
@ -226,7 +226,16 @@
|
|||||||
<input id="updateFrequency" type="number" class="text-input" name="updateFrequency" />
|
<input id="updateFrequency" type="number" class="text-input" name="updateFrequency" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="group__option">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Custom CSS</h4>
|
||||||
|
<p>
|
||||||
|
The css that you put in here will be injected into a style tag in the head of the document.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<textarea id="customCSS" class="textarea" cols="40" rows="8" spellcheck="false"></textarea>
|
||||||
|
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<p class="group__title">Flags</p>
|
<p class="group__title">Flags</p>
|
||||||
|
@ -7,7 +7,7 @@ const { downloadFile } = require("./scripts/download");
|
|||||||
const statuses = require("./constants/statuses");
|
const statuses = require("./constants/statuses");
|
||||||
const hotkeys = require("./scripts/hotkeys");
|
const hotkeys = require("./scripts/hotkeys");
|
||||||
const globalEvents = require("./constants/globalEvents");
|
const globalEvents = require("./constants/globalEvents");
|
||||||
const { skipArtists, updateFrequency } = require("./constants/settings");
|
const { skipArtists, updateFrequency, customCSS } = require("./constants/settings");
|
||||||
const notificationPath = `${app.getPath("userData")}/notification.jpg`;
|
const notificationPath = `${app.getPath("userData")}/notification.jpg`;
|
||||||
const appName = "Tidal Hifi";
|
const appName = "Tidal Hifi";
|
||||||
let currentSong = "";
|
let currentSong = "";
|
||||||
@ -143,6 +143,14 @@ const elements = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function addCustomCss() {
|
||||||
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
const style = document.createElement("style");
|
||||||
|
style.innerHTML = store.get(customCSS);
|
||||||
|
document.head.appendChild(style);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the update frequency from the store
|
* Get the update frequency from the store
|
||||||
* make sure it returns a number, if not use the default
|
* make sure it returns a number, if not use the default
|
||||||
@ -486,7 +494,7 @@ if (process.platform === "linux" && store.get(settings.mpris)) {
|
|||||||
console.log("player api not working");
|
console.log("player api not working");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
addCustomCss();
|
||||||
addHotKeys();
|
addHotKeys();
|
||||||
addIPCEventListeners();
|
addIPCEventListeners();
|
||||||
addFullScreenListeners();
|
addFullScreenListeners();
|
||||||
|
@ -12,6 +12,7 @@ const store = new Store({
|
|||||||
apiSettings: {
|
apiSettings: {
|
||||||
port: 47836,
|
port: 47836,
|
||||||
},
|
},
|
||||||
|
customCSS: "",
|
||||||
disableBackgroundThrottle: true,
|
disableBackgroundThrottle: true,
|
||||||
disableHardwareMediaKeys: false,
|
disableHardwareMediaKeys: false,
|
||||||
enableCustomHotkeys: false,
|
enableCustomHotkeys: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user