Home | History | Annotate | Download | only in views
      1 <html>
      2   <head>
      3     <title>Debug {{ expectation }}</title>
      4     <script language="javascript">
      5     var current = 0;
      6     var toggle_interval = null;
      7 
      8     var toggle = function() {
      9       current = (current + 1) % 2;
     10       var image = document.getElementById("screenshot");
     11       image.src = (current ? "{{ actual }}" : "{{ expected }}");
     12       var title = document.getElementById("text");
     13       title.textContent = (current ? "Actual" : "Expected");
     14     }
     15 
     16     var setup = function() {
     17       toggle();
     18       toggle_interval = window.setInterval(toggle, 1000);
     19     }
     20 
     21     var manualToggle = function() {
     22       if (toggle_interval != null)
     23         window.clearInterval(toggle_interval);
     24       toggle();
     25     }
     26 
     27     var confirmSubmit = function() {
     28       return confirm("The area in this diff will be ignored in all future comparisions. Are you sure?");
     29     }
     30     </script>
     31   </head>
     32   <body onload="setup();">
     33     <div>
     34       <a href="javascript:void(0)" onclick="manualToggle();">Toggle</a>
     35       &nbsp;&#8594;&nbsp;
     36       <span id="text"></span>
     37     </div>
     38     <br>
     39     <form action="/update_mask" method="post" onsubmit="return confirmSubmit();">
     40       <input type="hidden" name="test_run" value="{{ test_run }}"/>
     41       <input type="hidden" name="expectation" value="{{ expectation }}"/>
     42       <input type="submit" value="Ignore similar diffs in the future"/>
     43     </form>
     44     <br>
     45     <img id="screenshot" src=""/>
     46   </body>
     47 </html>
     48