Skip to content

Commit

Permalink
reload feature
Browse files Browse the repository at this point in the history
  • Loading branch information
teeteeteeteetee committed Feb 4, 2022
1 parent 52c6c55 commit 76a63a5
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 25 deletions.
2 changes: 1 addition & 1 deletion discord rpc/html/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<p class="h4">RPC Settings</p>
<button onclick="restart()" type="button" class="btn btn-primary btn-md mt-2">Force Reconnect</button>
<button type="button" class="btn btn-primary btn-md mt-2">Restart Panel</button>
<!-- <button type="button" class="btn btn-primary btn-md mt-2">Restart Panel</button> -->

<p class="h4 mt-5">Update Extension<div id="spin" class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></p>

Expand Down
10 changes: 1 addition & 9 deletions discord rpc/js/index-noload.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ var smallImage_enable = true;
var timestamp_enable = true;
var enabled_enable = true;

function loadJSX(fileName) {
var csInterface = new CSInterface();
var extensionRoot = csInterface.getSystemPath(SystemPath.EXTENSION) + "/host/";
csInterface.evalScript('$.evalFile("' + extensionRoot + fileName + '")');
console.log(fileName);
console.log(extensionRoot);
}

client.on('ready', () => {
send();
})
Expand All @@ -40,7 +32,7 @@ client.login({

getData();

csInterface.addEventListener('com.tee.discordrpc.restart', function(){
csInterface.addEventListener('com.discordrpc.restart', function(){
window.location.reload();
});

Expand Down
2 changes: 1 addition & 1 deletion discord rpc/js/index-other.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ client.login({
loadJSX(appID + ".jsx");
getData();

csInterface.addEventListener('com.tee.discordrpc.restart', function(){
csInterface.addEventListener('com.discordrpc.restart', function(){
window.location.reload();
});

Expand Down
3 changes: 2 additions & 1 deletion discord rpc/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ client.login({
loadJSX(appID + ".jsx");
getData();

csInterface.addEventListener('com.tee.discordrpc.restart', function(){
csInterface.addEventListener('com.discordrpc.restart', function(){
client.destroy();
window.location.reload();
});

Expand Down
24 changes: 12 additions & 12 deletions discord rpc/js/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var csInterface = new CSInterface();

if(csInterface.getApplicationID() === "DRWV"){
csInterface.requestOpenExtension("com.tee.discordrpc.other.dreamweaver");
}
// gonna rewrite this sphagetti in future

console.log(csInterface.getApplicationID())
var csInterface = new CSInterface();

if(csInterface.getApplicationID() === "FLPR"){
console.log("request open")
csInterface.requestOpenExtension("com.tee.discordrpc.other.animate");
switch(csInterface.getApplicationID()){
case "DRWV":
csInterface.requestOpenExtension("com.tee.discordrpc.other.dreamweaver");
break;
case "FLPR":
csInterface.requestOpenExtension("com.tee.discordrpc.other.animate");
break;
}

var i = 0
Expand All @@ -31,7 +31,7 @@ document.getElementById("settings").onclick = function () {
csInterface.requestOpenExtension("com.tee.discordrpc.settings");
}

csInterface.addEventListener('com.tee.discordrpc.restart', function(){
csInterface.addEventListener('com.discordrpc.restart', function(){
window.location.reload();
});

Expand Down Expand Up @@ -92,7 +92,7 @@ $(document).ready(function () {
document.getElementById("_details").style.display = "block"
document.getElementById("_state").style.display = "block"
document.getElementById("_timestamp").style.display = "block"
} catch (err) {
} catch {

}
});
Expand All @@ -105,7 +105,7 @@ $(document).ready(function () {
setInterval(() => {
try {
document.getElementById("_timestamp").innerHTML = `${format(i++)} elapsed`
} catch (err) {
} catch {

}

Expand Down
4 changes: 4 additions & 0 deletions discord rpc/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const Shell = require('node-powershell');

var restart_event = new CSEvent("com.discordrpc.restart", "APPLICATION");

csInterface.addEventListener('com.discordrpc.restart', function(){
window.location.reload();
});

function restart(){
csInterface.dispatchEvent(restart_event);
window.location.reload();
Expand Down
2 changes: 1 addition & 1 deletion discord rpc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discord-rpc",
"version": "v0.0.4.1-beta",
"version": "v0.0.4.2-beta",
"description": "",
"main": "index.js",
"directories": {
Expand Down
19 changes: 19 additions & 0 deletions discord rpc/package.json.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "discord-rpc",
"version": "v0.0.4.1-beta",
"description": "",
"main": "index.js",
"directories": {
"lib": "lib"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Tee",
"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"discord-rpc": "^3.1.4",
"node-powershell": "^4.0.0"
}
}

0 comments on commit 76a63a5

Please sign in to comment.