diff --git a/website/auth.php b/website/auth.php index e34b1e7..5a2aca0 100644 --- a/website/auth.php +++ b/website/auth.php @@ -8,10 +8,7 @@ if(isset($_GET['persona'])) { // Login if(isset($_GET['assertion'])) { - if ($_SERVER['HTTP_HOST'] == "www.arewefastyet.com") - $verifier = new Auth_BrowserID('http://www.arewefastyet.com'); - else - $verifier = new Auth_BrowserID('http://arewefastyet.com'); + $verifier = new Auth_BrowserID("http://".$_SERVER['HTTP_HOST']); $result = $verifier->verifyAssertion($_GET['assertion']); if ($result->status === 'okay') { diff --git a/website/overview/css/main.css b/website/overview/css/main.css index c1af4e9..bb26558 100644 --- a/website/overview/css/main.css +++ b/website/overview/css/main.css @@ -58,7 +58,15 @@ padding: 12px; color: #42637b; } -@media -sass-debug-info{filename{font-family:file\:\/\/\/vagrant\/public\/arewefastyet\.firefox\.local\/arewefastyet\/website\/overview\/sass\/utility\/abstractions\/_box\.scss}line{font-family:\0000339}} +@media -sass-debug-info{filename{font-family:file\:\/\/\/vagrant\/public\/arewefastyet\.firefox\.local\/arewefastyet\/website\/overview\/sass\/utility\/abstractions\/_box\.scss}line{font-family:\0000345}} +.box .legend { + text-align: right; + font-size: 9px; + text-transform: uppercase; + margin-top: 18px; + color: #AAAAAA; +} +@media -sass-debug-info{filename{font-family:file\:\/\/\/vagrant\/public\/arewefastyet\.firefox\.local\/arewefastyet\/website\/overview\/sass\/utility\/abstractions\/_box\.scss}line{font-family:\0000353}} .box .score { float: right; font-size: 1.4em; diff --git a/website/overview/index.html b/website/overview/index.html index 82c926d..7e20a2b 100644 --- a/website/overview/index.html +++ b/website/overview/index.html @@ -13,6 +13,8 @@ + + @@ -32,8 +34,8 @@
diff --git a/website/overview/js/app.js b/website/overview/js/app.js index 440018d..0481c0b 100644 --- a/website/overview/js/app.js +++ b/website/overview/js/app.js @@ -40,20 +40,12 @@ awfyApp.controller('pageCtrl', ['$scope', '$http', '$q', '$location', } } - // Put select in proper format - var path = $location.path().split("/"); - if(path[2].indexOf(",") == -1) { - $scope.selectedMachine = master["machines"][path[2]]; - } else { - $scope.machines.push({ - id: path[2], - description: "Multipe machines", - }); - $scope.selectedMachine = $scope.machines[$scope.machines.length-1]; - } - // Watch for changes of selection - $scope.$watch('selectedMachine', function (machine) { + $scope.$watch('selectedMachine', function (machine) { + if(!machine) { + return; + } + var path = $location.path().split("/"); path[2] = machine.id; diff --git a/website/overview/js/controllers.js b/website/overview/js/controllers.js index 2b345fb..073ffb3 100644 --- a/website/overview/js/controllers.js +++ b/website/overview/js/controllers.js @@ -49,6 +49,17 @@ awfyCtrl.controller('overviewCtrl', ['$scope', '$http', '$routeParams', '$q', machines.push(machine); } + // Update selection + if($routeParams.machine.indexOf(",") == -1) { + $scope.$parent.selectedMachine = master["machines"][$routeParams.machine]; + } else { + $scope.$parent.machines.push({ + id: $routeParams.machine, + description: "Multipe machines", + }); + $scope.$parent.selectedMachine = $scope.$parent.machines[$scope.$parent.machines.length-1]; + } + // Show date $scope.$parent.date = machines[0].stamp*1000; @@ -101,16 +112,20 @@ awfyCtrl.controller('overviewCtrl', ['$scope', '$http', '$routeParams', '$q', // Create for(i in testsuites) { - var name; + var name, suite; if(!$routeParams.suite) { name = master["suiteversions"][i]["name"]; + suite = master["suiteversions"][i]["suite"]; } else { name = i; + suite = master["suiteversions"][$routeParams.suite]["suite"]; } var testsuite = { id: i, name: name, + suite: suite, + order: master["suites"][suite]["direction"], machines: [], maxScore: 0, }; @@ -140,10 +155,15 @@ awfyCtrl.controller('overviewCtrl', ['$scope', '$http', '$routeParams', '$q', for(var k in machines[j]["data"][key]["scores"]) { var test = machines[j]["data"][key]["scores"][k]; + var score = Math.round(test["score"]*100)/100; + + if(testsuite.order == -1) { + score += "ms"; + } machine.tests.push({ name: master["modes"][test["modeid"]]["name"], - score: Math.round(test["score"], 2), + score: score, ff: isFF(master["modes"][test["modeid"]]["name"]) ? "ff" : "", }); diff --git a/website/overview/js/persona.js b/website/overview/js/persona.js new file mode 100644 index 0000000..9fbb7ef --- /dev/null +++ b/website/overview/js/persona.js @@ -0,0 +1,38 @@ + + // Listen on Persona events +var request = false; +var currentUser = decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent("persona").replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; +var url = window.location.href.replace(window.location.hash, "") + "../auth.php"; +navigator.id.watch({ + loggedInUser: currentUser == "" ? null : currentUser, + onlogin: function (assertion) { + if(request) { + window.location = url + "?persona=1&assertion=" + assertion; + } + }, + onlogout: function () { + if(request) { + window.location = url + "?persona=1&logout=1"; + } + } +}); + +// Set default login +if(currentUser) { + $(function() { + document.getElementById("personaLogout").style.display = "block"; + document.getElementById("personaLogin").style.display = "none"; + }); +} + +// Do login in +var doPersonaLogin = function() { + request = true; + navigator.id.request(); +} + +// Do login out +var doPersonaLogout = function() { + request = true; + navigator.id.logout(); +} \ No newline at end of file diff --git a/website/overview/partials/overview.html b/website/overview/partials/overview.html index e1fe6a6..d5aa0f8 100644 --- a/website/overview/partials/overview.html +++ b/website/overview/partials/overview.html @@ -43,13 +43,15 @@ +