Ok guys so this is a branch off my other tutorial "Uploader for the New Editor" so if you haven't read that yet Read It Now So this is simple, below add the code right after the Instantiated AWC Core
That is that, make sure you add the API key Any more information please let me assist you, the uploader can send Documents and Images as well as VIDEOS!
- Code:
avacweb_chat_config.add_event('onload', function () {
var script = document.createElement('script');
script.id="filepicker";
script.type="text/javascript";
script.src="//api.filepicker.io/v1/filepicker.js";
var body=$('body');
body.append(script);
function getPick(){
var textArea = $(avacweb_chat.id('message'));
filepicker.setKey('API KEY HERE');
filepicker.pick({
mimetypes: ['text/*','image/*','video/*'],
services:['COMPUTER','WEBCAM','VIDEO']
},function(FPFile) {
var docFile = FPFile.url;
var type= FPFile.mimetype;
var file = FPFile.url+'+'+FPFile.filename.replace(/\s/g,"");
if(/^.*text.*$/.test(type)) {
textArea.val(textArea.val()+'[url]'+file+'[/url]');
} else if(/^.*image.*$/.test(type)) {
textArea.val(textArea.val()+'[url='+file+'][img]'+file+'[/img][/url]');
}else {
textArea.val(textArea.val()+'[flash]'+file+'[/flash]');
}
avacweb_chat.submit();
});
}
$(avacweb_chat.id('achat_color_button')).after('<div class="achat_button" id="uploadImage">Share Image</div>');
$(avacweb_chat.id('uploadImage')).on('click',function(){
getPick();
});
});
That is that, make sure you add the API key Any more information please let me assist you, the uploader can send Documents and Images as well as VIDEOS!