|
|
@@ -0,0 +1,267 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
+<head>
|
|
|
+ <title></title>
|
|
|
+ <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
|
|
|
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
|
|
+ <script src="/Scripts/jquery-fontspy.js"></script>
|
|
|
+<!-- <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />-->
|
|
|
+ <link href="/css/fonts.css" rel="stylesheet" />
|
|
|
+ <style>
|
|
|
+ table {
|
|
|
+ width: 100%;
|
|
|
+ border-collapse: collapse;
|
|
|
+ }
|
|
|
+ h1 {
|
|
|
+ font-family: veneer;
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: normal;
|
|
|
+ background-color: rgb(235,37,42);
|
|
|
+ color: white;
|
|
|
+ margin: 0 0 0 0;
|
|
|
+ padding: 5px 5px 5px 5px;
|
|
|
+ }
|
|
|
+ footer {
|
|
|
+ margin-top: 30px;
|
|
|
+ background-color: black;
|
|
|
+ color: white;
|
|
|
+ padding: 5px 5px 5px 5px;
|
|
|
+ }
|
|
|
+ footer a {
|
|
|
+ color: rgb(70, 181, 255);
|
|
|
+ }
|
|
|
+ th {
|
|
|
+ text-align: left;
|
|
|
+ font-family: function-pro-demi;
|
|
|
+ font-weight: normal;
|
|
|
+ }
|
|
|
+ .table-striped > tbody > tr:nth-child(even) > td {
|
|
|
+ background-color: rgb(227, 227, 227);
|
|
|
+ }
|
|
|
+ .table-striped > tbody > tr:nth-child(odd) > td {
|
|
|
+ background-color: rgb(214, 214, 214);
|
|
|
+ }
|
|
|
+ .content {
|
|
|
+ overflow-y: auto;
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
+ header, footer{
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
+ body, select, option {
|
|
|
+ font-family: function-pro-book;
|
|
|
+ }
|
|
|
+ body {
|
|
|
+ overflow: hidden;
|
|
|
+ -webkit-font-smoothing: antialiased;
|
|
|
+ }
|
|
|
+ @media screen and (max-width: 300px) {
|
|
|
+ thead select {
|
|
|
+ max-width: 112px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @media (min-width: 301px) {
|
|
|
+ td:first-child, th:first-child {
|
|
|
+ padding: 0 0 0 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <script>
|
|
|
+ $(function () {
|
|
|
+ function onresize() {
|
|
|
+ var header = $("header");
|
|
|
+ var footer = $("footer");
|
|
|
+ var content = $(".content");
|
|
|
+ var w = $(window).width();
|
|
|
+ var h = $(window).height();
|
|
|
+ header.offset({ left: 0, top: 0 });
|
|
|
+ header.width(w);
|
|
|
+ footer.offset({ left: 0, top: h - footer.outerHeight() });
|
|
|
+ footer.width(w);
|
|
|
+ content.offset({ left: 0, top: header.outerHeight() });
|
|
|
+ content.width(w);
|
|
|
+ content.height(h - footer.outerHeight() - header.outerHeight());
|
|
|
+ };
|
|
|
+ $(window).resize(onresize);
|
|
|
+ fontSpy('veneer', { success: onresize });
|
|
|
+ fontSpy('function-pro-demi', { success: onresize });
|
|
|
+ fontSpy('function-pro-book', { success: onresize });
|
|
|
+ onresize();
|
|
|
+ });
|
|
|
+
|
|
|
+ </script>
|
|
|
+ <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
|
|
|
+ <script>
|
|
|
+ var serieses = [
|
|
|
+ { id: 1, name: "Formula Drift USA PRO" },
|
|
|
+ { id: 3, name: "Formula Drift USA PRO2" },
|
|
|
+ { id: 2, name: "Formula Drift Asia" }
|
|
|
+ ];
|
|
|
+
|
|
|
+ var statTypes = [
|
|
|
+ { procedure: "record_highesteventwinpercentage.wins" , name: "Event Win Count" },
|
|
|
+ { procedure: "record_highestpodiumcount.podiums" , name: "Podium Count" },
|
|
|
+ { procedure: "record_highestpodiumpercentage.percentage" , name: "Podium Percentage" },
|
|
|
+ { procedure: "record_highestresultaverage.averageresult" , name: "Result Average" },
|
|
|
+ { procedure: "record_highestmatchwincount.wins" , name: "Match Win Count" },
|
|
|
+ { procedure: "record_highestmatchwinpercentage.percentage" , name: "Match Win Percentage" },
|
|
|
+ { procedure: "record_highestqualifyingaverage.averagequalify" , name: "Qualifying Average" },
|
|
|
+ { procedure: "record_top4count.topcount" , name: "Top 4 Count" },
|
|
|
+ { procedure: "record_top8count.topcount" , name: "Top 8 Count" },
|
|
|
+ { procedure: "record_top16count.topcount" , name: "Top 16 Count" },
|
|
|
+ { procedure: "record_top32count.topcount" , name: "Top 32 Count" }
|
|
|
+ ];
|
|
|
+
|
|
|
+ function queryObj() {
|
|
|
+ var result = {}, queryString = location.search.slice(1),
|
|
|
+ re = /([^&=]+)=([^&]*)/g, m;
|
|
|
+
|
|
|
+ while (m = re.exec(queryString)) {
|
|
|
+ result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ function driverStatsFrame($scope, $http) {
|
|
|
+ $scope.statType = statTypes[0].procedure;
|
|
|
+ var query = queryObj();
|
|
|
+ var mySeries = serieses.slice(0);
|
|
|
+ var qs = [];
|
|
|
+ if (query.seriesid) {
|
|
|
+ qs = query.seriesid.split(',').map(function(s){ return +s; });
|
|
|
+ var newSeries = [];
|
|
|
+ for (var i = 0; i < mySeries.length; i++) {
|
|
|
+ if (qs.indexOf(mySeries[i].id) != -1) {
|
|
|
+ newSeries.push(mySeries[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mySeries = newSeries;
|
|
|
+ }
|
|
|
+ if (query.seriesid) $scope.seriesid = qs[0];
|
|
|
+ if (query.stattypeid) $scope.statType = statTypes[+query.stattypeid - 1].procedure;
|
|
|
+ $scope.serieses = mySeries;
|
|
|
+ $scope.statTypes = statTypes;
|
|
|
+ window.$scope = $scope;
|
|
|
+ $scope.year = null;
|
|
|
+ $scope.hash = function () {
|
|
|
+ return [$scope.seriesid, $scope.statType, $scope.year].join(".");
|
|
|
+ };
|
|
|
+ $scope.$watch("seriesid", function () {
|
|
|
+ if ($scope.seriesid) {
|
|
|
+ $http.post("/Service.asmx/GetSeries", {
|
|
|
+ series: +$scope.seriesid
|
|
|
+ }).success(function (res) {
|
|
|
+ $scope.championshipData = res.d;
|
|
|
+ $scope.championshipData.Seasons.forEach(function (season) {
|
|
|
+ season.Label = season.Year.toString();
|
|
|
+ });
|
|
|
+ $scope.championshipData.Seasons.unshift({
|
|
|
+ Label: "Lifetime",
|
|
|
+ Year: null
|
|
|
+ });
|
|
|
+ var validYears = $scope.championshipData.Seasons.map(function (season) {
|
|
|
+ return season.Year;
|
|
|
+ });
|
|
|
+ if ($scope.year && validYears.indexOf($scope.year) == -1) {
|
|
|
+ $scope.year = null;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.$watch("hash()", function () {
|
|
|
+ if ($scope.seriesid && $scope.statType) {
|
|
|
+ var words = $scope.statType.split("."),
|
|
|
+ procedure = words[0],
|
|
|
+ column = $scope.column = words[1];
|
|
|
+ $scope.data = null;
|
|
|
+ $http.post("/Service.asmx/QueryRecords", {
|
|
|
+ procedure: procedure,
|
|
|
+ arguments: [+$scope.seriesid, $scope.year]
|
|
|
+ })
|
|
|
+ .success(function (dataset) {
|
|
|
+ $scope.dataset = dataset;
|
|
|
+ window.dataset = dataset;
|
|
|
+ $scope.data = window.data = dataset.d.Tables[0].Data.map(function(row) {
|
|
|
+ return row.reduce(function (pv, cv, i, a) {
|
|
|
+ var column = dataset.d.Tables[0].Columns[i];
|
|
|
+ pv[column] = column == "percentage" ?
|
|
|
+ (Math.floor(cv * 10000) / 100) + "%"
|
|
|
+ : isFinite(cv) ? (Math.floor(cv * 100) / 100) :
|
|
|
+ cv
|
|
|
+ return pv;
|
|
|
+ }, {});
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+
|
|
|
+</head>
|
|
|
+<body ng-app ng-controller="driverStatsFrame">
|
|
|
+ <header>
|
|
|
+ <h1>Driver Stats</h1>
|
|
|
+ <table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>Championship</th>
|
|
|
+ <th>Year</th>
|
|
|
+ <th>Stat Type</th>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>
|
|
|
+ <select ng-model="seriesid" ng-options="series.id as series.name for series in serieses"></select>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <select ng-model="year" ng-options="season.Year as season.Label for season in championshipData.Seasons">
|
|
|
+
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <select ng-model="statType" ng-options="st.procedure as st.name for st in statTypes"></select>
|
|
|
+ <!-- <select ng-model="statType">
|
|
|
+ <option value="record_highesteventwinpercentage.wins" >Event Win Count</option>
|
|
|
+ <option value="record_highestpodiumcount.podiums" >Podium Count</option>
|
|
|
+ <option value="record_highestpodiumpercentage.percentage" >Podium Percentage</option>
|
|
|
+ <option value="record_highestresultaverage.averageresult" >Result Average</option>
|
|
|
+ <option value="record_highestmatchwincount.wins" >Match Win Count</option>
|
|
|
+ <option value="record_highestmatchwinpercentage.percentage" >Match Win Percentage</option>
|
|
|
+ <option value="record_highestqualifyingaverage.averagequalify" >Qualifying Average</option>
|
|
|
+ <option value="record_top4count.topcount" >Top 4 Count</option>
|
|
|
+ <option value="record_top8count.topcount" >Top 8 Count</option>
|
|
|
+ <option value="record_top16count.topcount" >Top 16 Count</option>
|
|
|
+ <option value="record_top32count.topcount" >Top 32 Count</option>
|
|
|
+ </select>-->
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ </table>
|
|
|
+ </header>
|
|
|
+ <div class="content">
|
|
|
+ <table>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td colspan="3">
|
|
|
+ <table class="table-striped">
|
|
|
+ <tbody>
|
|
|
+ <tr ng-repeat="row in data">
|
|
|
+ <td width="66%">{{row.drivername}}</td>
|
|
|
+ <td width="34%">{{row[column]}}</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <footer>
|
|
|
+ Powered by <a target="_blank" href="http://www.driftstats.com">DriftStats.com</a>
|
|
|
+ </footer>
|
|
|
+</body>
|
|
|
+</html>
|
|
|
+
|