;"use strict";
var contented = (function($, currentScriptPath) {
"use strict";
var baseURL = currentScriptPath.replace('sdk.js', '');
/**
* contented_SupportsDrop returns whether drag-and-drop is supported by this
* browser.
*
* @return bool
*/
var contented_SupportsDrop = function() {
return ('ondrop' in window && 'FormData' in window && 'FileReader' in window);
}
/**
* contented_EnableDrop enables drag-and-drop upload on a DOM element.
* The class "is-dragover" will be toggled on the target element.
*
* @param any element Drop target (string selector / DOMElement / jQuery)
* @param Function onUploaded Called with a property object for every uploaded file
* @param Function onClose Called when the widget should be destroyed
*/
var contented_EnableDrop = function(elementSelector, onUploaded, onClose) {
onUploaded = onUploaded || function(){};
onClose = onClose || function(){};
if ($(elementSelector).length != 1) {
return; // should only find one element
}
var element = $(elementSelector)[0];
//
// Create a new div for ourselves on top of the existing area
$.get(baseURL + "about", function(ret) {
$("title").text( ret.AppTitle );
var extraText = "";
if (ret.MaxUploadBytes > 0) {
extraText = " (max " + Math.floor(ret.MaxUploadBytes / (1024*1024)) + " MiB)";
}
$.get(baseURL + "widget.html", function(widgetHtml) {
var $f = $("