From 3d0ccfba34d6371b41e877189b78599ae7b2f98a Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sat, 16 Mar 2024 17:48:01 +0700 Subject: new branch! decided to revive this old project. lessons now support markdown, rebrand? --- scripts/onload/lesson.js | 17 +++++++++++++++++ scripts/onload/list.js | 4 ++++ scripts/onload/subject.js | 16 ++++++++++++++++ scripts/onload/toc.js | 3 +++ 4 files changed, 40 insertions(+) create mode 100644 scripts/onload/lesson.js create mode 100644 scripts/onload/list.js create mode 100644 scripts/onload/subject.js create mode 100644 scripts/onload/toc.js (limited to 'scripts/onload') 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(); +} -- cgit v1.2.3