avm99963 | 027b5b0 | 2018-12-28 02:31:46 +0100 | [diff] [blame] | 1 | // *********** HERE STARTS just-do-it.js *************
|
Javier López-Contreras | 052503f | 2018-12-26 12:34:42 +0100 | [diff] [blame] | 2 |
|
| 3 | var seq = [38, 38, 40, 40, 37, 39, 37, 39, 65, 66, 13];
|
| 4 | var cur = 0;
|
| 5 |
|
| 6 | function justdoit() {
|
| 7 | s.graph.nodes().forEach(function(n) {
|
| 8 | switch(n.color) {
|
| 9 | case "#d61c08":
|
| 10 | n.color = "#0159aa";
|
| 11 | break;
|
| 12 |
|
| 13 | case "#0159aa":
|
| 14 | n.color = "#0ca80a";
|
| 15 | break;
|
| 16 |
|
| 17 | case "#0ca80a":
|
| 18 | n.color = "#d61c08";
|
| 19 | break;
|
| 20 | }
|
| 21 | });
|
| 22 |
|
| 23 | s.refresh();
|
| 24 | setTimeout(justdoit, 333);
|
| 25 | }
|
| 26 |
|
| 27 |
|
avm99963 | 027b5b0 | 2018-12-28 02:31:46 +0100 | [diff] [blame] | 28 | function initJustDoIt() {
|
Andreu Huguet | 65622cc | 2018-12-28 13:41:17 +0100 | [diff] [blame] | 29 | document.addEventListener("keydown", function(event) {
|
Javier López-Contreras | 052503f | 2018-12-26 12:34:42 +0100 | [diff] [blame] | 30 | if (event.key == "f" && event.target.getAttribute("id") != "search-input") altSearchBar();
|
| 31 | if (event.which == seq[cur]) {
|
| 32 | if (cur < seq.length) {
|
| 33 | ++cur;
|
| 34 | if (cur == seq.length) {
|
| 35 | justdoit();
|
| 36 | }
|
| 37 | }
|
| 38 | } else cur = 0;
|
| 39 | });
|
| 40 | }
|