add customvr.js

This commit is contained in:
Natsumi
2024-05-31 15:44:50 +12:00
parent 2742d6edb0
commit 5e8ecdb755
3 changed files with 32 additions and 1 deletions

View File

@@ -197,6 +197,7 @@ Vue.component('marquee-text', MarqueeText);
currentTime: new Date().toJSON(),
cpuUsage: 0,
pcUptime: '',
customInfo: '',
config: {},
onlineFriendCount: 0,
nowPlaying: {
@@ -230,6 +231,7 @@ Vue.component('marquee-text', MarqueeText);
mounted() {
workerTimers.setTimeout(() => AppApiVr.VrInit(), 1000);
if (this.appType === '1') {
this.refreshCustomScript();
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 () {
try {
this.currentTime = new Date()

View File

@@ -523,7 +523,7 @@ html
br
span(style="float:right") {{ currentTime }}
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)
svg(class="np-progress-circle")
circle(class="np-progress-circle-stroke" cx="60" cy="60" stroke="white" r="30" fill="transparent" stroke-width="60")