2 * jQuery File Upload Plugin JS Example 7.0
3 * https://github.com/blueimp/jQuery-File-Upload
5 * Copyright 2010, Sebastian Tschan
8 * Licensed under the MIT license:
9 * http://www.opensource.org/licenses/MIT
12 /*jslint nomen: true, unparam: true, regexp: true */
13 /*global $, window, document */
18 // Initialize the jQuery File Upload widget:
19 $('#fileupload').fileupload({
20 // Uncomment the following to send cross-domain cookies:
21 //xhrFields: {withCredentials: true},
23 url: '/solgs/upload/prediction/genotypes/'
26 // Enable iframe cross-domain access via redirect option:
27 $('#fileupload').fileupload(
30 window.location.href.replace(
32 '/cors/result.html?%s'
36 if (window.location.hostname === 'blueimp.github.com') {
38 $('#fileupload').fileupload('option', {
39 url: '//jquery-file-upload.appspot.com/',
41 acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
45 fileTypes: /^image\/(gif|jpeg|png)$/,
46 maxFileSize: 20000000 // 20MB
58 // Upload server status check for browsers with CORS support:
61 url: '//jquery-file-upload.appspot.com/',
64 $('<span class="alert alert-error"/>')
65 .text('Upload server currently unavailable - ' +
67 .appendTo('#fileupload');
71 // Load existing files:
73 // Uncomment the following to send cross-domain cookies:
74 //xhrFields: {withCredentials: true},
75 url: $('#fileupload').fileupload('option', 'url'),
77 context: $('#fileupload')[0]
78 }).done(function (result) {
79 $(this).fileupload('option', 'done')
80 .call(this, null, {result: result});
84 // Initialize the Image Gallery widget:
85 $('#fileupload .files').imagegallery();
87 // Initialize the theme switcher:
88 $('#theme-switcher').change(function () {
89 var theme = $('#theme');
92 theme.prop('href').replace(
93 /[\w\-]+\/jquery-ui.css/,
94 $(this).val() + '/jquery-ui.css'