Filters semesters in CreatorPro "Term" dropdown select.
// ==UserScript==
// @name Hide CreatorPro Dates
// @namespace http://github.com/tidusx18
// @version 0.1
// @description Hides unwanted dates in CreatorPro search page's date dropdown.
// @match https://cp.fiu.edu/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var dateFilters = document.querySelectorAll('#CourseFilter-menu li a');
var dateContainer = document.querySelector('#CourseTerm-menu');
var cpDates = dateContainer.childNodes;
var myDates = 'Spring 2018 Fall 2017 Summer 2017 Spring 2017 Fall 2016 Summer 2016 Spring 2016';
function filterDates() {
console.log('CreatorPro Dates Filtered');
dateContainer.style.height = 'auto';
for(let date of dateContainer.childNodes) {
if(!myDates.includes(date.textContent)) {
date.style.display = "none";
}
}
}
var target = document.getElementById('CourseTerm-menu');
var observer = new MutationObserver(filterDates);
var config = { attributes: false, childList: true, characterData: false };
observer.observe(target, config);
filterDates();
})();