Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 1 | %= javascript begin |
| 2 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame^] | 3 | // Create new hint |
| 4 | var hint = Object.create(Hint).init(); |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 5 | |
| 6 | function openTutorial (o) { |
| 7 | var tut = $("#tutorial"); |
| 8 | tut.addClass("active"); |
| 9 | var iframe = tut.children("iframe"); |
Nils Diewald | 4e9fbcb | 2014-07-15 11:45:09 +0000 | [diff] [blame] | 10 | iframe.attr("src", getTutorialPage()); |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 11 | }; |
| 12 | |
| 13 | function closeTutorial (o) { |
| 14 | $("#tutorial").removeClass("active"); |
| 15 | }; |
| 16 | |
| 17 | function useQuery (o) { |
| 18 | var q = o.getAttribute("data-query"); |
| 19 | var ql = o.getAttribute("data-query-language"); |
Nils Diewald | f49633a | 2014-11-08 22:33:25 +0000 | [diff] [blame] | 20 | var qc = o.getAttribute("data-query-cutoff"); |
Nils Diewald | e8e8805 | 2014-11-10 16:32:02 +0000 | [diff] [blame] | 21 | if (qc !== 0 && qc !== "0" && qc !== "off" && qc !== null) |
| 22 | $("#q-cutoff-field").prop('checked', true); |
| 23 | |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 24 | $("#ql-field").val(ql); |
| 25 | $("#q-field").val(q); |
Nils Diewald | e8e8805 | 2014-11-10 16:32:02 +0000 | [diff] [blame] | 26 | |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 27 | closeTutorial(); |
| 28 | }; |
| 29 | |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 30 | $("#sidebar").on("click", function () { |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 31 | $(this).toggleClass('active'); |
| 32 | }); |
| 33 | |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 34 | $("span.location").on("click", function () { |
| 35 | $("#sidebar").toggleClass('active'); |
| 36 | }); |
| 37 | |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 38 | % end |