General > Support
adding a javascript Notification()
garethGZA:
Hi All,
I have a client that is using Mibew, and none of the staff have speakers on their terminals. The staff dont know when a user is waiting to chat with them, I have turned on the popup in operator/settings/features but it doesnt do anything. I have looked and found some javascript for Notification() and tested it and it works, but where in the code can I add this? I have written it as a function NotifyMe() and it works, but i need to find where in the code to place it, I was thinking of adding it where the code to play the sound it, but I cant find that, what would I be looking for in the code?
Here is the Stack article on how it works, http://stackoverflow.com/questions/2271156/chrome-desktop-notification-example
Regards
Gareth
Dmitriy Simushev:
Hi,
First of all you don't specify the exact version of Mibew you use, so I cannot really say where you should place the code.
The second. There is a title notification plugin for Mibew 2.0. It can be downloaded here: https://mibew.org/plugins#mibew-title-notification
garethGZA:
I am using 2.0.0-beta.3. I have tried the title plugin, but have not managed to get it working. Does the title notification thing make a popup/notification on the screen or does it just do something on the title? I have tried to read about it, but couldn't find the answer to it. I was looking to find where in the code it makes the sound play, because from there I think i can add code to make the notification() work.
Is there a site/demo with the title notification thing installed that I can check how it looks?
Thank you very much.
Dmitriy Simushev:
We release stable 2.0.0 version some time ago. It includes several bug fixes and improvements, so I recommend you to update your installation.
Title notification plugin, as its name says, affects only browser title. This plugin is installed in the official demo (https://demo2.mibew.org).
If you want to add custom notification I recommend you to create a plugin, like Mibew:TitleNotification one. You can get its sources here: https://github.com/Mibew/title-notification-plugin . The sources are well documented thus I don't think it's too hard to make a similar plugin with different notification logic.
Nevertheless, if you really want to patch Mibew Core, the function that plays sound is located here: https://github.com/Mibew/mibew/blob/master/src/mibew/js/source/default/utils.js#L108 . After you change it, you have to rebuild the application. Read https://github.com/Mibew/mibew#build-from-sources to get how it could be done.
garethGZA:
Thank you, I'll upgrade and then have a look.
You should build something like that notification into the one you release, I think a lot of people would want it as I have seen other questions on the forum where people have asked the same thing
Thank you :D
Navigation
[0] Message Index
[#] Next page
Go to full version