The most likely issue with using that code is that your SP site doesn't contain the same elements. For example, the code is looking for an element with
id="CalViewTable1". When I inspected the calendar in my test site, there is no
CalViewTable1. Instead I found that I do have a
class="ms-acal-month". This would then be the basis for manipulation.