Not able to upload file by using dropbox on cordova app based on meteor - meteor

I want to use dropbox to upload files on my cordova app based on meteor i.e., user will be given option if he wants to upload file using dropbox if user click on the button then inappbrowser should open from where user will be authenticated and can upload file.
I am using below script
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="id_dropbox" data-app-key="xxxxxxxxxxx"></script>
This is the code
e.preventDefault();
Dropbox.choose({
linkType: "direct",
multiselect: false,
extensions: ['.doc'],
success: function(files) {
console.log("files ", files[0]);
if(files[0]['bytes']<1000000){
GetBlobDataDropbox(files) //function to upload file
}else{
alert('Size should be less than 1 mb')
}
},
error:function(error){console.log(error)},
cancel: function() {}
});
This is giving me below error.
maximum call stack size exceded.
Please tell how to resolve it.

This is the template code around my code. I am not using helper on this template.
Template.AttachResume.events({
'click #dropbox' : function(e){
console.log('dropbox123 ',Dropbox)
e.preventDefault();
Dropbox.choose({
linkType: "direct",
multiselect: false,
extensions: ['.doc', '.docx', '.pdf', '.rtf', '.txt', '.odt'],
success: function(files) {
console.log("files ", files[0]);
if(files[0]['bytes']<1000000){
GetBlobDataDropbox(files)
}else{
alert('Size should be less than 1 mb')
}
},
error:function(error){console.log(error)},
cancel: function() {}
});
},
})

Related

Extjs Iframe - displays "cannot connect error message"

I have an extjs iframe created as below which gets rendered onto a page when called using its xtype. However, the page displays "cannot connect to" the URL I specified in src parameter error message. But if I access the URL which I have in src parameter directly from the browser, I am able to access it. What is the issue here? Any suggestions would really help!
Ext.define('myComp', {
extend:'Ext.container.Container',
xtype: 'iframe'
itemId:'iframe204'
requires: [
'Ext.ux.IFrame',
],
layout:'fit',
height:'100%',
initComponent:
function() {
this.items = [];
this.items.push({
xtype:'uxiframe',
itemId:'myframe',
height:'100%',
src: someURL
});
this.callParent(arguments);
},
});

Change open graph title dynamically before sharing on Facebook

How do I change open graph title dynamically before sharing on face book?
The code is
FB.ui(
{
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object: {
'og:url': myurl,
'og:title': mytitle,
'og:description': mydescription,
'og:image': myimageURL,
},
}),
},
function(response) {
console.log(response);
// Action after response
},
);
You canĀ“t, that option was just a workaround that does not work anymore. You must provide correct OG tags in the source of the shared URL.

plupload can't show well and maybe it's style conflict

I use pluploadQueue to upload files which all the function could work well except the showing, I think maybe it's due to style confict. I want to know, does anyone have meet this issue before that?
using MVC + bootstrap modal + bootstrap dialog + plupload Queue
I can't upload picture, how to get reputaton?
var uploader1 = $("#uploader1").pluploadQueue({
// General settings
runtimes: 'html5,silverlight,flash,html4',
url: '#Url.Action("PLUpload", "Document")' + '?hasModification=true',
chunk_size: '2mb',
//Allow multiple files
max_file_count: 10,
// Specify what files to browse for
filters: {
// Maximum file size
max_file_size: '20mb',
// Specify what files to browse for
mime_types: [
{ title: "Allowed files", extensions: "#Model.PLUploadAllowedExtensions" }
]
},
// Rename files by clicking on their titles
rename: true,
// Sort files
sortable: true,
// Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
dragdrop: true,
//// Views to activate
views: {
list: true,
thumbs: false, // Show thumbs
active: 'list'
},
init: {
PostInit: function () {
// Called after initialization is finished and internal event handlers bound. http://www.plupload.com/examples/events
// The uploader must in html4 only mode be initialized fully before it's hidden: http://stackoverflow.com/questions/11898082/plupload-html4-add-files-dialog-not-triggering-in-ie
// Prepare uploader
if ('#Model.HasUploadFiles' == 'True') {
$("#hasChanged").attr('value', true);
$("#uploader1").show();
} else {
$("#uploader1").hide();
}
//// Force resize function is not working. this is the fix for window size
//$('#formID').css("overflow", "hidden");
},
},
// Flash settings
flash_swf_url: '#Url.Content("~/Scripts/plupload/Moxie.swf")',
// Silverlight settings
silverlight_xap_url: '#Url.Content("~/Scripts/plupload/Moxie.xap")'
});

How to correctly waitFor() a saveScreenShot() end of execution

Here is my full first working test:
var expect = require('chai').expect;
var assert = require('assert');
var webdriverjs = require('webdriverjs');
var client = {};
var webdriverOptions = {
desiredCapabilities: {
browserName: 'phantomjs'
},
logLevel: 'verbose'
};
describe('Test mysite', function(){
before(function() {
client = webdriverjs.remote( webdriverOptions );
client.init();
});
var selector = "#mybodybody";
it('should see the correct title', function(done) {
client.url('http://localhost/mysite/')
.getTitle( function(err, title){
expect(err).to.be.null;
assert.strictEqual(title, 'My title page' );
})
.waitFor( selector, 2000, function(){
client.saveScreenshot( "./ExtractScreen.png" );
})
.waitFor( selector, 7000, function(){ })
.call(done);
});
after(function(done) {
client.end(done);
});
});
Ok, it does not do much, but after working many hours to get the environement correctly setup, it passed. Now, the only way I got it working is by playing with the waitFor() method and adjust the delays. It works, but I still do not understand how to surely wait for a png file to be saved on disk. As I will deal with tests orders, I will eventually get hung up from the test script before securely save the file.
Now, How can I improve this screen save sequence and avoid loosing my screenshot ?
Since you are using chaning feature of webdriverjs it is wrong to use callback in waitFor function.
Function saveScreenshot is also chained. So the proper way would be the following:
it('should see the correct title', function(done) {
client.url('http://localhost/mysite/')
.getTitle( function(err, title){
expect(err).to.be.null;
assert.strictEqual(title, 'My title page' );
})
.waitFor( selector, 2000)
.saveScreenshot( "./ExtractScreen.png" )
.call(done);
});

Yes/No/Yes to All/No to All message box asp.net

I want to show a confirmation box include 4 options: Yes/No/Yes to All/No to All after user click a button in my aspx page. I have seen a lot of sample but it only contain Yes/No option. Please show me the way to do that.
There's no native javascript function for that (I guess you saw samples that are using confirm function).
Give a try to a javascript library, that create pseudo dialog.
One of the most used is JQueryUI. Especially, look at the Dialog confirmation sample, and you'll ends with something like:
<script>
$(function() {
$( "#dialog-confirm" ).dialog({
resizable: false,
height:140,
modal: true,
buttons: {
"Yes": function() {
// Handler for Yes
},
"No": function() {
// Handler for No
},
"Yes to all": function() {
// Handler for Yes to all
},
"No to all": function() {
// Handler for no to all
}
}
});
});
</script>

Resources