Bugfixing. - authored by Keb Hellion.

This commit is contained in:
Kasen IO 2020-03-13 13:34:32 -04:00
parent cb4407532d
commit f70a9ec4c0
2 changed files with 34 additions and 22 deletions

View file

@ -54,7 +54,16 @@
function sendRunningScriptList() { function sendRunningScriptList() {
var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); var currentlyRunningScripts = ScriptDiscoveryService.getRunning();
tablet.emitScriptEvent(JSON.stringify(currentlyRunningScripts)); var newMessage = "RSL4MOREAPP:";
var runningScriptJson;
for (var j = 0; j < currentlyRunningScripts.length; j++) {
runningScriptJson = currentlyRunningScripts[j].url;
if (runningScriptJson.indexOf("https://kasenvr.github.io/community-apps/applications") !== -1) {
newMessage = newMessage + "_" + runningScriptJson;
}
}
tablet.emitScriptEvent(newMessage);
} }
function onMoreAppWebEventReceived(eventz) { function onMoreAppWebEventReceived(eventz) {
@ -77,7 +86,7 @@
Script.setTimeout(function() { Script.setTimeout(function() {
sendRunningScriptList(); sendRunningScriptList();
}, 2000); }, 1500);
} }
} }
@ -93,7 +102,7 @@
Script.setTimeout(function() { Script.setTimeout(function() {
sendRunningScriptList(); sendRunningScriptList();
}, 2000); }, 1500);
} }
} }

View file

@ -92,18 +92,20 @@
EventBridge.scriptEventReceived.connect(function(message){ EventBridge.scriptEventReceived.connect(function(message){
//update the buttons //update the buttons
buttonList.forEach(function(item){ if (message.indexOf("RSL4MOREAPP:") !== -1){
var btn = ""; buttonList.forEach(function(item){
if (message.indexOf(item.url) !== -1) { var btn = "";
//Means already running if (message.indexOf(item.url) !== -1) {
btn = "<button class='uninstall' onclick='uninstall(" + '"' + item.url + '"' + ", " + '"' + item.id + '"' + ");'>Uninstall</button>"; //Means already running
} else { btn = "<button class='uninstall' onclick='uninstall(" + '"' + item.url + '"' + ", " + '"' + item.id + '"' + ");'>Uninstall</button>";
//Means not already installed } else {
btn = "<button class='install' onclick='install(" + '"' + item.url + '"' + ", " + '"' + item.id + '"' + ");'>Install</button>"; //Means not already installed
} btn = "<button class='install' onclick='install(" + '"' + item.url + '"' + ", " + '"' + item.id + '"' + ");'>Install</button>";
}
document.getElementById(item.id).innerHTML = btn;
}); document.getElementById(item.id).innerHTML = btn;
});
}
}); });
function install(script, btnId){ function install(script, btnId){
@ -143,7 +145,7 @@
</head> </head>
<body><form name = "searchbar"> <body><form name = "searchbar">
<h1 class="mainTitle">Add more functionalities...</h1> <h1 class="mainTitle">Add more functionalities...</h1>
<p class="mainDesc">Want to add your own app? Read the <a href="../web/index.html">guide</a>!</p> <p class="mainDesc">Want to add your own app? Read the <a href="https://kasenvr.github.io/community-apps/web/index.html">guide</a>!</p>
<table style = "width:100%;"> <table style = "width:100%;">
<tr > <tr >
<td style = "vertical-align:middle; text-align:left;"> <td style = "vertical-align:middle; text-align:left;">
@ -167,25 +169,26 @@
</table> </table>
</form><br> </form><br>
<div id = "data"></div> <div id = "data"></div>
<div style="width:98%; text-align:right;"><div style = "vertical-align: middle;" id = 'pager_footer'></div> <div style="width:98%; text-align:right;">
<div style = "vertical-align: middle;" id = 'pager_footer'><!-- More info placeholder --></div>
</div>
<script> <script>
document.searchbar.searchtextbox.value = search; document.searchbar.searchtextbox.value = search;
function DisplayApp(item) { function DisplayApp(item) {
pageContent = pageContent + "<a name = '" + window.btoa(item.name) + "'><table class='item'><tr>"; pageContent = pageContent + "<a name = '" + window.btoa(item.directory) + "'><table class='item'><tr>";
pageContent = pageContent + "<td><div class='iconContainer'><img src='" + rootPath + item.icon + "' style='width:50px;'><br><font class = 'caption'>" + item.caption + "</font></div></td>"; pageContent = pageContent + "<td><div class='iconContainer'><img src='" + rootPath + item.icon + "' style='width:50px;'><br><font class = 'caption'>" + item.caption + "</font></div></td>";
var btn = ""; var btn = "";
var absoluteJsFile = rootPath + item.jsfile; var absoluteJsFile = rootPath + item.jsfile;
var btn = "<button class='install' onclick = 'install(" + '"' + absoluteJsFile + " ," + window.btoa(item.name) + '"' + ");'>Install</button>"; var btn = "<button class='install' onclick = 'install(" + '"' + absoluteJsFile + " ," + window.btoa(item.directory) + '"' + ");'>Install</button>";
var btndata = { var btndata = {
"url": absoluteJsFile, "url": absoluteJsFile,
"id": window.btoa(item.name) "id": window.btoa(item.directory)
}; };
buttonList.push(btndata); buttonList.push(btndata);
pageContent = pageContent + "<td><font class='appname'>" + item.name + "<br></font><font class = 'appdesc'>" + item.description + "<br></font><div id = '"+ window.btoa(item.name) +"' align='right'>" + btn + "</div></td>"; pageContent = pageContent + "<td><font class='appname'>" + item.name + "<br></font><font class = 'appdesc'>" + item.description + "<br></font><div id = '"+ window.btoa(item.directory) +"' align='right'>" + btn + "</div></td>";
pageContent = pageContent + "</tr></table><br><br>"; pageContent = pageContent + "</tr></table><br><br>";
} }