[feat] Shrunk the UI of Hacknet Nodes to view more at a time on screen.

The UI of a single Hacknet Node now only takes up ~50% of the screen.
This allows two nodes to be displayed per "row" when the screen is wide
enough.

Also repositioned the buttons for the nodes so they are inline with the
information each updates. This visual correlation lets us reduce the
text that needs to be in each button.

Also reduced the amount of DOM that needs to be continuously garbage
collected by updating specific text rather than throwing out entire HTML
elements.
This commit is contained in:
Steven Evans
2018-06-05 13:19:33 -04:00
parent f28ffcc49e
commit 720478377f
5 changed files with 253 additions and 138 deletions
+16 -1
View File
@@ -74,6 +74,21 @@ function removeChildrenFromElement(el) {
}
}
/**
* Returns a reference to the first object with the specified value of the ID or NAME attribute, throwing an error if it is unable to find it.
* @param {string} elementId The HTML ID to retrieve the element by.
* @returns {HTMLElement} The single element.
* @throws {Error} When the 'idString' cannot be found.
*/
function getElementById(elementId) {
var el = document.getElementById(elementId);
if (el == null) {
throw new Error("Unable to find element with id '" + elementId + "'");
}
return el;
}
function createElement(type, params={}) {
var el = document.createElement(type);
if (params.id) {el.id = params.id;}
@@ -260,4 +275,4 @@ export {sizeOfObject, clearObject, addOffset, clearEventListeners, getRandomInt,
removeElementById, removeElement, createElement, createAccordionElement,
appendLineBreaks,
removeChildrenFromElement, createPopup, clearSelector, exceptionAlert,
createProgressBarText};
createProgressBarText, getElementById};