Added initial Summary as first step to address #88

This commit is contained in:
iandoug 2015-08-12 21:57:30 +02:00
parent fed6a86732
commit 3efd78bfa0
3 changed files with 40 additions and 2 deletions

3
kb.css
View file

@ -191,10 +191,11 @@ for i in (1..9) {
text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
}
#rawdata, #rawdata-error, #customstyles, #customstyles-error, #noteseditor, #picker-html { font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; line-height: 1.42857143 !important; border: solid 1px #ccc; }
#rawdata, #rawdata-error, #customstyles, #customstyles-error, #noteseditor, #picker-html, #summary { font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; line-height: 1.42857143 !important; border: solid 1px #ccc; }
#rawdata, #customstyles { width: 100%; height: 400px; }
#noteseditor { height: 275px; }
#rawdata-error, #customstyles-error { white-space: pre; }
#summary { width: 100%; height: 400px; padding-left: 20px;}
#tab-content {
border-left: 1px solid #ddd;

12
kb.html
View file

@ -259,6 +259,7 @@ Nav Bar / Header
<li ng-class="{active:selTab==1}"><a ng-click="selTab=1" data-toggle="tab"><i class="fa fa-keyboard-o"></i> Keyboard Properties</a></li>
<li ng-class="{active:selTab==3}"><a ng-click="selTab=3" data-toggle="tab"><i class="fa fa-file-text-o"></i> Custom Styles</a></li>
<li ng-class="{active:selTab==2}"><a ng-click="selTab=2" data-toggle="tab"><i class="fa fa-code"></i> Raw data</a></li>
<li ng-class="{active:selTab==4}"><a ng-click="selTab=4" data-toggle="tab"><i class="fa fa-file-text-o"></i> Summary</a></li>
</ul>
<div id="tab-content" class='col-md-12 col-lg-12 row' ui-keydown="{esc:'focusKb()'}" ng-cloak>
@ -820,6 +821,17 @@ Nav Bar / Header
</alert>
</div>
<!-- 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>
Key sizes summary:<br>
<ul>
<div ng-repeat="(k,v) in keyCount()"><li>{{k}} : {{v}}</li></div>
</ul>
</div>
</div>
</div>
</div>

27
kb.js
View file

@ -271,8 +271,33 @@
reader.readAsText(file[0]);
}
};
// count the keys
$scope.keyCount = function() {
var counts = new Object();
counts["Total"] = 0;
counts["Decals"] = 0;
// Helper function to select a single key
angular.forEach($scope.keys(), function(key){
counts["Total"]++;
if (key.decal)
{
counts["Decals"]++;
var thisk = "Decal ";
}
else
{var thisk = "";};
thisk += key.width + " x " + key.height;
if (counts[thisk])
{counts[thisk]++;}
else
{counts[thisk] = 1;}
});
counts["Total less decals"] = counts["Total"] - counts["Decals"];
return counts;
};
// Helper function to select a single key
function selectKey(key,event) {
if(key) {
// If SHIFT is held down, we want to *extend* the selection from the last