mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 01:03:59 +02:00
Code housekeeping, update URL for guide to link to repo.
This commit is contained in:
parent
95f1c5da25
commit
8092220ea4
3 changed files with 60 additions and 51 deletions
|
@ -6,12 +6,16 @@
|
|||
// Created by Keb Helion, February 2020.
|
||||
// Copyright 2020 Project Athena and contributors.
|
||||
//
|
||||
// App maintained in: https://github.com/kasenvr/community-apps
|
||||
// App copied to: https://github.com/kasenvr/project-athena
|
||||
//
|
||||
// This script adds a "More Apps" selector to "Project Athena" to allow the user to add optional functionalities to the tablet.
|
||||
// This application has been designed to work directly from the Github repository.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
//
|
||||
|
||||
(function() {
|
||||
var ROOT = Script.resolvePath('').split("app-more.js")[0];
|
||||
var APP_NAME = "MORE...";
|
||||
|
@ -34,7 +38,7 @@
|
|||
|
||||
|
||||
function clicked() {
|
||||
if (Appstatus == true) {
|
||||
if (Appstatus) {
|
||||
tablet.webEventReceived.disconnect(onMoreAppWebEventReceived);
|
||||
tablet.gotoHomeScreen();
|
||||
Appstatus = false;
|
||||
|
@ -67,7 +71,7 @@
|
|||
|
||||
if (eventzget.action === "installScript") {
|
||||
|
||||
if (lastProcessing.action == eventzget.action && lastProcessing.script == eventzget.script) {
|
||||
if (lastProcessing.action === eventzget.action && lastProcessing.script === eventzget.script) {
|
||||
return;
|
||||
} else {
|
||||
ScriptDiscoveryService.loadOneScript(eventzget.script);
|
||||
|
@ -83,7 +87,7 @@
|
|||
|
||||
if (eventzget.action === "uninstallScript") {
|
||||
|
||||
if (lastProcessing.action == eventzget.action && lastProcessing.script == eventzget.script) {
|
||||
if (lastProcessing.action === eventzget.action && lastProcessing.script === eventzget.script) {
|
||||
return;
|
||||
} else {
|
||||
ScriptDiscoveryService.stopScript(eventzget.script, false);
|
||||
|
@ -107,7 +111,7 @@
|
|||
|
||||
|
||||
function onScreenChanged(type, url) {
|
||||
if (type == "Web" && url.indexOf(APP_URL) != -1) {
|
||||
if (type === "Web" && url.indexOf(APP_URL) !== -1) {
|
||||
//Active
|
||||
//print("MORE... ACTIVE");
|
||||
Appstatus = true;
|
||||
|
|
|
@ -32,10 +32,6 @@ h1 {
|
|||
text-shadow: 3px 3px 3px rgba(63,64,76,1);
|
||||
}
|
||||
|
||||
h1.mainTitle {
|
||||
|
||||
}
|
||||
|
||||
p.mainDesc {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
@ -136,8 +132,8 @@ button.install {
|
|||
}
|
||||
|
||||
button.install:hover {
|
||||
background-color: #10afe3;
|
||||
border: 2px solid #10afe3;
|
||||
background-color: #10afe3;
|
||||
border: 2px solid #10afe3;
|
||||
}
|
||||
|
||||
button.uninstall {
|
||||
|
@ -153,8 +149,8 @@ button.uninstall {
|
|||
}
|
||||
|
||||
button.uninstall:hover {
|
||||
background-color: #e34c22;
|
||||
border: 2px solid #e34c22;
|
||||
background-color: #e34c22;
|
||||
border: 2px solid #e34c22;
|
||||
}
|
||||
|
||||
button.processing {
|
||||
|
|
|
@ -39,21 +39,29 @@
|
|||
var items = location.search.substr(1).split("&");
|
||||
for (var index = 0; index < items.length; index++) {
|
||||
tmp = items[index].split("=");
|
||||
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
|
||||
if (tmp[0] === parameterName) {
|
||||
result = decodeURIComponent(tmp[1])
|
||||
};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
var offset = findGetParameter("offset");
|
||||
if(offset === null){offset = 0;}
|
||||
if (offset === null) {
|
||||
offset = 0;
|
||||
}
|
||||
offset = parseInt(offset);
|
||||
|
||||
var perpage = findGetParameter("perpage");
|
||||
if(perpage === null){perpage = 25;}
|
||||
if (perpage === null) {
|
||||
perpage = 25;
|
||||
}
|
||||
perpage = parseInt(perpage);
|
||||
|
||||
var search = findGetParameter("search");
|
||||
if(search === null){search = "";}
|
||||
if (search === null) {
|
||||
search = "";
|
||||
}
|
||||
|
||||
//Search
|
||||
function doSearch(keyword){
|
||||
|
@ -78,7 +86,7 @@
|
|||
//update the buttons
|
||||
buttonList.forEach(function(item){
|
||||
var btn = "";
|
||||
if (message.indexOf(item.url) != -1) {
|
||||
if (message.indexOf(item.url) !== -1) {
|
||||
//Means already running
|
||||
btn = "<button class='uninstall' onclick='uninstall(" + '"' + item.url + '"' + ", " + '"' + item.id + '"' + ");'>Uninstall</button>";
|
||||
} else {
|
||||
|
@ -125,30 +133,31 @@
|
|||
<link href="css/styles.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body><form name = "searchbar">
|
||||
<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>
|
||||
<table style = "width:100%;">
|
||||
<tr >
|
||||
<td style = "vertical-align:middle; text-align:left;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style = "vertical-align:middle; text-align:left;">
|
||||
<div class = "searchbox">
|
||||
<input class = "searchtextbox" name = "searchtextbox" size = "26" maxlength="32"> <a href="#" onclick='clearSearch();'><img src="del-x-16.png"></a>
|
||||
</div>
|
||||
</td>
|
||||
<td style = "vertical-align:middle; text-align:left;">
|
||||
<a href = "#" onclick = 'doSearch(document.searchbar.searchtextbox.value);'><img src="search-32.png"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style = "vertical-align:middle; text-align:right;">
|
||||
<div id = 'pager_top' style = "vertical-align: middle;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<body>
|
||||
<form name = "searchbar">
|
||||
<h1 class="mainTitle">Add more functionalities...</h1>
|
||||
<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%;">
|
||||
<tr >
|
||||
<td style = "vertical-align:middle; text-align:left;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style = "vertical-align:middle; text-align:left;">
|
||||
<div class = "searchbox">
|
||||
<input class = "searchtextbox" name = "searchtextbox" size = "26" maxlength="32"> <a href="#" onclick='clearSearch();'><img src="del-x-16.png"></a>
|
||||
</div>
|
||||
</td>
|
||||
<td style = "vertical-align:middle; text-align:left;">
|
||||
<a href = "#" onclick = 'doSearch(document.searchbar.searchtextbox.value);'><img src="search-32.png"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style = "vertical-align:middle; text-align:right;">
|
||||
<div id = 'pager_top' style = "vertical-align: middle;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form><br>
|
||||
<div id = "data"></div>
|
||||
<div style="width:98%; text-align:right;"><div style = "vertical-align: middle;" id = 'pager_footer'></div>
|
||||
|
@ -182,13 +191,13 @@
|
|||
|
||||
for (index = 0; index < metadata.applications.length; index++){
|
||||
lowItem = metadata.applications[index].name.toLowerCase();
|
||||
if (lowItem.indexOf(search.toLowerCase()) != -1 && metadata.applications[index].isActive == true){
|
||||
if (lowItem.indexOf(search.toLowerCase()) !== -1 && metadata.applications[index].isActive) {
|
||||
counterDir = counterDir + 1;
|
||||
if ((counterDir >= offset) && (counterDir < (offset + perpage))){
|
||||
if ((counterDir >= offset) && (counterDir < (offset + perpage))) {
|
||||
DisplayApp(metadata.applications[index]);
|
||||
counterDisp = counterDisp + 1;
|
||||
}
|
||||
if (counterDir >= (offset + perpage)){
|
||||
if (counterDir >= (offset + perpage)) {
|
||||
needNext = true;
|
||||
break;
|
||||
}
|
||||
|
@ -197,7 +206,7 @@
|
|||
|
||||
//pager
|
||||
|
||||
function pagetoPrevious(){
|
||||
function pagetoPrevious() {
|
||||
offset = offset - perpage;
|
||||
if (offset < 0){
|
||||
offset = 0;
|
||||
|
@ -205,18 +214,18 @@
|
|||
location.href = "more.html?offset=" + offset + "&perpage=" + perpage + "&search=" + encodeURI(search);
|
||||
}
|
||||
|
||||
function pagetoNext(){
|
||||
function pagetoNext() {
|
||||
offset = offset + perpage;
|
||||
location.href = "more.html?offset=" + offset + "&perpage=" + perpage + "&search=" + encodeURI(search);
|
||||
}
|
||||
|
||||
var pagerPrevious = "<a href='#' onclick='pagetoPrevious();'><img src='minus-16.png'></a>";
|
||||
if (offset <= 0){
|
||||
if (offset <= 0) {
|
||||
pagerPrevious = "<img src='blank_minus-16.png'>";
|
||||
}
|
||||
|
||||
var pagerNext = "<a href='#' onclick='pagetoNext();'><img src='plus-16.png'></a>";
|
||||
if (needNext == false){
|
||||
if (!needNext) {
|
||||
pagerNext = "<img src='blank_plus-16.png'>";
|
||||
}
|
||||
|
||||
|
@ -226,11 +235,11 @@
|
|||
|
||||
var pagerHtml = pagerPrevious + "<font class='pager'> " + countA + " - " + countB + " </font>" + pagerNext;
|
||||
|
||||
if (counterDisp > 0 ){
|
||||
if (counterDisp > 0 ) {
|
||||
document.getElementById("pager_top").innerHTML = pagerHtml;
|
||||
document.getElementById("data").innerHTML = pageContent;
|
||||
document.getElementById("pager_footer").innerHTML = pagerHtml;
|
||||
}else{
|
||||
} else {
|
||||
document.getElementById("data").innerHTML = "<hr><div align='center'><font class='noresult'><br><br><br><br>Sorry, no result found.<br><br><br><br><br><br></font></div><hr>";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue