芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/question/type/ddimageortext/amd/build/form.min.js
define(["jquery","core/dragdrop"],function(a,b){"use strict";var c={maxBgImageSize:null,maxDragImageSize:null,fp:null,init:function(b,d){c.maxBgImageSize=b,c.maxDragImageSize=d,c.fp=c.filePickers(),a("#id_previewareaheader").append('
'),c.updateVisibilityOfFilePickers(),c.setOptionsForDragItemSelectors(),c.setupEventHandlers(),c.waitForFilePickerToInitialise()},waitForFilePickerToInitialise:function(){return null===c.fp.file("bgimage").href?void setTimeout(c.waitForFilePickerToInitialise,1e3):(M.util.js_pending("dragDropToImageForm"),a("form.mform").on("change",".filepickerhidden",function(){M.util.js_pending("dragDropToImageForm"),c.loadPreviewImage()}),void c.loadPreviewImage())},loadPreviewImage:function(){a("fieldset#id_previewareaheader .dropbackground").one("load",c.afterPreviewImageLoaded).attr("src",c.fp.file("bgimage").href)},afterPreviewImageLoaded:function(){var b=a("fieldset#id_previewareaheader .dropbackground");c.constrainImageSize(b,c.maxBgImageSize),c.createDropZones(),M.util.js_complete("dragDropToImageForm")},constrainImageSize:function(a,b){var c=Math.max(a.width()/b.width,a.height()/b.height);c>1&&a.css("width",Math.floor(a.width()/c)),a.addClass("constrained")},createDropZones:function(){var b=a(".dropzones");b.empty();var d=c.fp.file("bgimage").href;if(null!==d){for(var e=c.form.getFormValue("nodropzone",[]),f=0;f
')}else""!==i&&b.append('
'+i+"
")}}c.waitForAllDropImagesToBeLoaded()}},waitForAllDropImagesToBeLoaded:function(){var b=a(".dropzones img").not(function(a,b){return c.imageIsLoaded(b)});return b.length>0?void setTimeout(function(){c.waitForAllDropImagesToBeLoaded()},100):void c.updateDropZones()},imageIsLoaded:function(a){return a.complete&&0!==a.naturalHeight},updateDropZones:function(){var b=c.fp.file("bgimage").href;if(null!==b){for(var d=a("fieldset#id_previewareaheader .dropbackground").offset(),e=c.form.getFormValue("nodropzone",[]),f=0;f
'+b[l]+"");var m=j.find('option[value="'+l+'"]');parseInt(l)===parseInt(k)?m.attr("selected",!0):c.isItemUsed(parseInt(l))&&m.attr("disabled",!0)}}},isItemUsed:function(b){return 0!==b&&(!c.form.getFormValue("drags",[b-1,"infinite"])&&0!==a("fieldset#id_dropzoneheader select").filter(function(c,d){return parseInt(a(d).val())===b}).length)},dragStart:function(d){var e=a(d.target).closest(".droppreview"),f=b.prepare(d);f.start&&b.start(d,e,function(a,b,d){c.dragMove(d)},function(){c.dragEnd()})},dragMove:function(b){var d=a("fieldset#id_previewareaheader .dropbackground"),e=d.offset(),f=b.data("dropNo"),g=b.offset(),h=Math.round(g.left-e.left),i=Math.round(g.top-e.top);h=Math.max(0,Math.min(h,d.width()-b.width()-10)),i=Math.max(0,Math.min(i,d.height()-b.height()-10)),c.form.setFormValue("drops",[f,"xleft"],h),c.form.setFormValue("drops",[f,"ytop"],i)},dragEnd:function(){c.updateDropZones()},form:{toNameWithIndex:function(a,b){for(var c=a,d=0;d