Allow navigating by clicking the sparkline.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 25 Nov 2016 21:07:46 +0000 (22:07 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 25 Nov 2016 21:07:46 +0000 (22:07 +0100)
Patch from Chris Carlmar.

www/index.html
www/js/remoteglot.js

index 94547e4..76718a5 100644 (file)
   &copy; 2007&ndash;2016 <a href="http://www.sesse.net/">Steinar H. Gunderson</a>.
   Chess analysis by <a href="http://stockfishchess.org/" id="engineid">Stockfish</a><span id="enginedetails"></span>.
   <span id="movesource"></span>
-  Hosting and additional analysis hardware by <a href="http://www.samfundet.no/">Studentersamfundet i Trondhjem</a>.
+  Hosting and additional analysis hardware by <a href="http://www.samfundet.no/">Studentersamfundet i Trondhjem</a>
+  and Berge Schwebs Bjørlo.
   JavaScript chessboard powered by <a href="http://chessboardjs.com/">chessboard.js</a>
   and <a href="https://github.com/jhlywa/chess.js">chess.js</a>.
   Ding sound by <a href="https://www.freesound.org/people/Aiwha/sounds/196106/">Aiwha</a> (CC-BY-3.0).
   <span id="lomonosov">7-man Lomonosov tablebase lookup by <a href="http://tb7.chessok.com/">ChessOK</a>.</span></p>
 
 <!-- For faster development -->
-<!--
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
 <script type="text/javascript" src="js/chessboard-0.3.0.min.js"></script>
 <script type="text/javascript" src="js/chess.min.js"></script>
 <script type="text/javascript" src="js/json_delta.js"></script>
 <script type="text/javascript" src="js/jquery.sparkline.js"></script>
 <script type="text/javascript" src="js/remoteglot.js"></script>
+<!--
 -->
 
 <!-- Minified version of the previous six, compiled together -->
-<script type="text/javascript" src="js/remoteglot.min.js"></script>
 <!--
+<script type="text/javascript" src="js/remoteglot.min.js"></script>
 -->
 </body>
 </html>
index 3568360..836b4ba 100644 (file)
@@ -1317,6 +1317,13 @@ var update_sparkline = function(data) {
                                        return format_tooltip(data, fields[0].offset + first_move_num - 1);
                                }
                        });
+                       $('#scorespark').bind('sparklineClick', function(event) {
+                               var sparkline = event.sparklines[0];
+                               var region = sparkline.getCurrentRegionFields();
+                               if (region[0].offset !== undefined) {
+                                       show_line(0, first_move_num + region[0].offset - 1);
+                               }
+                       });
                } else {
                        $("#scorespark").text("");
                }