Your IP : 3.148.180.219


Current Path : /var/www/ooareogundevinitiative/wp-content/plugins/advanced-uploader/js/
Upload File :
Current File : /var/www/ooareogundevinitiative/wp-content/plugins/advanced-uploader/js/upload.min.js

"use strict";var default_action,default_url,blobSlice,requestFileSystem,up_plupload,max_upload=0,max_file_size=0,max_file_size_display=0,adv_max_file_size_display=0,msgProgLabel=document.createElement("label");msgProgLabel.className="pLabel";var msgProgress=document.createElement("progress"),msgProgressDiv=document.createElement("div");msgProgressDiv.className="progress",msgProgressDiv.appendChild(msgProgLabel),msgProgressDiv.appendChild(msgProgress);var completeUpload=function(e,t,i){if(void 0!==t.thumbs&&t.chunksUploaded){var s=new FormData;if(s.append("action","adv_upload_dropzone"),s.append("security",security.value),s.append("filename",t.name),s.append("fileDest",t.dest),s.append("album",t.album),s.append("dzuuid",t.upload.uuid),s.append("dztotalchunkcount",t.upload.totalChunkCount),s.append("destinations",JSON.stringify(destinations)),t.thumbs){s.append("meta",JSON.stringify(t.thumbsImageMeta));for(var a=0;a<t.thumbsKeys.length;a++){for(var n,o=t.thumbsKeys[a],r=atob(t.thumbsDataURL[o].split(",")[1]),l=[],d=0;d<r.length;d++)l.push(r.charCodeAt(d));n=t.name.split(".").pop().match(/jpg/)?new Blob([new Uint8Array(l)],{type:"image/jpeg"}):new Blob([new Uint8Array(l)],{type:"image/png"}),s.append("thumbs[]",n,t.thumbsImageMeta[o].file)}}jQuery(t.previewElement).find(".dz-status-message span").html("Completing Upload"),jQuery.ajax({type:"post",url:ajaxurl,data:s,enctype:"multipart/form-data",encoding:"multipart/form-data",cache:!1,processData:!1,contentType:!1}).done(function(s){!1!==s.success?(jQuery(t.previewElement).find(".dz-status-message span").html('<a href="'+s.data.editLink+'">Edit</a>'),"function"==typeof i?i("success"):"function"==typeof t.sucessCallback&&t.sucessCallback("success")):e.emit("error",t,"media-upload-error")}).error(function(i,s,a){e.emit("error",t,s)})}else"function"==typeof i&&(t.sucessCallback=i)},createThumbImage=function(e,t,i,s){var a=new FileReader;a.onload=function(){i.split(".").pop();var n=new Image;n.src=a.result,n.onload=function(){var i=n.width,a=n.height;if(a>sizes.thumbnail.height||i>sizes.thumbnail.width){var o={},r={},l=[],d=a,c=i,p="";for(var u in sizes){a=d,i=c;var m=sizes[u].width,g=sizes[u].height;if(a>g||i>m){i>d?(a*=m/i,i=m):(i*=g/a,a=g);var h="-"+(i=Math.round(i))+"x"+(a=Math.round(a))+".jpg";if(-1==p.search(h)){p+=h+";";var f=document.createElement("canvas");f.width=i,f.height=a,f.getContext("2d").drawImage(this,0,0,i,a),l.push(u),r[u]=f.toDataURL("image/jpeg",.9)}o[u]={},o[u].file=h,o[u].width=i,o[u].height=a,o[u]["mime-type"]="image/jpeg"}}t.thumbs=!0,t.thumbsDataURL=r,t.thumbsImageMeta=o,t.thumbsKeys=l,s(e,t)}else t.thumbs=!1;s(e,t)}},a.readAsDataURL(t)},pdf=function(e,t,i,s,a){var n=new FileReader;n.onload=function(){pdfjsLib.getDocument({data:this.result}).promise.then(function(i){i.getPage(1).then(function(i){var n=[];for(var o in sizes)n.push(o);!function i(n,o,r,l,d,c){var p=r.pop(),u=n.getViewport({scale:1}),m=sizes[p].width/u.width,g=sizes[p].height/u.height,h=m>g?g:m,f=n.getViewport({scale:h}),v=document.createElement("canvas"),y=v.getContext("2d");v.height=f.height,v.width=f.width;var w="-"+v.width+"x"+v.height+".png";if(d[p]={},d[p].file=w,d[p].width=v.width,d[p].height=v.height,d[p]["mime-type"]="image/png",-1==o.search(w)){o+=w+";";var b={canvasContext:y,viewport:f};n.render(b).promise.then(function(){l.push(p),c[p]=v.toDataURL("image/png"),r.length>0?i(n,o,r,l,d,c):(t.thumbs=!0,t.thumbsDataURL=c,t.thumbsImageMeta=d,t.thumbsKeys=l,a.css("background","url("+c.thumbnail+")"),s(e,t))})}else r.length>0?i(n,o,r,l,d,c):(t.thumbs=!0,t.thumbsDataURL=c,t.thumbsImageMeta=d,t.thumbsKeys=l,alert(a),s(e,t))}(i,"",n,[],{},{})})})},n.readAsArrayBuffer(t)},destination={files:[],options:"",group:"",catOpt:"",dropzone:null,callback:null,destSelected:!1,dlg:jQuery("<div id='dest-popup' />"),select:function(e,t){var i,s;if(this.dropzone=t,this.files.push(e),jQuery(e.previewElement).find(".dz-status-message span").html("Select Destination"),""===this.options){for(this.options='<option value="">Select Destination</option>',this.group="",i=0;i<destinations.length;i++)this.group!=destinations[i][2]&&(""!==this.group&&(this.options+="</optgroup>"),this.options+='<optgroup label="'+destinations[i][2]+'">'),this.options+='<option value="'+i+'">'+destinations[i][0]+"</option>",this.group=destinations[i][2];""!==this.group&&(this.options+="</optgroup>")}if(""===this.catOpt)for(this.catOpt='<option value="">Select category</option>',i=0;i<categories.length;i++)this.catOpt+='<option class="'+categories[i][2]+'" value="'+i+'">'+categories[i][1]+"</option>";1===this.files.length?(s='<p id="eachSelect">Select destination for each file</p>',this.dlg.html(s)):2===this.files.length&&(s="<p>Select destination for all files",s+='<select id="dest">',s+=this.options,s+="</select>",s+='<span id="wg_" class="hide gallery_name"><input class="alignright" type=text />Gallery name: </span>',s+='<select id="cat" class="hide">',s+=this.catOpt,s+="</select>",s+="</p>",s+='<div class="dashed"></div>',jQuery(s).insertBefore("#eachSelect")),s='<div class="option">'+e.name+'<select id="dest'+this.files.length+'" class="file" name="file'+this.files.length+'">',s+=this.options,s+="</select>",s+='<span id="wg_'+this.files.length+'" class="hide gallery_name"><input class="alignright" type=text />Gallery name:</span>',s+='<select id="cat'+this.files.length+'" class="hide">',s+=this.catOpt,s+="</select></div>",this.dlg.append(s),"audio/mp3"==e.type&&new jsmediatags.Reader(e).setTagsToRead(["album"]).read({onSuccess:function(t){e.album=t.tags.album},onError:function(e){console.log(":(",e.type,e.info)}});var a=function(t){var i=0;jQuery("#dest-popup .error").remove();var s=jQuery("#dest :selected").val(),a=jQuery(".file :selected");if(void 0===s&&void 0===a)return!1;if("dest"==t.target.id&&void 0===s)return!1;if(void 0!==s&&""!==s){for(i=0;i<destination.files.length;i++)destination.files[i].dest=s;if(destinations[s]&&"Category"==destinations[s][2]){if(""===jQuery("#adv_cat").val())return jQuery("<div>").attr({id:"adv_err_cat",class:"clear alignright media-item error"}).html("You must enter an existing category").insertAfter("#ac_cat"),!1;var n=jQuery("#cat")[0].selectedIndex-1,o=categories[n][3];for(i=0;i<destination.files.length;i++){destination.files[i].album=categories[n][0];var r=destination.files[i].type;if(""!=o&&"image"!=r.split("/")[0]&&"application/pdf"!=r)jQuery(destination.files[i].previewElement).find(".dz-image img").attr("src",o)}}else if(destinations[s]&&"Wordpress Gallery"==destinations[s][2]&&"new"==destinations[s][3])return""===jQuery("#wg_ input").val()?(jQuery("<div>").attr({id:"adv_err_gal",class:"clear alignright media-item error"}).html("You must enter a name for the new gallery").insertAfter("#wg_ input"),!1):(jQuery.post(ajaxurl,{action:"adv_file_upload_new_post",security:security,title:JSON.stringify(new Array(jQuery("#wg_ input").val()))},function(e){destination.dropzone.processQueue(),destination.destSelected=!0,destination.dlg.dialog("close")},"json"),!1);destination.dropzone.processQueue(),destination.destSelected=!0,destination.dlg.dialog("close")}else{if(!a.length)return jQuery("<div>").attr({class:"clear alignright media-item error"}).html("You must enter a destination").insertAfter("#dest"),!1;var l=!1,d=!1,c={};for(i=0;i<a.length;i++){var p=a[i].value;if(0===p.length)jQuery("<div>").attr({class:"clear alignright media-item error"}).html("You must enter a destination").insertAfter("#dest"+i),l=!0;else if(destination.files[i].dest=p,destinations[p]&&"Category"==destinations[p][2]){var u=i+1;""===jQuery("#adv_cat"+u).val()&&(jQuery("<div>").attr({id:"adv_err_cat"+i,class:"clear alignright media-item error"}).html("You must enter an existing category").insertAfter("#ac_cat"+i),d=!0);n=jQuery("#cat"+u)[0].selectedIndex-1,o=categories[n][3];destination.files[i].album=categories[n][0];r=destination.files[i].type;if(""!=o&&"image"!=r.split("/")[0]&&"application/pdf"!=r)jQuery(destination.files[i].previewElement).find(".dz-image img").attr("src",o)}else destinations[p]&&"Wordpress Gallery"==destinations[p][2]&&"new"==destinations[p][3]&&(""===jQuery("#wg_"+i+" input").val()&&(jQuery("<div>").attr({id:"adv_err_gal"+i,class:"clear alignright media-item error"}).html("You must enter a name for the new gallery").insertAfter("#wg_"+i+" input"),d=!0),void 0===c[jQuery("#wg_"+i+" input").val()]?c[jQuery("#wg_"+i+" input").val()]=i.toString():c[jQuery("#wg_"+i+" input").val()]+=","+i.toString())}if(l)return jQuery("<div>").attr({class:"clear alignright media-item error"}).html("You must enter a destination for all files").insertAfter("#dest"),!1;if(d)return!1;if(!jQuery.isEmptyObject(c))return jQuery.post(ajaxurl,{action:"adv_file_upload_new_post",security:security,title:JSON.stringify(Object.keys(c))},function(t){for(var i in t)for(var s=c[t[i].title].split(","),a=0;a<s.length;a++)destination.files[s[a]].album=t[i].id;destination.dropzone.processQueue(),jQuery(e.previewElement).find(".dz-status-message span").html("Uploading..."),destination.destSelected=!0,destination.dlg.dialog("close")},"json"),!1;destination.dropzone.processQueue(),jQuery(e.previewElement).find(".dz-status-message span").html("Uploading..."),destination.destSelected=!0,destination.dlg.dialog("close")}};jQuery(document).on("change",".ui-dialog select",function(e){var t=e.target.id.match(/^dest(.*)/)[1],i="cat"+t;if(destinations[e.target.selectedIndex-1]&&"Category"==destinations[e.target.selectedIndex-1][2])jQuery("#wg_"+t).hide(),jQuery("#adv_err_gal"+t).remove(),0===jQuery("#ac_"+i).length?(jQuery("#"+i).combobox({desc:"adv_"+i,id:"ac_"+i}),""===t&&(t=1),"undefined"!==destination.files[t-1].hasOwnProperty("album")&&jQuery("#ac_"+i+" input").autocomplete("search",destination.files[t-1].album)):jQuery("#ac_"+i).show();else if(destinations[e.target.selectedIndex-1]&&"Wordpress Gallery"==destinations[e.target.selectedIndex-1][2]&&"new"==destinations[e.target.selectedIndex-1][3])jQuery("#ac_"+i).hide(),jQuery("#adv_err_"+i).remove(),jQuery("#wg_"+t).css("display","block");else{jQuery("#wg_"+t).hide(),jQuery("#ac_"+i).hide(),jQuery("#adv_err_"+i).remove(),jQuery("#adv_err_gal"+t).remove();var s=jQuery(".file :selected");""!==t&&1!=s.length||a(e)}}),this.dlg.dialog({title:"Destination",dialogClass:"wp-dialog",width:"auto",modal:!0,autoOpen:!1,closeOnEscape:!0,buttons:[{text:"Cancel",class:"button-primary",click:function(){jQuery(this).dialog("close")}},{text:"Select",class:"button-primary",click:a}],close:function(){if(!destination.destSelected)for(i=0;i<destination.files.length;i++)destination.dropzone.removeFile(destination.files[i]);destination.files=[],destination.destSelected=!1,jQuery(this).dialog("destroy").remove()}}),this.dlg.dialog("open")}};jQuery(document).ready(function(e){Dropzone.options.dragDropArea={maxFilesize:1024,chunking:!0,chunkSize:max_upload,forceChunking:!0,previewsContainer:"#media-items",previewTemplate:'<div class="dz-preview dz-file-preview"><div class="dz-image"><img data-dz-thumbnail=""></div><div class="dz-details"><div class="dz-filename"><span data-dz-name=""></span></div><div class="dz-size">Size<span data-dz-size=""></span></div><div class="dz-status-message"><span data-dz-status=""></span></div><div class="dz-error-message"><span data-dz-errormessage=""></span></div></div><div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress=""></span></div><div class="dz-success-mark"><svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"><title>Check</title><defs></defs><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"><path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF" sketch:type="MSShapeGroup"></path></g></svg></div><div class="dz-error-mark"><svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"><title>Error</title><defs></defs><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"><g id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475"><path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" sketch:type="MSShapeGroup"></path></g></g></svg></div></div>',autoProcessQueue:!1,accept:function(e,t){t(),destination.select(e,this);var i=jQuery(e.previewElement).find(".dz-image");switch(adv_browser&&e.type.startsWith("image")?createThumbImage(this,e,e.name,completeUpload):adv_browser&&"application/pdf"==e.type&&"undefined"!=typeof pdfjsLib?pdf(this,e,e.name,completeUpload,i):e.thumbs=!1,e.type.split("/")[0]){case"image":break;case"audio":i.css("background","url(../wp-includes/images/media/audio.png) center no-repeat");break;case"video":i.css("background","url(../wp-includes/images/media/video.png) center no-repeat");break;case"text":i.css("background","url(../wp-includes/images/media/text.png) center no-repeat");break;case"application":switch(e.type){case"application/pdf":i.css("background","url(../wp-includes/images/media/document.png) center no-repeat");break;case"application/x-zip-compressed":i.css("background","url(../wp-includes/images/media/archive.png) center no-repeat");break;case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":i.css("background","url(../wp-includes/images/media/document.png) center no-repeat");break;case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":i.css("background","url(../wp-includes/images/media/spreadsheet.png) center no-repeat");break;default:i.css("background","url(../wp-includes/images/media/default.png) center no-repeat")}break;default:i.css("background","url(../wp-includes/images/media/default.png) center no-repeat")}i.css("background-size","contain")},chunksUploaded:function(e,t){e.chunksUploaded=!0,completeUpload(this,e,t)}},e.widget("custom.combobox",{_create:function(){this.wrapper=e("<div>").addClass("custom-combobox").attr("id",this.options.id).insertAfter(this.element),this.element.hide(),this._createAutocomplete(),this._createShowAllButton()},_createAutocomplete:function(){var t=this.element.children(":selected"),i=t.val()?t.text():"";this.input=e("<input>").appendTo(this.wrapper).attr("id",this.options.desc).attr("name",this.options.desc).val(i).attr("title","").addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-all").autocomplete({delay:0,minLength:0,source:e.proxy(this,"_source")}),this._on(this.input,{autocompleteselect:function(e,t){t.item.option.selected=!0,this._trigger("select",e,{item:t.item.option})},autocompletechange:"_removeIfInvalid"})},_createShowAllButton:function(){var t=this.input,i=!1;e("<a>").attr("tabIndex",-1).attr("title","Show All Items").height(e("#"+this.options.desc).innerHeight()-6).appendTo(this.wrapper).button({icons:{primary:"ui-icon-triangle-1-s"},text:!1}).removeClass("ui-corner-all").addClass("custom-combobox-toggle").mousedown(function(){i=t.autocomplete("widget").is(":visible")}).click(function(){t.focus(),i||t.autocomplete("search","")})},_source:function(t,i){var s=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");i(this.element.children("option").map(function(){var i=e(this).text();if(this.value&&(!t.term||s.test(i)))return{label:i,value:i,option:this}}))},_removeIfInvalid:function(t,i){if(!i.item){var s=this.input.val().toLowerCase(),a=!1,n="";if(this.element.children("option").each(function(){if(e(this).text().toLowerCase()===s)return this.selected=a=!0,n=e(this).text(),!1}),a)return this.input.val(n),this.element.val(n),void(this.input.data("ui-autocomplete").term=n);this.input.val(""),this.element.val(""),this.input.data("ui-autocomplete").term=""}},_destroy:function(){this.wrapper.remove(),this.element.show()}})});