diff --git a/AppApi.cs b/AppApi.cs index 309b4551..1eafba0a 100644 --- a/AppApi.cs +++ b/AppApi.cs @@ -394,6 +394,15 @@ namespace VRCX return System.Text.Json.JsonSerializer.Serialize(eventData); } + public string CustomCssPath() + { + var output = String.Empty; + var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "VRCX\\custom.css"); + if (File.Exists(filePath)) + output = filePath; + return output; + } + public void SetStartup(bool enabled) { try diff --git a/html/src/app.js b/html/src/app.js index 72a1d458..7bdb428a 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -73,6 +73,8 @@ speechSynthesis.getVoices(); } else if (e.key === 'r') { location.reload(); } + } else if (e.key === 'R') { + $app.refreshCustomCss(); } }); @@ -4055,6 +4057,7 @@ speechSynthesis.getVoices(); API.$on('SHOW_LAUNCH_DIALOG', (tag) => this.showLaunchDialog(tag)); this.updateLoop(); this.getGameLogTable(); + this.refreshCustomCss(); this.$nextTick(function () { this.$el.style.display = ''; if (!this.enablePrimaryPassword) { @@ -4077,6 +4080,22 @@ speechSynthesis.getVoices(); } }; + $app.methods.refreshCustomCss = function () { + if (document.contains(document.getElementById('app-custom-style'))) { + document.getElementById('app-custom-style').remove(); + } + AppApi.CustomCssPath().then((customCss) => { + var head = document.head; + if (customCss) { + var $appCustomStyle = document.createElement('link'); + $appCustomStyle.setAttribute('id', 'app-custom-style'); + $appCustomStyle.rel = 'stylesheet'; + $appCustomStyle.href = `file://${customCss}?_=${Date.now()}`; + head.appendChild($appCustomStyle); + } + }); + }; + $app.methods.openExternalLink = function (link) { this.$confirm(`${link}`, 'Open External Link', { confirmButtonText: 'Confirm',