diff options
Diffstat (limited to 'scripts/onload')
-rw-r--r-- | scripts/onload/lesson.js | 17 | ||||
-rw-r--r-- | scripts/onload/list.js | 4 | ||||
-rw-r--r-- | scripts/onload/subject.js | 16 | ||||
-rw-r--r-- | scripts/onload/toc.js | 3 |
4 files changed, 40 insertions, 0 deletions
diff --git a/scripts/onload/lesson.js b/scripts/onload/lesson.js new file mode 100644 index 0000000..8e6d5e3 --- /dev/null +++ b/scripts/onload/lesson.js @@ -0,0 +1,17 @@ +// DEPENDENCIES +// * /scripts/lesson.js +// * /scripts/toc.js +window.onload = function() { + loadLesson(getUrlVars()['subject'], getUrlVars()['chapter'], getUrlVars()['id']); +} + +function getUrlVars() { + var vars = [], hash; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + for (var i = 0; i < hashes.length; i++) { + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + } + return vars; +} diff --git a/scripts/onload/list.js b/scripts/onload/list.js new file mode 100644 index 0000000..496c5dd --- /dev/null +++ b/scripts/onload/list.js @@ -0,0 +1,4 @@ +window.onload = function() { + toc(); + listSubjects(); +} diff --git a/scripts/onload/subject.js b/scripts/onload/subject.js new file mode 100644 index 0000000..a22e3e8 --- /dev/null +++ b/scripts/onload/subject.js @@ -0,0 +1,16 @@ +window.onload = function() { + toc(); + loadSubject(getUrlVars()['id']); +} + +function getUrlVars() { + var vars = [], hash; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + for (var i = 0; i < hashes.length; i++) { + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + } + return vars; +} + diff --git a/scripts/onload/toc.js b/scripts/onload/toc.js new file mode 100644 index 0000000..f1101fe --- /dev/null +++ b/scripts/onload/toc.js @@ -0,0 +1,3 @@ +window.onload = function() { + toc(); +} |