mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +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);
|
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)
|
public void SetStartup(bool enabled)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ speechSynthesis.getVoices();
|
|||||||
} else if (e.key === 'r') {
|
} else if (e.key === 'r') {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
} else if (e.key === 'R') {
|
||||||
|
$app.refreshCustomCss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4055,6 +4057,7 @@ speechSynthesis.getVoices();
|
|||||||
API.$on('SHOW_LAUNCH_DIALOG', (tag) => this.showLaunchDialog(tag));
|
API.$on('SHOW_LAUNCH_DIALOG', (tag) => this.showLaunchDialog(tag));
|
||||||
this.updateLoop();
|
this.updateLoop();
|
||||||
this.getGameLogTable();
|
this.getGameLogTable();
|
||||||
|
this.refreshCustomCss();
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
this.$el.style.display = '';
|
this.$el.style.display = '';
|
||||||
if (!this.enablePrimaryPassword) {
|
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) {
|
$app.methods.openExternalLink = function (link) {
|
||||||
this.$confirm(`${link}`, 'Open External Link', {
|
this.$confirm(`${link}`, 'Open External Link', {
|
||||||
confirmButtonText: 'Confirm',
|
confirmButtonText: 'Confirm',
|
||||||
|
|||||||
Reference in New Issue
Block a user