1import {parse} from "/_resources20/js/vanillaes.csv.index.min.js"; 2 3const programsXmlUrl = "/_resources20/data/program-pages/_config.programs.xml"; 4const programsCsvUrl = "/_resources20/data/program-pages/program-finder-urls.csv"; 5const undergradDegreeDescriptions = ['Bachelor of Science', 'Associate in Applied Science', 'Associate in Arts', 6 'Bachelor of Arts', 'Bachelor of Fine Arts', 'Assoc in Fine Arts', 'Bachelor of Applied Science', 7 'Associate in Science', 'BS in Nursing', 'Bachelor of Social Work', "Bachelor's of Fine Arts", 'Associate of Fine Arts']; 8const graduateDegreeDescriptions = ['MS Career & Tech Ed', 'MS Criminal Justice Adm', 'Master of Education', 9 'Master of Science', 'Master of Fine Arts', 'MS Info Sec and Intel', 'Master of Business Admin.', 10 'Master of Architecture', 'Master of Hlthcare Admin', 'Master of Public Health', 11 'Master of Science in Nursing', 'Master of Social Work', 'Master of Arts']; 12const doctorateDegreeDescriptions = ['Doctor of Education', 'Doctor of Nursing Practice', 'Doctor of Optometry', 13 'Doctor of Pharmacy']; 14const unlistedDegreeDescriptions = ['Minor', 'Certificate Program', 'Nondegree Certificate', 'Post Graduate Certificate']; 15let parsedProgramData; 16 17$(document).ready(function() { 18 // Read in the program URL list CSV 19 let xhr = new XMLHttpRequest(); 20 xhr.open("GET", programsCsvUrl, false); 21 xhr.onreadystatechange = function () { 22 if (xhr.readyState === 4 && xhr.status === 200) { 23 let csvString = xhr.responseText; 24 parsedProgramData = parse(csvString); 25 } 26 } 27 xhr.send(null); 28 29 // Read in the list of all programs from the catalog 30 $.get(programsXmlUrl, function(data) { 31 let programsHtml = ` 32 <div id="no-results-found" class="ferrisFlexObject-Two-simple" style="display: none;"> 33 <p class="person-name">No programs found</p> 34 <p style="margin-top: 0px; margin-bottom: 0px;">Please change your filter criteria</p> 35 </div> 36 `; 37 let programs = data.getElementsByTagName("program"); 38 for (let i = 0; i < programs.length; i++) { 39 let degreeLevel = ""; 40 let degreeDescription = programs[i].getElementsByTagName("DEGREEDESC")[0].innerHTML; 41 if (unlistedDegreeDescriptions.indexOf(degreeDescription) !== -1) { 42 // if unlisted degree description, skip 43 continue; 44 } else if (undergradDegreeDescriptions.indexOf(degreeDescription) !== -1) { 45 degreeLevel = "undergrad"; 46 } else if (graduateDegreeDescriptions.indexOf(degreeDescription) !== -1) { 47 degreeLevel = "graduate"; 48 } else if (doctorateDegreeDescriptions.indexOf(degreeDescription) !== -1) { 49 degreeLevel = "doctorate"; 50 } else { 51 // if unknown degree description, skip 52 console.log("New degree description found: " + degreeDescription); 53 continue; 54 } 55 let major = programs[i].getElementsByTagName("MAJOR")[0].innerHTML; 56 let programId = programs[i].getElementsByTagName("PROG")[0].innerHTML.toLowerCase(); 57 let dataId = major; 58 59 // find program URL from CSV 60 let foundProgramArray = parsedProgramData.find((element) => element[2].trim().toLowerCase() === programId); 61 let programUrl = undefined; 62 if (foundProgramArray) { 63 if (foundProgramArray[3].trim()) { 64 programUrl = foundProgramArray[3].trim(); 65 } 66 if (foundProgramArray[4].trim()) { 67 dataId += " " + foundProgramArray[4].trim(); 68 } 69 } 70 71 // let programUrl = "/catalog/current/programs/" + programId + ".htm"; 72 73 // Format data as HTML output 74 programsHtml += '<div class="ferrisFlexObject-Two-simple program-object" data-id="' + dataId + 75 '" data-program-level="' + degreeLevel + '" data-program-id="' + programId + '">\n' + 76 '<p class="person-name">\n'; 77 if (programUrl === undefined) { 78 programsHtml += `${major}\n`; 79 } else { 80 programsHtml += `<a class="filterLink" href="${programUrl}">${major}</a>\n` 81 } 82 programsHtml += '</p>\n' + 83 '<p style="margin-top: 0px; margin-bottom: 0px;">' + degreeDescription + '</p>\n' + 84 '</div>\n'; 85 } 86 $("#programs-wrapper").html(programsHtml); // fill the programs wrapper with programs 87 }); 88});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.