master #1

Open
DashCampbell wants to merge 4 commits from DashCampbell/MATH201:master into master
1 changed files with 9 additions and 8 deletions
Showing only changes of commit fa560a5b29 - Show all commits

View File

@ -1,6 +1,6 @@
// On localhost the root url is /MATH201 // On localhost the root url is /MATH201
// On sasserisop the root url is /sasserisop // On sasserisop the root url is /sasserisop
const localhost = true; const localhost = false;
const root = localhost ? "" : "/MATH201"; const root = localhost ? "" : "/MATH201";
loadIndex() loadIndex()
@ -181,14 +181,15 @@ function load_lecture_links() {
const sorted_links = new Map([...lecture_links.entries()].sort((a, b) => (a[0] - b[0]))); const sorted_links = new Map([...lecture_links.entries()].sort((a, b) => (a[0] - b[0])));
sorted_links.forEach(val => { sorted_links.forEach(val => {
a_tag = document.createElement('a'); a_tag = document.createElement('a');
a_tag.innerText = val[0]; a_tag.innerText = val[0]; //title
a_tag.href = val[1]; a_tag.href = val[1]; //permalink
p_tag = document.createElement('p'); p_tag = document.createElement('p');
p_tag.append(a_tag); p_tag.append(a_tag);
p_tag.className = "lecture-link" p_tag.className = "lecture-link"
// Add lecture notes before third </br> tag in _index.md
$("#note-wrapper br:nth-of-type(3)").before(p_tag); $("#note-wrapper br:nth-of-type(3)").before(p_tag);
}); });
}, root); });
} }
} }
function loadIndex() { function loadIndex() {
@ -228,9 +229,9 @@ function loadIndex() {
const tags = '<span style="display:none">' + note.tags + '</span>' const tags = '<span style="display:none">' + note.tags + '</span>'
var list_content; var list_content;
if (current_note === permalink) { if (current_note === permalink) {
list_content = '<a href="' + root + permalink + '" class="selected search-item" tabindex="0">' + title + summary + '</a>' list_content = '<a href="' + permalink + '" class="selected search-item" tabindex="0">' + title + summary + '</a>'
} else { } else {
list_content = '<a href="' + root + permalink + '" class="search-item" tabindex="0">' + title + summary + thumbnail + tags + '</a>' list_content = '<a href="' + permalink + '" class="search-item" tabindex="0">' + title + summary + thumbnail + tags + '</a>'
} }
const child = document.createElement("li"); const child = document.createElement("li");
@ -272,11 +273,11 @@ function loadIndex() {
// tags.append(child) // tags.append(child)
// }); // });
// //
}, root); });
} }
function fetchJSON(callback, root) { function fetchJSON(callback) {
const requestURL = root + '/index.json'; const requestURL = root + '/index.json';
const request = new XMLHttpRequest(); const request = new XMLHttpRequest();
request.open('GET', requestURL, true); request.open('GET', requestURL, true);