Minor code change

Minor code change
This commit is contained in:
Alezia Kurdis 2020-12-01 23:32:52 -05:00 committed by GitHub
parent 5a71881799
commit 670d832c8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,8 +9,8 @@
const ASCENDING_SORT = 1;
const DESCENDING_SORT = -1;
const ASCENDING_STRING = '▴';
const DESCENDING_STRING = '▾';
const ASCENDING_STRING = "▴";
const DESCENDING_STRING = "▾";
const BYTES_PER_MEGABYTE = 1024 * 1024;
const COLLAPSE_EXTRA_INFO = "E";
const EXPAND_EXTRA_INFO = "D";
@ -34,7 +34,7 @@ function displayIfNonZero(number) {
}
function getFilename(url) {
let urlParts = url.split('/');
let urlParts = url.split("/");
return urlParts[urlParts.length - 1];
}
@ -195,7 +195,7 @@ let lastSelectedEntity;
*/
let entityListContextMenu = null;
let currentSortColumnID = 'type';
let currentSortColumnID = "type";
let currentSortOrder = ASCENDING_SORT;
let elSortOrders = {};
let typeFilters = [];
@ -279,7 +279,7 @@ let elEntityTable,
elRenameInput;
const ENABLE_PROFILING = false;
let profileIndent = '';
let profileIndent = "";
const PROFILE_NOOP = function(_name, fn, args) {
fn.apply(this, args);
} ;
@ -330,7 +330,7 @@ function loaded() {
elSelectTopParent = document.getElementById("selecttopparent");
elAddChildrenToSelection = document.getElementById("addchildrentoselection");
elSelectFamily = document.getElementById("selectfamily");
elSelectTopFamily = document.getElementById("selecttopfamily");
elSelectTopFamily = document.getElementById("selecttopfamily");
elTeleportToEntity = document.getElementById("teleport-to-entity");
elSetCameraFocusToSelection = document.getElementById("setCameraFocusToSelection");
elToggleLocalWorldMode = document.getElementById("toggleLocalWorldMode");
@ -357,17 +357,17 @@ function loaded() {
elNoEntitiesMessage = document.getElementById("no-entities");
elColumnsMultiselectBox = document.getElementById("entity-table-columns-multiselect-box");
elColumnsOptions = document.getElementById("entity-table-columns-options");
elToggleSpaceMode = document.getElementById('toggle-space-mode');
elToggleSpaceMode = document.getElementById("toggle-space-mode");
document.body.onclick = onBodyClick;
elToggleLocked.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleLocked' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "toggleLocked" }));
};
elToggleVisible.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleVisible' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "toggleVisible" }));
};
elExport.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'export'}));
EventBridge.emitWebEvent(JSON.stringify({ type: "export"}));
};
elHmdMultiSelect.onclick = function() {
if (hmdMultiSelectMode) {
@ -377,7 +377,7 @@ function loaded() {
elHmdMultiSelect.className = "white vglyph";
hmdMultiSelectMode = true;
}
EventBridge.emitWebEvent(JSON.stringify({ type: 'hmdMultiSelectMode', value: hmdMultiSelectMode }));
EventBridge.emitWebEvent(JSON.stringify({ type: "hmdMultiSelectMode", value: hmdMultiSelectMode }));
};
elActionsMenu.onclick = function() {
document.getElementById("menuBackgroundOverlay").style.display = "block";
@ -395,43 +395,43 @@ function loaded() {
closeAllEntityListMenu();
};
elHmdCopy.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'copy' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "copy" }));
closeAllEntityListMenu();
};
elHmdCut.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'cut' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "cut" }));
closeAllEntityListMenu();
};
elHmdPaste.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'paste' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "paste" }));
closeAllEntityListMenu();
};
elHmdDuplicate.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'duplicate' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "duplicate" }));
closeAllEntityListMenu();
};
elParent.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'parent' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "parent" }));
closeAllEntityListMenu();
};
elUnparent.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "unparent" }));
closeAllEntityListMenu();
};
elUndo.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'undo' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "undo" }));
closeAllEntityListMenu();
};
elRedo.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'redo' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "redo" }));
closeAllEntityListMenu();
};
elDelete.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "delete" }));
closeAllEntityListMenu();
};
elMoveEntitySelectionToAvatar.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'moveEntitySelectionToAvatar' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "moveEntitySelectionToAvatar" }));
closeAllEntityListMenu();
};
elSelectAll.onclick = function() {
@ -493,31 +493,31 @@ function loaded() {
closeAllEntityListMenu();
};
elSelectAllInBox.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'selectAllInBox' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "selectAllInBox" }));
closeAllEntityListMenu();
};
elSelectAllTouchingBox.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'selectAllTouchingBox' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "selectAllTouchingBox" }));
closeAllEntityListMenu();
};
elSelectParent.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'selectParent' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "selectParent" }));
closeAllEntityListMenu();
};
elSelectTopParent.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'selectTopParent' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "selectTopParent" }));
closeAllEntityListMenu();
};
elAddChildrenToSelection.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'addChildrenToSelection' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "addChildrenToSelection" }));
closeAllEntityListMenu();
};
elSelectFamily.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'selectFamily' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "selectFamily" }));
closeAllEntityListMenu();
};
elSelectTopFamily.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'selectTopFamily' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "selectTopFamily" }));
closeAllEntityListMenu();
};
elTeleportToEntity.onclick = function () {
@ -529,19 +529,19 @@ function loaded() {
closeAllEntityListMenu();
};
elToggleLocalWorldMode.onclick = function () {
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleSpaceMode' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "toggleSpaceMode" }));
closeAllEntityListMenu();
};
elExportSelectedEntities.onclick = function () {
EventBridge.emitWebEvent(JSON.stringify({ type: 'export'}));
EventBridge.emitWebEvent(JSON.stringify({ type: "export"}));
closeAllEntityListMenu();
};
elImportEntitiesFromFile.onclick = function () {
EventBridge.emitWebEvent(JSON.stringify({ type: 'importFromFile'}));
EventBridge.emitWebEvent(JSON.stringify({ type: "importFromFile"}));
closeAllEntityListMenu();
};
elImportEntitiesFromUrl.onclick = function () {
EventBridge.emitWebEvent(JSON.stringify({ type: 'importFromUrl'}));
EventBridge.emitWebEvent(JSON.stringify({ type: "importFromUrl"}));
closeAllEntityListMenu();
};
elGridActivator.onclick = function () {
@ -561,7 +561,7 @@ function loaded() {
closeAllEntityListMenu();
};
elToggleSpaceMode.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleSpaceMode' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "toggleSpaceMode" }));
};
elRefresh.onclick = refreshEntities;
elFilterTypeMultiselectBox.onclick = onToggleTypeDropdown;
@ -579,11 +579,11 @@ function loaded() {
let type = FILTER_TYPES[i];
let typeFilterID = "filter-type-" + type;
let elDiv = document.createElement('div');
let elDiv = document.createElement("div");
elDiv.onclick = onToggleTypeFilter;
elFilterTypeOptions.insertBefore(elDiv, elFilterTypeOptionsButtons);
let elInput = document.createElement('input');
let elInput = document.createElement("input");
elInput.setAttribute("type", "checkbox");
elInput.setAttribute("id", typeFilterID);
elInput.setAttribute("filterType", type);
@ -591,12 +591,12 @@ function loaded() {
elFilterTypeInputs[type] = elInput;
elDiv.appendChild(elInput);
let elLabel = document.createElement('label');
let elLabel = document.createElement("label");
elLabel.setAttribute("for", typeFilterID);
elLabel.innerText = type;
elDiv.appendChild(elLabel);
let elSpan = document.createElement('span');
let elSpan = document.createElement("span");
elSpan.setAttribute("class", "typeIcon");
elSpan.innerHTML = ENTITY_TYPE_ICON[type];
@ -629,11 +629,11 @@ function loaded() {
elTh.innerText = columnData.columnHeader;
}
elTh.onmousedown = function(event) {
if (event.target.nodeName === 'TH') {
if (event.target.nodeName === "TH") {
elTargetTh = event.target;
targetColumnIndex = parseInt(elTargetTh.getAttribute("columnIndex"));
lastColumnSwapPosition = event.clientX;
} else if (event.target.nodeName === 'SPAN') {
} else if (event.target.nodeName === "SPAN") {
elTargetSpan = event.target;
}
initialThEvent = event;
@ -656,18 +656,18 @@ function loaded() {
if (columnData.alwaysShown !== true) {
let columnDropdownID = "entity-table-column-" + columnID;
let elDiv = document.createElement('div');
let elDiv = document.createElement("div");
elDiv.onclick = onToggleColumn;
elColumnsOptions.appendChild(elDiv);
let elInput = document.createElement('input');
let elInput = document.createElement("input");
elInput.setAttribute("type", "checkbox");
elInput.setAttribute("id", columnDropdownID);
elInput.setAttribute("columnID", columnID);
elInput.checked = columnData.initiallyShown === true;
elDiv.appendChild(elInput);
let elLabel = document.createElement('label');
let elLabel = document.createElement("label");
elLabel.setAttribute("for", columnDropdownID);
elLabel.innerText = columnData.dropdownLabel;
elDiv.appendChild(elLabel);
@ -702,7 +702,7 @@ function loaded() {
let elCell = entity.elRow.childNodes[getColumnIndex("name")];
elRenameInput = document.createElement("input");
elRenameInput.setAttribute('class', 'rename-entity');
elRenameInput.setAttribute("class", "rename-entity");
elRenameInput.value = entity.name;
let ignoreClicks = function(event) {
event.stopPropagation();
@ -767,22 +767,22 @@ function loaded() {
entityListContextMenu.setOnSelectedCallback(function(optionName, selectedEntityID) {
switch (optionName) {
case "Cut":
EventBridge.emitWebEvent(JSON.stringify({ type: 'cut' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "cut" }));
break;
case "Copy":
EventBridge.emitWebEvent(JSON.stringify({ type: 'copy' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "copy" }));
break;
case "Paste":
EventBridge.emitWebEvent(JSON.stringify({ type: 'paste' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "paste" }));
break;
case "Rename":
startRenamingEntity(selectedEntityID);
break;
case "Duplicate":
EventBridge.emitWebEvent(JSON.stringify({ type: 'duplicate' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "duplicate" }));
break;
case "Delete":
EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "delete" }));
break;
}
});
@ -806,11 +806,11 @@ function loaded() {
}));
}
let enabledContextMenuItems = ['Copy', 'Paste', 'Duplicate'];
let enabledContextMenuItems = ["Copy", "Paste", "Duplicate"];
if (entitiesByID[entityID] && !entitiesByID[entityID].locked) {
enabledContextMenuItems.push('Cut');
enabledContextMenuItems.push('Rename');
enabledContextMenuItems.push('Delete');
enabledContextMenuItems.push("Cut");
enabledContextMenuItems.push("Rename");
enabledContextMenuItems.push("Delete");
}
entityListContextMenu.open(clickEvent, entityID, enabledContextMenuItems);
@ -1009,7 +1009,7 @@ function loaded() {
if (id === deletedIDs[i]) {
let elRow = entities[j].elRow;
if (elRow) {
elRow.className = '';
elRow.className = "";
elRow.dataset.entityID = EMPTY_ENTITY_ID;
}
entities.splice(j, 1);
@ -1092,7 +1092,7 @@ function loaded() {
}
function refreshEntities() {
EventBridge.emitWebEvent(JSON.stringify({ type: 'refresh' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "refresh" }));
}
function refreshFooter() {
@ -1119,7 +1119,7 @@ function loaded() {
if (entity !== undefined) {
entity.selected = false;
if (entity.elRow) {
entity.elRow.className = '';
entity.elRow.className = "";
}
}
});
@ -1133,9 +1133,9 @@ function loaded() {
entity.selected = true;
if (entity.elRow) {
if (id === lastSelectedEntity) {
entity.elRow.className = 'last-selected';
entity.elRow.className = "last-selected";
} else {
entity.elRow.className = 'selected';
entity.elRow.className = "selected";
}
}
} else {
@ -1206,12 +1206,12 @@ function loaded() {
// if this entity was previously selected flag it's row as selected
if (itemData.selected) {
if (itemData.id === lastSelectedEntity) {
elRow.className = 'last-selected';
elRow.className = "last-selected";
} else {
elRow.className = 'selected';
elRow.className = "selected";
}
} else {
elRow.className = '';
elRow.className = "";
}
// if this row previously had an associated entity ID that wasn't the new entity ID then clear
@ -1264,9 +1264,9 @@ function loaded() {
}
function onRadiusChange() {
elFilterRadius.value = elFilterRadius.value.replace(/[^0-9]/g, '');
elFilterRadius.value = elFilterRadius.value.replace(/[^0-9]/g, "");
elFilterRadius.value = Math.max(elFilterRadius.value, 0);
EventBridge.emitWebEvent(JSON.stringify({ type: 'radius', radius: elFilterRadius.value }));
EventBridge.emitWebEvent(JSON.stringify({ type: "radius", radius: elFilterRadius.value }));
refreshEntities();
}
@ -1487,7 +1487,7 @@ function loaded() {
}
if (isColumnsSettingLoaded) {
EventBridge.emitWebEvent(JSON.stringify({ type: 'saveColumnsConfigSetting', columnsData: columns }));
EventBridge.emitWebEvent(JSON.stringify({ type: "saveColumnsConfigSetting", columnsData: columns }));
}
entityList.refresh();
@ -1690,7 +1690,7 @@ function loaded() {
}
EventBridge.emitWebEvent(JSON.stringify({
type: 'keyUpEvent',
type: "keyUpEvent",
keyUpEvent: {
code,
key,
@ -1790,7 +1790,7 @@ function loaded() {
}
}
} else {
EventBridge.emitWebEvent(JSON.stringify({ type: 'saveColumnsConfigSetting', columnsData: "" }));
EventBridge.emitWebEvent(JSON.stringify({ type: "saveColumnsConfigSetting", columnsData: "" }));
}
}
isColumnsSettingLoaded = true;
@ -1803,7 +1803,7 @@ function loaded() {
window.addEventListener("resize", updateColumnWidths);
EventBridge.emitWebEvent(JSON.stringify({ type: 'loadConfigSetting' }));
EventBridge.emitWebEvent(JSON.stringify({ type: "loadConfigSetting" }));
});
augmentSpinButtons();