diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index a8eb12021e..06b97d33ba 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -41,6 +41,7 @@ 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": "communityScripts/decentralizedGoTo/decentralizedGoTo.js", "beta": "https://metaverse.projectathena.io/interim/d-goto/app/decentralizedGoTo.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..99b359d9e8 --- /dev/null +++ b/scripts/system/more/app-more.js @@ -0,0 +1,118 @@ +"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) { + 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(); + 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 += "_" + runningScriptJson; + } + } + tablet.emitScriptEvent(newMessage); + } + + function onMoreAppWebEventReceived(message) { + if (typeof message === "string") { + var instruction = JSON.parse(message); + + if (instruction.action === "installScript") { + if (lastProcessing.action !== instruction.action || lastProcessing.script !== instruction.script) { + ScriptDiscoveryService.loadOneScript(instruction.script); + lastProcessing.action = instruction.action; + lastProcessing.script = instruction.script; + Script.setTimeout(function() { + sendRunningScriptList(); + }, 1500); + } + } + + if (instruction.action === "uninstallScript") { + if (lastProcessing.action !== instruction.action || lastProcessing.script !== instruction.script) { + ScriptDiscoveryService.stopScript(instruction.script, false); + lastProcessing.action = instruction.action; + lastProcessing.script = instruction.script; + Script.setTimeout(function() { + sendRunningScriptList(); + }, 1500); + } + } + + if (instruction.action === "requestRunningScriptData") { + sendRunningScriptList(); + } + } + } + + function onScreenChanged(type, url) { + if (type === "Web" && url.indexOf(APP_URL) !== -1) { + appStatus = true; + } else { + 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); +}()); diff --git a/scripts/system/more/appicon_a.png b/scripts/system/more/appicon_a.png new file mode 100644 index 0000000000..b62d597746 Binary files /dev/null and b/scripts/system/more/appicon_a.png differ diff --git a/scripts/system/more/appicon_i.png b/scripts/system/more/appicon_i.png new file mode 100644 index 0000000000..e765410b50 Binary files /dev/null and b/scripts/system/more/appicon_i.png differ diff --git a/scripts/system/more/blank_minus-16.png b/scripts/system/more/blank_minus-16.png new file mode 100644 index 0000000000..dfa1a82802 Binary files /dev/null and b/scripts/system/more/blank_minus-16.png differ diff --git a/scripts/system/more/blank_plus-16.png b/scripts/system/more/blank_plus-16.png new file mode 100644 index 0000000000..c40ab20443 Binary files /dev/null and b/scripts/system/more/blank_plus-16.png differ diff --git a/scripts/system/more/css/styles.css b/scripts/system/more/css/styles.css new file mode 100644 index 0000000000..1f9aba0695 --- /dev/null +++ b/scripts/system/more/css/styles.css @@ -0,0 +1,186 @@ +/* + styles.css + + Created by Kalila L. on 23 Feb 2020. + Copyright 2020 Project Athena and contributors. + + Distributed under the Apache License, Version 2.0. + See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +*/ + +body { + background: #27343B; + font-family: 'Merriweather', sans-serif; + font-size: 14px; + color: #FFFFFF; + font-weight: 600; + text-decoration: none; + font-style: normal; + font-variant: normal; + text-transform: none; +} + +font.mainTitle { + font-family: 'Quicksand', sans-serif; + font-size: 28px; + color: #ffffff; + font-weight: 800; + text-decoration: none; + font-style: normal; + font-variant: normal; + text-transform: none; + text-shadow: 3px 3px 3px rgba(63,64,76,1); +} + +p.mainDesc { + font-family: 'Merriweather', sans-serif; + font-size: 14px; + font-weight: 500; +} + +p a { + color: SteelBlue; +} + +font.appname { + font-family: 'Merriweather', sans-serif; + font-size: 18px; + color: #CFB538; + font-weight: 800; + text-decoration: none; + font-style: normal; + font-variant: normal; + text-transform: none; + margin-bottom: 5px; + float: left; + clear: both; +} + +font.appdesc { + font-family: 'Merriweather', sans-serif; + font-size: 15px; + color: #ffffff; + font-weight: 500; + text-decoration: none; + font-style: normal; + font-variant: normal; + text-transform: none; + margin-bottom: 5px; + float: left; + clear: both; +} + +font.noresult { + font-family: Arial, Helvetica, sans-serif; + font-size: 18px; + color: #aaaaaa; + font-weight: 500; + text-decoration: none; + font-style: normal; + font-variant: normal; + text-transform: none; +} + +font.caption { + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + color: #ffffff; + font-weight: 600; + text-decoration: none; + font-style: normal; + font-variant: normal; + text-transform: none; +} + +font.pager { + font-family: 'Quicksand', sans-serif; + font-size: 14px; + color: #B2B5D9; + font-weight: 600; + text-decoration: none; + font-style: normal; + font-variant: normal; + text-transform: none; +} + +div.iconContainer{ + border-radius: 15px; + background: #000000; + padding: 5px; + width: 70px; + height: 70px; + text-align: center; +} + +table.item { + background: #3E415E; +} + +td { + vertical-align: top; + padding: 5px; +} + +button.install { + font-family: Arial, Helvetica, sans-serif; + background-color: #008CBA; + font-size: 16px; + color: #ffffff; + font-weight: 600; + border-radius: 6px; + border: 2px solid #008CBA; + transition-duration: 0.3s; + float: right; +} + +button.install:hover { + background-color: #10afe3; + border: 2px solid #10afe3; +} + +button.uninstall { + font-family: Arial, Helvetica, sans-serif; + background-color: #b34700; + font-size: 16px; + color: #ffffff; + font-weight: 600; + border-radius: 6px; + border: 2px solid #b34700; + transition-duration: 0.3s; + float: right; +} + +button.uninstall:hover { + background-color: #e34c22; + border: 2px solid #e34c22; +} + +button.processing { + font-family: Arial, Helvetica, sans-serif; + background-color: #b59207; + font-size: 16px; + color: #ffffff; + font-weight: 600; + border-radius: 6px; + border: 2px solid #b59207; + transition-duration: 0.3s; + float: right; +} + +div.searchbox { + border-radius: 6px; + background: #ffffff; + padding: 4px; + border: 0px; + vertical-align: middle; +} + +input.searchtextbox{ + font-family: Arial, Helvetica, sans-serif; + font-size: 14px; + color: #000000; + font-weight: 400; + text-decoration: none; + border: 0px; + outline-color: #ffffff; +} diff --git a/scripts/system/more/del-x-16.png b/scripts/system/more/del-x-16.png new file mode 100644 index 0000000000..9a5153d26f Binary files /dev/null and b/scripts/system/more/del-x-16.png differ diff --git a/scripts/system/more/minus-16.png b/scripts/system/more/minus-16.png new file mode 100644 index 0000000000..e5caf2615c Binary files /dev/null and b/scripts/system/more/minus-16.png differ diff --git a/scripts/system/more/more.html b/scripts/system/more/more.html new file mode 100644 index 0000000000..218744969e --- /dev/null +++ b/scripts/system/more/more.html @@ -0,0 +1,276 @@ + + + + + + + + + + + + +
+ Add more functionalities...
+ + + + + +
+ + + + + +
+ + + +
+
+
+
+
+
+
+ +
+
+

Want to contribute and add your own app?
+ Read the guide!

+ + + diff --git a/scripts/system/more/plus-16.png b/scripts/system/more/plus-16.png new file mode 100644 index 0000000000..6935847757 Binary files /dev/null and b/scripts/system/more/plus-16.png differ diff --git a/scripts/system/more/search-32.png b/scripts/system/more/search-32.png new file mode 100644 index 0000000000..8d4bb5daa2 Binary files /dev/null and b/scripts/system/more/search-32.png differ