From da07790594f1bc4ff298714406bda6c1ec875dfc Mon Sep 17 00:00:00 2001 From: William Blythe Date: Tue, 23 Oct 2018 09:40:13 +1100 Subject: [PATCH] various bits --- d3.js | 966 ++----------------------------- d3.min.js | 2 +- src/app/Coriolis.jsx | 4 +- src/app/components/Ad.jsx | 39 ++ src/app/pages/AboutPage.jsx | 134 ++++- src/app/pages/NotFoundPage.jsx | 4 +- src/app/pages/OutfittingPage.jsx | 594 +++++++++++++++---- src/app/pages/ShipyardPage.jsx | 504 +++++++++++----- src/index.ejs | 7 +- 9 files changed, 1059 insertions(+), 1195 deletions(-) create mode 100644 src/app/components/Ad.jsx diff --git a/d3.js b/d3.js index 9e4e3102..888fbbf3 100644 --- a/d3.js +++ b/d3.js @@ -2129,864 +2129,6 @@ cubehelix$1(hue); var cubehelixLong = cubehelix$1(nogamma); - var xhtml$1 = "http://www.w3.org/1999/xhtml"; - - var namespaces$1 = { - svg: "http://www.w3.org/2000/svg", - xhtml: xhtml$1, - xlink: "http://www.w3.org/1999/xlink", - xml: "http://www.w3.org/XML/1998/namespace", - xmlns: "http://www.w3.org/2000/xmlns/" - }; - - function namespace$1(name) { - var prefix = name += "", i = prefix.indexOf(":"); - if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); - return namespaces$1.hasOwnProperty(prefix) ? {space: namespaces$1[prefix], local: name} : name; - } - - function creatorInherit$1(name) { - return function() { - var document = this.ownerDocument, - uri = this.namespaceURI; - return uri === xhtml$1 && document.documentElement.namespaceURI === xhtml$1 - ? document.createElement(name) - : document.createElementNS(uri, name); - }; - } - - function creatorFixed$1(fullname) { - return function() { - return this.ownerDocument.createElementNS(fullname.space, fullname.local); - }; - } - - function creator$1(name) { - var fullname = namespace$1(name); - return (fullname.local - ? creatorFixed$1 - : creatorInherit$1)(fullname); - } - - function none$1() {} - - function selector$1(selector) { - return selector == null ? none$1 : function() { - return this.querySelector(selector); - }; - } - - function selection_select$1(select) { - if (typeof select !== "function") select = selector$1(select); - - for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { - if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { - if ("__data__" in node) subnode.__data__ = node.__data__; - subgroup[i] = subnode; - } - } - } - - return new Selection$1(subgroups, this._parents); - } - - function empty$1() { - return []; - } - - function selectorAll$1(selector) { - return selector == null ? empty$1 : function() { - return this.querySelectorAll(selector); - }; - } - - function selection_selectAll$1(select) { - if (typeof select !== "function") select = selectorAll$1(select); - - for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { - if (node = group[i]) { - subgroups.push(select.call(node, node.__data__, i, group)); - parents.push(node); - } - } - } - - return new Selection$1(subgroups, parents); - } - - var matcher$2 = function(selector) { - return function() { - return this.matches(selector); - }; - }; - - if (typeof document !== "undefined") { - var element$2 = document.documentElement; - if (!element$2.matches) { - var vendorMatches$1 = element$2.webkitMatchesSelector - || element$2.msMatchesSelector - || element$2.mozMatchesSelector - || element$2.oMatchesSelector; - matcher$2 = function(selector) { - return function() { - return vendorMatches$1.call(this, selector); - }; - }; - } - } - - var matcher$3 = matcher$2; - - function selection_filter$1(match) { - if (typeof match !== "function") match = matcher$3(match); - - for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { - if ((node = group[i]) && match.call(node, node.__data__, i, group)) { - subgroup.push(node); - } - } - } - - return new Selection$1(subgroups, this._parents); - } - - function sparse$1(update) { - return new Array(update.length); - } - - function selection_enter$1() { - return new Selection$1(this._enter || this._groups.map(sparse$1), this._parents); - } - - function EnterNode$1(parent, datum) { - this.ownerDocument = parent.ownerDocument; - this.namespaceURI = parent.namespaceURI; - this._next = null; - this._parent = parent; - this.__data__ = datum; - } - - EnterNode$1.prototype = { - constructor: EnterNode$1, - appendChild: function(child) { return this._parent.insertBefore(child, this._next); }, - insertBefore: function(child, next) { return this._parent.insertBefore(child, next); }, - querySelector: function(selector) { return this._parent.querySelector(selector); }, - querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); } - }; - - function constant$4(x) { - return function() { - return x; - }; - } - - var keyPrefix$1 = "$"; // Protect against keys like “__proto__”. - - function bindIndex$1(parent, group, enter, update, exit, data) { - var i = 0, - node, - groupLength = group.length, - dataLength = data.length; - - // Put any non-null nodes that fit into update. - // Put any null nodes into enter. - // Put any remaining data into enter. - for (; i < dataLength; ++i) { - if (node = group[i]) { - node.__data__ = data[i]; - update[i] = node; - } else { - enter[i] = new EnterNode$1(parent, data[i]); - } - } - - // Put any non-null nodes that don’t fit into exit. - for (; i < groupLength; ++i) { - if (node = group[i]) { - exit[i] = node; - } - } - } - - function bindKey$1(parent, group, enter, update, exit, data, key) { - var i, - node, - nodeByKeyValue = {}, - groupLength = group.length, - dataLength = data.length, - keyValues = new Array(groupLength), - keyValue; - - // Compute the key for each node. - // If multiple nodes have the same key, the duplicates are added to exit. - for (i = 0; i < groupLength; ++i) { - if (node = group[i]) { - keyValues[i] = keyValue = keyPrefix$1 + key.call(node, node.__data__, i, group); - if (keyValue in nodeByKeyValue) { - exit[i] = node; - } else { - nodeByKeyValue[keyValue] = node; - } - } - } - - // Compute the key for each datum. - // If there a node associated with this key, join and add it to update. - // If there is not (or the key is a duplicate), add it to enter. - for (i = 0; i < dataLength; ++i) { - keyValue = keyPrefix$1 + key.call(parent, data[i], i, data); - if (node = nodeByKeyValue[keyValue]) { - update[i] = node; - node.__data__ = data[i]; - nodeByKeyValue[keyValue] = null; - } else { - enter[i] = new EnterNode$1(parent, data[i]); - } - } - - // Add any remaining nodes that were not bound to data to exit. - for (i = 0; i < groupLength; ++i) { - if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) { - exit[i] = node; - } - } - } - - function selection_data$1(value, key) { - if (!value) { - data = new Array(this.size()), j = -1; - this.each(function(d) { data[++j] = d; }); - return data; - } - - var bind = key ? bindKey$1 : bindIndex$1, - parents = this._parents, - groups = this._groups; - - if (typeof value !== "function") value = constant$4(value); - - for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) { - var parent = parents[j], - group = groups[j], - groupLength = group.length, - data = value.call(parent, parent && parent.__data__, j, parents), - dataLength = data.length, - enterGroup = enter[j] = new Array(dataLength), - updateGroup = update[j] = new Array(dataLength), - exitGroup = exit[j] = new Array(groupLength); - - bind(parent, group, enterGroup, updateGroup, exitGroup, data, key); - - // Now connect the enter nodes to their following update node, such that - // appendChild can insert the materialized enter node before this node, - // rather than at the end of the parent node. - for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) { - if (previous = enterGroup[i0]) { - if (i0 >= i1) i1 = i0 + 1; - while (!(next = updateGroup[i1]) && ++i1 < dataLength); - previous._next = next || null; - } - } - } - - update = new Selection$1(update, parents); - update._enter = enter; - update._exit = exit; - return update; - } - - function selection_exit$1() { - return new Selection$1(this._exit || this._groups.map(sparse$1), this._parents); - } - - function selection_merge$1(selection) { - - for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { - for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { - if (node = group0[i] || group1[i]) { - merge[i] = node; - } - } - } - - for (; j < m0; ++j) { - merges[j] = groups0[j]; - } - - return new Selection$1(merges, this._parents); - } - - function selection_order$1() { - - for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) { - for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) { - if (node = group[i]) { - if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); - next = node; - } - } - } - - return this; - } - - function selection_sort$1(compare) { - if (!compare) compare = ascending$2; - - function compareNode(a, b) { - return a && b ? compare(a.__data__, b.__data__) : !a - !b; - } - - for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) { - for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) { - if (node = group[i]) { - sortgroup[i] = node; - } - } - sortgroup.sort(compareNode); - } - - return new Selection$1(sortgroups, this._parents).order(); - } - - function ascending$2(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - - function selection_call$1() { - var callback = arguments[0]; - arguments[0] = this; - callback.apply(null, arguments); - return this; - } - - function selection_nodes$1() { - var nodes = new Array(this.size()), i = -1; - this.each(function() { nodes[++i] = this; }); - return nodes; - } - - function selection_node$1() { - - for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { - for (var group = groups[j], i = 0, n = group.length; i < n; ++i) { - var node = group[i]; - if (node) return node; - } - } - - return null; - } - - function selection_size$1() { - var size = 0; - this.each(function() { ++size; }); - return size; - } - - function selection_empty$1() { - return !this.node(); - } - - function selection_each$1(callback) { - - for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { - for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) { - if (node = group[i]) callback.call(node, node.__data__, i, group); - } - } - - return this; - } - - function attrRemove$1(name) { - return function() { - this.removeAttribute(name); - }; - } - - function attrRemoveNS$1(fullname) { - return function() { - this.removeAttributeNS(fullname.space, fullname.local); - }; - } - - function attrConstant$1(name, value) { - return function() { - this.setAttribute(name, value); - }; - } - - function attrConstantNS$1(fullname, value) { - return function() { - this.setAttributeNS(fullname.space, fullname.local, value); - }; - } - - function attrFunction$1(name, value) { - return function() { - var v = value.apply(this, arguments); - if (v == null) this.removeAttribute(name); - else this.setAttribute(name, v); - }; - } - - function attrFunctionNS$1(fullname, value) { - return function() { - var v = value.apply(this, arguments); - if (v == null) this.removeAttributeNS(fullname.space, fullname.local); - else this.setAttributeNS(fullname.space, fullname.local, v); - }; - } - - function selection_attr$1(name, value) { - var fullname = namespace$1(name); - - if (arguments.length < 2) { - var node = this.node(); - return fullname.local - ? node.getAttributeNS(fullname.space, fullname.local) - : node.getAttribute(fullname); - } - - return this.each((value == null - ? (fullname.local ? attrRemoveNS$1 : attrRemove$1) : (typeof value === "function" - ? (fullname.local ? attrFunctionNS$1 : attrFunction$1) - : (fullname.local ? attrConstantNS$1 : attrConstant$1)))(fullname, value)); - } - - function defaultView$1(node) { - return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node - || (node.document && node) // node is a Window - || node.defaultView; // node is a Document - } - - function styleRemove$1(name) { - return function() { - this.style.removeProperty(name); - }; - } - - function styleConstant$1(name, value, priority) { - return function() { - this.style.setProperty(name, value, priority); - }; - } - - function styleFunction$1(name, value, priority) { - return function() { - var v = value.apply(this, arguments); - if (v == null) this.style.removeProperty(name); - else this.style.setProperty(name, v, priority); - }; - } - - function selection_style$1(name, value, priority) { - return arguments.length > 1 - ? this.each((value == null - ? styleRemove$1 : typeof value === "function" - ? styleFunction$1 - : styleConstant$1)(name, value, priority == null ? "" : priority)) - : styleValue$1(this.node(), name); - } - - function styleValue$1(node, name) { - return node.style.getPropertyValue(name) - || defaultView$1(node).getComputedStyle(node, null).getPropertyValue(name); - } - - function propertyRemove$1(name) { - return function() { - delete this[name]; - }; - } - - function propertyConstant$1(name, value) { - return function() { - this[name] = value; - }; - } - - function propertyFunction$1(name, value) { - return function() { - var v = value.apply(this, arguments); - if (v == null) delete this[name]; - else this[name] = v; - }; - } - - function selection_property$1(name, value) { - return arguments.length > 1 - ? this.each((value == null - ? propertyRemove$1 : typeof value === "function" - ? propertyFunction$1 - : propertyConstant$1)(name, value)) - : this.node()[name]; - } - - function classArray$1(string) { - return string.trim().split(/^|\s+/); - } - - function classList$1(node) { - return node.classList || new ClassList$1(node); - } - - function ClassList$1(node) { - this._node = node; - this._names = classArray$1(node.getAttribute("class") || ""); - } - - ClassList$1.prototype = { - add: function(name) { - var i = this._names.indexOf(name); - if (i < 0) { - this._names.push(name); - this._node.setAttribute("class", this._names.join(" ")); - } - }, - remove: function(name) { - var i = this._names.indexOf(name); - if (i >= 0) { - this._names.splice(i, 1); - this._node.setAttribute("class", this._names.join(" ")); - } - }, - contains: function(name) { - return this._names.indexOf(name) >= 0; - } - }; - - function classedAdd$1(node, names) { - var list = classList$1(node), i = -1, n = names.length; - while (++i < n) list.add(names[i]); - } - - function classedRemove$1(node, names) { - var list = classList$1(node), i = -1, n = names.length; - while (++i < n) list.remove(names[i]); - } - - function classedTrue$1(names) { - return function() { - classedAdd$1(this, names); - }; - } - - function classedFalse$1(names) { - return function() { - classedRemove$1(this, names); - }; - } - - function classedFunction$1(names, value) { - return function() { - (value.apply(this, arguments) ? classedAdd$1 : classedRemove$1)(this, names); - }; - } - - function selection_classed$1(name, value) { - var names = classArray$1(name + ""); - - if (arguments.length < 2) { - var list = classList$1(this.node()), i = -1, n = names.length; - while (++i < n) if (!list.contains(names[i])) return false; - return true; - } - - return this.each((typeof value === "function" - ? classedFunction$1 : value - ? classedTrue$1 - : classedFalse$1)(names, value)); - } - - function textRemove$1() { - this.textContent = ""; - } - - function textConstant$1(value) { - return function() { - this.textContent = value; - }; - } - - function textFunction$1(value) { - return function() { - var v = value.apply(this, arguments); - this.textContent = v == null ? "" : v; - }; - } - - function selection_text$1(value) { - return arguments.length - ? this.each(value == null - ? textRemove$1 : (typeof value === "function" - ? textFunction$1 - : textConstant$1)(value)) - : this.node().textContent; - } - - function htmlRemove$1() { - this.innerHTML = ""; - } - - function htmlConstant$1(value) { - return function() { - this.innerHTML = value; - }; - } - - function htmlFunction$1(value) { - return function() { - var v = value.apply(this, arguments); - this.innerHTML = v == null ? "" : v; - }; - } - - function selection_html$1(value) { - return arguments.length - ? this.each(value == null - ? htmlRemove$1 : (typeof value === "function" - ? htmlFunction$1 - : htmlConstant$1)(value)) - : this.node().innerHTML; - } - - function raise$1() { - if (this.nextSibling) this.parentNode.appendChild(this); - } - - function selection_raise$1() { - return this.each(raise$1); - } - - function lower$1() { - if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); - } - - function selection_lower$1() { - return this.each(lower$1); - } - - function selection_append$1(name) { - var create = typeof name === "function" ? name : creator$1(name); - return this.select(function() { - return this.appendChild(create.apply(this, arguments)); - }); - } - - function constantNull$1() { - return null; - } - - function selection_insert$1(name, before) { - var create = typeof name === "function" ? name : creator$1(name), - select = before == null ? constantNull$1 : typeof before === "function" ? before : selector$1(before); - return this.select(function() { - return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null); - }); - } - - function remove$1() { - var parent = this.parentNode; - if (parent) parent.removeChild(this); - } - - function selection_remove$1() { - return this.each(remove$1); - } - - function selection_cloneShallow$1() { - return this.parentNode.insertBefore(this.cloneNode(false), this.nextSibling); - } - - function selection_cloneDeep$1() { - return this.parentNode.insertBefore(this.cloneNode(true), this.nextSibling); - } - - function selection_clone$1(deep) { - return this.select(deep ? selection_cloneDeep$1 : selection_cloneShallow$1); - } - - function selection_datum$1(value) { - return arguments.length - ? this.property("__data__", value) - : this.node().__data__; - } - - var filterEvents$1 = {}; - - if (typeof document !== "undefined") { - var element$3 = document.documentElement; - if (!("onmouseenter" in element$3)) { - filterEvents$1 = {mouseenter: "mouseover", mouseleave: "mouseout"}; - } - } - - function filterContextListener$1(listener, index, group) { - listener = contextListener$1(listener, index, group); - return function(event) { - var related = event.relatedTarget; - if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) { - listener.call(this, event); - } - }; - } - - function contextListener$1(listener, index, group) { - return function(event1) { - try { - listener.call(this, this.__data__, index, group); - } finally { - } - }; - } - - function parseTypenames$2(typenames) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - return {type: t, name: name}; - }); - } - - function onRemove$1(typename) { - return function() { - var on = this.__on; - if (!on) return; - for (var j = 0, i = -1, m = on.length, o; j < m; ++j) { - if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) { - this.removeEventListener(o.type, o.listener, o.capture); - } else { - on[++i] = o; - } - } - if (++i) on.length = i; - else delete this.__on; - }; - } - - function onAdd$1(typename, value, capture) { - var wrap = filterEvents$1.hasOwnProperty(typename.type) ? filterContextListener$1 : contextListener$1; - return function(d, i, group) { - var on = this.__on, o, listener = wrap(value, i, group); - if (on) for (var j = 0, m = on.length; j < m; ++j) { - if ((o = on[j]).type === typename.type && o.name === typename.name) { - this.removeEventListener(o.type, o.listener, o.capture); - this.addEventListener(o.type, o.listener = listener, o.capture = capture); - o.value = value; - return; - } - } - this.addEventListener(typename.type, listener, capture); - o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture}; - if (!on) this.__on = [o]; - else on.push(o); - }; - } - - function selection_on$1(typename, value, capture) { - var typenames = parseTypenames$2(typename + ""), i, n = typenames.length, t; - - if (arguments.length < 2) { - var on = this.node().__on; - if (on) for (var j = 0, m = on.length, o; j < m; ++j) { - for (i = 0, o = on[j]; i < n; ++i) { - if ((t = typenames[i]).type === o.type && t.name === o.name) { - return o.value; - } - } - } - return; - } - - on = value ? onAdd$1 : onRemove$1; - if (capture == null) capture = false; - for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture)); - return this; - } - - function dispatchEvent$1(node, type, params) { - var window = defaultView$1(node), - event = window.CustomEvent; - - if (typeof event === "function") { - event = new event(type, params); - } else { - event = window.document.createEvent("Event"); - if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail; - else event.initEvent(type, false, false); - } - - node.dispatchEvent(event); - } - - function dispatchConstant$1(type, params) { - return function() { - return dispatchEvent$1(this, type, params); - }; - } - - function dispatchFunction$1(type, params) { - return function() { - return dispatchEvent$1(this, type, params.apply(this, arguments)); - }; - } - - function selection_dispatch$1(type, params) { - return this.each((typeof params === "function" - ? dispatchFunction$1 - : dispatchConstant$1)(type, params)); - } - - var root$1 = [null]; - - function Selection$1(groups, parents) { - this._groups = groups; - this._parents = parents; - } - - function selection$1() { - return new Selection$1([[document.documentElement]], root$1); - } - - Selection$1.prototype = selection$1.prototype = { - constructor: Selection$1, - select: selection_select$1, - selectAll: selection_selectAll$1, - filter: selection_filter$1, - data: selection_data$1, - enter: selection_enter$1, - exit: selection_exit$1, - merge: selection_merge$1, - order: selection_order$1, - sort: selection_sort$1, - call: selection_call$1, - nodes: selection_nodes$1, - node: selection_node$1, - size: selection_size$1, - empty: selection_empty$1, - each: selection_each$1, - attr: selection_attr$1, - style: selection_style$1, - property: selection_property$1, - classed: selection_classed$1, - text: selection_text$1, - html: selection_html$1, - raise: selection_raise$1, - lower: selection_lower$1, - append: selection_append$1, - insert: selection_insert$1, - remove: selection_remove$1, - clone: selection_clone$1, - datum: selection_datum$1, - on: selection_on$1, - dispatch: selection_dispatch$1 - }; - var frame = 0, // is an animation frame pending? timeout = 0, // is a timeout pending? interval = 0, // are any timers active? @@ -3123,7 +2265,7 @@ var schedules = node.__transition; if (!schedules) node.__transition = {}; else if (id in schedules) return; - create$2(node, id, { + create$1(node, id, { name: name, index: index, // For context during callback. group: group, // For context during callback. @@ -3156,7 +2298,7 @@ return schedule; } - function create$2(node, id, self) { + function create$1(node, id, self) { var schedules = node.__transition, tween; @@ -3378,19 +2520,19 @@ : interpolateString)(a, b); } - function attrRemove$2(name) { + function attrRemove$1(name) { return function() { this.removeAttribute(name); }; } - function attrRemoveNS$2(fullname) { + function attrRemoveNS$1(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } - function attrConstant$2(name, interpolate$$1, value1) { + function attrConstant$1(name, interpolate$$1, value1) { var value00, interpolate0; return function() { @@ -3401,7 +2543,7 @@ }; } - function attrConstantNS$2(fullname, interpolate$$1, value1) { + function attrConstantNS$1(fullname, interpolate$$1, value1) { var value00, interpolate0; return function() { @@ -3412,7 +2554,7 @@ }; } - function attrFunction$2(name, interpolate$$1, value) { + function attrFunction$1(name, interpolate$$1, value) { var value00, value10, interpolate0; @@ -3426,7 +2568,7 @@ }; } - function attrFunctionNS$2(fullname, interpolate$$1, value) { + function attrFunctionNS$1(fullname, interpolate$$1, value) { var value00, value10, interpolate0; @@ -3441,11 +2583,11 @@ } function transition_attr(name, value) { - var fullname = namespace$1(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate; + var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate; return this.attrTween(name, typeof value === "function" - ? (fullname.local ? attrFunctionNS$2 : attrFunction$2)(fullname, i, tweenValue(this, "attr." + name, value)) - : value == null ? (fullname.local ? attrRemoveNS$2 : attrRemove$2)(fullname) - : (fullname.local ? attrConstantNS$2 : attrConstant$2)(fullname, i, value + "")); + ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value)) + : value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname) + : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value + "")); } function attrTweenNS(fullname, value) { @@ -3475,7 +2617,7 @@ if (arguments.length < 2) return (key = this.tween(key)) && key._value; if (value == null) return this.tween(key, null); if (typeof value !== "function") throw new Error; - var fullname = namespace$1(name); + var fullname = namespace(name); return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value)); } @@ -3539,7 +2681,7 @@ } function transition_filter(match) { - if (typeof match !== "function") match = matcher$3(match); + if (typeof match !== "function") match = matcher$1(match); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { @@ -3613,15 +2755,15 @@ return this.on("end.remove", removeFunction(this._id)); } - function transition_select(select) { + function transition_select(select$$1) { var name = this._name, id = this._id; - if (typeof select !== "function") select = selector$1(select); + if (typeof select$$1 !== "function") select$$1 = selector(select$$1); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { - if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { + if ((node = group[i]) && (subnode = select$$1.call(node, node.__data__, i, group))) { if ("__data__" in node) subnode.__data__ = node.__data__; subgroup[i] = subnode; schedule(subgroup[i], name, id, i, subgroup, get$1(node, id)); @@ -3632,16 +2774,16 @@ return new Transition(subgroups, this._parents, name, id); } - function transition_selectAll(select) { + function transition_selectAll(select$$1) { var name = this._name, id = this._id; - if (typeof select !== "function") select = selectorAll$1(select); + if (typeof select$$1 !== "function") select$$1 = selectorAll(select$$1); for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { if (node = group[i]) { - for (var children = select.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) { + for (var children = select$$1.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) { if (child = children[k]) { schedule(child, name, id, k, children, inherit); } @@ -3655,19 +2797,19 @@ return new Transition(subgroups, parents, name, id); } - var Selection$2 = selection$1.prototype.constructor; + var Selection$1 = selection.prototype.constructor; function transition_selection() { - return new Selection$2(this._groups, this._parents); + return new Selection$1(this._groups, this._parents); } - function styleRemove$2(name, interpolate$$1) { + function styleRemove$1(name, interpolate$$1) { var value00, value10, interpolate0; return function() { - var value0 = styleValue$1(this, name), - value1 = (this.style.removeProperty(name), styleValue$1(this, name)); + var value0 = styleValue(this, name), + value1 = (this.style.removeProperty(name), styleValue(this, name)); return value0 === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value10 = value1); @@ -3680,25 +2822,25 @@ }; } - function styleConstant$2(name, interpolate$$1, value1) { + function styleConstant$1(name, interpolate$$1, value1) { var value00, interpolate0; return function() { - var value0 = styleValue$1(this, name); + var value0 = styleValue(this, name); return value0 === value1 ? null : value0 === value00 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value1); }; } - function styleFunction$2(name, interpolate$$1, value) { + function styleFunction$1(name, interpolate$$1, value) { var value00, value10, interpolate0; return function() { - var value0 = styleValue$1(this, name), + var value0 = styleValue(this, name), value1 = value(this); - if (value1 == null) value1 = (this.style.removeProperty(name), styleValue$1(this, name)); + if (value1 == null) value1 = (this.style.removeProperty(name), styleValue(this, name)); return value0 === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value10 = value1); @@ -3708,11 +2850,11 @@ function transition_style(name, value, priority) { var i = (name += "") === "transform" ? interpolateTransformCss : interpolate; return value == null ? this - .styleTween(name, styleRemove$2(name, i)) + .styleTween(name, styleRemove$1(name, i)) .on("end.style." + name, styleRemoveEnd(name)) : this.styleTween(name, typeof value === "function" - ? styleFunction$2(name, i, tweenValue(this, "style." + name, value)) - : styleConstant$2(name, i, value + ""), priority); + ? styleFunction$1(name, i, tweenValue(this, "style." + name, value)) + : styleConstant$1(name, i, value + ""), priority); } function styleTween(name, value, priority) { @@ -3734,13 +2876,13 @@ return this.tween(key, styleTween(name, value, priority == null ? "" : priority)); } - function textConstant$2(value) { + function textConstant$1(value) { return function() { this.textContent = value; }; } - function textFunction$2(value) { + function textFunction$1(value) { return function() { var value1 = value(this); this.textContent = value1 == null ? "" : value1; @@ -3749,8 +2891,8 @@ function transition_text(value) { return this.tween("text", typeof value === "function" - ? textFunction$2(tweenValue(this, "text", value)) - : textConstant$2(value == null ? "" : value + "")); + ? textFunction$1(tweenValue(this, "text", value)) + : textConstant$1(value == null ? "" : value + "")); } function transition_transition() { @@ -3785,14 +2927,14 @@ } function transition(name) { - return selection$1().transition(name); + return selection().transition(name); } function newId() { return ++id; } - var selection_prototype = selection$1.prototype; + var selection_prototype = selection.prototype; Transition.prototype = transition.prototype = { constructor: Transition, @@ -3867,8 +3009,8 @@ return new Transition(groups, this._parents, name, id); } - selection$1.prototype.interrupt = selection_interrupt; - selection$1.prototype.transition = selection_transition; + selection.prototype.interrupt = selection_interrupt; + selection.prototype.transition = selection_transition; var pi$1 = Math.PI; @@ -5165,7 +4307,7 @@ return rescale(); } - function constant$b(x) { + function constant$a(x) { return function() { return x; }; @@ -5180,7 +4322,7 @@ function deinterpolateLinear(a, b) { return (b -= (a = +a)) ? function(x) { return (x - a) / b; } - : constant$b(b); + : constant$a(b); } function deinterpolateClamp(deinterpolate) { @@ -5541,8 +4683,6 @@ var saturday = weekday(6); var sundays = sunday.range; - var mondays = monday.range; - var thursdays = thursday.range; var month = newInterval(function(date) { date.setDate(1); @@ -5632,8 +4772,6 @@ var utcSaturday = utcWeekday(6); var utcSundays = utcSunday.range; - var utcMondays = utcMonday.range; - var utcThursdays = utcThursday.range; var utcMonth = newInterval(function(date) { date.setUTCDate(1); @@ -6740,7 +5878,7 @@ var plasma = ramp$1(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); - function constant$c(x) { + function constant$b(x) { return function constant() { return x; }; @@ -6791,7 +5929,7 @@ function line() { var x$$1 = x$3, y$$1 = y$3, - defined = constant$c(true), + defined = constant$b(true), context = null, curve = curveLinear, output = null; @@ -6817,15 +5955,15 @@ } line.x = function(_) { - return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$c(+_), line) : x$$1; + return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$b(+_), line) : x$$1; }; line.y = function(_) { - return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$c(+_), line) : y$$1; + return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$b(+_), line) : y$$1; }; line.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : constant$c(!!_), line) : defined; + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$b(!!_), line) : defined; }; line.curve = function(_) { @@ -6865,7 +6003,7 @@ // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations // "you can express cubic Hermite interpolation in terms of cubic Bézier curves // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". - function point$6(that, t0, t1) { + function point$5(that, t0, t1) { var x0 = that._x0, y0 = that._y0, x1 = that._x1, @@ -6894,7 +6032,7 @@ lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x1, this._y1); break; - case 3: point$6(this, this._t0, slope2(this, this._t0)); break; + case 3: point$5(this, this._t0, slope2(this, this._t0)); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; @@ -6907,8 +6045,8 @@ switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; break; - case 2: this._point = 3; point$6(this, slope2(this, t1 = slope3(this, x, y)), t1); break; - default: point$6(this, this._t0, t1 = slope3(this, x, y)); break; + case 2: this._point = 3; point$5(this, slope2(this, t1 = slope3(this, x, y)), t1); break; + default: point$5(this, this._t0, t1 = slope3(this, x, y)); break; } this._x0 = this._x1, this._x1 = x; diff --git a/d3.min.js b/d3.min.js index ac1d31d6..1f1334de 100644 --- a/d3.min.js +++ b/d3.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.d3={})}(this,function(t){"use strict";function n(t,e){return t>>1;f(t[a],e)<0?n=a+1:r=a}return n},right:function(t,e,n,r){for(null==n&&(n=0),null==r&&(r=t.length);n>>1;0>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=_t.exec(t))?Ct(parseInt(e[1],16)):(e=vt.exec(t))?new Dt(e[1],e[2],e[3],1):(e=mt.exec(t))?new Dt(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=wt.exec(t))?kt(e[1],e[2],e[3],e[4]):(e=xt.exec(t))?kt(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Mt.exec(t))?Pt(e[1],e[2]/100,e[3]/100,1):(e=At.exec(t))?Pt(e[1],e[2]/100,e[3]/100,e[4]):Nt.hasOwnProperty(t)?Ct(Nt[t]):"transparent"===t?new Dt(NaN,NaN,NaN,0):null}function Ct(t){return new Dt(t>>16&255,t>>8&255,255&t,1)}function kt(t,e,n,r){return r<=0&&(t=e=n=NaN),new Dt(t,e,n,r)}function St(t){return t instanceof lt||(t=Tt(t)),t?new Dt((t=t.rgb()).r,t.g,t.b,t.opacity):new Dt}function Ut(t,e,n,r){return 1===arguments.length?St(t):new Dt(t,e,n,null==r?1:r)}function Dt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Et(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Pt(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||1<=n?t=e=NaN:e<=0&&(t=NaN),new Ft(t,e,n,r)}function Ft(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Lt(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}st(lt,Tt,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),st(Dt,Ut,dt(lt,{brighter:function(t){return t=null==t?ht:Math.pow(ht,t),new Dt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Dt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+Et(this.r)+Et(this.g)+Et(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),st(Ft,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Ft)return new Ft(t.h,t.s,t.l,t.opacity);if(t instanceof lt||(t=Tt(t)),!t)return new Ft;if(t instanceof Ft)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,a=Math.min(e,n,r),f=Math.max(e,n,r),i=NaN,c=f-a,o=(f+a)/2;return c?(i=e===f?(n-r)/c+6*(nc&&(a=r.slice(c,a),u[o]?u[o]+=a:u[++o]=a),(e=e[0])===(n=n[0])?u[o]?u[o]+=n:u[++o]=n:(u[++o]=null,s.push({i:o,x:be(e,n)})),c=ge.lastIndex;return cn._time&&(r=n._time),(t=n)._next):(e=n._next,n._next=null,t?t._next=e:wn=e);xn=t,On(r)}(),kn=0}}function Hn(){var t=Un.now(),e=t-Cn;Tnzn)throw new Error("too late; already scheduled");return n}function Jn(t,e){var n=Gn(t,e);if(n.state>Xn)throw new Error("too late; already started");return n}function Gn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Kn(t,e,n){var r=t._id;return t.each(function(){var t=Jn(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Gn(t,r).value[e]}}function tr(t,e){var n;return("number"==typeof e?be:e instanceof Tt?de:(n=Tt(e))?(e=n,de):ye)(t,e)}var er=mn.prototype.constructor;var nr=0;function rr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function ar(){return++nr}var fr=mn.prototype;rr.prototype=function(t){return mn().transition(t)}.prototype={constructor:rr,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=He(t));for(var r=this._groups,a=r.length,f=new Array(a),i=0;iXn&&n.state<$n,n.state=Zn,n.timer.stop(),r&&n.on.call("interrupt",t,t.__data__,n.index,n.group),delete f[a]):i=!1;i&&delete t.__transition}}(this,t)})},mn.prototype.transition=function(t){var e,n;t=t instanceof rr?(e=t._id,t._name):(e=ar(),(n=ir).time=En(),null==t?null:t+"");for(var r=this._groups,a=r.length,f=0;fsr&&a){var l=n-f,h=r-i,b=c*c+o*o,p=l*l+h*h,g=Math.sqrt(b),y=Math.sqrt(d),_=a*Math.tan((or-Math.acos((b+d-p)/(2*g*y)))/2),v=_/y,m=_/g;Math.abs(v-1)>sr&&(this._+="L"+(t+v*u)+","+(e+v*s)),this._+="A"+a+","+a+",0,0,"+ +(u*hsr||Math.abs(this._y1-u)>sr)&&(this._+="L"+o+","+u),n&&(d<0&&(d=d%ur+ur),dr=a?c=!0:10===(e=r.charCodeAt(f++))?o=!0:13===e&&(o=!0,10===r.charCodeAt(f)&&++f),r.slice(n+1,t-1).replace(/""/g,'"')}for(;f=(f=(p+y)/2))?p=f:y=f,(s=n>=(i=(g+_)/2))?g=i:_=i,!(h=(a=h)[d=s<<1|u]))return a[d]=b,t;if(c=+t._x.call(null,h.data),o=+t._y.call(null,h.data),e===c&&n===o)return b.next=h,a?a[d]=b:t._root=b,t;for(;a=a?a[d]=new Array(4):t._root=new Array(4),(u=e>=(f=(p+y)/2))?p=f:y=f,(s=n>=(i=(g+_)/2))?g=i:_=i,(d=s<<1|u)==(l=(i<=o)<<1|f<=c););return a[l]=h,a[d]=b,t}function Ar(t,e,n,r,a){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=a}function Nr(t){return t[0]}function Tr(t){return t[1]}function Cr(t,e,n,r,a,f){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=a,this._y1=f,this._root=void 0}function kr(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Sr=function(t,e,n){var r=new Cr(null==e?Nr:e,null==n?Tr:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}.prototype=Cr.prototype;Sr.copy=function(){var t,e,n=new Cr(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=kr(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var a=0;a<4;++a)(e=r.source[a])&&(e.length?t.push({source:e,target:r.target[a]=new Array(4)}):r.target[a]=kr(e));return n},Sr.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return Mr(this.cover(e,n),e,n,t)},Sr.addAll=function(t){var e,n,r,a,f=t.length,i=new Array(f),c=new Array(f),o=1/0,u=1/0,s=-1/0,d=-1/0;for(n=0;nl||(f=o.y0)>h||(i=o.x1)=(c=(b+g)/2))?b=c:g=c,(s=i>=(o=(p+y)/2))?p=o:y=o,!(h=(e=h)[d=s<<1|u]))return this;if(!h.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(n=e,l=d)}for(;h.data!==t;)if(!(h=(r=h).next))return this;return(a=h.next)&&delete h.next,r?a?r.next=a:delete r.next:e?(a?e[d]=a:delete e[d],(h=e[0]||e[1]||e[2]||e[3])&&h===(e[3]||e[2]||e[1]||e[0])&&!h.length&&(n?n[l]=h:this._root=h)):this._root=a,this},Sr.removeAll=function(t){for(var e=0,n=t.length;e=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Fr(t){return new Lr(t)}function Lr(t){if(!(e=Pr.exec(t)))throw new Error("invalid format: "+t);var e;this.fill=e[1]||" ",this.align=e[2]||">",this.sign=e[3]||"-",this.symbol=e[4]||"",this.zero=!!e[5],this.width=e[6]&&+e[6],this.comma=!!e[7],this.precision=e[8]&&+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||""}function Yr(t,e){var n=Ur(t,e);if(!n)return t+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}Fr.prototype=Lr.prototype,Lr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Hr={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return Yr(100*t,e)},r:Yr,s:function(t,e){var n=Ur(t,e);if(!n)return t+"";var r=n[0],a=n[1],f=a-(Er=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,i=r.length;return f===i?r:ie));)f=c[a=(a+1)%c.length];return r.reverse().join(o)}):Or,r=t.currency,M=t.decimal,A=t.numerals?(e=t.numerals,function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}):Or,a=t.percent||"%";function i(t){var u=(t=Fr(t)).fill,s=t.align,d=t.sign,e=t.symbol,l=t.zero,h=t.width,b=t.comma,p=t.precision,g=t.trim,y=t.type;"n"===y?(b=!0,y="g"):Hr[y]||(null==p&&(p=12),g=!0,y="g"),(l||"0"===u&&"="===s)&&(l=!0,u="0",s="=");var _="$"===e?r[0]:"#"===e&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",v="$"===e?r[1]:/[%p]/.test(y)?a:"",m=Hr[y],w=/[defgprs%]/.test(y);function n(t){var e,n,r,a=_,f=v;if("c"===y)f=m(t)+f,t="";else{var i=(t=+t)<0;if(t=m(Math.abs(t),p),g&&(t=function(t){t:for(var e,n=t.length,r=1,a=-1;r>1)+a+t+f+o.slice(c);break;default:t=o+a+t+f}return A(t)}return p=null==p?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),n.toString=function(){return t+""},n}return{format:i,formatPrefix:function(t,e){var n=i(((t=Fr(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Dr(e)/3))),a=Math.pow(10,-r),f=zr[8+r/3];return function(t){return n(a*t)+f}}}}function Xr(){return new Rr}function Rr(){this.reset()}qr=Vr({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),Ir=qr.format,jr=qr.formatPrefix,Rr.prototype={constructor:Rr,reset:function(){this.s=this.t=0},add:function(t){$r(Br,t,this.t),$r(this,Br.s,this.s),this.s?this.t+=Br.t:this.s=Br.t},valueOf:function(){return this.s}};var Br=new Rr;function $r(t,e,n){var r=t.s=e+n,a=r-e,f=r-a;t.t=e-f+(n-a)}Math.PI,Xr(),Xr(),Xr(),Xr(),Xr(),Xr(),Xr(),Xr();var Zr=Array.prototype,Wr=Zr.map,Qr=Zr.slice,Jr={name:"implicit"};function Gr(r){var f=gr(),i=[],a=Jr;function c(t){var e=t+"",n=f.get(e);if(!n){if(a!==Jr)return a;f.set(e,n=i.push(t))}return r[(n-1)%r.length]}return r=null==r?[]:Qr.call(r),c.domain=function(t){if(!arguments.length)return i.slice();i=[],f=gr();for(var e,n,r=-1,a=t.length;++r>>1;f(e[a],t)<0?n=a+1:r=a}return n},right:function(e,t,n,r){for(null==n&&(n=0),null==r&&(r=e.length);n>>1;0>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):(t=we.exec(e))?Ue(parseInt(t[1],16)):(t=xe.exec(e))?new Pe(t[1],t[2],t[3],1):(t=Me.exec(e))?new Pe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Ae.exec(e))?De(t[1],t[2],t[3],t[4]):(t=Te.exec(e))?De(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Ne.exec(e))?He(t[1],t[2]/100,t[3]/100,1):(t=Ce.exec(e))?He(t[1],t[2]/100,t[3]/100,t[4]):ke.hasOwnProperty(e)?Ue(ke[e]):"transparent"===e?new Pe(NaN,NaN,NaN,0):null}function Ue(e){return new Pe(e>>16&255,e>>8&255,255&e,1)}function De(e,t,n,r){return r<=0&&(e=t=n=NaN),new Pe(e,t,n,r)}function Ee(e){return e instanceof pe||(e=Se(e)),e?new Pe((e=e.rgb()).r,e.g,e.b,e.opacity):new Pe}function Fe(e,t,n,r){return 1===arguments.length?Ee(e):new Pe(e,t,n,null==r?1:r)}function Pe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Ye(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function He(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||1<=n?e=t=NaN:t<=0&&(e=NaN),new Le(e,t,n,r)}function Le(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Oe(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}he(pe,Se,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),he(Pe,Fe,be(pe,{brighter:function(e){return e=null==e?ge:Math.pow(ge,e),new Pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+Ye(this.r)+Ye(this.g)+Ye(this.b)},toString:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}})),he(Le,function(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Le)return new Le(e.h,e.s,e.l,e.opacity);if(e instanceof pe||(e=Se(e)),!e)return new Le;if(e instanceof Le)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),f=Math.max(t,n,r),i=NaN,c=f-a,o=(f+a)/2;return c?(i=t===f?(n-r)/c+6*(nc&&(a=r.slice(c,a),u[o]?u[o]+=a:u[++o]=a),(t=t[0])===(n=n[0])?u[o]?u[o]+=n:u[++o]=n:(u[++o]=null,s.push({i:o,x:yt(t,n)})),c=_t.lastIndex;return cn._time&&(r=n._time),(e=n)._next):(t=n._next,n._next=null,e?e._next=t:Pt=t);Yt=e,Gt(r)}(),zt=0}}function Jt(){var e=Vt.now(),t=e-qt;Itnn)throw new Error("too late; already scheduled");return n}function ln(e,t){var n=hn(e,t);if(n.state>an)throw new Error("too late; already started");return n}function hn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function bn(e,t,n){var r=e._id;return e.each(function(){var e=ln(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return hn(e,r).value[t]}}function pn(e,t){var n;return("number"==typeof t?yt:t instanceof Se?bt:(n=Se(t))?(t=n,bt):mt)(e,t)}var gn=le.prototype.constructor;var yn=0;function vn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function _n(){return++yn}var mn=le.prototype;vn.prototype=function(e){return le().transition(e)}.prototype={constructor:vn,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=M(e));for(var r=this._groups,a=r.length,f=new Array(a),i=0;ian&&n.stateTn&&a){var l=n-f,h=r-i,b=c*c+o*o,p=l*l+h*h,g=Math.sqrt(b),y=Math.sqrt(d),v=a*Math.tan((Mn-Math.acos((b+d-p)/(2*g*y)))/2),_=v/y,m=v/g;Math.abs(_-1)>Tn&&(this._+="L"+(e+_*u)+","+(t+_*s)),this._+="A"+a+","+a+",0,0,"+ +(u*hTn||Math.abs(this._y1-u)>Tn)&&(this._+="L"+o+","+u),n&&(d<0&&(d=d%An+An),Nn=a?c=!0:10===(t=r.charCodeAt(f++))?o=!0:13===t&&(o=!0,10===r.charCodeAt(f)&&++f),r.slice(n+1,e-1).replace(/""/g,'"')}for(;f=(f=(p+y)/2))?p=f:y=f,(s=n>=(i=(g+v)/2))?g=i:v=i,!(h=(a=h)[d=s<<1|u]))return a[d]=b,e;if(c=+e._x.call(null,h.data),o=+e._y.call(null,h.data),t===c&&n===o)return b.next=h,a?a[d]=b:e._root=b,e;for(;a=a?a[d]=new Array(4):e._root=new Array(4),(u=t>=(f=(p+y)/2))?p=f:y=f,(s=n>=(i=(g+v)/2))?g=i:v=i,(d=s<<1|u)==(l=(i<=o)<<1|f<=c););return a[l]=h,a[d]=b,e}function jn(e,t,n,r,a){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=a}function In(e){return e[0]}function qn(e){return e[1]}function zn(e,t,n,r,a,f){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=a,this._y1=f,this._root=void 0}function Xn(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Vn=function(e,t,n){var r=new zn(null==t?In:t,null==n?qn:n,NaN,NaN,NaN,NaN);return null==e?r:r.addAll(e)}.prototype=zn.prototype;Vn.copy=function(){var e,t,n=new zn(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Xn(r),n;for(e=[{source:r,target:n._root=new Array(4)}];r=e.pop();)for(var a=0;a<4;++a)(t=r.source[a])&&(t.length?e.push({source:t,target:r.target[a]=new Array(4)}):r.target[a]=Xn(t));return n},Vn.add=function(e){var t=+this._x.call(null,e),n=+this._y.call(null,e);return On(this.cover(t,n),t,n,e)},Vn.addAll=function(e){var t,n,r,a,f=e.length,i=new Array(f),c=new Array(f),o=1/0,u=1/0,s=-1/0,d=-1/0;for(n=0;nl||(f=o.y0)>h||(i=o.x1)=(c=(b+g)/2))?b=c:g=c,(s=i>=(o=(p+y)/2))?p=o:y=o,!(h=(t=h)[d=s<<1|u]))return this;if(!h.length)break;(t[d+1&3]||t[d+2&3]||t[d+3&3])&&(n=t,l=d)}for(;h.data!==e;)if(!(h=(r=h).next))return this;return(a=h.next)&&delete h.next,r?a?r.next=a:delete r.next:t?(a?t[d]=a:delete t[d],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[l]=h:this._root=h)):this._root=a,this},Vn.removeAll=function(e){for(var t=0,n=e.length;t=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wn(e){return new Qn(e)}function Qn(e){if(!(t=Bn.exec(e)))throw new Error("invalid format: "+e);var t;this.fill=t[1]||" ",this.align=t[2]||">",this.sign=t[3]||"-",this.symbol=t[4]||"",this.zero=!!t[5],this.width=t[6]&&+t[6],this.comma=!!t[7],this.precision=t[8]&&+t[8].slice(1),this.trim=!!t[9],this.type=t[10]||""}function Jn(e,t){var n=Rn(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}Wn.prototype=Qn.prototype,Qn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Gn={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return Jn(100*e,t)},r:Jn,s:function(e,t){var n=Rn(e,t);if(!n)return e+"";var r=n[0],a=n[1],f=a-(Zn=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,i=r.length;return f===i?r:it));)f=c[a=(a+1)%c.length];return r.reverse().join(o)}):Kn,r=e.currency,M=e.decimal,A=e.numerals?(t=e.numerals,function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}):Kn,a=e.percent||"%";function i(e){var u=(e=Wn(e)).fill,s=e.align,d=e.sign,t=e.symbol,l=e.zero,h=e.width,b=e.comma,p=e.precision,g=e.trim,y=e.type;"n"===y?(b=!0,y="g"):Gn[y]||(null==p&&(p=12),g=!0,y="g"),(l||"0"===u&&"="===s)&&(l=!0,u="0",s="=");var v="$"===t?r[0]:"#"===t&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===t?r[1]:/[%p]/.test(y)?a:"",m=Gn[y],w=/[defgprs%]/.test(y);function n(e){var t,n,r,a=v,f=_;if("c"===y)f=m(e)+f,e="";else{var i=(e=+e)<0;if(e=m(Math.abs(e),p),g&&(e=function(e){e:for(var t,n=e.length,r=1,a=-1;r>1)+a+e+f+o.slice(c);break;default:e=o+a+e+f}return A(e)}return p=null==p?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),n.toString=function(){return e+""},n}return{format:i,formatPrefix:function(e,t){var n=i(((e=Wn(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor($n(t)/3))),a=Math.pow(10,-r),f=rr[8+r/3];return function(e){return n(a*e)+f}}}}function fr(){return new ir}function ir(){this.reset()}er=ar({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),tr=er.format,nr=er.formatPrefix,ir.prototype={constructor:ir,reset:function(){this.s=this.t=0},add:function(e){or(cr,e,this.t),or(this,cr.s,this.s),this.s?this.t+=cr.t:this.s=cr.t},valueOf:function(){return this.s}};var cr=new ir;function or(e,t,n){var r=e.s=t+n,a=r-t,f=r-a;e.t=t-f+(n-a)}Math.PI,fr(),fr(),fr(),fr(),fr(),fr(),fr(),fr();var ur=Array.prototype,sr=ur.map,dr=ur.slice,lr={name:"implicit"};function hr(r){var f=Dn(),i=[],a=lr;function c(e){var t=e+"",n=f.get(t);if(!n){if(a!==lr)return a;f.set(t,n=i.push(e))}return r[(n-1)%r.length]}return r=null==r?[]:dr.call(r),c.domain=function(e){if(!arguments.length)return i.slice();i=[],f=Dn();for(var t,n,r=-1,a=e.length;++r diff --git a/src/app/components/Ad.jsx b/src/app/components/Ad.jsx new file mode 100644 index 00000000..0153bf38 --- /dev/null +++ b/src/app/components/Ad.jsx @@ -0,0 +1,39 @@ +import React, { Component, PropTypes } from 'react'; + +export default class Ad extends Component { + static propTypes = { + client: PropTypes.string, + slot: PropTypes.string, + format: PropTypes.string, + wrapperDivStyle: PropTypes.object + }; + constructor(props) { + super(props); + } + // This code is ran when the component mounts + componentDidMount() { + try { + (window.adsbygoogle = window.adsbygoogle || []).push({}); + } catch (err) { + console.error(err); + } + } + + // an outer div for styling purposes + // changed class to ClassName + // changed style from string to an object + + render() { + return ( +
+ +
+ ); + } +} diff --git a/src/app/pages/AboutPage.jsx b/src/app/pages/AboutPage.jsx index 2e24cba8..5b29f976 100644 --- a/src/app/pages/AboutPage.jsx +++ b/src/app/pages/AboutPage.jsx @@ -1,12 +1,12 @@ import React from 'react'; import Page from './Page'; import { CoriolisLogo, GitHub } from '../components/SvgIcons'; +import Ad from '../components/Ad'; /** * About Page */ export default class AboutPage extends Page { - /** * Constructor * @param {Object} props React Component properties @@ -23,33 +23,121 @@ export default class AboutPage extends Page { * @return {React.Component} The page contents */ renderPage() { - return
-

Coriolis EDCD Edition

+ return ( +
+

+ + Coriolis EDCD Edition +

-

This is a clone of the Coriolis project, whose original author is currently unable to maintain it. This clone is maintained by the EDCD community.

-

To recover your builds, go to https://coriolis.io/, backup your builds (Settings / Backup), copy the text, return here and import (Settings / Import).

-

The Coriolis project was inspired by E:D Shipyard and, of course, Elite Dangerous. The ultimate goal of Coriolis is to provide rich features to support in-game play and planning while engaging the E:D community to support its development.

-

Coriolis was created using assets and imagery from Elite: Dangerous, with the permission of Frontier Developments plc, for non-commercial purposes. It is not endorsed by nor reflects the views or opinions of Frontier Developments. A number of assets were sourced from ED Assets

+

+ This is a clone of the Coriolis project, whose original author is + currently unable to maintain it. This clone is maintained by the{' '} + EDCD community. +

+

+ To recover your builds, go to{' '} + + https://coriolis.io/ + + , backup your builds (Settings / Backup), copy the text, return here + and import (Settings / Import). +

+

+ The Coriolis project was inspired by{' '} + + E:D Shipyard + {' '} + and, of course,{' '} + + Elite Dangerous + + . The ultimate goal of Coriolis is to provide rich features to support + in-game play and planning while engaging the E:D community to support + its development. +

+

+ Coriolis was created using assets and imagery from Elite: Dangerous, + with the permission of Frontier Developments plc, for non-commercial + purposes. It is not endorsed by nor reflects the views or opinions of + Frontier Developments. A number of assets were sourced from{' '} + + ED Assets + +

- - -

Github

- github.com/EDCD/coriolis -
+ + +

Github

+ github.com/EDCD/coriolis +
-

Coriolis is an open source project. Checkout the list of upcoming features and to-do list on github. Any and all contributions and feedback are welcome. If you encounter any bugs please report them and provide as much detail as possible.

+

+ Coriolis is an open source project. Checkout the list of upcoming + features and to-do list on github. Any and all contributions and + feedback are welcome. If you encounter any bugs please report them and + provide as much detail as possible. +

-

Chat

-

You can chat to us on our EDCD Discord server.

+

Chat

+

+ You can chat to us on our{' '} + + EDCD Discord server + + . +

-

Supporting Coriolis

-

Coriolis is an open source project, and I work on it in my free time. I have set up a patreon at patreon.com/coriolis_elite, which will be used to keep Coriolis up to date and the servers running.

-
- - - - +

Supporting Coriolis

+

+ Coriolis is an open source project, and I work on it in my free time. + I have set up a patreon at{' '} + + patreon.com/coriolis_elite + + , which will be used to keep Coriolis up to date and the servers + running. +

+ + + + +
-
; + +
+ ); } } diff --git a/src/app/pages/NotFoundPage.jsx b/src/app/pages/NotFoundPage.jsx index 768d8c1c..b5e0943a 100644 --- a/src/app/pages/NotFoundPage.jsx +++ b/src/app/pages/NotFoundPage.jsx @@ -1,6 +1,5 @@ import React from 'react'; import Page from './Page'; - /** * 404 Page */ @@ -22,6 +21,7 @@ export default class NotFoundPage extends Page { * @return {React.Component} The page contents */ renderPage() { - return
Page {this.context.route.path} Not Found
; + return
Page {this.context.route.path} Not Found +
; } } diff --git a/src/app/pages/OutfittingPage.jsx b/src/app/pages/OutfittingPage.jsx index b74e56d5..12365d3e 100644 --- a/src/app/pages/OutfittingPage.jsx +++ b/src/app/pages/OutfittingPage.jsx @@ -23,6 +23,7 @@ import { } from '../components/SvgIcons'; import LZString from 'lz-string'; import ShipSummaryTable from '../components/ShipSummaryTable'; +import Ad from '../components/Ad'; import StandardSlotSection from '../components/StandardSlotSection'; import HardpointSlotSection from '../components/HardpointSlotSection'; import InternalSlotSection from '../components/InternalSlotSection'; @@ -53,7 +54,6 @@ function getTitle(shipName, buildName) { * The Outfitting Page */ export default class OutfittingPage extends Page { - /** * Constructor * @param {Object} props React Component properties @@ -85,22 +85,38 @@ export default class OutfittingPage extends Page { let shipId = params.ship; let code = params.code; let buildName = params.bn; - let data = Ships[shipId]; // Retrieve the basic ship properties, slots and defaults + let data = Ships[shipId]; // Retrieve the basic ship properties, slots and defaults let savedCode = Persist.getBuild(shipId, buildName); if (!data) { return { error: { message: 'Ship not found: ' + shipId } }; } - let ship = new Ship(shipId, data.properties, data.slots); // Create a new Ship instance + let ship = new Ship(shipId, data.properties, data.slots); // Create a new Ship instance if (code) { - ship.buildFrom(code); // Populate modules from serialized 'code' URL param + ship.buildFrom(code); // Populate modules from serialized 'code' URL param } else { - ship.buildWith(data.defaults); // Populate with default components + ship.buildWith(data.defaults); // Populate with default components } this._getTitle = getTitle.bind(this, data.properties.name); // Obtain ship control from code - const { sys, eng, wep, mcSys, mcEng, mcWep, boost, fuel, cargo, opponent, opponentBuild, opponentSys, opponentEng, opponentWep, engagementRange } = this._obtainControlFromCode(ship, code); + const { + sys, + eng, + wep, + mcSys, + mcEng, + mcWep, + boost, + fuel, + cargo, + opponent, + opponentBuild, + opponentSys, + opponentEng, + opponentWep, + engagementRange + } = this._obtainControlFromCode(ship, code); return { error: null, title: this._getTitle(buildName), @@ -139,7 +155,10 @@ export default class OutfittingPage extends Page { }; if (Persist.hasBuild(this.state.shipId, stateChanges.newBuildName)) { - stateChanges.savedCode = Persist.getBuild(this.state.shipId, stateChanges.newBuildName); + stateChanges.savedCode = Persist.getBuild( + this.state.shipId, + stateChanges.newBuildName + ); } else { stateChanges.savedCode = null; } @@ -165,7 +184,9 @@ export default class OutfittingPage extends Page { * @returns {string} the code for this ship */ _fullCode(ship, fuel, cargo) { - return `${ship.toString()}.${LZString.compressToBase64(this._controlCode(fuel, cargo))}`; + return `${ship.toString()}.${LZString.compressToBase64( + this._controlCode(fuel, cargo) + )}`; } /** @@ -185,7 +206,11 @@ export default class OutfittingPage extends Page { let boost = false; let fuel = ship.fuelCapacity; let cargo = ship.cargoCapacity; - let opponent = new Ship('eagle', Ships['eagle'].properties, Ships['eagle'].slots).buildWith(Ships['eagle'].defaults); + let opponent = new Ship( + 'eagle', + Ships['eagle'].properties, + Ships['eagle'].slots + ).buildWith(Ships['eagle'].defaults); let opponentSys = 2; let opponentEng = 2; let opponentWep = 2; @@ -197,7 +222,9 @@ export default class OutfittingPage extends Page { const parts = code.split('.'); if (parts.length >= 5) { // We have control information in the code - const control = LZString.decompressFromBase64(Utils.fromUrlSafe(parts[4])).split('/'); + const control = LZString.decompressFromBase64( + Utils.fromUrlSafe(parts[4]) + ).split('/'); sys = parseFloat(control[0]) || sys; eng = parseFloat(control[1]) || eng; wep = parseFloat(control[2]) || wep; @@ -206,7 +233,11 @@ export default class OutfittingPage extends Page { cargo = parseInt(control[5]) || cargo; if (control[6]) { const shipId = control[6]; - opponent = new Ship(shipId, Ships[shipId].properties, Ships[shipId].slots); + opponent = new Ship( + shipId, + Ships[shipId].properties, + Ships[shipId].slots + ); if (control[7] && Persist.getBuild(shipId, control[7])) { // Ship is a particular build const opponentCode = Persist.getBuild(shipId, control[7]); @@ -216,7 +247,9 @@ export default class OutfittingPage extends Page { // Obtain opponent's sys/eng/wep pips from their code const opponentParts = opponentCode.split('.'); if (opponentParts.length >= 5) { - const opponentControl = LZString.decompressFromBase64(Utils.fromUrlSafe(opponentParts[4])).split('/'); + const opponentControl = LZString.decompressFromBase64( + Utils.fromUrlSafe(opponentParts[4]) + ).split('/'); opponentSys = parseFloat(opponentControl[0]) || opponentSys; opponentEng = parseFloat(opponentControl[1]) || opponentEng; opponentWep = parseFloat(opponentControl[2]) || opponentWep; @@ -237,7 +270,23 @@ export default class OutfittingPage extends Page { } } - return { sys, eng, wep, mcSys, mcEng, mcWep, boost, fuel, cargo, opponent, opponentBuild, opponentSys, opponentEng, opponentWep, engagementRange }; + return { + sys, + eng, + wep, + mcSys, + mcEng, + mcWep, + boost, + fuel, + cargo, + opponent, + opponentBuild, + opponentSys, + opponentEng, + opponentWep, + engagementRange + }; } /** @@ -252,7 +301,9 @@ export default class OutfittingPage extends Page { * @param {number} mcWep WEP pips from multi-crew */ _pipsUpdated(sys, eng, wep, mcSys, mcEng, mcWep) { - this.setState({ sys, eng, wep, mcSys, mcEng, mcWep }, () => this._updateRouteOnControlChange()); + this.setState({ sys, eng, wep, mcSys, mcEng, mcWep }, () => + this._updateRouteOnControlChange() + ); } /** @@ -260,7 +311,7 @@ export default class OutfittingPage extends Page { * @param {boolean} boost true if boosting */ _boostUpdated(boost) { - this.setState({ boost }, () => this._updateRouteOnControlChange()); + this.setState({ boost }, () => this._updateRouteOnControlChange()); } /** @@ -268,7 +319,7 @@ export default class OutfittingPage extends Page { * @param {number} fuel the amount of fuel, in T */ _fuelUpdated(fuel) { - this.setState({ fuel }, () => this._updateRouteOnControlChange()); + this.setState({ fuel }, () => this._updateRouteOnControlChange()); } /** @@ -276,7 +327,7 @@ export default class OutfittingPage extends Page { * @param {number} cargo the amount of cargo, in T */ _cargoUpdated(cargo) { - this.setState({ cargo }, () => this._updateRouteOnControlChange()); + this.setState({ cargo }, () => this._updateRouteOnControlChange()); } /** @@ -284,7 +335,9 @@ export default class OutfittingPage extends Page { * @param {number} engagementRange the engagement range, in m */ _engagementRangeUpdated(engagementRange) { - this.setState({ engagementRange }, () => this._updateRouteOnControlChange()); + this.setState({ engagementRange }, () => + this._updateRouteOnControlChange() + ); } /** @@ -293,7 +346,11 @@ export default class OutfittingPage extends Page { * @param {string} opponentBuild the name of the opponent's build */ _opponentUpdated(opponent, opponentBuild) { - const opponentShip = new Ship(opponent, Ships[opponent].properties, Ships[opponent].slots); + const opponentShip = new Ship( + opponent, + Ships[opponent].properties, + Ships[opponent].slots + ); let opponentSys = this.state.opponentSys; let opponentEng = this.state.opponentEng; let opponentWep = this.state.opponentWep; @@ -301,9 +358,13 @@ export default class OutfittingPage extends Page { // Ship is a particular build opponentShip.buildFrom(Persist.getBuild(opponent, opponentBuild)); // Set pips for opponent - const opponentParts = Persist.getBuild(opponent, opponentBuild).split('.'); + const opponentParts = Persist.getBuild(opponent, opponentBuild).split( + '.' + ); if (opponentParts.length >= 5) { - const opponentControl = LZString.decompressFromBase64(Utils.fromUrlSafe(opponentParts[4])).split('/'); + const opponentControl = LZString.decompressFromBase64( + Utils.fromUrlSafe(opponentParts[4]) + ).split('/'); opponentSys = parseFloat(opponentControl[0]); opponentEng = parseFloat(opponentControl[1]); opponentWep = parseFloat(opponentControl[2]); @@ -316,7 +377,16 @@ export default class OutfittingPage extends Page { opponentWep = 2; } - this.setState({ opponent: opponentShip, opponentBuild, opponentSys, opponentEng, opponentWep }, () => this._updateRouteOnControlChange()); + this.setState( + { + opponent: opponentShip, + opponentBuild, + opponentSys, + opponentEng, + opponentWep + }, + () => this._updateRouteOnControlChange() + ); } /** @@ -326,8 +396,22 @@ export default class OutfittingPage extends Page { * @returns {string} The control code */ _controlCode(fuel, cargo) { - const { sys, eng, wep, mcSys, mcEng, mcWep, boost, opponent, opponentBuild, engagementRange } = this.state; - const code = `${sys}/${eng}/${wep}/${boost ? 1 : 0}/${fuel || this.state.fuel}/${cargo || this.state.cargo}/${opponent.id}/${opponentBuild ? opponentBuild : ''}/${engagementRange}/${mcSys}/${mcEng}/${mcWep}`; + const { + sys, + eng, + wep, + mcSys, + mcEng, + mcWep, + boost, + opponent, + opponentBuild, + engagementRange + } = this.state; + const code = `${sys}/${eng}/${wep}/${boost ? 1 : 0}/${fuel || + this.state.fuel}/${cargo || this.state.cargo}/${opponent.id}/${ + opponentBuild ? opponentBuild : '' + }/${engagementRange}/${mcSys}/${mcEng}/${mcWep}`; return code; } @@ -338,27 +422,44 @@ export default class OutfittingPage extends Page { const { ship, buildName, newBuildName, shipId } = this.state; // If this is a stock ship the code won't be set, so ensure that we have it - const code = this.state.code || ship.toString(); + const code = this.state.code || ship.toString(); Persist.saveBuild(shipId, newBuildName, code); this._updateRoute(shipId, newBuildName, code); let opponent, opponentBuild, opponentSys, opponentEng, opponentWep; - if (shipId === this.state.opponent.id && buildName === this.state.opponentBuild) { + if ( + shipId === this.state.opponent.id && + buildName === this.state.opponentBuild + ) { // This is a save of our current opponent build; update it opponentBuild = newBuildName; - opponent = new Ship(shipId, Ships[shipId].properties, Ships[shipId].slots).buildFrom(code); + opponent = new Ship( + shipId, + Ships[shipId].properties, + Ships[shipId].slots + ).buildFrom(code); opponentSys = this.state.sys; opponentEng = this.state.eng; opponentWep = this.state.wep; } else { opponentBuild = this.state.opponentBuild; - opponent = this.state.opponent; + opponent = this.state.opponent; opponentSys = this.state.opponentSys; opponentEng = this.state.opponentEng; opponentWep = this.state.opponentWep; } - this.setState({ buildName: newBuildName, code, savedCode: code, opponent, opponentBuild, opponentSys, opponentEng, opponentWep, title: this._getTitle(newBuildName) }); + this.setState({ + buildName: newBuildName, + code, + savedCode: code, + opponent, + opponentBuild, + opponentSys, + opponentEng, + opponentWep, + title: this._getTitle(newBuildName) + }); } /** @@ -370,7 +471,12 @@ export default class OutfittingPage extends Page { Persist.deleteBuild(shipId, buildName); Persist.saveBuild(shipId, newBuildName, code); this._updateRoute(shipId, newBuildName, code); - this.setState({ buildName: newBuildName, code, savedCode: code, opponentBuild: newBuildName }); + this.setState({ + buildName: newBuildName, + code, + savedCode: code, + opponentBuild: newBuildName + }); } } @@ -390,9 +496,7 @@ export default class OutfittingPage extends Page { ship.buildWith(Ships[shipId].defaults); // Reset controls const code = ship.toString(); - const { sys, eng, wep, mcSys, mcEng, mcWep, boost, fuel, cargo, opponent, opponentBuild, engagementRange } = this._obtainControlFromCode(ship, code); - // Update state, and refresh the ship - this.setState({ + const { sys, eng, wep, @@ -405,7 +509,25 @@ export default class OutfittingPage extends Page { opponent, opponentBuild, engagementRange - }, () => this._updateRoute(shipId, buildName, code)); + } = this._obtainControlFromCode(ship, code); + // Update state, and refresh the ship + this.setState( + { + sys, + eng, + wep, + mcSys, + mcEng, + mcWep, + boost, + fuel, + cargo, + opponent, + opponentBuild, + engagementRange + }, + () => this._updateRoute(shipId, buildName, code) + ); } /** @@ -416,7 +538,10 @@ export default class OutfittingPage extends Page { Persist.deleteBuild(shipId, buildName); let opponentBuild; - if (shipId === this.state.opponent.id && buildName === this.state.opponentBuild) { + if ( + shipId === this.state.opponent.id && + buildName === this.state.opponentBuild + ) { // Our current opponent has been deleted; revert to stock opponentBuild = null; } else { @@ -433,11 +558,13 @@ export default class OutfittingPage extends Page { _exportBuild() { let translate = this.context.language.translate; let { buildName, ship } = this.state; - this.context.showModal(); + this.context.showModal( + + ); } /** @@ -450,9 +577,7 @@ export default class OutfittingPage extends Page { this.state.ship.buildFrom(code); // Obtain controls from the code - const { sys, eng, wep, mcSys, mcEng, mcWep, boost, fuel, cargo, opponent, opponentBuild, engagementRange } = this._obtainControlFromCode(ship, code); - // Update state, and refresh the route when complete - this.setState({ + const { sys, eng, wep, @@ -465,7 +590,25 @@ export default class OutfittingPage extends Page { opponent, opponentBuild, engagementRange - }, () => this._updateRoute(shipId, buildName, code)); + } = this._obtainControlFromCode(ship, code); + // Update state, and refresh the route when complete + this.setState( + { + sys, + eng, + wep, + mcSys, + mcEng, + mcWep, + boost, + fuel, + cargo, + opponent, + opponentBuild, + engagementRange + }, + () => this._updateRoute(shipId, buildName, code) + ); } /** @@ -481,8 +624,14 @@ export default class OutfittingPage extends Page { } const code = this._fullCode(ship, fuel, cargo); // Only update the state if this really has been updated - if (this.state.code != code || this.state.cargo != cargo || this.state.fuel != fuel) { - this.setState({ code, cargo, fuel }, () => this._updateRoute(shipId, buildName, code)); + if ( + this.state.code != code || + this.state.cargo != cargo || + this.state.fuel != fuel + ) { + this.setState({ code, cargo, fuel }, () => + this._updateRoute(shipId, buildName, code) + ); } } @@ -502,7 +651,8 @@ export default class OutfittingPage extends Page { * @param {Object} nextContext Incoming/Next conext */ componentWillReceiveProps(nextProps, nextContext) { - if (this.context.route !== nextContext.route) { // Only reinit state if the route has changed + if (this.context.route !== nextContext.route) { + // Only reinit state if the route has changed this.setState(this._initState(nextProps, nextContext)); } } @@ -525,7 +675,7 @@ export default class OutfittingPage extends Page { * Generates the short URL */ _genShortlink() { - this.context.showModal(); + this.context.showModal(); } /** @@ -542,7 +692,7 @@ export default class OutfittingPage extends Page { data.ShipName = ship.id; data.Ship = ship.id; console.log(data); - this.context.showModal(); + this.context.showModal(); } /** @@ -553,17 +703,23 @@ export default class OutfittingPage extends Page { const shipId = Ships[ship.id].eddbID; // Provide unique list of non-PP module EDDB IDs - const modIds = ship.internal.concat(ship.bulkheads, ship.standard, ship.hardpoints).filter(slot => slot !== null && slot.m !== null && !slot.m.pp).map(slot => slot.m.eddbID).filter((v, i, a) => a.indexOf(v) === i); + const modIds = ship.internal + .concat(ship.bulkheads, ship.standard, ship.hardpoints) + .filter(slot => slot !== null && slot.m !== null && !slot.m.pp) + .map(slot => slot.m.eddbID) + .filter((v, i, a) => a.indexOf(v) === i); // Open up the relevant URL - window.open('https://eddb.io/station?s=' + shipId + '&m=' + modIds.join(',')); + window.open( + 'https://eddb.io/station?s=' + shipId + '&m=' + modIds.join(',') + ); } /** * Generates the shopping list */ _genShoppingList() { - this.context.showModal(); + this.context.showModal(); } /** @@ -573,8 +729,9 @@ export default class OutfittingPage extends Page { _keyDown(e) { // .keyCode will eventually be replaced with .key switch (e.keyCode) { - case 69: // 'e' - if (e.ctrlKey || e.metaKey) { // CTRL/CMD + e + case 69: // 'e' + if (e.ctrlKey || e.metaKey) { + // CTRL/CMD + e e.preventDefault(); this._exportBuild(); } @@ -590,7 +747,28 @@ export default class OutfittingPage extends Page { let state = this.state, { language, termtip, tooltip, sizeRatio, onWindowResize } = this.context, { translate, units, formats } = language, - { ship, code, savedCode, buildName, newBuildName, sys, eng, wep, mcSys, mcEng, mcWep, boost, fuel, cargo, opponent, opponentBuild, opponentSys, opponentEng, opponentWep, engagementRange } = state, + { + ship, + code, + savedCode, + buildName, + newBuildName, + sys, + eng, + wep, + mcSys, + mcEng, + mcWep, + boost, + fuel, + cargo, + opponent, + opponentBuild, + opponentSys, + opponentEng, + opponentWep, + engagementRange + } = state, hide = tooltip.bind(null, null), menu = this.props.currentMenu, shipUpdated = this._shipUpdated, @@ -608,11 +786,15 @@ export default class OutfittingPage extends Page { const _pStr = `${ship.getPowerEnabledString()}${ship.getPowerPrioritiesString()}`; const _mStr = ship.getModificationsString(); - const standardSlotMarker = `${ship.name}${_sStr}${_pStr}${_mStr}${ship.ladenMass}${cargo}${fuel}`; + const standardSlotMarker = `${ship.name}${_sStr}${_pStr}${_mStr}${ + ship.ladenMass + }${cargo}${fuel}`; const internalSlotMarker = `${ship.name}${_iStr}${_pStr}${_mStr}`; const hardpointsSlotMarker = `${ship.name}${_hStr}${_pStr}${_mStr}`; const boostMarker = `${ship.canBoost(cargo, fuel)}`; - const shipSummaryMarker = `${ship.name}${_sStr}${_iStr}${_hStr}${_pStr}${_mStr}${ship.ladenMass}${cargo}${fuel}`; + const shipSummaryMarker = `${ + ship.name + }${_sStr}${_iStr}${_hStr}${_pStr}${_mStr}${ship.ladenMass}${cargo}${fuel}`; const requirements = Ships[ship.id].requirements; let requirementElements = []; @@ -624,94 +806,275 @@ export default class OutfittingPage extends Page { */ function renderRequirement(className, textKey, tooltipTextKey) { if (textKey.startsWith('empire') || textKey.startsWith('federation')) { - requirementElements.push(); + requirementElements.push( + + ); } else { - requirementElements.push(
{translate(textKey)}
); + requirementElements.push( +
+ {translate(textKey)} +
+ ); } } if (requirements) { - requirements.federationRank && renderRequirement('federation', 'federation rank ' + requirements.federationRank, 'federation rank required'); - requirements.empireRank && renderRequirement('empire', 'empire rank ' + requirements.empireRank, 'empire rank required'); - requirements.horizons && renderRequirement('horizons', 'horizons', 'horizons required'); - requirements.horizonsEarlyAdoption && renderRequirement('horizons', 'horizons early adoption', 'horizons early adoption required'); + requirements.federationRank && + renderRequirement( + 'federation', + 'federation rank ' + requirements.federationRank, + 'federation rank required' + ); + requirements.empireRank && + renderRequirement( + 'empire', + 'empire rank ' + requirements.empireRank, + 'empire rank required' + ); + requirements.horizons && + renderRequirement('horizons', 'horizons', 'horizons required'); + requirements.horizonsEarlyAdoption && + renderRequirement( + 'horizons', + 'horizons early adoption', + 'horizons early adoption required' + ); } return ( -
-
+
+

{ship.name}

-
{requirementElements}
-
- - - - - - - - - - -
{/* Main tables */} - - - - - + + + + + {/* Control of ship and opponent */} -
-
-

{translate('ship control')}

+
+
+

+ {translate('ship control')} +

-
- +
+
-
- +
+
-
- +
+
-
- { ship.cargoCapacity > 0 ? : null } +
+ {ship.cargoCapacity > 0 ? ( + + ) : null}
-
-
-

{translate('opponent')}

+
+
+

+ {translate('opponent')} +

-
- +
+
-
- +
+
{/* Tabbed subpages */} @@ -733,6 +1096,15 @@ export default class OutfittingPage extends Page { opponentEng={opponentEng} opponentWep={opponentWep} /> +
); } diff --git a/src/app/pages/ShipyardPage.jsx b/src/app/pages/ShipyardPage.jsx index 5f5e1842..0f4f8110 100644 --- a/src/app/pages/ShipyardPage.jsx +++ b/src/app/pages/ShipyardPage.jsx @@ -6,6 +6,7 @@ import Ship from '../shipyard/Ship'; import * as ModuleUtils from '../shipyard/ModuleUtils'; import { SizeMap } from '../shipyard/Constants'; import Link from '../components/Link'; +import Ad from '../components/Ad'; /** * Counts the hardpoints by class/size @@ -22,9 +23,11 @@ function countHp(slot) { */ function countInt(slot) { let crEligible = !slot.eligible || slot.eligible.cr; - this.int[slot.maxClass - 1]++; // Subtract 1 since there is no Class 0 Internal compartment + this.int[slot.maxClass - 1]++; // Subtract 1 since there is no Class 0 Internal compartment this.intCount++; - this.maxCargo += crEligible ? ModuleUtils.findInternal('cr', slot.maxClass, 'E').cargo : 0; + this.maxCargo += crEligible ? + ModuleUtils.findInternal('cr', slot.maxClass, 'E').cargo : + 0; // if no eligiblity, then assume pce let passSlotType = null; @@ -42,7 +45,9 @@ function countInt(slot) { passSlotType = 'pcq'; passSlotRating = 'B'; } - let passengerBay = passSlotType ? ModuleUtils.findMaxInternal(passSlotType, slot.maxClass, passSlotRating) : null; + let passengerBay = passSlotType ? + ModuleUtils.findMaxInternal(passSlotType, slot.maxClass, passSlotRating) : + null; this.maxPassengers += passengerBay ? passengerBay.passengers : 0; } @@ -62,18 +67,21 @@ function shipSummary(shipId, shipData) { hp: [0, 0, 0, 0, 0], // Utility, Small, Medium, Large, Huge int: [0, 0, 0, 0, 0, 0, 0, 0], // Sizes 1 - 8 standard: shipData.slots.standard, - agility: shipData.properties.pitch + shipData.properties.yaw + shipData.properties.roll + agility: + shipData.properties.pitch + + shipData.properties.yaw + + shipData.properties.roll }; Object.assign(summary, shipData.properties); let ship = new Ship(shipId, shipData.properties, shipData.slots); // Build Ship - ship.buildWith(shipData.defaults); // Populate with stock/default components + ship.buildWith(shipData.defaults); // Populate with stock/default components ship.hardpoints.forEach(countHp.bind(summary)); // Count Hardpoints by class - ship.internal.forEach(countInt.bind(summary)); // Count Internal Compartments by class - summary.retailCost = ship.totalCost; // Record Stock/Default/retail cost - ship.optimizeMass({ pd: '1D' }); // Optimize Mass with 1D PD for maximum possible jump range - summary.maxJumpRange = ship.unladenRange; // Record Jump Range + ship.internal.forEach(countInt.bind(summary)); // Count Internal Compartments by class + summary.retailCost = ship.totalCost; // Record Stock/Default/retail cost + ship.optimizeMass({ pd: '1D' }); // Optimize Mass with 1D PD for maximum possible jump range + summary.maxJumpRange = ship.unladenRange; // Record Jump Range // Best thrusters let th; @@ -97,7 +105,6 @@ function shipSummary(shipId, shipData) { * The Shipyard summary page */ export default class ShipyardPage extends Page { - static cachedShipSummaries = null; /** @@ -145,12 +152,15 @@ export default class ShipyardPage extends Page { shipPredicateIndex = undefined; } - if (this.state.shipPredicate == shipPredicate && this.state.shipPredicateIndex == shipPredicateIndex) { + if ( + this.state.shipPredicate == shipPredicate && + this.state.shipPredicateIndex == shipPredicateIndex + ) { shipDesc = !shipDesc; } this.setState({ shipPredicate, shipDesc, shipPredicateIndex }); - }; + } /** * Generate the table row summary for the ship @@ -165,50 +175,55 @@ export default class ShipyardPage extends Page { _shipRowElement(s, translate, u, fInt, fRound, highlight) { let noTouch = this.context.noTouch; - return - {s.manufacturer} - {fInt(s.retailCost)} - {translate(SizeMap[s.class])} - {fInt(s.crew)} - {s.masslock} - {fInt(s.agility)} - {fInt(s.hardness)} - {fInt(s.hullMass)} - {fInt(s.speed)} - {fInt(s.boost)} - {fInt(s.baseArmour)} - {fInt(s.baseShieldStrength)} - {fInt(s.topSpeed)} - {fInt(s.topBoost)} - {fRound(s.maxJumpRange)} - {fInt(s.maxCargo)} - {fInt(s.maxPassengers)} - {s.standard[0]} - {s.standard[1]} - {s.standard[2]} - {s.standard[3]} - {s.standard[4]} - {s.standard[5]} - {s.standard[6]} - {s.hp[1]} - {s.hp[2]} - {s.hp[3]} - {s.hp[4]} - {s.hp[0]} - {s.int[0]} - {s.int[1]} - {s.int[2]} - {s.int[3]} - {s.int[4]} - {s.int[5]} - {s.int[6]} - {s.int[7]} - ; + {s.manufacturer} + {fInt(s.retailCost)} + {translate(SizeMap[s.class])} + {fInt(s.crew)} + {s.masslock} + {fInt(s.agility)} + {fInt(s.hardness)} + {fInt(s.hullMass)} + {fInt(s.speed)} + {fInt(s.boost)} + {fInt(s.baseArmour)} + {fInt(s.baseShieldStrength)} + {fInt(s.topSpeed)} + {fInt(s.topBoost)} + {fRound(s.maxJumpRange)} + {fInt(s.maxCargo)} + {fInt(s.maxPassengers)} + {s.standard[0]} + {s.standard[1]} + {s.standard[2]} + {s.standard[3]} + {s.standard[4]} + {s.standard[5]} + {s.standard[6]} + {s.hp[1]} + {s.hp[2]} + {s.hp[3]} + {s.hp[4]} + {s.hp[0]} + {s.int[0]} + {s.int[1]} + {s.int[2]} + {s.int[3]} + {s.int[4]} + {s.int[5]} + {s.int[6]} + {s.int[7]} + + ); } /** @@ -222,7 +237,8 @@ export default class ShipyardPage extends Page { let fInt = formats.int; let fRound = formats.round; let { shipSummaries, shipPredicate, shipPredicateIndex } = this.state; - let sortShips = (predicate, index) => this._sortShips.bind(this, predicate, index); + let sortShips = (predicate, index) => + this._sortShips.bind(this, predicate, index); let filters = { // 'class': { 1: 1, 2: 1} @@ -239,7 +255,8 @@ export default class ShipyardPage extends Page { // Sort shipsOverview shipSummaries.sort((a, b) => { - let valA = a[shipPredicate], valB = b[shipPredicate]; + let valA = a[shipPredicate], + valB = b[shipPredicate]; if (shipPredicateIndex != undefined) { valA = valA[shipPredicateIndex]; @@ -252,7 +269,7 @@ export default class ShipyardPage extends Page { valB = val; } - if(valA == valB) { + if (valA == valB) { if (a.name > b.name) { return 1; } else { @@ -274,42 +291,65 @@ export default class ShipyardPage extends Page { for (let s of shipSummaries) { let shipSortValue = s[shipPredicate]; - if(shipPredicateIndex != undefined) { + if (shipPredicateIndex != undefined) { shipSortValue = shipSortValue[shipPredicateIndex]; } - if(shipSortValue != lastShipSortValue) { + if (shipSortValue != lastShipSortValue) { backgroundHighlight = !backgroundHighlight; lastShipSortValue = shipSortValue; } - detailRows[i] = this._shipRowElement(s, translate, units, fInt, formats.f1, backgroundHighlight); + detailRows[i] = this._shipRowElement( + s, + translate, + units, + fInt, + formats.f1, + backgroundHighlight + ); shipRows[i] = ( - {s.name} + + {s.name} + ); i++; } return ( -
-
+
+
- + - - + + - + @@ -317,80 +357,270 @@ export default class ShipyardPage extends Page {
  
{translate('ship')}
+ {translate('ship')} +
{units['m/s']}{units['m/s']}
- - - - - - - - - - - - - - - - - - - - - - - - +
{translate('manufacturer')} {translate('size')}{translate('crew')}{translate('MLF')}{translate('agility')}{translate('hrd')} {translate('base')}{translate('max')}
{translate('cost')}{translate('hull')}{translate('speed')}{translate('boost')}{translate('armour')}{translate('shields')}
+ + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - {detailRows} - -
+ {translate('manufacturer')} +   + {translate('size')} + + {translate('crew')} + + {translate('MLF')} + + {translate('agility')} + + {translate('hrd')} +  {translate('base')}{translate('max')} + + +
+ {translate('cost')} + + {translate('hull')} + + {translate('speed')} + + {translate('boost')} + + {translate('armour')} + + {translate('shields')} + {translate('speed')}{translate('boost')}{translate('jump')}{translate('cargo')}{translate('pax')} + {translate('speed')} + + {translate('boost')} + + {translate('jump')} + + {translate('cargo')} + + {translate('pax')} + {translate('core module classes')}{translate('hardpoints')}{translate('internal compartments')}
{units.CR}{units.T}{units['m/s']}{units['m/s']} {units.MJ}{units['m/s']}{units['m/s']}{units.LY}{units.T} {'pp'}{'th'}{'fsd'}{'ls'}{'pd'}{'s'}{'ft'}{translate('S')}{translate('M')}{translate('L')}{translate('H')}{translate('U')} + {translate('core module classes')} + + {translate('hardpoints')} + + {translate('internal compartments')} +
+ {units.CR} + + {units.T} + + {units['m/s']} + + {units['m/s']} +   + {units.MJ} + + {units['m/s']} + + {units['m/s']} + + {units.LY} + + {units.T} +   + {'pp'} + + {'th'} + + {'fsd'} + + {'ls'} + + {'pd'} + + {'s'} + + {'ft'} + + {translate('S')} + + {translate('M')} + + {translate('L')} + + {translate('H')} + + {translate('U')} + 12345678
+ + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + + + {detailRows} + + +
diff --git a/src/index.ejs b/src/index.ejs index b5848fb6..1831281f 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -1,5 +1,5 @@ - + Coriolis EDCD Edition @@ -31,10 +31,7 @@ <% if (htmlWebpackPlugin.options.uaTracking) { %>