Showing/hiding sets of calendars

Discussion of general topics about Mozilla Thunderbird
Post Reply
user2018
Posts: 196
Joined: September 23rd, 2018, 11:07 am

Showing/hiding sets of calendars

Post by user2018 »

I have a significant number of calendars that I am accessing through Thunderbird. The problem is the following: with my current workflow sometimes I want a subset of calendars to be visible and some other times another set (e.g., "calendars to show while working", "calendars to see on vacation", etc.), and the rest of calendars hidden. Right now I need to go manually calendar by calendar and hide/show each one according to my preferences. Is there any way to facilitate this task? Any idea is welcome.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Showing/hiding sets of calendars

Post by morat »

You can simulate a click to a calendar checkbox to show/hide a calendar.

e.g.

<input type="checkbox" class="calendar-displayed" title="Show Home"/>
<input type="checkbox" class="calendar-displayed" title="Hide Holidays"/>

Code: Select all

(function () {
  // show Home calendar
  var input = document.querySelector('.calendar-displayed[title$="Home"]');
  if (input.checked == false) input.click();
  // hide Holidays calendar
  var input = document.querySelector('.calendar-displayed[title$="Holidays"]');
  if (input.checked == true) input.click();
})();
Or

Code: Select all

(function () {
  var inputs = [];
  inputs.push(document.querySelector('.calendar-displayed[title$="Home"]'));
  inputs.push(document.querySelector('.calendar-displayed[title$="Holidays"]'));
  if (inputs[0].checked == false) {
    // show Home calendar and hide Holidays calendar
    if (inputs[0].checked == false) inputs[0].click();
    if (inputs[1].checked == true) inputs[1].click();
  } else {
    // hide Home calendar and show Holidays calendar
    if (inputs[0].checked == true) inputs[0].click();
    if (inputs[1].checked == false) inputs[1].click();
  }
})();
Attribute selectors
http://developer.mozilla.org/docs/Web/C ... ors#Syntax
Post Reply