aboutsummaryrefslogtreecommitdiffstats
path: root/jm2l/static/js/plugins.js
diff options
context:
space:
mode:
Diffstat (limited to 'jm2l/static/js/plugins.js')
-rw-r--r--jm2l/static/js/plugins.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/jm2l/static/js/plugins.js b/jm2l/static/js/plugins.js
index f887480..78eecbf 100644
--- a/jm2l/static/js/plugins.js
+++ b/jm2l/static/js/plugins.js
@@ -22,3 +22,40 @@
}());
// Place any jQuery/helper plugins in here.
+function HandleControls() {
+// Trig some javascript to handle New Dialog content
+ $.each( $('.fileupload'),
+ function( NumCtrl, Ctrl ) {
+ $("#"+Ctrl.id).fileupload({
+ // Uncomment the following to send cross-domain cookies:
+ //xhrFields: {withCredentials: true},
+ //url: '/uploader/proceed/'
+ url: this.action
+ });
+ // Enable iframe cross-domain access via redirect option:
+ $("#"+Ctrl.id).fileupload(
+ 'option',
+ 'redirect',
+ window.location.href.replace(
+ /\/[^\/]*$/,
+ '/cors/result.html?%s'
+ )
+ );
+ $("#"+Ctrl.id).addClass('fileupload-processing');
+ $.ajax({
+ // Uncomment the following to send cross-domain cookies:
+ //xhrFields: {withCredentials: true},
+ //url: this.action,
+ url: $("#"+Ctrl.id).fileupload('option', 'url'),
+ //url: "uploader/proceed/",
+ dataType: 'json',
+ context: $("#"+Ctrl.id)[0]
+ }).always(function () {
+ $(this).removeClass('fileupload-processing');
+ }).done(function (result) {
+ $(this).fileupload('option', 'done')
+ .call(this, $.Event('done'), {result: result}); //$(this)});
+ });
+ }
+ );
+} \ No newline at end of file