Perform CR updates.

This commit is contained in:
Kasen IO 2020-07-08 14:33:53 -04:00
parent c074f7573c
commit 343f883ac3
11 changed files with 379 additions and 338 deletions

View file

@ -0,0 +1,31 @@
module.exports = {
root: true,
extends: "eslint:recommended",
"parserOptions": {
"ecmaVersion": 5
},
"rules": {
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
"camelcase": ["error"],
"comma-dangle": ["error", "never"],
"curly": ["error", "all"],
"eqeqeq": ["error", "always"],
"indent": ["error", 4, { "SwitchCase": 1 }],
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict" }],
"keyword-spacing": ["error", { "before": true, "after": true }],
"max-len": ["error", 128, 4],
"new-cap": ["error"],
"no-console": ["off"],
"no-floating-decimal": ["error"],
"no-magic-numbers": ["error", { "ignore": [0.5, -1, 0, 1, 2], "ignoreArrayIndexes": true }],
"no-multi-spaces": ["error"],
"no-multiple-empty-lines": ["error"],
"no-unused-vars": ["error", { "args": "none", "vars": "local" }],
"semi": ["error", "always"],
"space-before-blocks": ["error"],
"space-before-function-paren": ["error", { "anonymous": "ignore", "named": "never" }],
"spaced-comment": ["error", "always", { "line": { "markers": ["/"] } }]
}
};

View file

@ -1,6 +1,5 @@
.DS_Store
node_modules
/dist
# local env files
.env.local

View file

@ -1,3 +1,14 @@
<!--
//
// index.html
//
// Created by kasenvr@gmail.com on 7 Apr 2020
// Copyright 2020 Vircadia 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
//
-->
<!DOCTYPE html>
<html lang="en">
<head>

View file

@ -8,7 +8,11 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* global AvatarList Clipboard console Controller Entities location Messages MyAvatar Script ScriptDiscoveryService Settings
Tablet Vec3 Window */
(function () { // BEGIN LOCAL_SCOPE
"use strict";
var AppUi = Script.require('appUi');
var ui;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
@ -23,42 +27,45 @@ var inventorySettings;
var RECEIVING_ITEM_QUEUE_LIMIT = 5;
var receivingItemQueue = [];
var NEARBY_USERS_SEARCH_RADIUS = 25;
// APP EVENT AND MESSAGING ROUTING
function onWebAppEventReceived(event) {
var eventJSON = JSON.parse(event);
if (eventJSON.app == "inventory") { // This is our web app!
if (eventJSON.app === "inventory") { // This is our web app!
// print("inventory.js received a web event: " + event);
if (eventJSON.command == "ready") {
if (eventJSON.command === "ready") {
initializeInventoryApp();
}
if (eventJSON.command == "web-to-script-inventory") {
if (eventJSON.command === "web-to-script-inventory") {
receiveInventory(eventJSON.data);
}
if (eventJSON.command == "web-to-script-settings") {
if (eventJSON.command === "web-to-script-settings") {
receiveSettings(eventJSON.data);
}
if (eventJSON.command == "use-item") {
if (eventJSON.command === "use-item") {
useItem(eventJSON.data);
}
if (eventJSON.command == "share-item") {
if (eventJSON.command === "share-item") {
shareItem(eventJSON.data);
}
if (eventJSON.command == "web-to-script-request-nearby-users") {
if (eventJSON.command === "web-to-script-request-nearby-users") {
sendNearbyUsers();
}
if (eventJSON.command == "web-to-script-request-receiving-item-queue") {
if (eventJSON.command === "web-to-script-request-receiving-item-queue") {
sendReceivingItemQueue();
}
if (eventJSON.command == "web-to-script-update-receiving-item-queue") {
if (eventJSON.command === "web-to-script-update-receiving-item-queue") {
updateReceivingItemQueue(eventJSON.data);
}
@ -72,7 +79,7 @@ function sendToWeb(command, data) {
"app": "inventory",
"command": command,
"data": data
}
};
tablet.emitScriptEvent(JSON.stringify(dataToSend));
}
@ -80,10 +87,11 @@ function sendToWeb(command, data) {
var inventoryMessagesChannel = "com.vircadia.inventory";
function onMessageReceived(channel, message, sender, localOnly) {
if (channel == inventoryMessagesChannel) {
if (channel === inventoryMessagesChannel) {
var messageJSON = JSON.parse(message);
// Window.alert("Passed 0 " + messageJSON.recipient + " vs " + MyAvatar.sessionUUID);
if (messageJSON.command == "share-item" && messageJSON.recipient == MyAvatar.sessionUUID) { // We are receiving an item.
if (messageJSON.command === "share-item"
&& messageJSON.recipient === MyAvatar.sessionUUID) { // We are receiving an item.
// Window.alert("Passed 1 " + messageJSON.recipient + " vs " + MyAvatar.sessionUUID);
pushReceivedItemToQueue(sender, messageJSON.type, messageJSON.name, messageJSON.url);
}
@ -158,10 +166,10 @@ function pushReceivedItemToQueue(senderUUID, type, name, url) {
"name": name,
"url": url
}
}
};
if (receivingItemQueue.length === RECEIVING_ITEM_QUEUE_LIMIT) {
receivingItemQueue = receivingItemQueue.slice(1, 5);
receivingItemQueue = receivingItemQueue.slice(1, RECEIVING_ITEM_QUEUE_LIMIT);
}
receivingItemQueue.push(packageRequest);
@ -178,16 +186,17 @@ function updateReceivingItemQueue(data) {
}
function sendNearbyUsers() {
var nearbyUsers = AvatarList.getAvatarsInRange(MyAvatar.position, 25); // Find all users within 25m.
var nearbyUsers = AvatarList.getAvatarsInRange(MyAvatar.position, NEARBY_USERS_SEARCH_RADIUS);
var nearbyUsersToSend = [];
nearbyUsers.forEach(function(user, i) {
nearbyUsers.forEach(function(user) {
var objectToWrite;
var aviDetails = AvatarList.getAvatar(user)
var aviDetails = AvatarList.getAvatar(user);
var aviName = aviDetails.displayName;
var aviDistance = Vec3.distance(MyAvatar.position, aviDetails.position);
// Window.alert("aviName" + aviName + "user" + user + "MyAvatar.sessionUUID" + MyAvatar.sessionUUID);
if (user != MyAvatar.sessionUUID || Controller.getValue(Controller.Hardware.Keyboard.Shift)) { // Don't add ourselves to the list!
if (user !== MyAvatar.sessionUUID
|| Controller.getValue(Controller.Hardware.Keyboard.Shift)) { // Don't add ourselves to the list!
objectToWrite = { "name": aviName, "distance": aviDistance, "uuid": user };
nearbyUsersToSend.push(objectToWrite);
}
@ -204,30 +213,29 @@ function useItem(item) {
item.type = item.type.toUpperCase();
// Depending on the type, we decide how to load this item.
if (item.type == "SCRIPT") {
ScriptDiscoveryService.loadScript(item.url, true, false, false, true, false); // See SDS.loadScript in APIDocs for more.
if (item.type === "SCRIPT") {
ScriptDiscoveryService.loadScript(item.url, true, false, false, true, false);
}
if (item.type == "MODEL") {
var entityID = Entities.addEntity({
if (item.type === "MODEL") {
Entities.addEntity({
type: "Model",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -1.5 })),
rotation: MyAvatar.orientation,
modelURL: item.url,
collisionless: true,
collisionless: true
});
}
if (item.type == "AVATAR") {
if (item.type === "AVATAR") {
MyAvatar.useFullAvatarURL(item.url);
}
if (item.type == "PLACE") {
location.handleLookupString(item.url, true); // https://apidocs.vircadia.dev/location.html#.handleLookupString
if (item.type === "PLACE") {
location.handleLookupString(item.url, true);
}
if (item.type == "JSON") {
// https://apidocs.vircadia.dev/Clipboard.html#.importEntities
if (item.type === "JSON") {
var jsonToLoad = item.url;
if (jsonToLoad) {
if (Clipboard.importEntities(jsonToLoad)) {
@ -241,7 +249,7 @@ function useItem(item) {
}
}
if (item.type == "UNKNOWN") {
if (item.type === "UNKNOWN") {
// We don't know how to handle this yet.
Window.alert("Unknown item type, unable to use.");
}

View file

@ -702,24 +702,24 @@ if (!browserDevelopment()) {
EventBridge.scriptEventReceived.connect(function(receivedCommand) {
receivedCommand = JSON.parse(receivedCommand);
// alert("RECEIVED COMMAND:" + receivedCommand.command)
if (receivedCommand.app == "inventory") {
if (receivedCommand.app === "inventory") {
// We route the data based on the command given.
if (receivedCommand.command == 'script-to-web-inventory') {
if (receivedCommand.command === 'script-to-web-inventory') {
// alert("INVENTORY RECEIVED ON APP:" + JSON.stringify(receivedCommand.data));
vue_this.receiveInventory(receivedCommand.data);
}
if (receivedCommand.command == 'script-to-web-receiving-item-queue') {
if (receivedCommand.command === 'script-to-web-receiving-item-queue') {
// alert("RECEIVING ITEM QUEUE:" + JSON.stringify(receivedCommand.data));
vue_this.receiveReceivingItemQueue(receivedCommand.data);
}
if (receivedCommand.command == 'script-to-web-nearby-users') {
if (receivedCommand.command === 'script-to-web-nearby-users') {
// alert("RECEIVING NEARBY USERS:" + JSON.stringify(receivedCommand.data));
vue_this.receiveNearbyUsers(receivedCommand.data);
}
if (receivedCommand.command == 'script-to-web-settings') {
if (receivedCommand.command === 'script-to-web-settings') {
// alert("RECEIVING SETTINGS:" + JSON.stringify(receivedCommand.data));
vue_this.receiveSettings(receivedCommand.data);
}
@ -875,10 +875,7 @@ export default {
case ".json":
detectedItemType = "JSON";
break;
}
if (detectedItemType == null) {
// This is not a known item...
default:
detectedItemType = "UNKNOWN";
}
@ -889,12 +886,12 @@ export default {
itemType = itemType.toUpperCase();
this.$store.state.supportedItemTypes.forEach(function (itemTypeInList) {
if (itemTypeInList == itemType) {
if (itemTypeInList === itemType) {
detectedItemType = itemTypeInList;
}
});
if (detectedItemType == null) {
if (detectedItemType === null) {
// This is not a known item type...
detectedItemType = "UNKNOWN";
}
@ -917,8 +914,8 @@ export default {
if (findFolder) {
findFolder.returnedItem.name = this.$store.state.editFolderDialog.data.name;
if (this.$store.state.editFolderDialog.data.folder !== null && this.$store.state.editFolderDialog.data.folder !== "No Change") {
if (findFolder.returnedItem.folder !== this.$store.state.editFolderDialog.data.folder && this.$store.state.editFolderDialog.data.folder !== "No Folder") {
if (this.$store.state.editFolderDialog.data.folder !=== null && this.$store.state.editFolderDialog.data.folder !=== "No Change") {
if (findFolder.returnedItem.folder !=== this.$store.state.editFolderDialog.data.folder && this.$store.state.editFolderDialog.data.folder !=== "No Folder") {
this.moveFolder(uuid, this.$store.state.editFolderDialog.data.folder);
} else if (this.$store.state.editFolderDialog.data.folder === "No Folder") {
this.moveFolder(uuid, "top");
@ -1069,7 +1066,7 @@ export default {
var generateList;
this.recursiveFolderHoldingList = []; // Clear that list before we do anything.
if (request == "edit") {
if (request === "edit") {
this.folderList = [
{
"name": "No Change",
@ -1083,7 +1080,7 @@ export default {
generateList = this.recursiveFolderPopulate(this.itemsStore, null);
} else if (request == "add") {
} else if (request === "add") {
this.folderList = [
{
"name": "No Folder",
@ -1093,7 +1090,7 @@ export default {
generateList = this.recursiveFolderPopulate(this.itemsStore, null);
} else if (request == "editFolder") {
} else if (request === "editFolder") {
this.folderList = [
{
"name": "No Change",
@ -1165,7 +1162,7 @@ export default {
},
recursiveSingularSearch: function(uuid, indexToSearch) {
for (var i = 0; i < indexToSearch.length; i++) {
if (indexToSearch[i].uuid == uuid) {
if (indexToSearch[i].uuid === uuid) {
var foundItem = {
"returnedItem": indexToSearch[i],
"iteration": i,
@ -1424,7 +1421,7 @@ export default {
},
receivingItemQueue: {
handler: function() {
// Do nothing.
}
},
}

View file

@ -1,3 +1,13 @@
/*
styles.css
Created by Kalila L. on 7 Apr 2020
Copyright 2020 Vircadia 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
*/
/* Top Level */
.draggable-card {

View file

@ -1,3 +1,13 @@
<!--
NotUsing.vue
Created by Kalila L. on 7 Apr 2020
Copyright 2020 Vircadia 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
-->
<template v-if="!disabledProp">
<v-data-iterator
:items="items"

View file

@ -1,12 +1,22 @@
/*
main.js
Created by Kalila L. on 7 Apr 2020
Copyright 2020 Vircadia 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
*/
import Vue from 'vue'
import App from './App.vue'
import vuetify from './plugins/vuetify';
import { store } from './plugins/store';
Vue.config.productionTip = false
Vue.config.productionTip = false;
window.vm = new Vue({
vuetify,
store,
render: h => h(App)
}).$mount('#app')
}).$mount('#app');

View file

@ -17,6 +17,7 @@ export const store = new Vuex.Store({
devtools: true,
state: {
items: [
// This is test data and is primarily used for in browser development.
{
"type": "script",
"name": "VRGrabScale",
@ -52,62 +53,6 @@ export const store = new Vuex.Store({
],
"uuid": "sdfsdf",
},
// {
// "hasChildren": true,
// "name": "Test Folder",
// "folder": "No Folder",
// "items": [
// {
// "hasChildren": false,
// "type": "script",
// "name": "TESTFOLDERSCRIPT",
// "url": "https://googfdafsgaergale.com/vr.js",
// "folder": "Test Folder",
// "uuid": "54hgfhgf25fdfadf4354353",
// },
// {
// "hasChildren": false,
// "type": "script",
// "name": "FOLDERSCRIPT2",
// "url": "https://googfdafsgaergale.com/vr.js",
// "folder": "Test Folder",
// "uuid": "54hgfhgf25ffdafddfadf4354353",
// },
// {
// "hasChildren": true,
// "name": "FolderWithinAFolder",
// "folder": "Test Folder",
// "items": [
// {
// "hasChildren": false,
// "type": "script",
// "name": "inception1",
// "url": "https://googfdafsgaergale.com/vr.js",
// "folder": "FolderWithinAFolder",
// "uuid": "54hgfhgf25fdfadeqwqeqf4354353",
// },
// {
// "hasChildren": false,
// "type": "script",
// "name": "123what",
// "url": "https://googfdafsgaergale.com/vr.js",
// "folder": "FolderWithinAFolder",
// "uuid": "54hgfhgf25ffdafdWDQDdsadasQWWQdfadf4354353",
// },
// {
// "hasChildren": false,
// "type": "script",
// "name": "inception432",
// "url": "https://googfdafsgaergale.com/vr.js",
// "folder": "FolderWithinAFolder",
// "uuid": "54hgfhgf25ffdafdWDQDQWWQdfadf4354353",
// },
// ],
// "uuid": "54354363wgtrhtrhegs45ujs"
// },
// ],
// "uuid": "54354363wgsegs45ujs",
// },
{
"type": "script",
"name": "VRGrabScale",

View file

@ -1,3 +1,13 @@
/*
vuetify.js
Created by Kalila L. on 7 Apr 2020
Copyright 2020 Vircadia 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
*/
import Vue from 'vue';
import Vuetify from 'vuetify/lib';

View file

@ -1,3 +1,13 @@
/*
vue.config.js
Created by Kalila L. on 7 Apr 2020
Copyright 2020 Vircadia 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
*/
module.exports = {
publicPath: "./",
assetsDir: "./",