|
6 | 6 | <title>DragonRuby Game Toolkit Tutorial</title> |
7 | 7 | <script> |
8 | 8 | function tutorialUrl() { |
| 9 | + // is there a querystring parameter |
| 10 | + // url looks like http://dragonruby.org/?tutorial=TUTORIAL_URL |
9 | 11 | var tutorialUrlMatches = window.location.href.match(/tutorial=(.*)/) || [""]; |
10 | 12 | var result = (tutorialUrlMatches[0] || "").replace("tutorial=", "").trim(); |
| 13 | + |
| 14 | + // nothing found? how about: |
| 15 | + // url looks like http://dragonruby.org/index.html#TUTORIAL_URL |
| 16 | + if (result.length == 0) { |
| 17 | + tutorialUrlMatches = window.location.href.match(/index\.html#(.*)/) || [""]; |
| 18 | + result = (tutorialUrlMatches[0] || "").replace("index.html#", "").trim(); |
| 19 | + } |
| 20 | + |
| 21 | + // nothing found? how about: |
| 22 | + // url looks like http://dragonruby.org#TUTORIAL_URL |
| 23 | + if (result.length == 0) { |
| 24 | + tutorialUrlMatches = window.location.href.match(/\.org#(.*)/) || [""]; |
| 25 | + result = (tutorialUrlMatches[0] || "").replace(".org#", "").trim(); |
| 26 | + } |
| 27 | + |
| 28 | + // nothing found? how about: |
| 29 | + // url looks like http://dragonruby.org/#TUTORIAL_URL |
| 30 | + if (result.length == 0) { |
| 31 | + tutorialUrlMatches = window.location.href.match(/\/#(.*)/) || [""]; |
| 32 | + result = (tutorialUrlMatches[0] || "").replace("/#", "").trim(); |
| 33 | + } |
| 34 | + |
11 | 35 | if (result.match(/gist\.github\.com/) && !result.match(/raw/)) { |
12 | 36 | result = result + "/raw"; |
13 | 37 | result = result.replace("gist.github.com", "gist.githubusercontent.com"); |
14 | 38 | } |
| 39 | + |
15 | 40 | return result; |
16 | 41 | } |
17 | 42 |
|
|
0 commit comments