]> git.sesse.net Git - remoteglot/blobdiff - www/js/remoteglot.js
Allow navigating by clicking the sparkline.
[remoteglot] / www / js / remoteglot.js
index 35683608f55fb33aac14a0e5d7b5fd16f39497c6..836b4ba5529c407b1875e69865860b3c4df14991 100644 (file)
@@ -1317,6 +1317,13 @@ var update_sparkline = function(data) {
                                        return format_tooltip(data, fields[0].offset + first_move_num - 1);
                                }
                        });
                                        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("");
                }
                } else {
                        $("#scorespark").text("");
                }