Updated switches data to be a bit more descriptive

-- Found part numbers for a few switch types
-- Split switch data into a JS object, rather than a simple string
-- Small tweaks to UI layout
-- When setting mount-type, brand & switch-type are reset
-- When setting brand, switch-type is reset
This commit is contained in:
Ian Prest 2015-08-06 22:57:52 -04:00
parent 899228097c
commit e3b4dd2bb3
5 changed files with 105 additions and 156 deletions

77
kb.html
View file

@ -215,7 +215,7 @@ Nav Bar / Header
ng-mousedown="selectClick($event)"
ngf-drop="true" ngf-change="uploadJson($files, $event)" ngf-drag-over-class="drag-over">
<div id='keyboard-bg'
<div id='keyboard-bg'
ng-attr-style="height:{{kbHeight}}px; width:{{kbWidth}}px; background-color:{{keyboard.meta.backcolor}}; border-radius: {{keyboard.meta.radii || '6px'}}; {{keyboard.meta.background.style}}">
<div ng-repeat="key in keys()"
class="key {{key.profile}}"
@ -611,50 +611,45 @@ Nav Bar / Header
<!-- Default keyswitch options-->
<div class="form-group form-group-sm">
<label class="control-label col-md-2 col-lg-1 text-nowrap" for="defaultkeyswitchstyleeditor">Default switch:</label>
<label class="control-label col-md-2 col-lg-1 text-nowrap" for="switcheditor">Default switch:</label>
<!-- Default keyswitch style-->
<div class=" col-md-4 col-lg-4">
<div class="form-inline form-outdent hint--top hint--rounded"
data-hint="Specify the default styleof key switch for this keyboard layout.">
<select id="defaultkeyswitchstyleeditor" class="form-control input-sm dropdown"
ng-model="meta.defaultkeyswitchstyle"
ng-change="updateMeta('defaultkeyswitchstyle')"
ng-blur="validateMeta('defaultkeyswitchstyle')">
<option value="" class="dropdown-header">Style</option>
<option ng-repeat="(k,v) in switches" value="{{k}}" ng-selected="'{{meta.defaultkeyswitchstyle}}' == '{{k}}'">{{k}}</option>
</select>
</div>
<!-- Default keyswitch brand-->
<div class="hint--top hint--rounded"
data-hint="Specify the default brand of key switch for this keyboard layout.">
<select id="defaultkeyswitchbrandeditor" class="form-control input-sm dropdown"
ng-model="meta.defaultkeyswitchbrand"
ng-change="updateMeta('defaultkeyswitchbrand')"
ng-blur="validateMeta('defaultkeyswitchbrand')">
<option value="" class="dropdown-header">Brand</option>
<option ng-repeat="(k,v) in switches[meta.defaultkeyswitchstyle]" value="{{k}}" ng-selected="'{{meta.defaultkeyswitchbrand}}' == '{{k}}'">{{k}}</option>
</select>
</div>
<!-- Default keyswitch style-->
<div class="form-inline form-outdent col-md-10 col-lg-11">
<div class="hint--top hint--rounded" data-hint="Specify the default style of switch for this keyboard layout.">
<select id="switcheditor" class="form-control input-sm dropdown"
ng-model="meta.switchMount"
ng-change="updateMeta('switchMount')"
ng-blur="validateMeta('switchMount')">
<option value="">Mount Style Not Specified</option>
<option ng-repeat="(k,v) in switches" value="{{k}}" ng-selected="meta.switchMount == k">{{v.name}}</option>
</select>
</div>
<!-- Default keyswitch type-->
<div class=" hint--top hint--rounded"
data-hint="Specify the default type of key switch for this keyboard layout.">
<select id="defaultkeyswitchtypeeditor" class="form-control input-sm dropdown"
ng-model="meta.defaultkeyswitchtype"
ng-change="updateMeta('defaultkeyswitchtype')"
ng-blur="validateMeta('defaultkeyswitchtype')">
<option value="" class="dropdown-header">Switch type</option>
<option ng-repeat="(k,v) in switches[meta.defaultkeyswitchstyle][meta.defaultkeyswitchbrand]" value="{{k}}" ng-selected="'{{meta.defaultkeyswitchtype}}' == '{{k}}'">{{v}}</option>
</select>
<!-- Default keyswitch brand-->
<div class="hint--top hint--rounded"
data-hint="Specify the default brand of key switch for this keyboard layout.">
<select class="form-control input-sm dropdown"
ng-model="meta.switchBrand"
ng-change="updateMeta('switchBrand')"
ng-blur="validateMeta('switchBrand')">
<option value="">Brand Not Specified</option>
<option ng-repeat="(k,v) in switches[meta.switchMount].brands" value="{{k}}" ng-selected="meta.switchBrand == k">{{v.name}}</option>
</select>
</div>
<!-- Default keyswitch type-->
<div class=" hint--top hint--rounded"
data-hint="Specify the default type of key switch for this keyboard layout.">
<select class="form-control input-sm dropdown"
ng-model="meta.switchType"
ng-change="updateMeta('switchType')"
ng-blur="validateMeta('switchType')">
<option value="">Switch Type Not Specified</option>
<option ng-repeat="v in switches[meta.switchMount].brands[meta.switchBrand].switches" value="{{v.part}}" ng-selected="meta.switchType == v.part">{{v.name + (v.feel ? ', '+v.feel : '') + (v.weight ? ', '+v.weight.toString()+' cN' : '')}}</option>
</select>
</div>
</div>
</div>
</div>
<!-- Notes -->
<div class="form-group form-group-sm">

36
kb.js
View file

@ -279,39 +279,8 @@
$scope.backgrounds = data;
});
// Known keyswitches styles ... Only CherryMX and Alps for now
//$scope.keyswitchstyles = {};
//$http.get('switchstyles.json').success(function(data) {
// $scope.keyswitchstyles = data.styles;
//});
// Known keyswitches brands
//$scope.CherryMX = {};
//$scope.CherryML = {};
//$scope.Alps = {};
//$http.get('switchbrands.json').success(function(data) {
// $scope.CherryMX = data.CherryMX;
// $scope.CherryML = data.CherryML;
// $scope.Alps = data.Alps;
//});
// Known keyswitches types
//$scope.Cherry = {};
//$scope.Gateron = {};
//$scope.Kailh = {};
//$scope.Gaote_Outemu = {};
//$scope.Greetech = {};
//$scope.Matias = {};
//$scope.AlpsSwitches = {};
$http.get('switches.json').success(function(data) {
//$scope.Cherry = data.Cherry;
//$scope.Gateron = data.Gateron;
//$scope.Kailh = data.Kailh;
//$scope.Gaote_Outemu = data.Gaote_Outemu;
//$scope.Greetech = data.Greetech;
//$scope.AlpsSwitches = data.AlpsSwitches;
//$scope.Matias = data.Matias;
$scope.switches = data.switches;
$scope.switches = data;
});
// The currently selected palette & character-picker
@ -667,7 +636,10 @@
}
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 = ''; }
});
$scope.meta = angular.copy($scope.keyboard.meta);
$scope.calcKbHeight();
};
$scope.validateMeta = function(prop) {

View file

@ -7,9 +7,9 @@
"style": "background-image: url('/bg/wood/Red_Mahogany_Wood.jpg');"
},
"radii": "30px 30px 50% 50%",
"defaultkeyswitchstyle": "CherryMX",
"defaultkeyswitchbrand": "Cherry",
"defaultkeyswitchtype": "MX Brown"
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx"
},
[
{

View file

@ -109,7 +109,7 @@ var $serial = (typeof(exports) !== 'undefined') ? exports : {};
ghost: false, stepped: false, decal: false
};
var _defaultMetaData = { backcolor: '#eeeeee', name: '', author: '', notes: '', background: undefined, radii: '' };
var _defaultMetaData = { backcolor: '#eeeeee', name: '', author: '', notes: '', background: undefined, radii: '', switchMount: '', switchBrand: '', switchType: '' };
$serial.defaultKeyProps = function() { return copy(_defaultKeyProps); };
$serial.defaultMetaData = function() { return copy(_defaultMetaData); };

View file

@ -1,79 +1,61 @@
{"switches" :
{
"Cherry MX style":
{
"Cherry":
{
"MX Blue": "MX Blue, MX1A-E1xx, Normal, Tactile Clicky, 50 cN",
"MX Black": "MX Black, MX1A-11xx, Normal, Linear, 60 cN",
"MX Brown": "MX Brown, MX1A-G1xx, Normal, Tactile Soft, 45 cN",
"MX Clear": "MX Clear, MX1A-C1xx, Normal, Tactile Soft, 65 cN",
"MX Green": "MX Green, MX1A-F1xx, Space bar, Tactile Clicky, 80 cN",
"MX Linear Grey": "MX Linear Grey, MX1A-21xx, Space bar, Linear, 80 cN",
"MX Lock": "MX Lock, MX1A-31xx, Alternate action, Linear, 60 cN ",
"MX Red": "MX Red, MX1A-L1xx, Normal, Linear, 45 cN",
"MX RGB Black": "MX RGB Black, MX1A-11xx, Normal, Linear, 60 cN",
"MX RGB Blue": "MX RGB Blue, MX1A-E1xx, Normal, Tactile Clicky, 50 cN",
"MX RGB Brown": "MX RGB Brown, MX1A-G1xx, Normal, Tactile Soft, 45 cN",
"MX RGB Red": "MX RGB Red, MX1A-L1xx, Normal, Linear, 45 cN",
"MX Tactile Grey": "MX Tactile Grey, MX1A-D1xx, Space bar, Tactile, 80 cN",
"MX White": "MX White, MX1A-A1xx, Normal, Tactile Clicky, 50 cN/80 cN"
},
"Gaote_Outemu":
{
"Clear, Black Shaft": "Clear, Black Shaft, PG150B01-1, 65 cN",
"Clear, Red Shaft": "Clear, Red Shaft, PG150R01-1, 50 cN",
"Clear, Blue Shaft": "Clear, Blue Shaft, PG150Q01-1, 55 cN",
"Clear, Brown Shaft": "Clear, Brown Shaft, PG150T01-1, 50 cN",
"Black, Black Shaft": "Black, Black Shaft, PG150B01, 65 cN",
"Black, Red Shaft": "Black, Red Shaft, PG150R01, 50 cN",
"Black, Blue Shaft": "Black, Blue Shaft, PG150Q01, 60 cN",
"Black, Brown Shaft": "Black, Brown Shaft, PG150T01, 55 cN"
},
"Gateron":
{
"KS-3 Black Shaft (black)": "KS-3 Black Shaft (black), Linear, 50 cN",
"KS-3 Green Axis (blue)": "KS-3 Green Axis (blue), Tactile Clicky, 55 cN",
"KS-3 Red Axis (red)": "KS-3 Red Axis (red), Linear, 45 cN",
"KS-3 Tea Axis (brown)": "KS-3 Tea Axis (brown), Tactile Soft, 450 cN",
"KS-3 Yellow (yellow)": "KS-3 Yellow (yellow), Linear, 50 cN",
"KS-3 White Shaft (translucent white)": "KS-3 White Shaft (translucent white), Linear, 35 cN"
},
"Greetech":
{
"GT02 Red stem": "Red stem, GT02A1Exx, Linear, 45 cN",
"GT02 Blue stem": "Blue stem, GT02A1Dxx, Tactile Clicky, 55 cN",
"GTO2 Brown stem": "Brown stem, GT02A1Bxx, Tactile Soft, 50 cN",
"GTO2 Black stem": "Black stem, GT02A2Axx, Linear, 65 cN"
},
"Kailh":
{
"PG1511 Black": "PG1511 Black, Linear, 60 cN",
"PG1511 Blue": "PG1511 Blue, Tactile Click, 60 cN",
"PG1511 Brown": "PG1511 Brown, Tactile Soft, 55 cN",
"PG1511 Red": "PG1511 Red, Linear, 50 cN"
}
},
"Alps style":
{
"Alps" :
{
"SKCL/SKCM": "SKCL/SKCM",
"SKBL/SKBM": "SKBL/SKBM"
},
"Matias" :
{
"Click": "Click, Tactile Clicky, 60 cN",
"Quiet Linear": "Quiet Linear, Linear, 35 cN",
"Quiet Click": "Quiet Click, Tactile Soft, 60 cN"
}
}
}
}
{
"cherry": { "mount": "cherry", "name": "Cherry MX Mount", "brands": {
"cherry": { "brand": "cherry", "name": "Cherry Electrical Products", "switches": [
{ "part": "MX1A-E1xx", "name": "MX Blue", "feel": "clicky", "weight": 50 },
{ "part": "MX1A-11xx", "name": "MX Black", "feel": "linear", "weight": 60 },
{ "part": "MX1A-G1xx", "name": "MX Brown", "feel": "tactile", "weight": 45 },
{ "part": "MX1A-C1xx", "name": "MX Clear", "feel": "tactile", "weight": 65 },
{ "part": "MX1A-F1xx", "name": "MX Green", "feel": "clicky", "weight": 80 },
{ "part": "MX1A-21xx", "name": "MX Linear Grey", "feel": "linear", "weight": 80 },
{ "part": "MX1A-31xx", "name": "MX Lock", "feel": "linear", "weight": 60, "lock": true },
{ "part": "MX1A-L1xx", "name": "MX Red", "feel": "linear", "weight": 45 },
{ "part": "MX1A-11xx", "name": "MX RGB Black", "feel": "linear", "weight": 60 },
{ "part": "MX1A-E1xx", "name": "MX RGB Blue", "feel": "clicky", "weight": 50 },
{ "part": "MX1A-G1xx", "name": "MX RGB Brown", "feel": "tactile", "weight": 45 },
{ "part": "MX1A-L1xx", "name": "MX RGB Red", "feel": "linear", "weight": 45 },
{ "part": "MX1A-D1xx", "name": "MX Tactile Grey", "feel": "tactile", "weight": 80 },
{ "part": "MX1A-A1xx", "name": "MX White", "feel": "clicky", "weight": 80 }
]},
"gaote": { "brand": "gaote", "name": "Outemu / Gaote Electronics", "switches": [
{ "part": "PG150B01-1", "name": "Clear, Black Shaft", "weight": 65 },
{ "part": "PG150R01-1", "name": "Clear, Red Shaft", "weight": 50 },
{ "part": "PG150Q01-1", "name": "Clear, Blue Shaft", "weight": 55 },
{ "part": "PG150T01-1", "name": "Clear, Brown Shaft", "weight": 50 },
{ "part": "PG150B01", "name": "Black, Black Shaft", "weight": 65 },
{ "part": "PG150R01", "name": "Black, Red Shaft", "weight": 50 },
{ "part": "PG150Q01", "name": "Black, Blue Shaft", "weight": 60 },
{ "part": "PG150T01", "name": "Black, Brown Shaft", "weight": 55 }
]},
"gateron": { "brand": "gateron", "name": "Gateron", "switches": [
{ "part": "KS-3-Black", "name": "KS-3 Black Shaft (black)", "feel": "linear", "weight": 50 },
{ "part": "KS-3-Green", "name": "KS-3 Green Axis (blue)", "feel": "clicky", "weight": 55 },
{ "part": "KS-3-Red", "name": "KS-3 Red Axis (red)", "feel": "linear", "weight": 45 },
{ "part": "KS-3-Tea", "name": "KS-3 Tea Axis (brown)", "feel": "tactile", "weight": 45 },
{ "part": "KS-3-Yellow", "name": "KS-3 Yellow (yellow)", "feel": "linear", "weight": 50 },
{ "part": "KS-3-White", "name": "KS-3 White Shaft (translucent white)", "feel": "linear", "weight": 35 }
]},
"greetech": { "brand": "greetech", "name": "Greetech (Huizhou Greetech Electronics Co.)", "switches": [
{ "part": "GT02A1Exx", "name": "GT02 Red stem", "feel": "linear", "weight": 45 },
{ "part": "GT02A1Dxx", "name": "GT02 Blue stem", "feel": "clicky", "weight": 55 },
{ "part": "GT02A1Bxx", "name": "GTO2 Brown stem", "feel": "tactile", "weight": 50 },
{ "part": "GT02A2Axx", "name": "GTO2 Black stem", "feel": "linear", "weight": 65 }
]},
"kailh": { "brand": "kailh", "name": "Kailh (Kaihua Electronics Co.)", "switches": [
{ "part": "PG151101D01/D15", "name": "Kailh Black", "feel": "linear", "weight": 60 },
{ "part": "PG151101D64/D10", "name": "Kailh Blue", "feel": "clicky", "weight": 60 },
{ "part": "PG151101D49/D09", "name": "Kailh Brown", "feel": "tactile", "weight": 55 },
{ "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": [
{ "part": "SKCL/SKCM", "name": "SKCL/SKCM (Complicated Alps)" },
{ "part": "SKBL/SKBM", "name": "SKBL/SKBM (Simplified Alps)" }
]},
"matias": { "brand": "matias", "name": "Matias Corporation", "switches": [
{ "part": "PG155B02", "name": "Click", "feel": "clicky", "weight": 60 },
{ "part": "KS102Q", "name": "Quiet Linear", "feel": "linear", "weight": 35 },
{ "part": "PG155B01", "name": "Quiet Click", "feel": "tactile", "weight": 60 }
]}
}}
}