Created
August 7, 2017 21:02
-
-
Save tidusx18/b1cf99d652b9dce3393519bbe69b2ef0 to your computer and use it in GitHub Desktop.
Filters semesters in CreatorPro "Term" dropdown select.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment