A few tweaks to the switch summary display

-- Reverted to using lowercase "IDs" in switches.json (no need to
change, and would break existing files))
-- Now showing the "display name" of the switches in the summary
display.
pull/124/head
Ian Prest 9 years ago
parent 9a2987be25
commit 962bd6ba78

@ -343,9 +343,11 @@ for i in (1..9) {
table.summarytable {
border-collapse: collapse;
margin-top: 1em;
}
.summarytable table, th, td {
table.summarytable th, table.summarytable td {
border: 1px solid black;
padding: 2px 5px;
}
}

@ -806,9 +806,8 @@ Nav Bar / Header
<!-- SUMMARY -->
<div id="summary" ng-class="{hidden:selTab!=4}">
<div class="col-md-12 col-lg-12 row">
Title: {{meta.name}}<br>
Author: {{meta.author}}<br>
<br>
<div>Title: {{meta.name}}</div>
<div>Author: {{meta.author}}</div>
<table class='summarytable'>
<tr><th class='summarytable' colspan='3'>Key sizes summary</th></tr>
<tr ng-repeat="(k,v) in keyCount()" class='summarytable'>
@ -817,10 +816,9 @@ Nav Bar / Header
<td align='right'>{{v}}</td>
</tr>
</table>
<br>
<table class='summarytable'>
<tr><th colspan='2'>Switches summary</th></tr>
<tr ng-repeat="(k,v) in switchCount()"><td>{{k}}</td><td>{{v}}</td></tr>
<tr><th colspan='3'>Switches summary</th></tr>
<tr ng-repeat="(k,v) in switchCount()"><td>{{k}}</td><td>{{switchNames[k]}}</td><td>{{v}}</td></tr>
</table>
</div>
</div>

49
kb.js

@ -281,8 +281,9 @@
if(!key.decal) {
var foo = key.color; // next line refused to work with key.color.
var colourname = reverseColors[foo];
if (!colourname) // not a defined name
{colourname = ""};
if(!colourname) { // not a defined name
colourname = "";
}
thisk += " " + colourname + " (" + key.color + ")";
}
if(kcounts[thisk]) {
@ -300,25 +301,11 @@
var scounts = new Object();
scounts["~Total"] = 0;
angular.forEach($scope.keys(), function(key) {
if (!key.decal) {
if(!key.decal) {
scounts["~Total"]++;
var thissw = "";
if ($scope.meta.switchType) {
thissw = $scope.meta.switchBrand + " " + $scope.meta.switchType;
}
if (key.st) {
if (key.sb) {
thissw = key.sb + " " + key.st;
} else {
thissw = $scope.meta.switchBrand + " " + key.st;
}
}
if (thissw) {
if (scounts[thissw]) {
scounts[thissw]++;
} else {
scounts[thissw] = 1;
}
var thissw = key.st || $scope.meta.switchType;
if(thissw) {
scounts[thissw] = (scounts[thissw] || 0) + 1;
}
}
});
@ -408,6 +395,17 @@
$http.get('switches.json').success(function(data) {
$scope.switches = data;
$scope.switchNames = {};
for(var mountName in $scope.switches) {
var mountType = $scope.switches[mountName];
for(var brandName in mountType.brands) {
var brandType = mountType.brands[brandName];
for(var part in brandType.switches) {
var switchType = brandType.switches[part];
$scope.switchNames[part] = brandType.name + " / " + switchType.name;
}
}
}
});
// The currently selected palette & character-picker
@ -415,9 +413,9 @@
$scope.picker = {};
$scope.pickerSelection = {};
var reverseColors = []; // array to provide fast reverse lookups of colour names for Summary.
// might be an issue if a colour features twice... only last will stick
// The set of known palettes
var reverseColors = {}; // array to provide fast reverse lookups of colour names for Summary.
// might be an issue if a colour features twice... only last will stick
// The set of known palettes
$scope.palettes = {};
$http.get('colors.json').success(function(data) {
$scope.palettes = data;
@ -773,8 +771,8 @@
}
transaction("metadata", function() {
$scope.keyboard.meta[prop] = value;
if(prop==='switchMount') { $scope.keyboard.meta.switchBrand = $scope.keyboard.meta.switchType = ''; }
else if(prop==='switchBrand') { $scope.keyboard.meta.switchType = ''; }
if(prop==='switchMount') { $scope.keyboard.meta.switchBrand = $scope.keyboard.meta.switchType = ''; }
else if(prop==='switchBrand') { $scope.keyboard.meta.switchType = ''; }
});
$scope.meta = angular.copy($scope.keyboard.meta);
$scope.calcKbHeight();
@ -1521,7 +1519,6 @@
var userLoginSecret;
var userLoginWindow;
$scope.userLogin = function() {
console.log(userLoginWindow);
if(userLoginWindow) {
if(userLoginWindow.closed) {
userLoginSecret = null;

@ -7,8 +7,8 @@
"style": "background-image: url('/bg/wood/Red_Mahogany_Wood.jpg');"
},
"radii": "30px 30px 50% 50%",
"switchMount": "Cherry",
"switchBrand": "Cherry",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx",
"plate": true,
"pcb": false

@ -1,6 +1,6 @@
{
"Cherry": { "mount": "Cherry", "name": "Cherry MX Mount", "brands": {
"Cherry": { "brand": "Cherry", "name": "Cherry Electrical Products", "switches": {
"cherry": { "mount": "cherry", "name": "Cherry MX Mount", "brands": {
"cherry": { "brand": "cherry", "name": "Cherry Electrical Products", "switches": {
"MX1A-A1xx": { "part": "MX1A-A1xx", "name": "MX White", "feel": "clicky", "weight": 70 },
"MX1A-11xx": { "part": "MX1A-11xx", "name": "MX Black", "feel": "linear", "weight": 60 },
"MX1A-C1xx": { "part": "MX1A-C1xx", "name": "MX Clear", "feel": "tactile", "weight": 55 },
@ -20,7 +20,7 @@
"MX3A-L1xx": { "part": "MX3A-L1xx", "name": "MX Silent Red", "feel": "linear", "weight": 45 },
"MX3A-11xx": { "part": "MX3A-11xx", "name": "MX Silent Black", "feel": "linear", "weight": 60 }
}},
"Outemu": { "brand": "Outemu", "name": "Outemu (Gaote Electronics)", "switches": {
"outemu": { "brand": "outemu", "name": "Outemu (Gaote Electronics)", "switches": {
"PG150B01-1": { "part": "PG150B01-1", "name": "Clear, Black Shaft", "weight": 65 },
"PG150R01-1": { "part": "PG150R01-1", "name": "Clear, Red Shaft", "weight": 50 },
"PG150Q01-1": { "part": "PG150Q01-1", "name": "Clear, Blue Shaft", "weight": 55 },
@ -30,7 +30,7 @@
"PG150Q01": { "part": "PG150Q01", "name": "Black, Blue Shaft", "weight": 60 },
"PG150T01": { "part": "PG150T01", "name": "Black, Brown Shaft", "weight": 55 }
}},
"Oateron": { "brand": "Gateron", "name": "Gateron (Huizhou Jia Electronic Technology Co.)", "switches": {
"gateron": { "brand": "gateron", "name": "Gateron (Huizhou Jia Electronic Technology Co.)", "switches": {
"KS-3-Black": { "part": "KS-3-Black", "name": "KS-3 Black Shaft (black)", "feel": "linear", "weight": 50 },
"KS-3-Green": { "part": "KS-3-Green", "name": "KS-3 Green Axis (blue)", "feel": "clicky", "weight": 55 },
"KS-3-Red": { "part": "KS-3-Red", "name": "KS-3 Red Axis (red)", "feel": "linear", "weight": 45 },
@ -38,31 +38,31 @@
"KS-3-Yellow": { "part": "KS-3-Yellow", "name": "KS-3 Yellow (yellow)", "feel": "linear", "weight": 50 },
"KS-3-White": { "part": "KS-3-White", "name": "KS-3 White Shaft (translucent white)", "feel": "linear", "weight": 35 }
}},
"Oreetech": { "brand": "Greetech", "name": "Greetech (Huizhou Greetech Electronics Co.)", "switches": {
"greetech": { "brand": "greetech", "name": "Greetech (Huizhou Greetech Electronics Co.)", "switches": {
"GT02A1Exx": { "part": "GT02A1Exx", "name": "GT02 Red stem", "feel": "linear", "weight": 45 },
"GT02A1Dxx": { "part": "GT02A1Dxx", "name": "GT02 Blue stem", "feel": "clicky", "weight": 55 },
"GT02A1Bxx": { "part": "GT02A1Bxx", "name": "GTO2 Brown stem", "feel": "tactile", "weight": 50 },
"GT02A2Axx": { "part": "GT02A2Axx", "name": "GTO2 Black stem", "feel": "linear", "weight": 65 }
}},
"Hua-Jie": { "brand": "Hua-Jie", "name": "Hua-Jie (Hua-Jie (Taiwan) Corp)", "switches": {
"hua-jie": { "brand": "hua-jie", "name": "Hua-Jie (Hua-Jie (Taiwan) Corp)", "switches": {
"AX01-B": { "part": "AX01-B", "name": "Black stem", "feel": "linear", "weight": 60 },
"AX01-R": { "part": "AX01-R", "name": "Red stem", "feel": "linear", "weight": 45 },
"AX01-T": { "part": "AX01-T", "name": "Tea/Brown stem", "feel": "tactile", "weight": 55 },
"AX01-C": { "part": "AX01-C", "name": "Cyan/Blue stem", "feel": "clicky", "weight": 60 }
}},
"Kailh": { "brand": "Kailh", "name": "Kailh (Kaihua Electronics Co.)", "switches": {
"kailh": { "brand": "kailh", "name": "Kailh (Kaihua Electronics Co.)", "switches": {
"PG151101D01/D15": { "part": "PG151101D01/D15", "name": "Kailh Black", "feel": "linear", "weight": 60 },
"PG151101D64/D10": { "part": "PG151101D64/D10", "name": "Kailh Blue", "feel": "clicky", "weight": 60 },
"PG151101D49/D09": { "part": "PG151101D49/D09", "name": "Kailh Brown", "feel": "tactile", "weight": 55 },
"PG151101D05/D43": { "part": "PG151101D05/D43", "name": "Kailh Red", "feel": "linear", "weight": 50 }
}}
}},
"Alps": { "mount": "Alps", "name": "Alps Mount", "brands": {
"Alps": { "brand": "Alps", "name": "Alps Electric Co.", "switches": {
"alps": { "mount": "alps", "name": "Alps Mount", "brands": {
"alps": { "brand": "alps", "name": "Alps Electric Co.", "switches": {
"SKCL/SKCM": { "part": "SKCL/SKCM", "name": "SKCL/SKCM (Complicated Alps)" },
"SKBL/SKBM": { "part": "SKBL/SKBM", "name": "SKBL/SKBM (Simplified Alps)" }
}},
"Matias": { "brand": "Matias", "name": "Matias Corporation", "switches": {
"matias": { "brand": "matias", "name": "Matias Corporation", "switches": {
"PG155B02": { "part": "PG155B02", "name": "Click", "feel": "clicky", "weight": 60 },
"KS102Q": { "part": "KS102Q", "name": "Quiet Linear", "feel": "linear", "weight": 35 },
"PG155B01": { "part": "PG155B01", "name": "Quiet Click", "feel": "tactile", "weight": 60 }

Loading…
Cancel
Save