How to provide calendar link per URL?

   

Answer

Calendar integration can be done in the module integration section of the widget setting. But you can add only one link into the calendar setting, in case if you want to have multiple URLs for the calendar and want to appear them as per page you can follow the programmable method.

 

Variable to defined the calendar URL using javascript - faqbotCalendyCode

Note: If faqbotCalendyCode is defined in the javascript then setting done using widget setting > Modules > Calendar Integration has no impact.  You can check for the URL and set the above variable conditionally.

 

Sample Code to be added after the faqbotKey = "<>"; in your widget code

function myfaqbotGetCurrentUrl()
{
var currentUrl = window.location.protocol + "//" + window.location.host + window.location.pathname.replace(/\/+$/, "");
return currentUrl.toLowerCase();
}

function myfaqbotIsUrl(url)
{
var currentUrl = myfaqbotGetCurrentUrl();
if (currentUrl.toLowerCase() === url.replace(/\/+$/, "").toLowerCase())
  return true;
else
  return false;
}

if (myfaqbotIsUrl(<url1>)) {

  var faqbotCalendyCode = "<your calender url which you want to show on the page url1>";

}

else if (myfaqbotIsUrl(<url2>)) {

  var faqbotCalendyCode = "<your calender url which you want to show on the page url2>";

}

else if (myfaqbotIsUrl(<url3>)) {

  var faqbotCalendyCode = "<your calender url which you want to show on the page url3>";

}

else {

  var faqbotCalendyCode = "<your calender url which you want to show on the default>";

}

...