We're seeing some strange behavior with Facebook Send dialogs (Javascript SDK, FB.ui method). After the Send button is clicked, the dialog disappears, then reappears. The dialog does disappear after a while without any user action, but this delay varies (anywhere from a split second to several seconds).
The messages are delivered without problems.
How to reproduce:
https://apps.facebook.com/barclays_pingit/
Click on "Send Message" under the "Tell a friend" title
Add a recipient and message
Click "Send"
Or:
Click on "Make your own video"
Choose a friend, how much they owe you, and for what
Click "Make video"
You can skip to the end of the video, then click "Send video to ..."
Add a message Click "Send"
Does anyone have any ideas?
Sorry I can't give you the answer, but as I have the same problem, here is a quick patch:
var callback = function callback(response) {
var clear_callback = function(){
$('.fb_dialog').remove();
};
var arr = [250,1000,2000,3000,4000,5000,7000];
for (var i in arr)
{
setTimeout(clear_callback,arr[i]);
}
}
FB.ui(obj, callback);
Related
I'm having a Hero Card, which opens an URL when a users taps on it:
const message = new builder.Message(session);
message.attachmentLayout(builder.AttachmentLayout.carousel);
message.addAttachment(
new builder.HeroCard(session)
.title('Title')
.tap(builder.CardAction.openUrl(session, 'https://www.google.com'))
.images([builder.CardImage.create(session, url)]));
How can I change the tap() action so that instead of opening an URL a certain dialog is started? (Like I would do with session.beginDialog('DialogID');)?
Change the openUrl to either imBack (if you want the user to see the message sent to the bot) or postBack (to hide the message sent to the bot).
So something like
.tap(builder.CardAction.imBack(session, 'I have been tapped'))
I am trying to use Dialog API of Office Add-ins.
According to the doc, we could use Office.context.ui.messageParent to send a message from the Dialog box to the host page (eg, task pane). Whereas, I don't see how we could send a message from the host page to the Dialog box.
Does anyone know how to do this?
There are 2 possible solutions:
Send data as query params, when you open a pagein dialog box.
If there are in same domain then localstorage should be available in dialog which was opened.
setInterval(function () { var value = localStorage.getItem("dataFromDialog"); }, 500)
You can write the same value in localStorage in dialog localStorageSetItem("dataFromDialog", "message to parent")
This feature is now in preview
See https://learn.microsoft.com/en-us/office/dev/add-ins/develop/parent-to-dialog
Example from the post:
Office.context.ui.addHandlerAsync(
Office.EventType.DialogParentMessageReceived,
onMessageFromParent);
function onMessageFromParent(event) {
var messageFromParent = JSON.parse(event.message);
}
I am using the multiple uploader from openntf. I want to add an error message if the user has selected the files but not uploaded them.
I am thinking about some kind of "must click" button, and if the user is not uploading the files, it should give a message while saving the document saying: "Attachments are not uploaded. Do you want to continue?"
How can I check if the span tag : ynFileUploadInfo contains something or not? And depending on that, trigger the validation.
Add following client side JavaScript (CSJS) code to your save button:
var files = document.getElementById('ynFileUploadMulti').files;
if (files && files.length > 0) {
if ( ! confirm('Attachments are not uploaded. Do you want to continue?')) {
return false;
}
}
return true;
It will ask the user if listed (additional) attachments really don't have to be uploaded.
If user clicks "OK" then document will be saved without the listed attachments.
If user clicks "Cancel" then document won't be saved and user can click "Upload now" to upload the listed attachments.
Remark: if CSJS code returns false in an event then submit and server side JavaScript (SCJS) code won't get executed.
I'm having an annoying little interaction issue with qTip 2. A button on my page has a tip attached to it, set to appear on mouseover after a 500ms delay and disappear immediately on mouseout.
When the button is clicked, the whole view changes and that particular button disappears, so I force the tip to hide immediately (otherwise, it hangs around until the user moves their mouse, even though the button that triggered it is no longer visible).
The problem is that the immediate hide event doesn't seem to cancel the delayed show event if it happens to occur first. In other words, if the user points at the button and clicks it in less than 500ms, the hide event triggers (doing nothing) and then the show event triggers at 500ms, causing the tooltip to display even thought the button is no longer there (and in the wrong position to boot, since it can't position itself correctly without the button being visible).
Is there a way when I trigger the hide event to tell it to just stop there and not perform any other events?
Not Tested
You can use the show event to check if the button visible , and if not than don't show it....
Something like this:
events: {
show: function(event, api) {
var target = event.originalEvent.target;
if($("#idOfButton").length === 0 ) {
event.preventDefault();
//or try this (commednt the above and uncomment the code below)
//clearTimeout(api.timers.custom);
}
}
}
I solved it like this (#Daniel, your answer was close so I'll upvote you too):
events: {
show: function(event, api) {
if ($("#mybutton").is(':hidden')) {
try { event.preventDefault(); } catch(e) {}
}
}
};
This is the method that qTip's documentation recommends.
I have a link that downloads a file. As I click the link it displays dialog box with "save" and "open" option and "Cancel" and "OK" button. I want to find "OK" and "Cancel" button for cucumber test.
I took help from below link but didn't helped much.
How to test a confirm dialog with Cucumber?
**features code**
And I want to click "OK"
**steps code**
Then /^I want to click "([^\"]*)"$/ do |option|
retval = (option == "OK") ? "true" : "false"
page.evaluate_script('window.confirm = function() { return true; }')
page.click("OK")
end
The issue is that the dialogue you are talking about is not actually a part of the webpage at all. its part of the browser. Really, that part of the user interface it outside the control of the webpage.
All you can test is the webpage UP to the point of requesting the download, what the browser does with that request subsequently is not something you can script with cuke.
Sorry.