Hi I’m trying to give background color to activities in Pipedrive.
I’ve gotten pretty far but need some help with the final step.
I’ve installed a chrome plugin called “Custom Javascript for Websites 2” which allows me to run JS code on the pipedrive page.
I’ve created the following code to run on my calendar page:
$(document).ready(function() {
//timeout needed because activities are not loaded yet at .ready
setTimeout(function (){
var elements = document.getElementsByClassName(‘gridModel__container’);
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.toLowerCase().indexOf(“offerte”) !=-1) {
elements[i].style.backgroundColor = ‘#026802’;
elements[i].style.color = ‘white’;
}
if (elements[i].innerHTML.toLowerCase().indexOf(“demo”) !=-1) {
elements[i].style.backgroundColor = ‘#026802’;
elements[i].style.color = ‘white’;
}
if (elements[i].innerHTML.toLowerCase().indexOf(“opvolging”) !=-1) {
elements[i].style.backgroundColor = ‘#fff100’;
}
}
}, 5000); // How long do you want the delay to be (in milliseconds)?
});
This works great when I load the page.
It creates a backgroundcolor for the needed activities within my current week
But if i switch to another week the JS doens’t run anymore (obviously).
Same problem when I come from another page (eg the deals page).
Is there any trigger I can set to run my JS when I switch between weeks?
Kr,
Nick