aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/skpdiff/viewer.html
blob: 0949dab5655ee9a8b7781400ad9bd0ef7999bd9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!doctype html>
<!-- This whole page uses the module -->
<html ng-app="diff_viewer">
  <head>
    <script type="text/javascript"
            src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
    <script type="text/javascript" src="skpdiff_output.json"></script>
    <script type="text/javascript" src="diff_viewer.js"></script>
    <link rel="stylesheet" type="text/css" href="viewer_style.css">
    <title>SkPDiff</title>
  </head>
  <body>
    <!--
      All templates are being included with the main page to avoid using AJAX, which would force
      us to use a webserver.
    -->
    <script type="text/ng-template" id="/diff_list.html">
      <!-- Give a choice of how to order the differs -->
      <div style="margin:8px">
        Show me the worst by metric:
        <button ng-repeat="differ in differs" ng-click="setSortIndex($index)">
          <span class="result-{{ $index }}" style="padding-left:12px;">&nbsp;</span>
          {{ differ.title }}
        </button>
      </div>
      <!-- Begin list of differences -->
      <table>
        <thead>
          <tr>
            <td>Baseline Image</td>
            <td>Actual Image</td>
            <td>Results</td>
          </tr>
        </thead>
        <tbody>
          <!--
            Loops through every record and crates a row for it. This sorts based on the whichever
            metric the user chose, and places a limit on the max number of records to show.
          -->
          <tr ng-repeat="record in records | orderBy:sortingDiffer | limitTo:500">
            <td><swap-img left-src="{{ record.baselinePath }}"
                         right-src="{{ record.testPath }}"
                         side="left"
                         class="gm-image left-image" /></td>
            <td><swap-img left-src="{{ record.baselinePath }}"
                         right-src="{{ record.testPath }}"
                         side="right"
                         class="gm-image right-image" /></td>
            <td>
              <div ng-repeat="diff in record.diffs"
                   ng-mouseover="highlight(diff.differName)"
                   class="result result-{{$index}}">
                <span class="result-button">{{ diff.result }}</span>
              </div>
            </td>
          </tr>
        </tbody>
      </table>
    </script>
    <!-- Whatever template is used is rendered in the following div -->
    <div ng-view></div>
  </body>
</html>