diff --git a/README.md b/README.md index 8098d6c..aa96536 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Yes. Consider sharing it with your classmates ;) Here's a quick rundown of how to build from source: 1) download or clone the repository ```git clone https://git.sasserisop.com/Sasserisop/MATH201``` 2) make sure you have hugo installed -3) if you are using localhost, inside of themes/zettels/assets/js/search.js set 'const localhost' to false. +3) if you are using localhost, inside of themes/zettels/assets/js/search.js set 'const localhost' to true. 4) open a command prompt in the MATH201/ directory and run the command ```hugo server --disableFastRender``` 5) visit your site by opening http://localhost:1313 on your browser. diff --git a/content/_index.md b/content/_index.md index 7d7cf15..a2c485f 100644 --- a/content/_index.md +++ b/content/_index.md @@ -5,32 +5,6 @@ I have written these notes for myself, I thought it would be cool to share them. Good luck on the final! <3 If we do bad on the exam, Petar will come after us with the Dirac delta 🤜💥
-[Separable equations (lec 1)](separable-equations-lec-1.html) -[Homogenous equations (lec 2)](homogenous-equations-lec-2.html) -[Linear equations (lec 2-3)](linear-equations-lec-2-3.html) -[Bernoulli equations (lec 3)](bernoulli-equations-lec-3.html) -[Linear coefficient equations (lec 4)](linear-coefficient-equations-lec-4.html) -[Exact equations (lec 4-5)](exact-equations-lec-4-5.html) -[Second order homogenous linear equations (lec 5-7)](second-order-homogenous-linear-equations-lec-5-7.html) -[Method of undetermined coefficients (lec 8-9)](method-of-undetermined-coefficients-lec-8-9.html) -[Variation of parameters (lec 9-10)](variation-of-parameters-lec-9-10.html) -[Cauchy-Euler equations (lec 10-11)](cauchy-euler-equations-lec-10-11.html) -[Reduction of order (lec 11)](reduction-of-order-lec-11.html) -[Free vibrations (lec 11-12)](free-vibrations-lec-11-12.html) -[Resonance & AM (lec 13-14)](resonance-am-lec-13-14.html) -[Laplace transform (lec 14-16)](laplace-transform-lec-14-16.html) -[Solving IVP's using Laplace transform (lec 17-18)](solving-ivps-using-laplace-transform-lec-17-18.html) -[(Heaviside) Unit step function (lec 18)](heaviside-unit-step-function-lec-18.html) -[Periodic functions (lec 19)](periodic-functions-lec-19.html) -[Convolution (lec 19-20)](convolution-lec-19-20.html) -[Dirak δ-function (lec 21)](dirak-δ-function-lec-21.html) -[Systems of linear equations (lec 21-22)](systems-of-linear-equations-lec-21-22.html) -[Power series (lec 22-25)](power-series-lec-22-25.html) -[Separation of variables & Eigen value problems (lec 26-28)](separation-of-variables-eigen-value-problems-lec-26-28.html) -[Fourier series (lec 28-29)](fourier-series-lec-28-29.html) -[Heat equation (lec 30-33)](heat-equation-lec-30-33.html) -[Wave equation (lec 33-36)](wave-equation-lec-33-36.html) -
[How to solve any DE, a flow chart](Solve-any-DE.png) (Last updated Oct 1st, needs revision. But it gives a nice overview.) [Big LT table (.png)](drawings/bigLTtable.png) diff --git a/themes/zettels/assets/js/search.js b/themes/zettels/assets/js/search.js index 26ae9b6..b25a082 100644 --- a/themes/zettels/assets/js/search.js +++ b/themes/zettels/assets/js/search.js @@ -1,6 +1,8 @@ // On localhost the root url is /MATH201 // On sasserisop the root url is /sasserisop const localhost = true; +const root = localhost ? "" : "/MATH201"; + loadIndex() // Highlight with jQuery @@ -149,8 +151,47 @@ document.addEventListener("turbolinks:load", function () { } }) +// load the lecture note links in homepage +function load_lecture_links() { + // check if links have already been generated first + if ($("p.lecture-link").length == 0) { + fetchJSON(function (response) { + const notes = response; + // for homepage lecture links + const lecture_links = new Map(); + + notes.index.filter(n => !/^Drawing|^20/.test(n.title)).forEach(note => { + // Add lecture notes to a dictionary, and then sort them by lecture number. + // second last character of the title may be first digit of lecture number + const d1 = note.title[note.title.length - 2]; + // find the lecture number, if there is one + if (/\d/.test(d1)) { + // it has a lecture number + // if the third last character is a digit, then the lecture number is 2 digits + const d2 = note.title[note.title.length - 3]; + var lecture_number = /\d/.test(d2) ? Number(d2 + d1) : Number(d1); + // some lecture titles have the same last lecture number + if (lecture_links.has(lecture_number)) { + // prevents two lectures from having the same key + lecture_number += 0.5; + } + lecture_links.set(lecture_number, [note.title, note.permalink]) + } + }); + const sorted_links = new Map([...lecture_links.entries()].sort((a, b) => (a[0] - b[0]))); + sorted_links.forEach(val => { + a_tag = document.createElement('a'); + a_tag.innerText = val[0]; + a_tag.href = val[1]; + p_tag = document.createElement('p'); + p_tag.append(a_tag); + p_tag.className = "lecture-link" + $("#note-wrapper br:nth-of-type(3)").before(p_tag); + }); + }, root); + } +} function loadIndex() { - const root = localhost ? "" : "/MATH201"; fetchJSON(function (response) { const notes = response; @@ -203,7 +244,11 @@ function loadIndex() { // it has a lecture number // if the third last character is a digit, then the lecture number is 2 digits const d2 = note.title[note.title.length - 3]; - const lecture_number = /\d/.test(d2) ? Number(d2 + d1) : Number(d1); + var lecture_number = /\d/.test(d2) ? Number(d2 + d1) : Number(d1); + if (lecture_notes.has(lecture_number)) { + // prevent lectures from having the same key + lecture_number += 0.5; + } lecture_notes.set(lecture_number, child); } else { non_lecture_notes.push(child); @@ -211,13 +256,14 @@ function loadIndex() { }); // sort notes by lecture number const sorted_notes = new Map([...lecture_notes.entries()].sort((a, b) => (a[0] - b[0]))); + // Add sorted notes first sorted_notes.forEach(val => { search_results.append(val); }); non_lecture_notes.forEach(child => { search_results.append(child); - }) + }); // @todo: wip // notes.tags.forEach(tag => { diff --git a/themes/zettels/layouts/index.html b/themes/zettels/layouts/index.html index 2be5127..e506610 100644 --- a/themes/zettels/layouts/index.html +++ b/themes/zettels/layouts/index.html @@ -1,7 +1,14 @@ {{ define "main" }} -

Back to Sasserisop homepage

- {{ partial "content.html" . }} -

❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦


-

Gitea repository


-

Community discord

-{{ end }} +

Back to Sasserisop homepage

+{{ partial "content.html" . }} +

❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦


+

Gitea repository +


+

Community + discord

+ +{{ end }} \ No newline at end of file diff --git a/themes/zettels/layouts/partials/search.html b/themes/zettels/layouts/partials/search.html index dee3bda..d2f5444 100644 --- a/themes/zettels/layouts/partials/search.html +++ b/themes/zettels/layouts/partials/search.html @@ -33,10 +33,8 @@ } #search-header { - padding: 12px; - position: fixed; - padding-left: 12px; - padding-right: 12px; + padding: 12px 0; + margin: 0 auto; background: var(--background-search); width: 250px; opacity: 1; @@ -78,7 +76,6 @@ } #search-results { - margin-top: 50px; overflow: auto; height: 100%; }