Last active
March 12, 2021 12:59
-
-
Save CaptainYarb/562b517d66e1e62465e3b83ada7266ba to your computer and use it in GitHub Desktop.
OK COVID-19 Vaccine Finder
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 OK COVID-19 Vaccine Finder | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Hides Oklahoma COVID-19 Vaccine search results for clinic locations without any bookings | |
// @author Jonathan Yarbor | |
// @match https://vaccinate.oklahoma.gov/en-US/covidvaccine-location-map/ | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let lastFire = null; | |
const search = document.querySelector('#entity-list-map-locations table tbody'); | |
var observer = new MutationObserver(function(mutations) { | |
const now = new Date().getTime(); | |
if(lastFire !== null && (now - lastFire) < 500){ | |
return; | |
} | |
lastFire = now; | |
setTimeout(function(){ | |
const results = document.querySelectorAll("#entity-list-map-locations table tbody tr td"); | |
let hidden = 0; | |
results.forEach(function(element){ | |
if(element.innerText.includes('No available')){ | |
element.style.display = 'none'; | |
hidden++; | |
} | |
}); | |
const oldResults = document.querySelector('#hidden-results'); | |
if(oldResults){ | |
oldResults.remove(); | |
} | |
var td = document.createElement('td'); | |
td.innerText = `${hidden} results have no bookings.`; | |
var tr = document.createElement('tr'); | |
td.id = 'hidden-results'; | |
tr.appendChild(td) | |
search.appendChild(tr); | |
}, 100); | |
}); | |
observer.observe(search, {childList: true, characterData: true, subTree: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment