schoolbox web extension :)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: tab-title.js #57

Willow 15098b0a 153cd575

+29 -24
+29 -24
src/plugins/tab-title/tab-title.js
··· 3 3 document.title = document.getElementById("heading").getAttribute("value"); 4 4 } 5 5 } catch (error) {} 6 - if (window.location.pathname === "/") { 7 - document.title = "Homepage"; 8 - } else if (window.location.pathname === "/timetable") { 9 - document.title = "Timetable"; 10 - } else if (window.location.pathname.includes("/calendar")) { 6 + 7 + const path = window.location.pathname; 8 + const titleMap = { 9 + "/": "Homepage", 10 + "/timetable": "Timetable", 11 + "/calendar": "Calendar", 12 + "/news": "News", 13 + "/learning/classes": "Classes", 14 + "/resources": "Resources", 15 + "/settings/messages": "Message Settings", 16 + "/mail/create": "Compose Email", 17 + "/feedback": "Support and Feedback", 18 + "/policy": "Guidelines of Use and Privacy Policy", 19 + }; 20 + 21 + if (titleMap.hasOwnProperty(path)) { 22 + document.title = titleMap[path]; 23 + } else if (path.includes("/calendar")) { 11 24 document.title = "Calendar"; 12 - } else if (window.location.pathname === "/news") { 13 - document.title = "News"; 14 - } else if (window.location.pathname === "/learning/classes") { 15 - document.title = "Classes"; 16 - } else if (window.location.pathname.includes("/grades/")) { 25 + } else if (path.includes("/grades/")) { 17 26 document.title = "Grades"; 18 - } else if (window.location.pathname.includes("/news/")) { 27 + } else if (path.includes("/news/")) { 19 28 document.title = `News (${document.getElementsByTagName("h1")[0].innerText})`; 20 - } else if (window.location.pathname.includes("/assessments/")) { 21 - document.title = `Assessments (${document.getElementsByTagName("h1")[0].innerText})`; 22 - } else if (window.location.pathname === "/resources") { 23 - document.title = "Resources"; 24 - } else if (window.location.pathname === "/settings/messages") { 25 - document.title = "Message Settings"; 26 - } else if (window.location.pathname.includes("/mail/create")) { 29 + } else if (path.includes("/assessments/")) { 30 + document.title = `Assessments - ${document.getElementsByTagName("h1")[0].innerText})`; 31 + } else if (path.includes("/mail/create")) { 27 32 document.title = "Compose Email"; 28 - } else if (window.location.pathname.includes("/search/user")) { 29 - document.title = `User Profile - ${document.getElementsByTagName("h1")[0].innerText}`; 30 - } else if (window.location.pathname === "/feedback") { 31 - document.title = "Support and Feedback"; 32 - } else if (window.location.pathname === "/policy") { 33 - document.title = "Guidelines of Use and Privacy Policy"; 33 + } else if (path.includes("/search/user")) { 34 + document.title = `Profile - ${document.getElementsByTagName("h1")[0].innerText}`; 35 + } else if (path.includes("/learning/due/")) { 36 + document.title = "Due Work"; 37 + } else if (path.includes("/homepage/")) { 38 + document.title = document.getElementsByTagName("h1")[0].innerText; 34 39 }