From 33791875cb5e60d9c277a4cfd518960a0ec573ef Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Wed, 26 Feb 2020 21:46:45 -0500 Subject: [PATCH 01/14] Add app-more.js to default scripts. --- scripts/defaultScripts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 7700167d59..d9c84467a3 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -34,7 +34,8 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/emote.js", "system/miniTablet.js", "system/audioMuteOverlay.js", - "system/keyboardShortcuts/keyboardShortcuts.js" + "system/keyboardShortcuts/keyboardShortcuts.js", + "https://kasenvr.github.io/community-apps/more/app-more.js" ]; var DEFAULT_SCRIPTS_SEPARATE = [ "system/controllers/controllerScripts.js", From 0f5a83b97025eb23353d813178c27df39ca6a580 Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Fri, 28 Feb 2020 01:44:54 -0500 Subject: [PATCH 02/14] Adds more app as default script w/ beta branch pulling from repo URL. --- scripts/defaultScripts.js | 2 +- scripts/system/more/app-more.js | 136 +++++++++++++++ scripts/system/more/appicon_a.png | Bin 0 -> 521 bytes scripts/system/more/appicon_i.png | Bin 0 -> 511 bytes scripts/system/more/blank_minus-16.png | Bin 0 -> 250 bytes scripts/system/more/blank_plus-16.png | Bin 0 -> 251 bytes scripts/system/more/css/styles.css | 188 +++++++++++++++++++++ scripts/system/more/del-x-16.png | Bin 0 -> 536 bytes scripts/system/more/minus-16.png | Bin 0 -> 385 bytes scripts/system/more/more.html | 225 +++++++++++++++++++++++++ scripts/system/more/plus-16.png | Bin 0 -> 393 bytes scripts/system/more/search-32.png | Bin 0 -> 1584 bytes 12 files changed, 550 insertions(+), 1 deletion(-) create mode 100644 scripts/system/more/app-more.js create mode 100644 scripts/system/more/appicon_a.png create mode 100644 scripts/system/more/appicon_i.png create mode 100644 scripts/system/more/blank_minus-16.png create mode 100644 scripts/system/more/blank_plus-16.png create mode 100644 scripts/system/more/css/styles.css create mode 100644 scripts/system/more/del-x-16.png create mode 100644 scripts/system/more/minus-16.png create mode 100644 scripts/system/more/more.html create mode 100644 scripts/system/more/plus-16.png create mode 100644 scripts/system/more/search-32.png diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index d9c84467a3..2d4e19f2e4 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -35,12 +35,12 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/miniTablet.js", "system/audioMuteOverlay.js", "system/keyboardShortcuts/keyboardShortcuts.js", - "https://kasenvr.github.io/community-apps/more/app-more.js" ]; var DEFAULT_SCRIPTS_SEPARATE = [ "system/controllers/controllerScripts.js", "communityModules/notificationCore/notificationCore.js", "simplifiedUI/ui/simplifiedNametag/simplifiedNametag.js", + {"stable": "system/more/app-more.js", "beta": "https://kasenvr.github.io/community-apps/more/app-more.js"}, {"stable": "communityModules/chat/FloofChat.js", "beta": "https://content.fluffy.ws/scripts/chat/FloofChat.js"} //"system/chat.js" ]; diff --git a/scripts/system/more/app-more.js b/scripts/system/more/app-more.js new file mode 100644 index 0000000000..91e5508a6b --- /dev/null +++ b/scripts/system/more/app-more.js @@ -0,0 +1,136 @@ +"use strict"; + +// app-more.js +// VERSION 1.0 +// +// Created by Keb Helion, February 2020. +// Copyright 2020 Project Athena and contributors. +// +// 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..."; + var APP_URL = ROOT + "more.html"; + var APP_ICON_INACTIVE = ROOT + "appicon_i.png"; + var APP_ICON_ACTIVE = ROOT + "appicon_a.png"; + var Appstatus = false; + var lastProcessing = { + "action": "", + "script": "" + }; + + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + tablet.screenChanged.connect(onScreenChanged); + var button = tablet.addButton({ + text: APP_NAME, + icon: APP_ICON_INACTIVE, + activeIcon: APP_ICON_ACTIVE + }); + + + function clicked() { + if (Appstatus == true) { + tablet.webEventReceived.disconnect(onMoreAppWebEventReceived); + tablet.gotoHomeScreen(); + Appstatus = false; + } else { + tablet.gotoWebScreen(APP_URL); + tablet.webEventReceived.connect(onMoreAppWebEventReceived); + Appstatus = true; + } + + button.editProperties({ + isActive: Appstatus + }); + + } + + button.clicked.connect(clicked); + + function sendRunningScriptList() { + var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); + tablet.emitScriptEvent(JSON.stringify(currentlyRunningScripts)); + } + + function onMoreAppWebEventReceived(eventz) { + + if (typeof eventz === "string") { + eventzget = JSON.parse(eventz); + + //print("EVENT ACTION: " + eventzget.action); + //print("EVENT SCRIPT: " + eventzget.script); + + if (eventzget.action === "installScript") { + + if (lastProcessing.action == eventzget.action && lastProcessing.script == eventzget.script) { + return; + } else { + ScriptDiscoveryService.loadOneScript(eventzget.script); + + lastProcessing.action = eventzget.action; + lastProcessing.script = eventzget.script; + + Script.setTimeout(function() { + sendRunningScriptList(); + }, 2000); + } + } + + if (eventzget.action === "uninstallScript") { + + if (lastProcessing.action == eventzget.action && lastProcessing.script == eventzget.script) { + return; + } else { + ScriptDiscoveryService.stopScript(eventzget.script, false); + + lastProcessing.action = eventzget.action; + lastProcessing.script = eventzget.script; + + Script.setTimeout(function() { + sendRunningScriptList(); + }, 2000); + } + } + + if (eventzget.action === "requestRunningScriptData") { + sendRunningScriptList(); + } + + } + + } + + + function onScreenChanged(type, url) { + if (type == "Web" && url.indexOf(APP_URL) != -1) { + //Active + //print("MORE... ACTIVE"); + Appstatus = true; + } else { + //Inactive + //print("MORE... INACTIVE"); + Appstatus = false; + } + + button.editProperties({ + isActive: Appstatus + }); + } + + + function cleanup() { + if (Appstatus) { + tablet.gotoHomeScreen(); + tablet.webEventReceived.disconnect(onMoreAppWebEventReceived); + } + tablet.screenChanged.disconnect(onScreenChanged); + tablet.removeButton(button); + } + + Script.scriptEnding.connect(cleanup); +}()); \ No newline at end of file diff --git a/scripts/system/more/appicon_a.png b/scripts/system/more/appicon_a.png new file mode 100644 index 0000000000000000000000000000000000000000..b62d59774686a43d1f07bf0d0f208aa5cd8fdf98 GIT binary patch literal 521 zcmeAS@N?(olHy`uVBq!ia0y~yU@!t<4mJh`208nVjSLJ7oCO|{#S9GG!XV7ZFl&wk z0|Ns~x}&cn1H;C?n%{ww85kH8l0AZa85pWm85kOx85n;4XJBY}$-q!*z`*b-fq}tl z1_Oh5{-pS$ZVU{J^`0({Ar-fh{`~)Mf4G2wf$<2Fl7ysW=SN;;F~h3Yhq)XkG732O z@Em4gV7aj2BZmV6uXI1r%#9On$tY}>bX2XiV02*Moh`x0u^{oWU;{&vUFq-7pFbO#5lx%x%KQoK-nK(#Y!-3=_tmGH$5og7^-*{|6gC zV_?d-aRkjVA+M*uVo+#^crm9jGt7X2ML^d}*Uf4+`!^K_hKq~8dW$m%IBZ$t{_nDt zrD8G2fGJThE0JtRXS$rOYFQyQGfI~Q=F}^BfB!8n^ANu6#K562&2ieC6W?q=o?F6- z;thyF6COu}y!B*axv-&Auz^9ULt>%lcL{|CiT2Znj2jr384~ps8vA#hYh_?yVDNPH Kb6Mw<&;$To>7oe$ literal 0 HcmV?d00001 diff --git a/scripts/system/more/appicon_i.png b/scripts/system/more/appicon_i.png new file mode 100644 index 0000000000000000000000000000000000000000..e765410b50e836051e64a1064681bbc9504db3a9 GIT binary patch literal 511 zcma)2&nrW50RO!2o_V&$(}Wi5)r)tb{K`S(O~ZDu7!H0ELm4R|wU&5@-twy`$*-1> zA5m(501d6g$pIG!F5`fNgr*kPfX-?$+W}-KVAKGN`SK2c zhz?6t7ogQEpfEch4}fkqm6(8?@t(J`DF9rf#a;rqlK^QDcntwk5a><=Zt8)Y86d8G zvhJV=pt`MQQ-$lI;XM?}_jdr)K3VZR==j)l_pLtyMD{plAi% zcb_XlH@6(7Xy;2`>tTYTCp4D8zP$RFu{sIzKnu$hwxohzSz19okq4a)G(m-GXj(P^Tlw+>zMNW zn(<|%?yMcz$g?V6r4v?EMe|ufql#vaN^Q0PxLw?(8044@AqN1gg*NkcLH)odCy<&b literal 0 HcmV?d00001 diff --git a/scripts/system/more/blank_minus-16.png b/scripts/system/more/blank_minus-16.png new file mode 100644 index 0000000000000000000000000000000000000000..dfa1a828022661d728f0c4f08d715bc5db4b5370 GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0y~yU{GLSU=ZM7V_;w?XQ+*2U|`@Z@Q5sCVBk9f!i-b3 z`J@>b7+BIBeH|GXHuly04x9|qmFyAZ%fL{j%D~Xj%)s#TKLbO(lV*z71g98Ka4rZv* b1cu7*?DCh6-{@dqU|{fc^>bP0l+XkK$T343 literal 0 HcmV?d00001 diff --git a/scripts/system/more/blank_plus-16.png b/scripts/system/more/blank_plus-16.png new file mode 100644 index 0000000000000000000000000000000000000000..c40ab2044308b2fc46d528209b8652e3ca27b0d0 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0y~yU{GLSU=ZM7V_;w?XQ+*2U|`@Z@Q5sCVBk9f!i-b3 z`J@>b7+BIBeH|GXHuly04x9|qmFyAZ%fL{j%D~Xj%)s#TKLbOpF1ZP1_K>z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ-j!8s8RCwBA{Qv(y10?_;fLK68XJ;p}mXJPZR#GEDaI_2q2gNkw7d9#Gnw3 z0ODLAUX7#~%`dmmvcc5CITCFawyd_!(sLA0Yk>WupU-YZ(9n2&VA{n&dVh z4ul5mN+6Cw3lk8y2Owq{KIjv&>Z=o(*2onGZAoRSj3W$$G1I-19)u5q$7wWP_K>Pq%13&;VQktCs a0t^5eg+!7ui7!6@0000uHnhXs9txXi_02ly}col#lj5PpA=oK6M zfG#SdSSrwE0$@9+odP>^qrbI_vehQm*@59)K$-x)V}SGu3={!xZlH7-Nb6Z>J*fil zX%na`@ZkN6#VU_^MuOL?cZ2ZC4@k)9RfD~f%3zS{U%Kv}eFs7?TtP;@h9etN6ijIH zlC0@JLU`e93&^*sfc{EYg@~#q0 V5~RWMciPJU literal 0 HcmV?d00001 diff --git a/scripts/system/more/more.html b/scripts/system/more/more.html new file mode 100644 index 0000000000..dfb71244e6 --- /dev/null +++ b/scripts/system/more/more.html @@ -0,0 +1,225 @@ + + + + + + + + + + + + +
+

Add more functionalities...

+

Want to add your own app? Read the guide!

+ + + + + +
+ + + + + +
+ + + +
+
+
+
+

+
+
+ + + + \ No newline at end of file diff --git a/scripts/system/more/plus-16.png b/scripts/system/more/plus-16.png new file mode 100644 index 0000000000000000000000000000000000000000..69358477577fc740e55a1eaeb1016a5ee2608ac2 GIT binary patch literal 393 zcmWm5O(=t500;2@GqVlb>$zZ|yqBF22gGFF@v<#VGr~A{O(=@_*4p&=%4djtthji7qANw=5q#tCePN9y)G_J)eDT?5*CnyYs*^ZR0UQ zczSb@XYKar$=wwJ8GB=~!gR{adPC*}OOEWlcC_iiv&k;#2bDc)`k~N=3_1=fzB`$5 z0vFKuei-LAO}8)<^`92=I@7qVU}j}#C|IecLRyx&=0ey}ohx|tXCR07YC?3U*&v|8 zPv+TIE=?IOJtqUc#n0cgo#9cp;O$KPL%y+pNf3j8WA#$3d^cauS dZNZGXI1xkvYgv84{-fg?04yct;%<>N@(0+PeTo18 literal 0 HcmV?d00001 diff --git a/scripts/system/more/search-32.png b/scripts/system/more/search-32.png new file mode 100644 index 0000000000000000000000000000000000000000..8d4bb5daa275e2eef7527df92eab589cff339940 GIT binary patch literal 1584 zcmWlYZB$eD9e{s-ZW01qlkg%YG|2S@43?2l#2Ey+2~l~MqD81q0!S*#goX)}QMpMt z5o(I81x1FE(ALsuF(9okFeIRb4hvXhf|A2~JCH)><`G1b9X>oCpD)ijPg#82-ZhRM zjsUPGGD4OB0K_Ux1_0z17XA+a9C9L(a{-)OS3yuy%LM@12a;F`KvQ|q%DbPh8tD-U zu>ghM0F(w`*#7%*g?Qs{z(!f0lB84*>m2q)c+4;7QtRn=P!1w4)#mIqP&f zfjTB8#yC1U>Ot0gD*dmSfrT!wJiVEnZ+pF*OHX#0{)mD!$sm!QnK^PiJ$*{(>-%GW zXQy;+iuKLPg^8i72gl+r1%LOfLxl~I)}U%W2?6TEXbp-K3a`id`}_NlkKcLy>cv?U zS)K)fnyRWQ#5Lky@2hLSsho*gEVfxK@FSveM$a}kH;-Joa>YlO(ta;9AcEiEtTVhz zPqeRhPq8Jb@m(t(4Q`qxzam?)4l#IK4pinSY z)aTBz{j9TtTNo9W$LD4P$Yu%(9lpVFHj+BE4HmaisI}k z>Flrlb;P=6^%5Xjzm~YLVJB2)aLL>HYuE7kzj6v*E_iks!q0FQEUosxTy1Ee!gtGL zCFagfwW_YJ&R{U0d1l2_ju_mO`f9o}AlkkX{Vm#VWI`G>JPr``_F&K7o^ zT_=pkUESP{_Vo2BN=r-S;N!1-@E}H8Q{!R6Ox{P6S~`J*CZc!1z3L-hNyF zO(#yAFxQY}Y>y&=0h9&%_q*=!*t~f&chq9x<^A@AzTN3yp4R&S1=0_p$0f-_6cB(0 zTk{tcw{j-zG!+$`;ee#xLwfIe_XjuFrfy)Pt>HBrCYR@ z*b+lQXL3RISi9$eG}TtNwxoonZfCPtj0-%X`+CaV^$WRDASn5Vjdc8c_Q1~$I@R(k zTi>OfHf-v7nCbUrw%;-9rru5I@*t~iqU(%Jl{p?JnzLfhoNA9txW^uc=`S@Bt;kN4 z@WXb14b0k~f_~$hFJ@ULWGnmHi56N0HEoTeA@;4((qzzHWNNR3trwe0Eq{9=Bpk$K{L8&Vu+~wZ`3wg!lgKblK7$Bc5 zdyD|d4t&Ap+TlDN4_7Lc_?|s`ewR8{z9&p+$FF-z?r&=tW(*niO7D;me(l;D&CMMS z9&Z7YC}4tUx literal 0 HcmV?d00001 From 22169d945825f07bbec6e6866dd1d152f7806bb4 Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Sun, 1 Mar 2020 16:13:02 -0500 Subject: [PATCH 03/14] Fixes apps and metadata loading locally or remotely. --- scripts/defaultScripts.js | 2 +- scripts/system/more/app-more.js | 222 ++++++++--------- scripts/system/more/more.html | 410 ++++++++++++++++---------------- 3 files changed, 323 insertions(+), 311 deletions(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 2d4e19f2e4..a34a6aa2b5 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -34,7 +34,7 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/emote.js", "system/miniTablet.js", "system/audioMuteOverlay.js", - "system/keyboardShortcuts/keyboardShortcuts.js", + "system/keyboardShortcuts/keyboardShortcuts.js" ]; var DEFAULT_SCRIPTS_SEPARATE = [ "system/controllers/controllerScripts.js", diff --git a/scripts/system/more/app-more.js b/scripts/system/more/app-more.js index 91e5508a6b..e9cd8e94c0 100644 --- a/scripts/system/more/app-more.js +++ b/scripts/system/more/app-more.js @@ -11,126 +11,126 @@ // // 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..."; - var APP_URL = ROOT + "more.html"; - var APP_ICON_INACTIVE = ROOT + "appicon_i.png"; - var APP_ICON_ACTIVE = ROOT + "appicon_a.png"; - var Appstatus = false; - var lastProcessing = { - "action": "", - "script": "" - }; - - var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - tablet.screenChanged.connect(onScreenChanged); - var button = tablet.addButton({ - text: APP_NAME, - icon: APP_ICON_INACTIVE, + var ROOT = Script.resolvePath('').split("app-more.js")[0]; + var APP_NAME = "MORE..."; + var APP_URL = ROOT + "more.html"; + var APP_ICON_INACTIVE = ROOT + "appicon_i.png"; + var APP_ICON_ACTIVE = ROOT + "appicon_a.png"; + var Appstatus = false; + var lastProcessing = { + "action": "", + "script": "" + }; + + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + tablet.screenChanged.connect(onScreenChanged); + var button = tablet.addButton({ + text: APP_NAME, + icon: APP_ICON_INACTIVE, activeIcon: APP_ICON_ACTIVE - }); - - - function clicked() { - if (Appstatus == true) { - tablet.webEventReceived.disconnect(onMoreAppWebEventReceived); - tablet.gotoHomeScreen(); - Appstatus = false; - } else { - tablet.gotoWebScreen(APP_URL); - tablet.webEventReceived.connect(onMoreAppWebEventReceived); - Appstatus = true; - } - - button.editProperties({ - isActive: Appstatus - }); + }); + + + function clicked() { + if (Appstatus == true) { + tablet.webEventReceived.disconnect(onMoreAppWebEventReceived); + tablet.gotoHomeScreen(); + Appstatus = false; + } else { + tablet.gotoWebScreen(APP_URL); + tablet.webEventReceived.connect(onMoreAppWebEventReceived); + Appstatus = true; + } + + button.editProperties({ + isActive: Appstatus + }); - } - - button.clicked.connect(clicked); + } + + button.clicked.connect(clicked); - function sendRunningScriptList() { - var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); - tablet.emitScriptEvent(JSON.stringify(currentlyRunningScripts)); - } + function sendRunningScriptList() { + var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); + tablet.emitScriptEvent(JSON.stringify(currentlyRunningScripts)); + } - function onMoreAppWebEventReceived(eventz) { + function onMoreAppWebEventReceived(eventz) { - if (typeof eventz === "string") { - eventzget = JSON.parse(eventz); - - //print("EVENT ACTION: " + eventzget.action); - //print("EVENT SCRIPT: " + eventzget.script); - - if (eventzget.action === "installScript") { - - if (lastProcessing.action == eventzget.action && lastProcessing.script == eventzget.script) { - return; - } else { - ScriptDiscoveryService.loadOneScript(eventzget.script); - - lastProcessing.action = eventzget.action; - lastProcessing.script = eventzget.script; - - Script.setTimeout(function() { - sendRunningScriptList(); - }, 2000); - } - } + if (typeof eventz === "string") { + eventzget = JSON.parse(eventz); + + //print("EVENT ACTION: " + eventzget.action); + //print("EVENT SCRIPT: " + eventzget.script); + + if (eventzget.action === "installScript") { + + if (lastProcessing.action == eventzget.action && lastProcessing.script == eventzget.script) { + return; + } else { + ScriptDiscoveryService.loadOneScript(eventzget.script); + + lastProcessing.action = eventzget.action; + lastProcessing.script = eventzget.script; + + Script.setTimeout(function() { + sendRunningScriptList(); + }, 2000); + } + } - if (eventzget.action === "uninstallScript") { - - if (lastProcessing.action == eventzget.action && lastProcessing.script == eventzget.script) { - return; - } else { - ScriptDiscoveryService.stopScript(eventzget.script, false); - - lastProcessing.action = eventzget.action; - lastProcessing.script = eventzget.script; - - Script.setTimeout(function() { - sendRunningScriptList(); - }, 2000); - } - } + if (eventzget.action === "uninstallScript") { + + if (lastProcessing.action == eventzget.action && lastProcessing.script == eventzget.script) { + return; + } else { + ScriptDiscoveryService.stopScript(eventzget.script, false); + + lastProcessing.action = eventzget.action; + lastProcessing.script = eventzget.script; + + Script.setTimeout(function() { + sendRunningScriptList(); + }, 2000); + } + } - if (eventzget.action === "requestRunningScriptData") { - sendRunningScriptList(); - } + if (eventzget.action === "requestRunningScriptData") { + sendRunningScriptList(); + } - } - - } + } + + } - function onScreenChanged(type, url) { - if (type == "Web" && url.indexOf(APP_URL) != -1) { - //Active - //print("MORE... ACTIVE"); - Appstatus = true; - } else { - //Inactive - //print("MORE... INACTIVE"); - Appstatus = false; - } - - button.editProperties({ - isActive: Appstatus - }); - } - - - function cleanup() { - if (Appstatus) { - tablet.gotoHomeScreen(); - tablet.webEventReceived.disconnect(onMoreAppWebEventReceived); - } - tablet.screenChanged.disconnect(onScreenChanged); - tablet.removeButton(button); - } - - Script.scriptEnding.connect(cleanup); + function onScreenChanged(type, url) { + if (type == "Web" && url.indexOf(APP_URL) != -1) { + //Active + //print("MORE... ACTIVE"); + Appstatus = true; + } else { + //Inactive + //print("MORE... INACTIVE"); + Appstatus = false; + } + + button.editProperties({ + isActive: Appstatus + }); + } + + + function cleanup() { + if (Appstatus) { + tablet.gotoHomeScreen(); + tablet.webEventReceived.disconnect(onMoreAppWebEventReceived); + } + tablet.screenChanged.disconnect(onScreenChanged); + tablet.removeButton(button); + } + + Script.scriptEnding.connect(cleanup); }()); \ No newline at end of file diff --git a/scripts/system/more/more.html b/scripts/system/more/more.html index dfb71244e6..e74963bf65 100644 --- a/scripts/system/more/more.html +++ b/scripts/system/more/more.html @@ -9,217 +9,229 @@ --> - - - - + - -
-

Add more functionalities...

-

Want to add your own app? Read the guide!

- - - - - -
- - - - - -
- - - -
-
-
-
-

-
-
- - - + var counterDir = -1; + var counterDisp = 0; + var index = 0; + var lowItem = ""; + var needNext = false; + var pageContent = ""; + + 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){ + counterDir = counterDir + 1; + if ((counterDir >= offset) && (counterDir < (offset + perpage))){ + DisplayApp(metadata.applications[index]); + counterDisp = counterDisp + 1; + } + if (counterDir >= (offset + perpage)){ + needNext = true; + break; + } + } + } + + //pager + + function pagetoPrevious(){ + offset = offset - perpage; + if (offset < 0){ + offset = 0; + } + location.href = "more.html?offset=" + offset + "&perpage=" + perpage + "&search=" + encodeURI(search); + } + + function pagetoNext(){ + offset = offset + perpage; + location.href = "more.html?offset=" + offset + "&perpage=" + perpage + "&search=" + encodeURI(search); + } + + var pagerPrevious = ""; + if (offset <= 0){ + pagerPrevious = ""; + } + + var pagerNext = ""; + if (needNext == false){ + pagerNext = ""; + } + + var countA = offset + 1; + + var countB = offset + counterDisp; + + var pagerHtml = pagerPrevious + "  " + countA + " - " + countB + "  " + pagerNext; + + if (counterDisp > 0 ){ + document.getElementById("pager_top").innerHTML = pagerHtml; + document.getElementById("data").innerHTML = pageContent; + document.getElementById("pager_footer").innerHTML = pagerHtml; + }else{ + document.getElementById("data").innerHTML = "




Sorry, no result found.






"; + } + + requestRunningScriptData(); + + \ No newline at end of file From 95f1c5da25e48c242387d27bcbb72de6dacfa226 Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Sun, 1 Mar 2020 16:41:02 -0500 Subject: [PATCH 04/14] Add maintenance header. --- scripts/system/more/more.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/system/more/more.html b/scripts/system/more/more.html index e74963bf65..b6a1380ae8 100644 --- a/scripts/system/more/more.html +++ b/scripts/system/more/more.html @@ -4,6 +4,9 @@ // 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 +// // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html --> From 8092220ea4ce7c82bc45ff2c41c0e947051c4e67 Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Mon, 2 Mar 2020 08:51:38 -0500 Subject: [PATCH 05/14] Code housekeeping, update URL for guide to link to repo. --- scripts/system/more/app-more.js | 14 +++-- scripts/system/more/css/styles.css | 12 ++--- scripts/system/more/more.html | 85 +++++++++++++++++------------- 3 files changed, 60 insertions(+), 51 deletions(-) diff --git a/scripts/system/more/app-more.js b/scripts/system/more/app-more.js index e9cd8e94c0..ba8f3c24c1 100644 --- a/scripts/system/more/app-more.js +++ b/scripts/system/more/app-more.js @@ -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; diff --git a/scripts/system/more/css/styles.css b/scripts/system/more/css/styles.css index 54066b694b..4141b4927e 100644 --- a/scripts/system/more/css/styles.css +++ b/scripts/system/more/css/styles.css @@ -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 { diff --git a/scripts/system/more/more.html b/scripts/system/more/more.html index b6a1380ae8..c93f884700 100644 --- a/scripts/system/more/more.html +++ b/scripts/system/more/more.html @@ -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 = ""; } else { @@ -125,30 +133,31 @@ -
-

Add more functionalities...

-

Want to add your own app? Read the guide!

- - - - - -
- - - - - -
- - - -
-
-
-
+ + +

Add more functionalities...

+

Want to add your own app? Read the guide!

+ + + + + +
+ + + + + +
+ + + +
+
+
+

@@ -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 = ""; - if (offset <= 0){ + if (offset <= 0) { pagerPrevious = ""; } var pagerNext = ""; - if (needNext == false){ + if (!needNext) { pagerNext = ""; } @@ -226,11 +235,11 @@ var pagerHtml = pagerPrevious + "  " + countA + " - " + countB + "  " + 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 = "




Sorry, no result found.






"; } From 4eea4980fd8dc1c36d2fae53007c9e3df3f0156b Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Wed, 11 Mar 2020 14:59:35 -0400 Subject: [PATCH 06/14] Lint + fix default apps per page + fix script list loading bug. --- scripts/system/more/app-more.js | 16 +++--- scripts/system/more/more.html | 95 ++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 54 deletions(-) diff --git a/scripts/system/more/app-more.js b/scripts/system/more/app-more.js index ba8f3c24c1..915ab841e7 100644 --- a/scripts/system/more/app-more.js +++ b/scripts/system/more/app-more.js @@ -6,16 +6,12 @@ // 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..."; @@ -38,7 +34,7 @@ function clicked() { - if (Appstatus) { + if (Appstatus == true) { tablet.webEventReceived.disconnect(onMoreAppWebEventReceived); tablet.gotoHomeScreen(); Appstatus = false; @@ -64,14 +60,14 @@ function onMoreAppWebEventReceived(eventz) { if (typeof eventz === "string") { - eventzget = JSON.parse(eventz); + var eventzget = JSON.parse(eventz); //print("EVENT ACTION: " + eventzget.action); //print("EVENT SCRIPT: " + eventzget.script); 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); @@ -87,7 +83,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); @@ -111,7 +107,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; diff --git a/scripts/system/more/more.html b/scripts/system/more/more.html index c93f884700..0bebaf9522 100644 --- a/scripts/system/more/more.html +++ b/scripts/system/more/more.html @@ -7,6 +7,7 @@ // App maintained in: https://github.com/kasenvr/community-apps // App copied to: https://github.com/kasenvr/project-athena // +// // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html --> @@ -14,20 +15,29 @@ + + - + -
-

Add more functionalities...

-

Want to add your own app? Read the guide!

+ + Add more functionalities...
+
@@ -153,7 +151,7 @@
@@ -164,96 +162,115 @@
-
-

+
- +
- - \ No newline at end of file + From c78f7a9596197be76d66b34638b7ce992bd7fb5d Mon Sep 17 00:00:00 2001 From: kasenvr <52365539+kasenvr@users.noreply.github.com> Date: Mon, 16 Mar 2020 00:22:04 -0400 Subject: [PATCH 11/14] Apply suggestions from code review Co-Authored-By: David Rowe --- scripts/system/more/more.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/more/more.html b/scripts/system/more/more.html index 24435fc027..7186aa17db 100644 --- a/scripts/system/more/more.html +++ b/scripts/system/more/more.html @@ -165,7 +165,7 @@ - +
@@ -188,7 +188,7 @@ document.searchbar.searchtextbox.value = search; var pageContent = ""; - function DisplayApp(item) { + function displayApp(item) { pageContent = pageContent + ""; pageContent = pageContent + ""; var btn = ""; From 391c4975fa075c636e7aa6bcd6c0c03530d6c8cb Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Mon, 16 Mar 2020 00:25:08 -0400 Subject: [PATCH 12/14] var -> const in more.html Co-Authored-By: Keb Helion <60008426+KebHelion@users.noreply.github.com> --- scripts/system/more/more.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/more/more.html b/scripts/system/more/more.html index 7186aa17db..7a2c82de02 100644 --- a/scripts/system/more/more.html +++ b/scripts/system/more/more.html @@ -18,8 +18,8 @@

" + item.caption + "