Created
October 19, 2018 14:30
-
-
Save xbenjii/01470d9457c1bc92ea4e8e0d08e87641 to your computer and use it in GitHub Desktop.
Enable podio calendar past 6 months
This file contains 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 Podio Re-enable calendar | |
// @namespace https://www.prestigegifting.co.uk | |
// @version 0.1 | |
// @description Podio has limited the calendar to 6 months, this re-enables it. | |
// @author Benjamin Fortune <ben@prestigegifting.co.uk> | |
// @match https://podio.com/calendar | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const config = { attributes: true, childList: false, subtree: false }; | |
const node = () => document.querySelector('#fullcalendar-header .prev'); | |
const removeDisabled = (el) => { | |
if(el.classList.contains('disabled')) { | |
el.classList.remove('disabled'); | |
} | |
}; | |
const observer = new MutationObserver((mutations, observer) => { | |
for(const mutation of mutations) { | |
if(mutation.type === 'attributes' && mutation.attributeName === 'class') { | |
removeDisabled(mutation.target); | |
} | |
} | |
}); | |
const id = setInterval(() => { | |
console.log('Looking for el'); | |
if(node() !== null) { | |
removeDisabled(node()); | |
observer.observe(node(), config); | |
clearInterval(id); | |
} | |
}, 100); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment