You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
7.0 KiB
90 lines
7.0 KiB
3 months ago
|
/* JavaScript providing functions for
|
||
|
* use on Linux Pages
|
||
|
*
|
||
|
* Includes local menus
|
||
|
*
|
||
|
* Author - Philip Osztromok
|
||
|
*
|
||
|
* 2 March 2024
|
||
|
*+
|
||
|
*/
|
||
|
|
||
|
function local_menu(course) {
|
||
|
const new_menu = menu(course);
|
||
|
const new_menu_links = menu_links(course);
|
||
|
const new_base = base(course);
|
||
|
console.log(new_base);
|
||
|
const new_local_menu = document.createElement("div");
|
||
|
|
||
|
for (let index=0; index < new_menu.length; index++) {
|
||
|
var link = document.createElement("a");
|
||
|
link.innerHTML = new_menu[index];
|
||
|
link.setAttribute("href", new_base+new_menu_links[index]+".html");
|
||
|
// console.log("The link is", link);
|
||
|
new_local_menu.append(link);
|
||
|
}
|
||
|
|
||
|
return new_local_menu;
|
||
|
}
|
||
|
|
||
|
export { local_menu }
|
||
|
|
||
|
/*
|
||
|
*
|
||
|
* helper functions
|
||
|
*
|
||
|
*/
|
||
|
function menu(course) {
|
||
|
if (course == "advancedlayoutswithgrid") return ["CSS Grid: Core Principles", "Planning for Grid Layouts", "Multi-Column Layout", "Full-Bleed Single Column Layout", "Various Card Layours", "Accessible Off-Screen Navigation Layouts", "Bonus Chapter: Ask the Instructor", "Conclusion"];
|
||
|
else if (course == "apache") return ["Introducing Apache HTTP Server", "Configuring Apache", "Troubleshooting with Log Files", "Conclusion"];
|
||
|
else if (course == "cssessentialtraining") return ["Introduction", "Getting Started", "Core Concepts", "The Box Model", "Typography", "Layouts: Float and Position", "Layouts: Flexbox and Grid", "Advanced Selectors", "Fluid and Responsive Layouts", "Conclusion", "resumes"];
|
||
|
else if (course == "csslayouts") return ["Float, Display and Position", "Flexbox", "Grid", "Conclusion"];
|
||
|
else if (course == "designingrestfulapis") return ["Why Good API Design is Important", "What Does Your API Look Like?", "How Does Your API Work?", "Common Design Challenges", "Conclusion"];
|
||
|
else if (course == "gsfullstack") return ["Make Your Mark","Show Information", "Programming", "Course ProjectPart 1", "Develop Safely", "Connect to Databases", "Course Project: Part 2", "Build on the Work of Others", "Develop Your Skills", "Conclusion"];
|
||
|
else if (course == "htmlessentialtraining") return ["Formatting Text", "Understanding the Power of HTML", "Linking and Navigation", "Images and Graphics", "Media", "More Ways to Identify Content", "Putting it all Together", "Forms and Interactive Elements", "Structuring Tabular Data", "Conclusion"]
|
||
|
else if (course == "httpessentialtraining") return ["HTTP: Hypertext Transfer Protocol", "Requests and Responses", "HTTP Headers", "Conclusion"];
|
||
|
else if (course == "introducingpostman") return ["Introduction", "Compose Requests", "Manage Requests", "Environments and Variables", "Conclusion"];
|
||
|
else if (course == "introductiontocss2022") return ["Introduction"];
|
||
|
else if (course == "introductiontowebapis") return ["What ia an API?"];
|
||
|
else if (course == "jqueryessentialtraining") return ["Introduction", "A Quick Introduction to jQuery", "Working with Page Content", "Manipulating Page Content", "jQuery Events", "Animations and Effects", "AJAX Operations", "Conclusion"]
|
||
|
else if (course == "jsonessentialtraining") return ["Introduction", "Understanding JSON", "Processing JSON Data", "Using JSON Data", "Applying Techniques for Working with JSON", "Working with JSON Schema", "Structuring Data with JSON-LD", "Conclusion"];
|
||
|
else if (course == "learningecmascript6") return ["What is ECMAScript?", "ECMAScriot Variables and Data Structures", "Arrays and Array Methods", "ECMAScript Objects", "ECMAScript Functions", "Asynchronous JavaScript", "Conclusion"];
|
||
|
else if (course === "learningthejavascriptlanguage") return ["Getting Started", "Variables and Types", "Objects, Arrays and More", "Operators and Control Structures", "Iterating with Loops", "Functions", "A Few More Advanced Pieces", "Conclusion"];
|
||
|
else if (course == "learningreactjs") return ["Getting Started", "React Elements", "React Components", "React State with Hooks", "React Enhancements", "Conclusion"];
|
||
|
else if (course == "learningrestapis") return["REST API", "Request", "Response", "Request/Response Pairs", "Conclusion"];
|
||
|
else if (course == "linuxwebservices") return["Serve Web Content with Apache", "Secure the Site and Control Access", "Conclusion", "Appendix A"];
|
||
|
else if (course == "reactfullstacksite") return ["Creating a React Front End", "Creating a Node.js Back End", "Adding MongoDB to Node.js", "Connecting the Front End and Back End"];
|
||
|
console.log("menu function finished without returning anything!!");
|
||
|
}
|
||
|
|
||
|
function menu_links(course) {
|
||
|
if (course == "advancedlayoutswithgrid") return ["core", "planning", "multi-column", "full-bleed", "card", "accessible", "bonus", "conclusion"];
|
||
|
else if (course == "apache") return ["introduction", "configuring", "troubleshooting", "conclusion"];
|
||
|
else if (course == "cssessentialtraining") return ["introduction", "gettingstarted", "core", "boxmodel", "typography", "layouts1", "layouts2", "selectors", "fluid", "conclusion", "resumes"];
|
||
|
else if (course == "csslayouts") return ["float", "flexbox", "grid", "conclusion"];
|
||
|
else if (course == "designingrestfulapis") return ["needs", "look", "work", "challenges", "conclusion"];
|
||
|
else if (course == "gsfullstack") return ["mark", "show", "programming", "project", "safely", "connect", "project2", "build", "skills", "conclusion"];
|
||
|
else if (course == "htmlessentialtraining") return ["formattingtext", "power", "links", "images", "media", "content", "together", "forms", "tabular", "conclusion"]
|
||
|
else if (course == "httpessentialtraining") return ["http", "requests", "headers", "conclusion"];
|
||
|
else if (course == "introducingpostman") return ["introduction", "compose", "manage", "environments", "conclusion"];
|
||
|
else if (course == "introductiontocss2022") return ["introduction"]
|
||
|
else if (course == "introductiontowebapis") return ["whatianapi"];
|
||
|
else if (course == "jqueryessentialtraining") return ["introduction", "quick", "working", "manipulating", "events", "animations", "ajax", "conclusion"];
|
||
|
else if (course == "jsonessentialtraining") return ["introduction", "understanding", "processing", "using", "applying", "working", "structuring", "conclusion"];
|
||
|
else if (course == "learningecmascript6") return ["ecmascript", "variables", "arrays", "objects", "functions", "asynchronous", "conclusion"];
|
||
|
else if (course === "learningthejavascriptlanguage") return ["gettingstarted", "variables", "objects", "operators", "loops", "functions", "advanced", "conclusion"];
|
||
|
else if (course == "learningreactjs") return ["gettingstarted", "elements", "components", "hooks", "enhancements", "conclusion"];
|
||
|
else if (course == "learningrestapis") return["restapis", "request", "response", "pairs", "conclusion"];
|
||
|
else if (course == "linuxwebservices") return["servewebcontent", "securethesite", "conclusion", "appendixa"];
|
||
|
else if (course == "reactfullstacksite") return ["frontend", "backend", "mongodb", "connecting"];
|
||
|
console.log("menu_links function finished without returning anything!!");
|
||
|
}
|
||
|
|
||
|
function base(course) {
|
||
|
const root = "/webdevelopment/"
|
||
|
if (course == "advancedlayoutswithgrid") return root+"cssadvancedlayouts/";
|
||
|
else if (course == "apache") return root+"apachewebserveradmin/";
|
||
|
else if (course == "javascript") return root+"learningjavascript/";
|
||
|
else return root+course+"/";
|
||
|
}
|