initial commit
Some checks failed
CI Pipeline / Build and Test (push) Has been cancelled
Build and Publish TechDocs / build-and-publish (push) Has been cancelled

Change-Id: Ia748646eaf5c18f44eb5b147ff577d0d5ee844e8
This commit is contained in:
Scaffolder
2026-03-23 17:40:04 +00:00
commit 3f7396407b
60 changed files with 4361 additions and 0 deletions

50
result/views/app.js Normal file
View File

@@ -0,0 +1,50 @@
var app = angular.module('catsvsdogs', []);
var socket = io.connect();
var bg1 = document.getElementById('background-stats-1');
var bg2 = document.getElementById('background-stats-2');
app.controller('statsCtrl', function($scope){
$scope.aPercent = 50;
$scope.bPercent = 50;
var updateScores = function(){
socket.on('scores', function (json) {
data = JSON.parse(json);
var a = parseInt(data.a || 0);
var b = parseInt(data.b || 0);
var percentages = getPercentages(a, b);
bg1.style.width = percentages.a + "%";
bg2.style.width = percentages.b + "%";
$scope.$apply(function () {
$scope.aPercent = percentages.a;
$scope.bPercent = percentages.b;
$scope.total = a + b;
});
});
};
var init = function(){
document.body.style.opacity=1;
updateScores();
};
socket.on('message',function(data){
init();
});
});
function getPercentages(a, b) {
var result = {};
if (a + b > 0) {
result.a = Math.round(a / (a + b) * 100);
result.b = 100 - result.a;
} else {
result.a = result.b = 50;
}
return result;
}