Open MessageBird widget chat from JS code - javascript

I'm using messagebird omnichannel widget for my website.
And put the snippet code already. The widget runs great BTW.
I did saw toggleChat function, but it can only hide the chat window.
How can I force-open the chat widget from javascript code ?

MessageBird developer is here :)
Good catch! There was a small issue with toggleChat method.
We just fixed it and deployed the fix, you can use toggleChat() now.
As you mentioned, toggleChat should do it - to open/hide the widget, but it didn't work. The issue that we had was the following:
you had to pass true to open the chat and pass false to close it. It is not obvious when we have the name of the method like toggleChat, I agree! :)
Anyway, it's fixed but feel free to reach me if you have any other questions about the widget or our other products.

Related

How do I delay a SurveyMonkey pop-up?

We're hoping to get feedback on a new site launch (beta; site will fully launch March 28). To give end users the chance to explore the site, we'd like the pop-up to appear after 10 seconds. I'm extremely new to coding JavaScript on my own, so any help is greatly appreciated.
I found an answer to a very similar question (and indeed, some answers seemed more specific to my situation): delayed pop-up code; however, I can't get the code to work on my site.
The pop-up is embedded using this JavaScript, supplied by SurveyMonkey. There's no associated HTML or CSS.
(function(t,e,s,o){var n,c,l;t.SMCX=t.SMCX||[],e.getElementById(o)||(n=e.getElementsByTagName(s),c=n[n.length-1],l=e.createElement(s),l.type="text/javascript",l.async=!0,l.id=o,l.src=["https:"===location.protocol?"https://":"http://","widget.surveymonkey.com/collect/website/js/tRaiETqnLgj758hTBazgd8fe_2Bhm5gFnGqBOI61Z1zZLxwDFd6OcUAaoSp03T3t6v.js"].join(""),c.parentNode.insertBefore(l,c))})(window,document,"script","smcx-sdk");
And this is the code I currently have, modified from one of the answers in the previous post.
function OpenSurvey(t,e,s,o){};
window.setTimeout(function(){ OpenSurvey(window,document,"script","smcx-sdk"); }, 10000);
I was running into the same issue today and I managed to get it working with this code. I hope this helps:
setTimeout(function(){ OpenSurvey(window,document,"script","smcx-sdk"); }, 60000);
function OpenSurvey(t,e,s,o){var n,a,c;t.SMCX=t.SMCX||[],e.getElementById(o)||(n=e.getElementsByTagName(s),a=n[n.length-1],c=e.createElement(s),c.type="text/javascript",c.async=!0,c.id=o,c.src=["https:"===location.protocol?"https://":"http://","widget.surveymonkey.com/collect/website/js/xxxxxxx.js"].join(""),a.parentNode.insertBefore(c,a))}
I had this exact same issue and was beating my head into my desk trying to make this work by editing the code snippet from SurveyMonkey. I called SurveyMonkey and the most they could do was to send me an additional snippet with some new handlers - didn't work. Finally, I was about to call WIX and while making my way down the tree to find the best phone option for me, the site suggested I try reading the tutorial on embedding 3rd party code. BINGO!
Long story short, click this link and follow the instructions - ridiculously easy to implement and you don't have to paste the snippet into the page code - there is a specific section in the Advanced Setting of your site Dashboard (not the WIX account dashboard or the editor, if you ARE on the WIX dashboard click on your sites thumbnail and look for Settings in the dark blue right rail, then click Advanced Settings in the body of the page). Link to WIX instructions for 3rd party code below:
https://support.wix.com/en/article/embedding-custom-code-to-your-site#working-with-third-party-code
Good luck with your endeavores and I really hope this helps! The most challenging part of this was honestly getting the dashboards confused until I realized they meant to go to that particular site's settings.
BrZrKr

Facebook Comment Box Disappears in Accordian

I have two examples of Facebook comment box failing to load when an accordian is collapsed and reloaded. One HTML/JavaScript basic and the other in a Wordpress site via Visual Composer - this problem also occurs in numerous other accordions
HTML Example - http://iknowdigital.co.uk/htmlexample/
Wordpress Via Visual Composer http://thesingingmajor.co.uk/test-comment-box-martin/
I have contacted Facebook Support and Visual Composer support and neither can help out.
here are the replies
From VC
Hi Martin, The issue is not with the iframe, but the js that facebook comments use to render. It is not able to re-initialize itself when it is displayed as hidden and hence the issue occur. You can see that when you add nay iframe, it works fine without any issue. It is the js from the comments which is restricting it. As mentioned previously, it will require some custom js code to re-initialize this loading when the closed (hidden) accordion is opened. Kindly check.
From Facebook
Hi Martin,The issue here is the way the library is working. If you debug the code you'll see the plugin does not disappear, the issue is that the library is changing the width of the iframe that contains the plugin to 0 and you cannot see the comments plugin. In order to avoid this situation you will have to manually change the width value again and you'll see the comment plugin is still there. I'm going to close this bug as "By design" as this is not an issue in our side.
I'm not a javascript programmer, so am really at a loss here. Can anyone chip in with some advice here?
Thanks Martin

Pinterest "Pin it" button breaking 'back' in Internet Explorer

I recently found out that in Internet Explorer (v9 at least), the "Pin it" button for Pinterest is breaking 'back' functionality in the browser. Right-clicking on it shows an entry like 'http://assets.pinterest.com/pidget.html' as the previous page.
Looks like Pinterest is adding an iFrame and IE is adding its address to the history. Clicking 'back' doesn't do anything. Is this a known issue and is there a fix for this?
well, as a temporary solution (other than removing the 'pin it' button), from reading their code, I believe (not tested) that you could add a part to the <script> call to disable logging, like this ...
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js" data-pin-do-not-log="true"></script>
This works but doesn't apply for me because I load the script asynchronously and I use a load command, so what I did was I copied the pinit.js file locally to the server, and changed the part that says
if(a.v.config["do-not-log"]||a.a.doNotLog===true)
to
if(a.v.config["do-not-log"]||a.a.doNotLog===true||true)
looks like it's doing some sort of log in an iframe.
I was having the same problem. I added the website to my list of restricted sites by going to "Tools", then "Internet options", then "Security". It seems to have solved the problem.
I've raised it with PInterest here https://help.pinterest.com/requests/884162
Thier response. Pretty much a brush off.
Hi ,
Information on how to add the Pin It button to your website or product pages is available here:
http://pinterest.com/about/goodies/
More advanced documentation is available here:
https://help.pinterest.com/entries/21101982
We regret that we're unable to provide coding support. Because issues with adding the Pin It button can be caused by conflicts with different parts of your setup it is usually best when someone that is familiar with your setup troubleshoots it. You may also want to try searching the web to see if others have had similar issues especially people that are using a similar site platform or language.
We request that you use our help articles to get the information you need as quickly as possible. If there’s additional information you’d like our team to know, you can reply to this message.
Thanks for writing and happy pinning!
The Pinterest Team
This was a temporary bug when we first pushed the new Pin It button and should no longer be an issue, since we removed the logging frame shortly after it was reported. Sorry for the trouble!

Using multiple CodeMirror editors on a single page?

I'm writing a page with examples that demonstrate the use of my js library. I'd like these examples to be editable and runnable, so I thought I have these options :
Use prettify to display code on the tutorial page, have a button that opens a new window with the editor where you can run the code (currently implemented solution). Alternatively, I can make the editor a modal dialog of some sort.
Use multiple CodeMirror editors for each example on the page (could be up to 30 on a single page). I'm not sure how "heavy" those editors are, so I'm not sure if that's a good idea.
Have an edit button that "swaps" prettyfied code with a CodeMirror editor when editing is needed, so that the user can edit and run the examples without bothering with new windows. I'm not sure if I can make prettify and CodeMIrror's syntax highlighting to look the same.
Any ideas on how I should do this and why? I'm also open to suggestions about different code editors or syntax highlighters too, so if anybody has experience with this kind of thing, please tell me how you did it.
You could use the same technique that Marijn Haverbeke (the creator of CodeMirror) uses for the online version of his javascript book. It shows code snippets, and provides an edit-button that opens a javascript console at the bottom of the screen.
Look at this chapter for an example.

Simple dashboard application

I am trying to have some fun with dashboard widgets, so I tried a simple application :
There will be a button over the widget which when clicked will open
StackOverflow website in safari.
To implement it, I tried this:
Created a custom dashboard widget.
Added a button to it from library.
Associated gotoStackOverflow handler with onclick event.
in body of function gotoStackOverflow, I wrote this code:
window.open('https://stackoverflow.com/','Stackoverflow','width=400, height=300');
When I 'Run' the application I found no browser window appearing on click of the button.
Can anyone suggest me where I may be wrong or/ and some useful links to play with dashcode and dashboard widgets?
Your code runs fine, when I recreate it. Maybe you have pop-ups blocked in Safari?
have you added
<key>AllowNetworkAccess</key>
<true/>
to the plist? if not the outside world will not be available.
I have used following code to solve my problem:
function gotoStackOverflow(event)
{
widget.openURL("http://stackoverflow.com/");
}
cheers... :)
Miraaj

Categories

Resources