I’m using FastPath for support reasons. I only want the “Live Support” picture to show on Monday - Friday (preferably between 9am and 6 pm).
Without the date/time logic, it shows. With it, nothing shows.
Here is what I have so far:
<script>
// http://stackoverflow.com/questions/4822852/how-to-get-the-day-of-week-and-the-month-of-the-year
var now = new Date();
if (now.getDay() === 6) {
call="http://URL:7070/webchat/jivelive.jsp"
showChatButton('support@workgroup.URL');
}
</script>
The Working code (without date if statement):
<!-- To enable fastpath Live Support photo -->
<script language="JavaScript" type="text/javascript" src="http://URL:7070/webchat/jivelive.jsp"></script>
<script>showChatButton('support@workgroup.URL');</script>
Any ideas?
Thanks everyone.
Update:
Using this code, it shows up even though today is Saturday. I’m missing something somewhere!!!
<script language="JavaScript" type="text/javascript" src="http://URL:7070/webchat/jivelive.jsp"></script>
<script>
// http://stackoverflow.com/questions/8710442/how-to-specify-multiple-conditions-in-an-if-statement-in-javascript
// If it is between 9-6 and not the weekend, show chat button
var gH = new Date().getHours();
var gD = new Date().getDay();
if ((gH >= 9 || gH < 18) && (gD != 0 || gD != 6)) {
showChatButton('support@workgroup.URL');
}
</script>
Thanks everyone.
-doubz
And success ladies and gentlemen!
Here is the final code:
<script language="JavaScript" type="text/javascript" src="http://URL:7070/webchat/jivelive.jsp"></script>
<script>
// http://stackoverflow.com/questions/8710442/how-to-specify-multiple-conditions-in-an-if-statement-in-javascript
// If it is between 8:30am - 5:30pm and not the weekend, show chat button
var gH = new Date().getHours().value;
var gD = new Date().getDay().value;
var gM = new Date().getMinutes().value;
if ((gH == 8) && (gM >= 30) {
showChatButton('support@workgroup.URL');
}
else if ((gH == 17) && (gM <= 30)) {
showChatButton('support@workgroup.URL');
}
else if ((gH >= 9) && (gH < 18) && (gD != 0 || gD != 6)) {
showChatButton('support@workgroup.URL');
}
else {//do nothing
}
I am fairly certain that it is un-ethical to mark your own response as solved. Oh well…
Any chance I could ask what version of Openfire/Environment you’re running? I’ve been trying to get Fastpath working for over a week. Having an issue where the visitor can see the buttons, can click, agent does receive the “Accept/Decline” button. But that’s it, no chat is ever established after that.
So I was also running into this originally on Openfire 3.9.3. This is everything I did to fix it, but I do not know which one exactly fixed it:
- Deleted default queue.
- Made new queue (i.e. Support)
- Make sure under group chat, group chat settings, that the administrator of the group chat IS NOT the agent that will be receiving notifications.
- Under Default Room Settings, make sure that “Make Room Moderated” is unchecked.
- After all of this, Stop your Openfire server, wait 10 seconds, and Start it again.
- Also, I had to delete the webchat.war plugin and install it again. After you install it, restart server. Then immediately go to http://URL:7070/webchat/setup-index.jsp set-up the webchat functionality.
- If for some reason after all of this, you still cannot connect, a port is probably not open.
- Keep me posted if this helped or not!