mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 13:53:52 +02:00
Custom CSS support
This commit is contained in:
@@ -394,6 +394,15 @@ namespace VRCX
|
||||
return System.Text.Json.JsonSerializer.Serialize<VRCEventDeserialization.EventEntry>(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
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user