mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 22:55:35 +00:00
Linting fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
angular.module('app').directive('componentSelect', function () {
|
||||
angular.module('app').directive('componentSelect', function() {
|
||||
|
||||
// Generting the HTML in this manner is MUCH faster than using an angular template.
|
||||
|
||||
@@ -8,42 +8,42 @@ angular.module('app').directive('componentSelect', function () {
|
||||
var o = opts[i];
|
||||
var id = o.id || (o.class + o.rating); // Common components' ID is their class and rating
|
||||
|
||||
if(i > 0 && opts.length > 3 && o.class != prevClass && (!o.grp || o.rating != prevRating || o.mode)) {
|
||||
if (i > 0 && opts.length > 3 && o.class != prevClass && (!o.grp || o.rating != prevRating || o.mode)) {
|
||||
list.push('<br/>');
|
||||
}
|
||||
|
||||
list.push('<li class="', o.name? 'lc' : 'c');
|
||||
list.push('<li class="', o.name ? 'lc' : 'c');
|
||||
|
||||
if (cid == id) {
|
||||
list.push(' active');
|
||||
}
|
||||
|
||||
list.push((o.maxmass && mass > o.maxmass)? ' disabled"' : '" cpid="', id, '">');
|
||||
list.push((o.maxmass && mass > o.maxmass) ? ' disabled"' : '" cpid="', id, '">');
|
||||
|
||||
if(o.mode) {
|
||||
list.push('<svg cpid="', id, '" class="icon lg"><use xlink:href="#mount-', o.mode , '"></use></svg> ');
|
||||
if (o.mode) {
|
||||
list.push('<svg cpid="', id, '" class="icon lg"><use xlink:href="#mount-', o.mode, '"></use></svg> ');
|
||||
}
|
||||
|
||||
list.push(o.class, o.rating);
|
||||
|
||||
if(o.missile) {
|
||||
if (o.missile) {
|
||||
list.push('/' + o.missile);
|
||||
}
|
||||
|
||||
|
||||
if(o.name) {
|
||||
if (o.name) {
|
||||
list.push(' ' + o.name);
|
||||
}
|
||||
|
||||
list.push('</li>');
|
||||
prevClass = o.class;
|
||||
prevRating= o.rating;
|
||||
prevRating = o.rating;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope:{
|
||||
scope: {
|
||||
opts: '=', // Component Options object
|
||||
groups: '=', // Groups of Component Options
|
||||
mass: '=', // Current ship unladen mass
|
||||
@@ -57,13 +57,13 @@ angular.module('app').directive('componentSelect', function () {
|
||||
var groups = scope.groups;
|
||||
var mass = scope.mass || 0;
|
||||
|
||||
if(groups) {
|
||||
if (groups) {
|
||||
// At present time slots with grouped options (Hardpoints and Internal) can be empty
|
||||
list.push('<div class="empty-c" cpid="empty">EMPTY</div>');
|
||||
for (var g in groups) {
|
||||
var grp = groups[g];
|
||||
var grpCode = grp[Object.keys(grp)[0]].grp; // Nasty operation to get the grp property of the first/any single component
|
||||
list.push('<div id="', grpCode ,'" class="select-group">', g, '</div><ul>');
|
||||
list.push('<div id="', grpCode, '" class="select-group">', g, '</div><ul>');
|
||||
appendGroup(list, grp, cid, mass);
|
||||
list.push('</ul>');
|
||||
}
|
||||
@@ -77,9 +77,9 @@ angular.module('app').directive('componentSelect', function () {
|
||||
// If groups are present and a component is already selectd
|
||||
if (groups && component && component.grp) {
|
||||
var groupElement = angular.element(document.getElementById(component.grp));
|
||||
var parentElem = element[0].parentElement;
|
||||
var parentElem = element[0].parentElement;
|
||||
parentElem.scrollTop = groupElement[0].offsetTop; // Scroll to currently selected group
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user