diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-02-02 13:15:29 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-02-02 13:15:29 +0100 |
commit | fecca29328713be500a8a5d391fdd4d2b6b0255b (patch) | |
tree | ee20e5073c12d1a533206db4a28f1fd6a14a48f9 | |
parent | c25d4e8e43654e0984856e004871c4b21a23a910 (diff) | |
parent | d32b758428145a8582f649423ca68a96792c9070 (diff) | |
download | forums-fecca29328713be500a8a5d391fdd4d2b6b0255b.tar forums-fecca29328713be500a8a5d391fdd4d2b6b0255b.tar.gz forums-fecca29328713be500a8a5d391fdd4d2b6b0255b.tar.bz2 forums-fecca29328713be500a8a5d391fdd4d2b6b0255b.tar.xz forums-fecca29328713be500a8a5d391fdd4d2b6b0255b.zip |
Merge remote-tracking branch 'prototech/ticket/12124' into develop
-rw-r--r-- | phpBB/assets/javascript/plupload.js | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/phpBB/assets/javascript/plupload.js b/phpBB/assets/javascript/plupload.js index 6b37b009a4..a90757d487 100644 --- a/phpBB/assets/javascript/plupload.js +++ b/phpBB/assets/javascript/plupload.js @@ -11,25 +11,30 @@ phpbb.plupload.ids = []; * @return undefined */ phpbb.plupload.initialize = function() { - phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0], - phpbb.plupload.rowTpl = $('#attach-row-tpl')[0].outerHTML; - - // Hide the basic upload panel and remove the attach row template. - $('#attach-row-tpl, #attach-panel-basic').remove(); - // Show multi-file upload options. - $('#attach-panel-multi').show(); + // Initialize the Plupload uploader. + uploader.init(); // Set attachment data. phpbb.plupload.setData(phpbb.plupload.data); phpbb.plupload.updateMultipartParams(phpbb.plupload.getSerializedData()); - // Initialize the Plupload uploader. - uploader.init(); + // Only execute if Plupload initialized successfully. + uploader.bind('Init', function() { + phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0], + phpbb.plupload.rowTpl = $('#attach-row-tpl')[0].outerHTML; - // Point out the drag-and-drop zone if it's supported. - if (!uploader.features.dragdrop) { - $('#drag-n-drop-message').show(); - } + // Hide the basic upload panel and remove the attach row template. + $('#attach-row-tpl, #attach-panel-basic').remove(); + // Show multi-file upload options. + $('#attach-panel-multi').show(); + }); + + uploader.bind('PostInit', function() { + // Point out the drag-and-drop zone if it's supported. + if (uploader.features.dragdrop) { + $('#drag-n-drop-message').show(); + } + }); }; /** @@ -92,7 +97,7 @@ phpbb.plupload.getSerializedData = function() { * @return int Returns the index of the file if it exists. */ phpbb.plupload.getIndex = function(attach_id) { - var index = phpbb.plupload.ids.indexOf(Number(attach_id)); + var index = $.inArray(Number(attach_id), phpbb.plupload.ids); return (index !== -1) ? index : false; }; @@ -308,7 +313,7 @@ phpbb.plupload.hideEmptyList = function() { * @return undefined */ phpbb.plupload.updateBbcode = function(action, index) { - var textarea = $(phpbb.plupload.form).find('textarea[name="message"]'), + var textarea = $('#message', phpbb.plupload.form), text = textarea.val(), removal = (action === 'removal'); |