mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 22:36:05 +02:00
add customvr.js
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
|
|
||||||
namespace VRCX
|
namespace VRCX
|
||||||
@@ -70,5 +71,18 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
return CultureInfo.CurrentCulture.ToString();
|
return CultureInfo.CurrentCulture.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the file path of the custom user js file, if it exists.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The file path of the custom user js file, or an empty string if it doesn't exist.</returns>
|
||||||
|
public string CustomVrScriptPath()
|
||||||
|
{
|
||||||
|
var output = string.Empty;
|
||||||
|
var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "VRCX\\customvr.js");
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
output = filePath;
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,6 +197,7 @@ Vue.component('marquee-text', MarqueeText);
|
|||||||
currentTime: new Date().toJSON(),
|
currentTime: new Date().toJSON(),
|
||||||
cpuUsage: 0,
|
cpuUsage: 0,
|
||||||
pcUptime: '',
|
pcUptime: '',
|
||||||
|
customInfo: '',
|
||||||
config: {},
|
config: {},
|
||||||
onlineFriendCount: 0,
|
onlineFriendCount: 0,
|
||||||
nowPlaying: {
|
nowPlaying: {
|
||||||
@@ -230,6 +231,7 @@ Vue.component('marquee-text', MarqueeText);
|
|||||||
mounted() {
|
mounted() {
|
||||||
workerTimers.setTimeout(() => AppApiVr.VrInit(), 1000);
|
workerTimers.setTimeout(() => AppApiVr.VrInit(), 1000);
|
||||||
if (this.appType === '1') {
|
if (this.appType === '1') {
|
||||||
|
this.refreshCustomScript();
|
||||||
this.updateStatsLoop();
|
this.updateStatsLoop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -403,6 +405,21 @@ Vue.component('marquee-text', MarqueeText);
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$app.methods.refreshCustomScript = function () {
|
||||||
|
if (document.contains(document.getElementById('vr-custom-script'))) {
|
||||||
|
document.getElementById('vr-custom-script').remove();
|
||||||
|
}
|
||||||
|
AppApiVr.CustomVrScriptPath().then((customScript) => {
|
||||||
|
var head = document.head;
|
||||||
|
if (customScript) {
|
||||||
|
var $vrCustomScript = document.createElement('script');
|
||||||
|
$vrCustomScript.setAttribute('id', 'vr-custom-script');
|
||||||
|
$vrCustomScript.src = `file://${customScript}?_=${Date.now()}`;
|
||||||
|
head.appendChild($vrCustomScript);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$app.methods.updateStatsLoop = async function () {
|
$app.methods.updateStatsLoop = async function () {
|
||||||
try {
|
try {
|
||||||
this.currentTime = new Date()
|
this.currentTime = new Date()
|
||||||
|
|||||||
+1
-1
@@ -523,7 +523,7 @@ html
|
|||||||
br
|
br
|
||||||
span(style="float:right") {{ currentTime }}
|
span(style="float:right") {{ currentTime }}
|
||||||
span(v-if="config && !config.hideCpuUsageFromFeed" style="display:inline-block;margin-right:5px") {{ $t('vr.status.cpu') }} {{ cpuUsage }}%
|
span(v-if="config && !config.hideCpuUsageFromFeed" style="display:inline-block;margin-right:5px") {{ $t('vr.status.cpu') }} {{ cpuUsage }}%
|
||||||
span(style="display:inline-block") {{ $t('vr.status.online') }} {{ onlineFriendCount }}
|
span(style="display:inline-block") {{ $t('vr.status.online') }} {{ onlineFriendCount }} {{ customInfo }}
|
||||||
template(v-else)
|
template(v-else)
|
||||||
svg(class="np-progress-circle")
|
svg(class="np-progress-circle")
|
||||||
circle(class="np-progress-circle-stroke" cx="60" cy="60" stroke="white" r="30" fill="transparent" stroke-width="60")
|
circle(class="np-progress-circle-stroke" cx="60" cy="60" stroke="white" r="30" fill="transparent" stroke-width="60")
|
||||||
|
|||||||
Reference in New Issue
Block a user