WordPress File Upload - Version 3.9.5

Version Description

  • added environment variable 'Upload Progress Mode' that defines how upload progress is calculated
  • improved progress bar calculation
  • minor bug fixes in AJAX functions mentioned by Hanneke Hoogstrate http://www.blagoworks.nl/
Download this release

Release Info

Developer nickboss
Plugin Icon 128x128 WordPress File Upload
Version 3.9.5
Comparing to
See all releases

Code changes from version 3.9.4 to 3.9.5

js/wordpress_file_upload_functions.js CHANGED
@@ -1,3 +1,3 @@
1
- function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var t=e.split(";"),a=0;a<t.length;a++)const_txt=t[a].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_Load_Code_Connectors(e){"undefined"==typeof wfu_Code_Objects&&(wfu_Code_Objects={}),wfu_Code_Objects[e]=new wfu_Code_Object(e);for(var t=0;t<Code_Initializators.length;t++)wfu_Code_Objects[e].additem(Code_Initializators[t](e))}function wfu_Code_Object(e){this.sid=e,this.items=[],this._calc_prioritized_list=function(e){for(var t,a,s=[],n=[],i=[],l=0;l<this.items.length;l++)t=this.items[l],t[e]&&(a=-1,t.priority&&(a=t.priority),t[e].priority&&(a=t[e].priority),a>=0?(s.push(a),n.push(l)):i.push(l));for(var l=1;l<s.length;l++)for(var r=l;r<s.length;r++)if(s[r]<s[l-1]){var o=s[r];s[r]=s[l-1],s[l-1]=o;var o=n[r];n[r]=n[l-1],n[l-1]=o}return n.concat(i)},this.additem=function(e){this.items.push(e)},this.apply_filters=function(e,t){if("undefined"==typeof t)return null;var a=this._calc_prioritized_list(e);if(0==a.length)return t;for(var s=0;s<a.length;s++){var n=this.items[a[s]],i=null;"function"==typeof n[e]?i=n[e]:"function"==typeof n[e].func&&(i=n[e].func),null!=i&&(t=i.apply(this,Array.prototype.slice.call(arguments,1)),arguments[1]=t)}return t},this.do_action=function(e){var t=this._calc_prioritized_list(e);if(0!=t.length)for(var a=0;a<t.length;a++){var s=this.items[t[a]],n=null;"function"==typeof s[e]?n=s[e]:"function"==typeof s[e].func&&(n=s[e].func),null!=n&&n.apply(this,Array.prototype.slice.call(arguments,1))}}}function wfu_plugin_load_action(e){wfu_install_unload_hook();var t=document.getElementById("selectsubdiredit_"+e);t&&"none"!=t.style.display&&wfu_attach_element_handlers(t,new Function("wfu_selectsubdiredit_change("+e+");"))}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString&&""!=GlobalData.UploadInProgressString.trim()?GlobalData.consts.wfu_pageexit_prompt:void 0}function wfu_Check_Browser_Capabilities(){if("undefined"==typeof wfu_BrowserCaps){wfu_BrowserCaps=new Object;var e=wfu_GetHttpRequestObject();wfu_BrowserCaps.supportsAJAX=null!=e,wfu_BrowserCaps.supportsUploadProgress=!!(e&&"upload"in e&&"onprogress"in e.upload);var t=null;try{var t=new FormData}catch(a){}wfu_BrowserCaps.supportsHTML5=null!=t;var a=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=a,wfu_BrowserCaps.supportsDRAGDROP=window.FileReader?!0:!1,wfu_BrowserCaps.supportsAnimation=wfu_check_animation(),wfu_BrowserCaps.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}}function wfu_check_animation(){var e=!1,t="animation",a="",s="Webkit Moz O ms Khtml".split(" "),n="",i=document.createElement("DIV");if(i.style.animationName&&(e=!0),e===!1)for(var l=0;l<s.length;l++)if(void 0!==i.style[s[l]+"AnimationName"]){n=s[l],t=n+"Animation",a="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var t=[].slice.call(arguments),a="",s="",n=1;n<t.length;n++)s=""==a||""==t[n]?"":e,a+=s+t[n];return a}function wfu_plugin_decode_string(e){for(var t,a,s=0,n="";s<e.length;)t=parseInt(e.substr(s,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(s+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(s+=2,2),16))<<6)+(63&parseInt(e.substr(s+=2,2),16)),n+=String.fromCharCode(a),s+=2;return n}function wfu_plugin_encode_string(e){var t=0,a="",s="";for(t=0;t<e.length;t++)num=e.charCodeAt(t),num>=2048?num=((16773120&num|917504)<<4)+((4032&num|8192)<<2)+(63&num|128):num>=128&&(num=((65472&num|12288)<<2)+(63&num|128)),s=num.toString(16),(1==s.length||3==s.length||5==s.length)&&(s="0"+s),a+=s;return a}function wfu_randomString(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",a=e,s="",n=0;a>n;n++){var i=Math.floor(Math.random()*t.length);s+=t.substring(i,i+1)}return s}function wfu_addEventHandler(e,t,a){e.addEventListener?e.addEventListener(t,a,!1):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a}function wfu_attach_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],s=0;s<a.length;s++)wfu_addEventHandler(e,a[s],t)}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_filedetails_showhide(e,t,a){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+t),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+t)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+t),i=document.getElementById("wfu_messageblock_subheader_"+e+"_"+t),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+t);a?(s.style.display="",n.style.display="none",i.style.display="",l.value=""):(s.style.display="none",n.style.display="",i.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var t=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),a="wfu_messageblock_"+e+"_",s=[];null!=t;)1===t.nodeType&&t.id.substr(0,a.length)==a&&s.push(t.id.substr(t.id.lastIndexOf("_")+1)),t=t.nextSibling;return s}function wfu_get_filelist(e,t){t="undefined"!=typeof t?t:!0;var a=document.getElementById("upfile_"+e),s=a.files;return s||(s=a.value?[{name:a.value}]:[]),t&&"undefined"!=typeof a.filearray&&(s=a.filearray),s}function wfu_add_files(e,t){var a=document.getElementById("upfile_"+e);"undefined"==typeof a.filearray&&(a.filearray=Array(),a.filearrayprops=Array()),document.getElementById("uploadform_"+e).reset(),a.filearray.length=a.filearrayprops.length=0;for(var s=0;s<t.length;s++)a.filearray.push(t[s].file),a.filearrayprops.push(t[s].props)}function wfu_filedetails_toggle(e,t){var a=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+t),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+t));wfu_filedetails_showhide(e,t,"none"==a.style.display)}function wfu_headerdetails_showhide(e,t){var a=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up")),s=document.getElementById("wfu_messageblock_arrow_"+e+"_down"),n=document.getElementById("wfu_messageblock_subheader_"+e),i=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),r=document.getElementById("wfu_messageblock_header_"+e+"_state"),o=wfu_get_file_ids(e);if(t){a.style.display="",s.style.display="none",("none"!=i.style.display||"none"!=l.style.display)&&(n.style.display=""),r.value="";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+o[_]).value}else{a.style.display="none",s.style.display="",n.style.display="none",r.value="none";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var t=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==t.style.display)}function wfu_attach_cancel_event(e,t,a,s){var n=document.getElementById("fileName_"+e);n&&(n.onkeyup=function(i){if(27==i.keyCode&&GlobalData[e]&&0!=GlobalData[e].xhrs.length){var l=confirm(GlobalData.consts.cancel_upload_prompt);if(1==l){for(var r=wfu_get_filelist(e),o=[],_=[],d=0;d<r.length;d++)o.push(null),_.push(r[d].name);for(var d=0;d<GlobalData[e].xhrs.length;d++){var u=GlobalData[e].xhrs[d].file_id-1;u>=0&&null==o[u]&&(o[u]=GlobalData[e].xhrs[d])}"true"==s.debugmode&&console.log("upload cancelled!");for(var d=0;d<o.length;d++)if(null==o[d]&&(o[d]=wfu_GetHttpRequestObject(),null!=o[d]&&wfu_initialize_fileupload_xhr(o[d],e,t,a,s,d,_[d])),-1!=o[d]){var c={target:{responseText:"force_cancel_code",shortcode_id:e}};wfu_uploadComplete.call(o[d],c)}n.onkeyup=null}}})}function wfu_dettach_cancel_event(e){var t=document.getElementById("fileName_"+e);t&&(t.onkeyup=null)}function wfu_selectbutton_changed(e,t){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(t=0);var a=document.getElementById("upfile_"+e),s=wfu_get_filelist(e,!1);if(1==t){"undefined"==typeof a.filearray&&(a.filearray=Array());for(var n=0;n<s.length;n++)a.filearray.push(s[n])}else"undefined"!=typeof a.filearray&&delete a.filearray;wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var t=document.getElementById("wordpress_file_upload_message_"+e);t&&(t.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var t=document.getElementById("upload_"+e);if(t){var a=wfu_get_filelist(e),s=a.length>0;s=wfu_Code_Objects[e].apply_filters("uploadbutton_status",s),t.disabled=!s}}function wfu_update_filename_text(e){var t=document.getElementById("fileName_"+e);if(t){for(var a=wfu_get_filelist(e),s="",n=0;n<a.length;n++)""!=s&&(s+=", "),s+=a[n].name.replace(/c:\\fakepath\\/i,"");t.value=s}}function wfu_selectsubdir_check(e){var t=document.getElementById("selectsubdir_"+e);if(!t)return!0;var a=document.getElementById("selectsubdiredit_"+e),s="none"!=a.style.display;return s&&t.selectedIndex>0&&(a.value=t.value.replace(/^\s+/,""),a.className="file_item_clean_match subfolder_autoplus_match",wfu_selectsubdiredit_change(e)),s?document.getElementById("hiddeninput_"+e).value=a.value:document.getElementById("hiddeninput_"+e).value=t.selectedIndex,!s&&0==t.selectedIndex||s&&(""==a.value||"file_item_clean_empty subfolder_autoplus_empty"==a.className)?(s?(t.className="subfolder_autoplus_dropdown_prompt",a.value="",GlobalData.FreeChangeHandler=!0,a.className="file_item_clean_prompt subfolder_autoplus_prompt",GlobalData.FreeChangeHandler=!1):t.className="file_item_clean_prompt subfolder_dropdown_prompt",!1):(s?t.className="subfolder_autoplus_dropdown":t.className="file_item_clean subfolder_dropdown",s&&"file_item_clean_prompt subfolder_autoplus_prompt"==a.className&&(a.className="file_item_clean subfolder_autoplus"),t.options[0].style.display="none",!0)}function wfu_selectsubdiredit_enter(e){var t=document.getElementById("selectsubdir_"+e),a=document.getElementById("selectsubdiredit_"+e);"file_item_clean_empty subfolder_autoplus_empty"==a.className&&(a.value=""),t.className="subfolder_autoplus_dropdown",a.className="file_item_clean subfolder_autoplus"}function wfu_selectsubdiredit_exit(e){var t=document.getElementById("selectsubdiredit_"+e);""==t.value&&(t.value=GlobalData.consts.wfu_subdir_typedir,t.className="file_item_clean_empty subfolder_autoplus_empty")}function wfu_selectsubdiredit_change(e){if(!GlobalData.FreeChangeHandler){var t=document.getElementById("selectsubdir_"+e),a=document.getElementById("selectsubdiredit_"+e);if("none"!=a.style.display){if("file_item_clean_empty subfolder_autoplus_empty"==a.className)return t.selectedIndex=0,void(document.getElementById("hiddeninput_"+e).value="");document.getElementById("hiddeninput_"+e).value=a.value;for(var s,n=!1,i=1;i<t.options.length;i++)s=t.options[i].value.replace(/^\s+/,"").toLowerCase(),a.value.length>=3?s.substr(0,a.value.length)==a.value.toLowerCase()?t.options[i].style.display="block":t.options[i].style.display="none":t.options[i].style.display="block",t.options[i].value.replace(/^\s+/,"")==a.value&&(t.selectedIndex=i,a.className="file_item_clean_match subfolder_autoplus_match",n=!0);n||(t.selectedIndex=0,a.className="file_item_clean subfolder_autoplus")}}}function wfu_selectsubdir_disable_onoff(e,t){var a=document.getElementById("selectsubdir_"+e);if(!a)return!0;var s=document.getElementById("selectsubdiredit_"+e),n="none"!=s.style.display;a.disabled=t,n&&(s.disabled=t)}function wfu_userdata_focused(e){var t=document.getElementById(e.id.replace("_field_","_fieldwrapper_"));if("file_userdata_fieldwrapper_required_empty"==t.className){t.className="file_userdata_fieldwrapper_required";var a=document.getElementById(e.id.replace("_field_","_hint_"));a.style.display="none"}}function wfu_Redirect(e){window.location=e}function wfu_loadStart(e){}function wfu_uploadProgress(e,t,a,s){s&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[t].xhrs[a],i=0,l=0,r=document.getElementById("progressbar_"+t+"_animation");if(e.lengthComputable){if(n.sizeloaded=e.loaded,n.size<e.total&&e.total>0){l=e.total-n.size,n.deltasize+=l,n.size+=l;for(var o=0;o<GlobalData[t].xhrs.length;o++)GlobalData[t].xhrs[o].file_id==n.file_id&&(GlobalData[t].xhrs[o].totalsize+=l)}if(r){for(var _=0,d=0,u=[],o=0;o<GlobalData[t].xhrs.length;o++)u[GlobalData[t].xhrs[o].file_id]=0;for(var o=0;o<GlobalData[t].xhrs.length;o++)u[GlobalData[t].xhrs[o].file_id]=Math.max(GlobalData[t].xhrs[o].totalsize,u[GlobalData[t].xhrs[o].file_id]);for(var o=0;o<u.length;o++)"undefined"!=typeof u[o]&&(_+=u[o]);for(var o=0;o<GlobalData[t].xhrs.length;o++)d+=GlobalData[t].xhrs[o].sizeloaded;i=Math.round(100*d/_),r.style.width=i.toString()+"%"}}else r&&(r.style.width="0%")}function wfu_notify_WPFilebase(e,t){var a=wfu_GetHttpRequestObject();if(null==a){var s=document.createElement("iframe");return s.style.display="none",s.src=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_notify_wpfilebase&params_index="+e+"&session_token="+t,void document.body.appendChild(s)}var n=GlobalData.consts.ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_notify_wpfilebase",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=e,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=t;for(var i="",s=0;s<params.length;s++)i+=(s>0?"&":"")+params[s][0]+"="+encodeURI(params[s][1]);a.open("POST",n,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(){},a.send(i)}function wfu_send_email_notification(e,t,a,s,n,i,l,r,o){var _=wfu_GetHttpRequestObject();if(null!=_){var d=GlobalData.consts.ajax_url,u=wfu_get_userdata_count(e);params=new Array(7+u),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_send_email_notification",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=a,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=s,params[3]=new Array(2),params[3][0]="only_filename_list",params[3][1]=n,params[4]=new Array(2),params[4][0]="target_path_list",params[4][1]=i,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="uniqueuploadid_"+e,params[6][1]=t;for(var c=0;u>c;c++)params[7+c]=new Array(2),params[7+c][0]="userdata_"+c,params[7+c][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+c).value);for(var m="",c=0;c<params.length;c++)m+=(c>0?"&":"")+params[c][0]+"="+encodeURI(params[c][1]);wfu_initialize_fileupload_xhr(_,e,s,t,{params_index:a,debugmode:r,is_admin:o,fail_colors:GlobalData.consts.fail_colors,error_header:""},-1,""),_.error_adminmessage_unknown="",_.open("POST",d,!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded"),_.addEventListener("load",wfu_uploadComplete,!1),_.addEventListener("error",wfu_uploadFailed,!1),_.addEventListener("abort",wfu_uploadCanceled,!1),_.send(m)}}function wfu_format_debug_data(e,t){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+t,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>",output}function wfu_uploadComplete(e){var t=new Date,a=this.shortcode_id,s=(this.file_id,!1),n="",i="",l="",r="unknown",o="",_="",d="wfu_fileupload_success:";this.loading=!1,this.end_time=t.getTime();var u=e.target.responseText,c=u,m="error";if(-1!=u&&(u.indexOf("force_errorabort_code")>-1&&(m="errorabort",u=u.replace("force_errorabort_code","")),u.indexOf("force_cancel_code")>-1&&(m="errorcancel",u=u.replace("force_cancel_code",""))),-1!=u){var f=u.indexOf(d);if(f>-1&&("true"==this.debugmode&&(_=u.substr(0,f)),c=u.substr(f+d.length),f=c.indexOf(":"),n=c.substr(0,f),c=c.substr(f+1),f=c.indexOf(":"),l=c.substr(0,f),i=c.substr(f+1)),""!=_){var p="";"fileupload"==this.requesttype?p=" - File: "+this.file_id:"email"==this.requesttype&&(p=" - Email Notification"),_=wfu_format_debug_data(_,p)}if(""!=l){var w=l.split(";");if(1==parseInt(w[2])){var b=w[3].split(",");r=wfu_plugin_decode_string(b[0]),o=b[4]}}}if(""==i||""==l){var g=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=a,y.general.unique_id=this.unique_id,y.general.state=7,y.general.files_count="fileupload"==this.requesttype?1:0,y.general.upload_finish_time=this.finish_time,"errorcancel"!=m?(y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+c)):(y.general.fail_message=GlobalData.consts.file_cancelled,y.general.fail_admin_message=""),y.general.files_count>0?(y[0]={},y[0].color=g[0],y[0].bgcolor=g[1],y[0].borcolor=g[2],y[0].message_type=m,r=m,y[0].header=this.error_message_header,y[0].message=GlobalData.consts.message_timelimit,y[0].admin_messages="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:""):y.general.admin_messages.other="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:"",y.general.upload_finish_time>0&&t.getTime()<y.general.upload_finish_time&&(y.general.files_count>0?(y[0].message=y.general.fail_message,y[0].admin_messages="true"==this.is_admin?y.general.fail_admin_message:""):y.general.admin_messages.other="true"==this.is_admin?y.general.fail_admin_message:"")}return s=""==i||""==l?wfu_ProcessUploadComplete(a,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,_,this.is_admin],this.requesttype,""):wfu_ProcessUploadComplete(a,this.file_id,i,this.unique_id,this.params_index,this.session_token,l,[this.debugmode,_,this.is_admin],this.requesttype,n),s&&(wfu_dettach_cancel_event(a),wfu_unlock_upload(a),wfu_hide_simple_progressbar(a),wfu_clear(a)),e.target.return_status?r:void 0}function wfu_ProcessUploadComplete(sid,file_id,upload_params,unique_id,params_index,session_token,safe_output,debug_data,request_type,js_script_enc){if(sid&&!(0>sid)&&null!=upload_params&&""!=upload_params&&""!=unique_id&&("no-ajax"==unique_id||GlobalData[sid])){var do_redirect=!1;if("string"==typeof upload_params){upload_params=wfu_plugin_decode_string(upload_params.replace(/^\s+|\s+$/g,""));var Params=null;try{Params=JSON.parse(upload_params)}catch(e){}if(null==Params){var safe_parts=safe_output.split(";");Params=wfu_Initialize_Params(),Params.general.shortcode_id=sid,Params.general.unique_id=unique_id,Params.general.state=safe_parts[0],4==Params.general.state&&Params.general.state++;var default_colors=safe_parts[1].split(","),filedata="",error_jsonparse_filemessage=GlobalData.consts.jsonparse_filemessage,error_jsonparse_message=GlobalData.consts.jsonparse_message,error_jsonparse_adminmessage=GlobalData.consts.jsonparse_adminmessage;Params.general.files_count=parseInt(safe_parts[2]);for(var i=0;i<Params.general.files_count;i++)Params[i]={},Params[i].color=default_colors[0],Params[i].bgcolor=default_colors[1],Params[i].borcolor=default_colors[2],filedata=safe_parts[i+3].split(","),Params[i].message_type=wfu_plugin_decode_string(filedata[0]),Params[i].header=wfu_plugin_decode_string(filedata[1]),"success"==Params[i].message_type&&(Params[i].header+=error_jsonparse_filemessage,Params[i].message_type="warning"),Params[i].message=wfu_join_strings("<br />",error_jsonparse_message,wfu_plugin_decode_string(filedata[2])),Params[i].admin_messages=wfu_join_strings("<br />",error_jsonparse_adminmessage,wfu_plugin_decode_string(filedata[3]))}}else{if("object"!=typeof upload_params)return;var Params=upload_params}for(i=0;Params[i];)Params[i].message_type&&"error"==Params[i].message_type.substr(0,5)&&(Params[i].message_type=Params[i].message_type.substr(0,5)),i++;var message_table=document.getElementById("wfu_messageblock_"+sid),UploadStates_Ok=!0;if(!UploadStates[sid]&&message_table){var upload_states=document.getElementById("wfu_messageblock_header_"+sid+"_states").value;upload_states=wfu_plugin_decode_string(upload_states.replace(/^\s+|\s+$/g,"")),UploadStates[sid]=null;try{UploadStates[sid]=JSON.parse(upload_states)}catch(e){}null==UploadStates[sid]&&(UploadStates_Ok=!1)}GlobalData[sid]||(GlobalData[sid]=Object());var G=GlobalData[sid];if("no-ajax"==unique_id)G.last=!1,G.unique_id="",G.files_count=Params.general.files_count,0==Params.general.state&&(Params.general.files_count=0),G.files_processed=Params.general.files_count,UploadStates_Ok?G.upload_state=Params.general.state:G.upload_state=10,G.message=Params.general.message,G.update_wpfilebase=Params.general.update_wpfilebase,G.redirect_link=Params.general.redirect_link,G.notify_only_filename_list="",G.notify_target_path_list="",G.notify_attachment_list="",G.admin_messages={},G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase,G.admin_messages.notify=Params.general.admin_messages.notify,G.admin_messages.redirect=Params.general.admin_messages.redirect,G.admin_messages.debug=debug_data[1],G.admin_messages.other=Params.general.admin_messages.other,G.errors={},G.errors.wpfilebase=Params.general.errors.wpfilebase,G.errors.notify=Params.general.errors.notify,G.errors.redirect=Params.general.errors.redirect,G.current_size=0,G.total_size=0;else{if(""==G.unique_id||G.unique_id!=unique_id||G.unique_id!=Params.general.unique_id)return;if(G.last)return;0==Params.general.files_count&&Params[0]&&"error"==Params[0].message_type&&(Params.general.files_count=1);for(var file_status="",i=0;i<Params.general.files_count;i++)file_status="error"==Params[i].message_type&&0==G.files_processed?"error1":"error"==Params[i].message_type&&G.files_processed>0?"error2":Params[i].message_type,G.upload_state=GlobalData.filestatematch[file_status][G.upload_state];UploadStates_Ok||(G.upload_state=10),G.files_processed+=Params.general.files_count,G.message=wfu_join_strings("<br />",G.message,Params.general.message),""==G.update_wpfilebase&&(G.update_wpfilebase=Params.general.update_wpfilebase),(!request_type||request_type&&"email"!=request_type)&&(G.redirect_link=Params.general.redirect_link),G.notify_only_filename_list=wfu_join_strings(", ",G.notify_only_filename_list,Params.general.notify_only_filename_list),G.notify_target_path_list=wfu_join_strings(", ",G.notify_target_path_list,Params.general.notify_target_path_list),G.notify_attachment_list=wfu_join_strings(",",G.notify_attachment_list,Params.general.notify_attachment_list),G.admin_messages.debug=wfu_join_strings("<br />",G.admin_messages.debug,debug_data[1]),G.admin_messages.other=wfu_join_strings("<br />",G.admin_messages.other,Params.general.admin_messages.other),""==G.admin_messages.wpfilebase&&(G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase),""==G.admin_messages.notify&&(G.admin_messages.notify=Params.general.admin_messages.notify),""==G.admin_messages.redirect&&(G.admin_messages.redirect=Params.general.admin_messages.redirect),""==G.errors.wpfilebase&&(G.errors.wpfilebase=Params.general.errors.wpfilebase),""==G.errors.notify&&(G.errors.notify=Params.general.errors.notify),""==G.errors.redirect&&(G.errors.redirect=Params.general.errors.redirect)}G.files_processed==G.files_count&&(G.last=!0,""!=G.update_wpfilebase&&(G.admin_messages.wpfilebase="",wfu_notify_WPFilebase(params_index,session_token)),""!=G.notify_only_filename_list&&(G.admin_messages.notify="",wfu_send_email_notification(sid,unique_id,params_index,session_token,G.notify_only_filename_list,G.notify_target_path_list,G.notify_attachment_list,debug_data[0],debug_data[2]),G.last=!1,G.notify_only_filename_list=""),G.last&&("no-ajax"!=unique_id&&wfu_notify_server_upload_ended(sid,unique_id,params_index,session_token),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+unique_id+"\\]","g"),"")),""!=G.errors.redirect&&(G.redirect_link=""),""!=G.redirect_link&&G.last&&""==GlobalData.UploadInProgressString.trim()&&(G.upload_state=11,do_redirect=!0));var nonadmin_message=G.message,admin_message=wfu_join_strings("<br />",G.admin_messages.other,G.admin_messages.wpfilebase,G.admin_messages.notify,G.admin_messages.redirect,G.admin_messages.debug);if(!UploadStates_Ok){var error_jsonparse_headermessage=GlobalData.consts.jsonparse_headermessage,error_jsonparse_headeradminmessage=GlobalData.consts.jsonparse_headeradminmessage;nonadmin_message=wfu_join_strings("<br />",error_jsonparse_headermessage,nonadmin_message),admin_message=wfu_join_strings("<br />",error_jsonparse_headeradminmessage,admin_message)}if(G.last){0==G.files_count&&12!=G.upload_state?G.upload_state=8:G.upload_state<4&&(G.upload_state+=4);var admin_messages_exist=""!=G.admin_messages.wpfilebase||""!=G.admin_messages.notify||""!=G.admin_messages.redirect||""!=G.admin_messages.other;4==G.upload_state&&""!=admin_message?G.upload_state++:5==G.upload_state&&""==!admin_message&&""==nonadmin_message&&G.upload_state--}if(message_table){var subheader_state=document.getElementById("wfu_messageblock_header_"+sid+"_state"),single_file_shown=1==G.files_count&&""==nonadmin_message&&""==admin_message&&G.last&&!do_redirect;if(single_file_shown)document.getElementById("wfu_messageblock_header_"+sid).style.display="none";else{document.getElementById("wfu_messageblock_header_"+sid).style.display="";var header_container=document.getElementById("wfu_messageblock_header_"+sid+"_container");if(UploadStates_Ok){var suffix="";1!=G.files_count||5!=G.upload_state&&7!=G.upload_state||(suffix="_singlefile"),header_container.innerHTML=UploadStates[sid]["State"+G.upload_state+suffix]}else{header_container.innerHTML="";var safe_container=document.getElementById("wfu_messageblock_header_"+sid+"_safecontainer");header_container.innerHTML=safe_container.innerHTML.replace(/_safe/g,"")}var subheader_show=!1;""!=nonadmin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_messagelabel").innerHTML=nonadmin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="none",""!=admin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessagelabel").innerHTML=admin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="none",subheader_show?document.getElementById("wfu_messageblock_subheader_"+sid).style.display=subheader_state.value:document.getElementById("wfu_messageblock_subheader_"+sid).style.display="none",subheader_show||G.files_processed>0?(header_container.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+sid).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+sid).style.display="none",header_container.colSpan=3)}for(var next_block=document.getElementById("wfu_messageblock_subheader_"+sid),next_block_id=0,file_block=null,file_template_container=document.getElementById("wfu_messageblock_"+sid+"_filetemplate"),file_contents="",door=document.getElementById("wfu_messageblock_"+sid+"_door"),ii=0,headerspan=1,subheaderspan=2,file_template=wfu_plugin_decode_string(file_template_container.value.replace(/^\s+|\s+$/g,"")),i=0;i<Params.general.files_count;i++){for(ii=i+file_id,file_contents=file_template.replace(/\[file_id\]/g,ii),file_contents=file_contents.replace(/\[filenumber_display\]/g,""),file_contents=file_contents.replace(/\[fileheader_color\]/g,Params[i].color),file_contents=file_contents.replace(/\[fileheader_bgcolor\]/g,Params[i].bgcolor),file_contents=file_contents.replace(/\[fileheader_borcolor\]/g,Params[i].borcolor),file_contents=file_contents.replace(/\[fileheader_message\]/g,Params[i].header),file_contents=file_contents.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_message\]/g,Params[i].message),file_contents=file_contents.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_adminmessage\]/g,Params[i].admin_messages),file_contents="<table><tbody>"+file_contents+"</tbody></table>",door.innerHTML=file_contents,headerspan=1,subheaderspan=2,subheader_show=!1,file_block=document.getElementById("wfu_messageblock_"+sid+"_"+ii),1==G.files_count?(document.getElementById("wfu_messageblock_"+sid+"_filenumber_"+ii).style.display="none",document.getElementById("wfu_messageblock_subheader_"+sid+"_fileempty_"+ii).style.display="none",single_file_shown?file_block.style.display="":file_block.style.display=subheader_state.value,headerspan++,subheaderspan++):file_block.style.display=subheader_state.value,""!=Params[i].message&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_message_"+ii).style.display="",subheader_show=!0),""!=Params[i].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage_"+ii).style.display="",subheader_show=!0),subheader_show||(document.getElementById("wfu_messageblock_arrow_"+sid+"_"+ii).style.display="none",headerspan++),document.getElementById("wfu_messageblock_header_"+sid+"_container_"+ii).colSpan=headerspan,document.getElementById("wfu_messageblock_subheader_"+sid+"_container_"+ii).colSpan=subheaderspan;ii>next_block_id&&(next_block=next_block.nextSibling,null!=next_block);)1===next_block.nodeType&&(next_block_id=next_block.id.substr(next_block.id.lastIndexOf("_")+1));message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block.nextSibling,file_block=document.getElementById("wfu_messageblock_subheader_"+sid+"_"+ii),message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block,next_block_id=ii}single_file_shown&&(document.getElementById("wfu_messageblock_"+sid+"_1").style.display=""),message_table.style.display="",document.getElementById("wordpress_file_upload_message_"+sid).style.display=""}return js_script_enc&&eval(wfu_plugin_decode_string(js_script_enc)),do_redirect&&wfu_Redirect(G.redirect_link),G.last}}function wfu_uploadFailed(e,t){t&&(console.log("failure report following"),console.log(e));var a=e.target,s={target:{responseText:"",shortcode_id:a.shortcode_id}};wfu_uploadComplete.call(a,s)}function wfu_uploadCanceled(e){}function wfu_notify_server_upload_ended(e,t,a,s){var n=wfu_GetHttpRequestObject();if(null!=n){var i=GlobalData.consts.ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="wfu_uploader_nonce",params[1][1]=document.getElementById("wfu_uploader_nonce_"+e).value,params[2]=new Array(2),params[2][0]="uniqueuploadid_"+e,params[2][1]=t,params[3]=new Array(2),params[3][0]="params_index",params[3][1]=a,params[4]=new Array(2),params[4][0]="session_token",params[4][1]=s,params[5]=new Array(2),params[5][0]="upload_finished",params[5][1]=1;for(var l="",r=0;r<params.length;r++)l+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);n.open("POST",i,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&200==n.status&&wfu_Code_Objects[e].do_action("after_upload",n.responseText)},n.send(l)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",
2
- e.general.state=0,e.general.files_count=0,e.general.update_wpfilebase="",e.general.redirect_link="",e.general.upload_finish_time=0,e.general.message="",e.general.message_type="",e.general.admin_messages={},e.general.admin_messages.wpfilebase="",e.general.admin_messages.notify="",e.general.admin_messages.redirect="",e.general.admin_messages.other="",e.general.errors={},e.general.errors.wpfilebase="",e.general.errors.notify="",e.general.errors.redirect="",e.general.color="",e.general.bgcolor="",e.general.borcolor="",e.general.notify_only_filename_list="",e.general.notify_target_path_list="",e.general.notify_attachment_list="",e.general.fail_message="",e.general.fail_admin_message="",e}function wfu_redirect_to_classic(e,t,a,s){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e,!0)&&wfu_Code_Objects[e].apply_filters("pre_start_check",!0)&&wfu_redirect_to_classic_cont(e,t,a,s)}function wfu_redirect_to_classic_cont(e,t,a,s){var n=function(n){var l="",r="wfu_askserver_success:",o="wfu_askserver_error:",_=n.indexOf(r),d=n.indexOf(o);if(_>-1){l=n.substr(_+r.length),wfu_Code_Objects[e].do_action("askserver_success",l,"no-ajax");var u=wfu_Initialize_Params();if(u.general.shortcode_id=e,u.general.unique_id="",u.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,u,"no-ajax","",t,"",["false","","false"]),1==a){var c="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+c}s>0?document.getElementById("adminerrorcodes_"+e).value=s:document.getElementById("adminerrorcodes_"+e).value="",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=i,document.getElementById("uploadform_"+e).submit()}else d>-1&&(l=n.substr(d+o.length),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_error",l))},i=wfu_randomString(10);wfu_lock_upload(e),wfu_Code_Objects[e].do_action("pre_start");var l="",r=wfu_Code_Objects[e].apply_filters("askserver_pass_params",{});for(var o in r)r.hasOwnProperty(o)&&(l+="&"+o+"="+r[o]);var _=new Date,d=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_ask_server&wfu_uploader_nonce="+document.getElementById("wfu_uploader_nonce_"+e).value+"&sid="+e+"&unique_id="+i+"&start_time="+_.getTime()+"&session_token="+t+l,u=wfu_GetHttpRequestObject();if(null==u){var c=document.createElement("iframe");return c?(c.style.display="none",c.src=d,document.body.appendChild(c),void(c.onload=function(){n(c.contentDocument.body.innerHTML)})):void wfu_Code_Objects[e].do_action("not_supported")}u.open("GET",d,!0),u.onreadystatechange=function(){4==u.readyState&&(200==u.status?n(u.responseText):(alert(GlobalData.consts.remoteserver_noresult),wfu_Code_Objects[e].do_action("askserver_noresult")))},u.send(null)}function wfu_filesselected(e){var t=document.getElementById("fileName_"+e),a=wfu_get_filelist(e);return 0==a.length&&t&&(t.value=GlobalData.consts.nofilemessage,t.className="file_input_textbox_nofile"),a.length}function wfu_check_required_userdata(e,t){for(var a=wfu_get_userdata_count(e),s=!1,n=0;a>n;n++){var i=document.getElementById("hiddeninput_"+e+"_userdata_"+n),l=document.getElementById("userdata_"+e+"_fieldwrapper_"+n),r=document.getElementById("userdata_"+e+"_field_"+n),o=document.getElementById("userdata_"+e+"_"+n),_=document.getElementById("userdata_"+e+"_hint_"+n);i.value=window["userdata_"+e+"_codes_"+n].value(r);for(var d={hintposition:"none"},u=document.getElementById("userdata_"+e+"_props_"+n).value.split("|"),c=0;c<u.length;c++)"p:"==u[c].substr(0,2)&&(d.hintposition=u[c].substr(2));var m="";if("file_userdata_fieldwrapper_required"==l.className.substr(0,35)&&(m=window["userdata_"+e+"_codes_"+n].empty(i)),""===m&&window["userdata_"+e+"_codes_"+n].validate&&(m=window["userdata_"+e+"_codes_"+n].validate(i)),""!==m){if(t)if("none"==d.hintposition)_.className="file_userdata_hint_none";else{l.className="file_userdata_fieldwrapper_required_empty";var f=o.getBoundingClientRect(),p=l.getBoundingClientRect();"inline"==d.hintposition?(_.className="file_userdata_hint_inline",_.style.left=parseInt(p.left-f.left)+"px",_.style.top=parseInt(p.top-f.top)+"px",_.style.right=parseInt(f.right-p.right)+"px",_.style.bottom=parseInt(f.bottom-p.bottom)+"px"):"top"==d.hintposition?(_.className="file_userdata_hint_top",_.style.left=parseInt(p.left-f.left)+"px",_.style.bottom=parseInt(f.bottom-p.top)+"px"):"right"==d.hintposition?(_.className="file_userdata_hint_right",_.style.left=parseInt(p.right-f.left)+"px",_.style.top=parseInt(p.top-f.top)+"px"):"bottom"==d.hintposition?(_.className="file_userdata_hint_bottom",_.style.left=parseInt(p.left-f.left)+"px",_.style.top=parseInt(p.bottom-f.top)+"px"):"left"==d.hintposition&&(_.className="file_userdata_hint_left",_.style.right=parseInt(f.right-p.left)+"px",_.style.top=parseInt(p.top-f.top)+"px"),_.innerHTML=m,_.style.display="block"}s=!0}}return!s}function wfu_HTML5UploadFile(e,t,a){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,a,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,a,1,2);t=wfu_plugin_decode_string(t.replace(/^\s+|\s+$/g,""));var s=null;try{s=JSON.parse(t)}catch(n){}if(null==s)return void wfu_redirect_to_classic(e,a,1,3);var i=wfu_GetHttpRequestObject();if(null!=i){var l=wfu_filesselected(e);if(0!=l){var r=document.getElementById("upload_"+e),o=!r;if(!wfu_selectsubdir_check(e))return void(o&&wfu_clear_files(e));var _=l;if(_+=_,!wfu_check_required_userdata(e,!0))return void(o&&wfu_clear_files(e));if(wfu_Code_Objects[e].apply_filters("pre_start_check",!0)){var d=wfu_randomString(10);if(wfu_lock_upload(e),wfu_Code_Objects[e].do_action("pre_start"),wfu_Code_Objects[e].apply_filters("pre_start_ask_server",!1,s.has_filters)){var u=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_ask_server",params[1]=new Array(2),params[1][0]="session_token",params[1][1]=a,params[2]=new Array(2),params[2][0]="sid",params[2][1]=e,params[3]=new Array(2),params[3][0]="unique_id",params[3][1]=d,params[4]=new Array(2),params[4][0]="wfu_uploader_nonce",params[4][1]=document.getElementById("wfu_uploader_nonce_"+e).value;var c=wfu_Code_Objects[e].apply_filters("askserver_pass_params",{});for(var m in c)c.hasOwnProperty(m)&&params.push([m,c[m]]);for(var f="",p=0;p<params.length;p++)f+=(p>0?"&":"")+params[p][0]+"="+encodeURI(params[p][1]);i.open("POST",u,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){if(4==i.readyState)if(200==i.status){var t=i.responseText,n="",l="wfu_askserver_success:",r="wfu_askserver_error:",o=t.indexOf(l),_=t.indexOf(r);o>-1?(n=t.substr(o+l.length),wfu_Code_Objects[e].do_action("askserver_success",n,"ajax"),wfu_HTML5UploadFile_cont(e,s,a,d)):_>-1&&(n=t.substr(_+r.length),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_error",n))}else alert(GlobalData.consts.remoteserver_noresult),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_noresult")},i.send(f)}else wfu_HTML5UploadFile_cont(e,s,a,d)}}}}function wfu_HTML5UploadFile_cont(e,t,a,s){function n(l,r,o,u){m=!0;var f=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=f&&null!=p){var w=null,b=null;try{var w=new FormData,b=new FormData}catch(g){}if(null!=w&&null!=b){w.append("action","wfu_ajax_action"),w.append("wfu_uploader_nonce",document.getElementById("wfu_uploader_nonce_"+e).value),o||w.append("uploadedfile_"+e+d,r),w.append("uploadedfile_"+e+"_index",l),w.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(_[l].name)),w.append("uploadedfile_"+e+"_size",_[l].size),w.append("uniqueuploadid_"+e,s),w.append("params_index",t.params_index),w.append("subdir_sel_index",i),o?w.append("only_check","1"):w.append("only_check","0"),w.append("session_token",a);var y=wfu_Code_Objects[e].apply_filters("upload_pass_params",{},"ajax");for(var h in y)y.hasOwnProperty(h)&&w.append(h,y[h]);for(var v=wfu_get_userdata_count(e),k=0;v>k;k++)w.append("hiddeninput_"+e+"_userdata_"+k,document.getElementById("hiddeninput_"+e+"_userdata_"+k).value);if(wfu_initialize_fileupload_xhr(f,e,a,s,t,l,_[l].name),o||(f.size=r.size,f.totalsize=_[l].size,f.loading=!0),u){b.append("action","wfu_ajax_action"),b.append("wfu_uploader_nonce",document.getElementById("wfu_uploader_nonce_"+e).value),b.append("params_index",t.params_index),b.append("session_token",a),b.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(b)}catch(I){}m=p.responseText.indexOf("success")>-1}if(m)o?(f.addEventListener("load",function(t){t={target:{responseText:t.target.responseText,shortcode_id:e,return_status:!0}};var a=wfu_uploadComplete.call(f,t);m="success"==a||"warning"==a,m&&n(l,r,!1,!1)},!1),f.addEventListener("error",function(e){},!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(w)):(f.upload.xhr=f,f.upload.dummy=1,f.upload.addEventListener("loadstart",wfu_loadStart,!1),f.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+f.xhrid+", "+t.debugmode+");"),!1),f.addEventListener("load",wfu_uploadComplete,!1),f.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+t.debugmode+");"),!1),f.addEventListener("abort",wfu_uploadCanceled,!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(w));else{var B={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(f,B)}return c++,m}}}var i=-1,l=document.getElementById("selectsubdir_"+e);if(l){var r=document.getElementById("selectsubdiredit_"+e),o="none"!=r.style.display;i=o?r.value:l.selectedIndex}var _=wfu_get_filelist(e),d="";GlobalData.UploadInProgressString+="["+s+"]",GlobalData[e]={},GlobalData[e].unique_id=s,GlobalData[e].last=!1,GlobalData[e].files_count=1,GlobalData[e].files_processed=0,GlobalData[e].upload_state=0,GlobalData[e].message="",GlobalData[e].update_wpfilebase="",GlobalData[e].redirect_link="",GlobalData[e].notify_only_filename_list="",GlobalData[e].notify_target_path_list="",GlobalData[e].notify_attachment_list="",GlobalData[e].admin_messages={},GlobalData[e].admin_messages.wpfilebase="",GlobalData[e].admin_messages.notify="",GlobalData[e].admin_messages.redirect="",GlobalData[e].admin_messages.debug="",GlobalData[e].admin_messages.other="",GlobalData[e].errors={},GlobalData[e].errors.wpfilebase="",GlobalData[e].errors.notify="",GlobalData[e].errors.redirect="",GlobalData[e].xhrs=Array(),wfu_show_simple_progressbar(t.shortcode_id,"progressive"),wfu_attach_cancel_event(e,a,s,t);var u=wfu_Initialize_Params();u.general.shortcode_id=e,u.general.unique_id=s,wfu_ProcessUploadComplete(e,0,u,s,t.params_index,a,"",["false","","false"]);var c=0,m=!0,f=0;n(f,_[f],!0,!1)}function wfu_initialize_fileupload_xhr(e,t,a,s,n,i,l){var r=i>=0?GlobalData[t].xhrs.push(e)-1:-1,o=new Date;e.xhrid=r,e.shortcode_id=t,e.requesttype=i>=0?"fileupload":"email",e.file_id=i+1,e.size=0,e.totalsize=0,e.loading=!1,e.deltasize=0,e.sizeloaded=0,e.aborted=!1,e.unique_id=s,e.params_index=n.params_index,e.session_token=a,e.debugmode=n.debugmode,e.is_admin=n.is_admin,e.start_time=o.getTime(),e.end_time=e.start_time,e.finish_time=e.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),e.fail_colors=n.fail_colors,e.error_message_header=n.error_header.replace(/%username%/g,"no data"),e.error_message_header=e.error_message_header.replace(/%useremail%/g,"no data"),e.error_message_header=e.error_message_header.replace(/%filename%/g,l),e.error_message_header=e.error_message_header.replace(/%filepath%/g,l),e.error_message_failed=GlobalData.consts.message_failed,e.error_message_cancelled=GlobalData.consts.message_cancelled,e.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%filename%/g,l),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%filepath%/g,l)}function wfu_get_userdata_count(e){for(var t=0;document.getElementById("userdata_"+e+"_"+t);)t++;return t}function wfu_lock_upload(e){document.getElementById("fileName_"+e);document.getElementById("input_"+e).disabled=!0,document.getElementById("upfile_"+e).disabled=!0,wfu_selectsubdir_disable_onoff(e,!0);var t=document.getElementById("upload_"+e);t&&(t.disabled=!0);for(var a=wfu_get_userdata_count(e),s=0;a>s;s++)window["userdata_"+e+"_codes_"+s].lock(document.getElementById("userdata_"+e+"_field_"+s));wfu_Code_Objects[e].do_action("lock_upload")}function wfu_unlock_upload(e){document.getElementById("fileName_"+e);document.getElementById("input_"+e).disabled=!1,document.getElementById("upfile_"+e).disabled=!1,wfu_selectsubdir_disable_onoff(e,!1);var t=document.getElementById("upload_"+e);t&&(t.disabled=!1);for(var a=wfu_get_userdata_count(e),s=0;a>s;s++)window["userdata_"+e+"_codes_"+s].unlock(document.getElementById("userdata_"+e+"_field_"+s));wfu_Code_Objects[e].do_action("unlock_upload")}function wfu_clear_files(e){document.getElementById("uploadform_"+e).reset();var t=document.getElementById("upfile_"+e);"undefined"!=typeof t.filearray&&(t.filearray.length=0,t.filearrayprops.length=0);var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox")}function wfu_clear(e){wfu_clear_files(e);var t=document.getElementById("selectsubdir_"+e);if(t){var a=document.getElementById("selectsubdiredit_"+e),s="none"!=a.style.display;s?(t.selectedIndex=-1,a.value=""):(t.options[0].style.display="block",t.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value),t.selectedIndex<0&&(t.selectedIndex=0))}for(var n=wfu_get_userdata_count(e),i=0;n>i;i++)window["userdata_"+e+"_codes_"+i].reset(document.getElementById("userdata_"+e+"_field_"+i),document.getElementById("hiddeninput_"+e+"_userdata_"+i));wfu_Code_Objects[e].do_action("clear_upload")}function wfu_reset_message(e){var t=document.getElementById("wfu_messageblock_"+e);if(t){document.getElementById("wfu_messageblock_header_"+e).style.display="";var a=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(a.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",a.colSpan=3,document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none";for(var s=wfu_get_file_ids(e),n=1;n<=s.length;n++)t.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),t.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,t){var a=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");a&&("progressive"==t?(a.style.width="0%",a.className="file_progress_progressive",s.style.display="none",a.style.display="block"):wfu_BrowserCaps.supportsAnimation?(a.style.width="25%",a.className="file_progress_shuffle",s.style.display="none",a.style.display="block"):(a.style.width="0%",a.className="file_progress_noanimation",a.style.display="none",s.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var t=document.getElementById("progressbar_"+e+"_animation"),a=document.getElementById("progressbar_"+e+"_imagesafe");t&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",t.style.width="0%",t.className="file_progress_noanimation",a.style.display="none",t.style.display="block")}function wfu_invoke_shortcode_editor(e,t,a,s){for(var n=document.getElementsByTagName("BUTTON"),i=0,l=null,r=0;r<n.length;r++)n[r].parentNode&&n[r].parentNode.id==s+"_editor_"+e&&(l=n[r],i++);if(0!=i){if(i>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){l.parentNode.style.display="none",document.getElementById(s+"_overlay_"+e).style.display="block";var _=GlobalData.consts.ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_edit_shortcode",params[1]=new Array(2),params[1][0]="upload_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="post_id",params[2][1]=t,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=a,params[4]=new Array(2),params[4][0]="shortcode_tag",params[4][1]=s,params[5]=new Array(2),params[5][0]="widget_id",params[5][1]=document.getElementById(s+"_"+e+"_widgetid")?document.getElementById(s+"_"+e+"_widgetid").value:"";for(var d="",r=0;r<params.length;r++)d+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);o.open("POST",_,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById(s+"_overlay_"+e).style.display="none",l.parentNode.removeAttribute("style");var t="wfu_edit_shortcode:",a=o.responseText.indexOf(t);-1==a&&(a=o.responseText.length);var n=(o.responseText.substr(0,a),o.responseText.substr(a+t.length,o.responseText.length-a-t.length));a=n.indexOf(":");var i=n.substr(0,a);if(txt_value=n.substr(a+1,n.length-a-1),"success"==i){var r=window.open(wfu_plugin_decode_string(txt_value),"_blank");r?r.plugin_window=window:alert(GlobalData.consts.enable_popups)}else"check_page_obsolete"==i&&alert(txt_value)}},o.send(d)}}}GlobalData={},UploadStates={},Code_Initializators=[],GlobalData.filestatematch={},GlobalData.filestatematch.success=[0,1,2,2],GlobalData.filestatematch.warning=[1,1,2,2],GlobalData.filestatematch.error1=[3,3,2,3],GlobalData.filestatematch.error2=[2,2,2,3],GlobalData.UploadInProgressString="",GlobalData.FreeChangeHandler=!1,wfu_Check_Browser_Capabilities(),Code_Initializators[Code_Initializators.length]=function(sid){var CBUV_Code_Objects={};return CBUV_Code_Objects.pre_start_ask_server=function(e,t){if(e)return e;this.sid;return"true"==t},CBUV_Code_Objects.askserver_pass_params=function(e){for(var t=this.sid,a=wfu_get_filelist(t),s="",n="",i=0;i<a.length;i++)i>0&&(s+=";",n+=";"),s+=wfu_plugin_encode_string(a[i].name),n+=a[i].size;return e.filenames=s,e.filesizes=n,e},CBUV_Code_Objects.askserver_success=function(response,mode){var sid=this.sid,upload_status="success",txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";""!=txt_header&&eval(txt_header)},CBUV_Code_Objects.askserver_error=function(response,mode){var sid=this.sid,upload_status="error",txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";if(""!=txt_header&&eval(txt_header),txt_match=response.match(/CBUV\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"",""!=txt_header){var Params=wfu_Initialize_Params();Params.general.shortcode_id=sid,Params.general.message=txt_header,Params.general.state=12,wfu_ProcessUploadComplete(sid,0,Params,"no-ajax","","","",["false","","false"]),wfu_clear(sid)}},CBUV_Code_Objects.after_upload=function(response){var sid=this.sid,txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";""!=txt_header&&eval(txt_header)},CBUV_Code_Objects},wfu_initialize_webcam=function(e,t,a,s,n,i,l,r,o){"undefined"==typeof wfu_parse_video_width&&(wfu_parse_video_width=function(e){var t=parseInt(e);t>0&&(this.empty=!1,this.video.width=t)}),"undefined"==typeof wfu_parse_video_height&&(wfu_parse_video_height=function(e){var t=parseInt(e);t>0&&(this.empty=!1,this.video.height=t)}),"undefined"==typeof wfu_parse_video_aspectratio&&(wfu_parse_video_aspectratio=function(e){var t=parseFloat(e);t>0&&(this.empty=!1,this.video.aspectRatio=t)}),"undefined"==typeof wfu_parse_video_framerate&&(wfu_parse_video_framerate=function(e){var t=parseFloat(e);t>0&&(this.empty=!1,this.video.frameRate=t)}),"undefined"==typeof wfu_parse_video_facingmode&&(wfu_parse_video_facingmode=function(e){var t="front"==e?"user":"back"==e?"environment":"";""!=t&&(this.empty=!1,this.video.facingMode=t)});var _={empty:!0,video:{}};wfu_parse_video_width.call(_,s),wfu_parse_video_height.call(_,n),wfu_parse_video_aspectratio.call(_,i),wfu_parse_video_framerate.call(_,l),wfu_parse_video_facingmode.call(_,r);var d={mode:t,audio:"true"==a,video:_.empty?!0:_.video,maxrecordtime:o};window["wfu_webcam_props_"+e]=d,wfu_reinitialize_webcam(e)},wfu_reinitialize_webcam=function(e){window["wfu_webcam_props_"+e].active=!0,window["wfu_webcam_props_"+e].width=0,window["wfu_webcam_props_"+e].width=0,window["wfu_webcam_props_"+e].timeStart=0,window["wfu_webcam_props_"+e].duration=0,window["wfu_webcam_props_"+e].counting=!1,window["wfu_webcam_props_"+e].stream=null,window["wfu_webcam_props_"+e].media=null,window["wfu_webcam_props_"+e].blobs=null,window["wfu_webcam_props_"+e].playing=!1;var t=window["wfu_webcam_props_"+e],a=document.getElementById("webcam_"+e+"_box"),s=document.getElementById("webcam_"+e+"_webcamoff");s.style.display="none",a.style.display="block";var n={audio:t.audio,video:t.video};"undefined"==typeof Promise&&(Promise=function(e){this.mainCallback=e,this.then=function(e){return this.successCallback=e,this},this["catch"]=function(t){e(this.successCallback,t)}},PromiseRejected=function(e){this.then=function(e){return this},this["catch"]=function(t){t(e)}},Promise.reject=function(e){return new PromiseRejected(e)});var i=function(e,t,a){var s=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return s&&"undefined"!=typeof MediaRecorder?new Promise(function(t,a){s.call(navigator,e,t,a)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))};void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=i),navigator.mediaDevices.getUserMedia(n).then(function(s){window["wfu_webcam_props_"+e].stream=s,a.autoplay=!0,a.ontimeupdate=null,a.onerror=null,a.onloadeddata=function(t){wfu_webcam_init_callback(e)},a.src=window.URL.createObjectURL(s),wfu_initialize_webcam_nav(e,t.mode)})["catch"](function(t){console.log("Video not supported!",t),document.getElementById("webcam_"+e+"_inner").className="wfu_file_webcam_inner wfu_webcam_notsupported"})},wfu_webcam_init_callback=function(e){var t=document.getElementById("webcam_"+e+"_inner"),a=document.getElementById("webcam_"+e+"_box");window["wfu_webcam_props_"+e].width=a.videoWidth,window["wfu_webcam_props_"+e].height=a.videoHeight;var s='<svg xmlns="http://www.w3.org/2000/svg" width="'+a.videoWidth+'" height="'+a.videoHeight+'"></svg>',n=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),i=document.getElementById("webcam_"+e+"_webcamoff_img");i.src=window.URL.createObjectURL(n),i.style.width=t.clientWidth+"px",i.style.height=t.clientHeight+"px"},wfu_initialize_webcam_nav=function(e,t){"undefined"==typeof SVGInjector&&!function(e,t){"use strict";function a(e){e=e.split(" ");for(var t={},a=e.length,s=[];a--;)t.hasOwnProperty(e[a])||(t[e[a]]=1,s.unshift(e[a]));return s.join(" ")}var s="file:"===e.location.protocol,n=t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),i=Array.prototype.forEach||function(e,t){if(void 0===this||null===this||"function"!=typeof e)throw new TypeError;var a,s=this.length>>>0;for(a=0;s>a;++a)a in this&&e.call(t,this[a],a,this)},l={},r=0,o=[],_=[],d={},u=function(e){return e.cloneNode(!0)},c=function(e,t){_[e]=_[e]||[],_[e].push(t)},m=function(e){for(var t=0,a=_[e].length;a>t;t++)!function(t){setTimeout(function(){_[e][t](u(l[e]))},0)}(t)},f=function(t,a){if(void 0!==l[t])l[t]instanceof SVGSVGElement?a(u(l[t])):c(t,a);else{if(!e.XMLHttpRequest)return a("Browser does not support XMLHttpRequest"),!1;l[t]={},c(t,a);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(404===n.status||null===n.responseXML)return a("Unable to load SVG file: "+t),s&&a("Note: SVG injection ajax calls do not work locally without adjusting security setting in your browser. Or consider using a local webserver."),a(),!1;if(!(200===n.status||s&&0===n.status))return a("There was a problem injecting the SVG: "+n.status+" "+n.statusText),!1;if(n.responseXML instanceof Document)l[t]=n.responseXML.documentElement;else if(DOMParser&&DOMParser instanceof Function){var e;try{var i=new DOMParser;e=i.parseFromString(n.responseText,"text/xml")}catch(r){e=void 0}if(!e||e.getElementsByTagName("parsererror").length)return a("Unable to parse SVG file: "+t),!1;l[t]=e.documentElement}m(t)}},n.open("GET",t),n.overrideMimeType&&n.overrideMimeType("text/xml"),n.send()}},p=function(t,s,l,_){var u=t.getAttribute("data-src")||t.getAttribute("src");if(!/\.svg/i.test(u))return void _("Attempted to inject a file with a non-svg extension: "+u);if(!n){var c=t.getAttribute("data-fallback")||t.getAttribute("data-png");return void(c?(t.setAttribute("src",c),_(null)):l?(t.setAttribute("src",l+"/"+u.split("/").pop().replace(".svg",".png")),_(null)):_("This browser does not support SVG and no PNG fallback was defined."))}-1===o.indexOf(t)&&(o.push(t),t.setAttribute("src",""),f(u,function(n){if("undefined"==typeof n||"string"==typeof n)return _(n),!1;var l=t.getAttribute("id");l&&n.setAttribute("id",l);var c=t.getAttribute("title");c&&n.setAttribute("title",c);var m=[].concat(n.getAttribute("class")||[],"injected-svg",t.getAttribute("class")||[]).join(" ");n.setAttribute("class",a(m));var f=t.getAttribute("style");f&&n.setAttribute("style",f);var p=[].filter.call(t.attributes,function(e){return/^data-\w[\w\-]*$/.test(e.name)});i.call(p,function(e){e.name&&e.value&&n.setAttribute(e.name,e.value)});var w,b,g,y,h,v={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],pattern:["fill","stroke"],radialGradient:["fill","stroke"]};Object.keys(v).forEach(function(e){w=e,g=v[e],b=n.querySelectorAll("defs "+w+"[id]");for(var t=0,a=b.length;a>t;t++){y=b[t].id,h=y+"-"+r;var s;i.call(g,function(e){s=n.querySelectorAll("["+e+'*="'+y+'"]');for(var t=0,a=s.length;a>t;t++)s[t].setAttribute(e,"url(#"+h+")")}),b[t].id=h}}),n.removeAttribute("xmlns:a");for(var k,I,B=n.querySelectorAll("script"),x=[],G=0,E=B.length;E>G;G++)I=B[G].getAttribute("type"),I&&"application/ecmascript"!==I&&"application/javascript"!==I||(k=B[G].innerText||B[G].textContent,x.push(k),n.removeChild(B[G]));if(x.length>0&&("always"===s||"once"===s&&!d[u])){for(var j=0,D=x.length;D>j;j++)new Function(x[j])(e);d[u]=!0}var P=n.querySelectorAll("style");i.call(P,function(e){e.textContent+=""}),t.parentNode.replaceChild(n,t),delete o[o.indexOf(t)],t=null,r++,_(n)}))},w=function(e,t,a){t=t||{};var s=t.evalScripts||"always",n=t.pngFallback||!1,l=t.each;if(void 0!==e.length){var r=0;i.call(e,function(t){p(t,s,n,function(t){l&&"function"==typeof l&&l(t),a&&e.length===++r&&a(r)})})}else e?p(e,s,n,function(t){l&&"function"==typeof l&&l(t),a&&a(1),e=null}):a&&a(0)};"object"==typeof module&&"object"==typeof module.exports?module.exports=exports=w:"function"==typeof define&&define.amd?define(function(){return w}):"object"==typeof e&&(e.SVGInjector=w)}(window,document),"1"!=document.getElementById("webcam_"+e+"_btns_converted").value&&(SVGInjector(document.getElementById("webcam_"+e+"_btns")),document.getElementById("webcam_"+e+"_btns_converted").value="1"),"capture video"==t?wfu_webcam_set_nav_status(e,"idle_only_video"):"take photos"==t?wfu_webcam_set_nav_status(e,"idle_only_pictures"):"both"==t?wfu_webcam_set_nav_status(e,"idle_video_and_pictures"):wfu_webcam_set_nav_status(e,"idle_only_video")},wfu_webcam_set_nav_status=function(e,t){var a=document.getElementById("webcam_"+e+"_btn_onoff"),s=document.getElementById("webcam_"+e+"_nav"),n=document.getElementById("webcam_"+e+"_btn_video"),i=document.getElementById("webcam_"+e+"_btn_record"),l=document.getElementById("webcam_"+e+"_btn_play"),r=document.getElementById("webcam_"+e+"_btn_stop"),o=document.getElementById("webcam_"+e+"_btn_pause"),_=document.getElementById("webcam_"+e+"_btn_pos"),d=document.getElementById("webcam_"+e+"_btn_back"),u=document.getElementById("webcam_"+e+"_btn_fwd"),c=document.getElementById("webcam_"+e+"_btn_time"),m=document.getElementById("webcam_"+e+"_btn_picture"),f=document.getElementById("webcam_"+e+"_screenshot");a.style.display="block","hidden"==t?s.style.display="none":"recording"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_recording",n.style.display="none",i.style.display="block",i.style.visibility="visible",i.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_record wfu_recording"),r.style.display="block",r.style.visibility="visible",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):"after_recording"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="hidden",m.style.display="none",f.style.display="block"):"ready_playback"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="visible",l.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_play"),o.style.display="block",o.style.visibility="visible",o.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_pause_disabled"),_.style.display="block",_.style.visibility="visible",d.style.display="block",d.style.visibility="visible",u.style.display="block",u.style.visibility="visible",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):"after_screenshot"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="hidden",m.style.display="none",f.style.display="block"):"playing"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_video_disabled"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="visible",l.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_play_disabled"),o.style.display="block",
3
- o.style.visibility="visible",o.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_pause"),_.style.display="block",_.style.visibility="visible",d.style.display="block",d.style.visibility="visible",u.style.display="block",u.style.visibility="visible",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_rec_ready",n.style.display="none",i.style.display="none",r.style.display="none",l.style.display="none",o.style.display="none",_.style.display="none",d.style.display="none",u.style.display="none",c.style.display="none",m.style.display="none",f.style.display="none",("idle_only_video"==t||"idle_video_and_pictures"==t)&&(i.style.display="block",i.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_record")),("idle_only_pictures"==t||"idle_video_and_pictures"==t)&&(m.style.display="block"))},wfu_webcam_counter_status=function(e,t){if("start"==t){var a=new Date;window["wfu_webcam_props_"+e].duration=0,window["wfu_webcam_props_"+e].timeStart=a.getTime()/1e3,window["wfu_webcam_props_"+e].counting=!0,wfu_webcam_update_counter(e)}else{var a=new Date;window["wfu_webcam_props_"+e].duration=a.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart,window["wfu_webcam_props_"+e].counting=!1}},wfu_webcam_update_counter=function(e){if(window["wfu_webcam_props_"+e].counting){var t=new Date,a=t.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart;wfu_webcam_update_timer(e,a),setTimeout(function(){wfu_webcam_update_counter(e)},100)}},wfu_webcam_update_timer=function(e,t){var a=Math.floor(t/3600);t-=3600*a;var s=Math.floor(t/60);t-=60*s;var n=Math.floor(t);1e3*(t-Math.floor(t));document.getElementById("webcam_"+e+"_btn_time_label").innerHTML=(a>0?a+":":"")+(10>s?"0":"")+s+":"+(10>n?"0":"")+n},wfu_webcam_onoff=function(e){if(window["wfu_webcam_props_"+e].active){var t=document.getElementById("webcam_"+e+"_inner"),a=document.getElementById("webcam_"+e+"_box"),s=document.getElementById("webcam_"+e+"_webcamoff"),n=document.getElementById("webcam_"+e+"_webcamoff_img");n.style.width=t.clientWidth+"px",n.style.height=t.clientHeight+"px",a.pause(),a.src="",a.load(),window["wfu_webcam_props_"+e].stream&&window["wfu_webcam_props_"+e].stream.stop&&window["wfu_webcam_props_"+e].stream.stop(),window["wfu_webcam_props_"+e].stream=null,window["wfu_webcam_props_"+e].media=null,window["wfu_webcam_props_"+e].blobs=null,wfu_webcam_set_nav_status(e,"hidden"),a.style.display="none",document.getElementById("webcam_"+e+"_screenshot").src="",s.style.display="block",window["wfu_webcam_props_"+e].active=!1}else wfu_reinitialize_webcam(e);wfu_selectbutton_clicked(e)},wfu_webcam_golive=function(e){window["wfu_webcam_props_"+e].playing||(wfu_reinitialize_webcam(e),wfu_add_files(e,[],!1),wfu_selectbutton_clicked(e),wfu_update_uploadbutton_status(e))},wfu_webcam_start_rec=function(e){if(!window["wfu_webcam_props_"+e].media||!window["wfu_webcam_props_"+e].media.state||"recording"!=window["wfu_webcam_props_"+e].media.state){try{window["wfu_webcam_props_"+e].media=new MediaRecorder(window["wfu_webcam_props_"+e].stream)}catch(t){return void alert(document.getElementById("webcam_"+e+"_video_notsupported").value)}window["wfu_webcam_props_"+e].blobs=[],window["wfu_webcam_props_"+e].media.ondataavailable=function(t){var a=new Date,s=a.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart;-1==window["wfu_webcam_props_"+e].maxrecordtime||window["wfu_webcam_props_"+e].maxrecordtime>0&&s<=window["wfu_webcam_props_"+e].maxrecordtime?t.data&&t.data.size>0&&window["wfu_webcam_props_"+e].blobs.push(t.data):wfu_webcam_stop_rec(e)},wfu_webcam_set_nav_status(e,"recording"),wfu_webcam_counter_status(e,"start"),window["wfu_webcam_props_"+e].media.onstop=function(t){wfu_webcam_counter_status(e,"stop"),wfu_webcam_set_nav_status(e,"after_recording"),wfu_webcam_onstop(t,e)},window["wfu_webcam_props_"+e].media.start(10)}},wfu_webcam_stop_rec=function(e){window["wfu_webcam_props_"+e].media.stop()},wfu_webcam_onstop=function(e,t){if(0==window["wfu_webcam_props_"+t].blobs.length)alert(document.getElementById("webcam_"+t+"_video_nothingrecorded").value),wfu_webcam_golive(t);else{var a=document.getElementById("webcam_"+t+"_box"),s=document.getElementById("webcam_"+t+"_canvas"),n=document.getElementById("webcam_"+t+"_screenshot");if(window["wfu_webcam_props_"+t].stream){s.width=a.clientWidth,s.height=a.clientHeight;var i=s.getContext("2d");i.drawImage(a,0,0,a.clientWidth,a.clientHeight),n.src=s.toDataURL("image/webp")}var l=new Blob(window["wfu_webcam_props_"+t].blobs,{type:"video/mp4"});a.autoplay=!1,a.ontimeupdate=function(e){wfu_webcam_update_pos(t)},a.onended=function(e){wfu_webcam_ended(t)},a.onloadeddata=function(e){a.readyState>=2&&wfu_webcam_set_nav_status(t,"ready_playback")},a.onerror=function(e){a.onloadeddata=null,a.src=window.URL.createObjectURL(window["wfu_webcam_props_"+t].stream)},a.src=window.URL.createObjectURL(l),l.name="video.mp4",wfu_add_files(t,[{file:l,props:{}}],!1),wfu_update_uploadbutton_status(t)}},wfu_webcam_play=function(e){if(!window["wfu_webcam_props_"+e].playing){var t=document.getElementById("webcam_"+e+"_box");wfu_webcam_set_nav_status(e,"playing"),window["wfu_webcam_props_"+e].playing=!0,t.play()}},wfu_webcam_ended=function(e){var t=document.getElementById("webcam_"+e+"_box");t.src=t.src,wfu_webcam_set_nav_status(e,"ready_playback"),window["wfu_webcam_props_"+e].playing=!1},wfu_webcam_pause=function(e){var t=document.getElementById("webcam_"+e+"_box");t.pause(),wfu_webcam_set_nav_status(e,"ready_playback"),window["wfu_webcam_props_"+e].playing=!1},wfu_webcam_back=function(e){var t=document.getElementById("webcam_"+e+"_box");t.src=t.src,t.currentTime=0},wfu_webcam_fwd=function(e){var t=document.getElementById("webcam_"+e+"_box");t.currentTime=isFinite(t.duration)?t.duration:2*window["wfu_webcam_props_"+e].duration},wfu_webcam_take_picture=function(e){var t=document.getElementById("webcam_"+e+"_box"),a=document.getElementById("webcam_"+e+"_canvas"),s=document.getElementById("webcam_"+e+"_screenshot");if(window["wfu_webcam_props_"+e].stream){a.width=t.clientWidth,a.height=t.clientHeight;var n=a.getContext("2d");n.drawImage(t,0,0,t.clientWidth,t.clientHeight),s.src=a.toDataURL("image/webp"),wfu_webcam_set_nav_status(e,"after_screenshot"),window.wfu_toBlob_function_initialized||(!function(e){"use strict";var t=e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype,a=e.Blob&&function(){try{return Boolean(new Blob)}catch(e){return!1}}(),s=a&&e.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}}(),n=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||e.MSBlobBuilder,i=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,l=(a||n)&&e.atob&&e.ArrayBuffer&&e.Uint8Array&&function(e){var t,l,r,o,_,d,u,c,m;if(t=e.match(i),!t)throw new Error("invalid data URI");for(l=t[2]?t[1]:"text/plain"+(t[3]||";charset=US-ASCII"),r=!!t[4],o=e.slice(t[0].length),_=r?atob(o):decodeURIComponent(o),d=new ArrayBuffer(_.length),u=new Uint8Array(d),c=0;c<_.length;c+=1)u[c]=_.charCodeAt(c);return a?new Blob([s?u:d],{type:l}):(m=new n,m.append(d),m.getBlob(l))};e.HTMLCanvasElement&&!t.toBlob&&(t.mozGetAsFile?t.toBlob=function(e,a,s){e(s&&t.toDataURL&&l?l(this.toDataURL(a,s)):this.mozGetAsFile("blob",a))}:t.toDataURL&&l&&(t.toBlob=function(e,t,a){e(l(this.toDataURL(t,a)))})),"function"==typeof define&&define.amd?define(function(){return l}):"object"==typeof module&&module.exports?module.exports=l:e.dataURLtoBlob=l}(window),window.wfu_toBlob_function_initialized=!0),a.toBlob&&a.toBlob(function(t){t.name="image.png",wfu_add_files(e,[{file:t,props:{}}],!1),wfu_update_uploadbutton_status(e)},"image/png")}},wfu_webcam_update_pos=function(e){var t=document.getElementById("webcam_"+e+"_box"),a=document.getElementById("webcam_"+e+"_btn_pointer"),s=isFinite(t.duration)?t.duration:window["wfu_webcam_props_"+e].duration,n=Math.round(t.currentTime/s*100);a.style.left=n+"%",wfu_webcam_update_timer(e,t.currentTime)};
1
+ function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var a=e.split(";"),t=0;t<a.length;t++)const_txt=a[t].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_Load_Code_Connectors(e){"undefined"==typeof wfu_Code_Objects&&(wfu_Code_Objects={}),wfu_Code_Objects[e]=new wfu_Code_Object(e);for(var a=0;a<Code_Initializators.length;a++)wfu_Code_Objects[e].additem(Code_Initializators[a](e))}function wfu_Code_Object(e){this.sid=e,this.items=[],this._calc_prioritized_list=function(e){for(var a,t,s=[],n=[],i=[],l=0;l<this.items.length;l++)a=this.items[l],a[e]&&(t=-1,a.priority&&(t=a.priority),a[e].priority&&(t=a[e].priority),t>=0?(s.push(t),n.push(l)):i.push(l));for(var l=1;l<s.length;l++)for(var r=l;r<s.length;r++)if(s[r]<s[l-1]){var o=s[r];s[r]=s[l-1],s[l-1]=o;var o=n[r];n[r]=n[l-1],n[l-1]=o}return n.concat(i)},this.additem=function(e){this.items.push(e)},this.apply_filters=function(e,a){if("undefined"==typeof a)return null;var t=this._calc_prioritized_list(e);if(0==t.length)return a;for(var s=0;s<t.length;s++){var n=this.items[t[s]],i=null;"function"==typeof n[e]?i=n[e]:"function"==typeof n[e].func&&(i=n[e].func),null!=i&&(a=i.apply(this,Array.prototype.slice.call(arguments,1)),arguments[1]=a)}return a},this.do_action=function(e){var a=this._calc_prioritized_list(e);if(0!=a.length)for(var t=0;t<a.length;t++){var s=this.items[a[t]],n=null;"function"==typeof s[e]?n=s[e]:"function"==typeof s[e].func&&(n=s[e].func),null!=n&&n.apply(this,Array.prototype.slice.call(arguments,1))}}}function wfu_plugin_load_action(e){wfu_install_unload_hook();var a=document.getElementById("selectsubdiredit_"+e);a&&"none"!=a.style.display&&wfu_attach_element_handlers(a,new Function("wfu_selectsubdiredit_change("+e+");"))}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString&&""!=GlobalData.UploadInProgressString.trim()?GlobalData.consts.wfu_pageexit_prompt:void 0}function wfu_Check_Browser_Capabilities(){if("undefined"==typeof wfu_BrowserCaps){wfu_BrowserCaps=new Object;var e=wfu_GetHttpRequestObject();wfu_BrowserCaps.supportsAJAX=null!=e,wfu_BrowserCaps.supportsUploadProgress=!!(e&&"upload"in e&&"onprogress"in e.upload);var a=null;try{var a=new FormData}catch(t){}wfu_BrowserCaps.supportsHTML5=null!=a;var t=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=t,wfu_BrowserCaps.supportsDRAGDROP=window.FileReader?!0:!1,wfu_BrowserCaps.supportsAnimation=wfu_check_animation(),wfu_BrowserCaps.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}}function wfu_check_animation(){var e=!1,a="animation",t="",s="Webkit Moz O ms Khtml".split(" "),n="",i=document.createElement("DIV");if(i.style.animationName&&(e=!0),e===!1)for(var l=0;l<s.length;l++)if(void 0!==i.style[s[l]+"AnimationName"]){n=s[l],a=n+"Animation",t="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var a=[].slice.call(arguments),t="",s="",n=1;n<a.length;n++)s=""==t||""==a[n]?"":e,t+=s+a[n];return t}function wfu_plugin_decode_string(e){for(var a,t,s=0,n="";s<e.length;)a=parseInt(e.substr(s,2),16),t=128>a?a:224>a?((31&a)<<6)+(63&parseInt(e.substr(s+=2,2),16)):((15&a)<<12)+((63&parseInt(e.substr(s+=2,2),16))<<6)+(63&parseInt(e.substr(s+=2,2),16)),n+=String.fromCharCode(t),s+=2;return n}function wfu_plugin_encode_string(e){var a=0,t="",s="";for(a=0;a<e.length;a++)num=e.charCodeAt(a),num>=2048?num=((16773120&num|917504)<<4)+((4032&num|8192)<<2)+(63&num|128):num>=128&&(num=((65472&num|12288)<<2)+(63&num|128)),s=num.toString(16),(1==s.length||3==s.length||5==s.length)&&(s="0"+s),t+=s;return t}function wfu_randomString(e){for(var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",t=e,s="",n=0;t>n;n++){var i=Math.floor(Math.random()*a.length);s+=a.substring(i,i+1)}return s}function wfu_addEventHandler(e,a,t){e.addEventListener?e.addEventListener(a,t,!1):e.attachEvent?e.attachEvent("on"+a,t):e["on"+a]=t}function wfu_attach_element_handlers(e,a){for(var t=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],s=0;s<t.length;s++)wfu_addEventHandler(e,t[s],a)}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(a){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(a){}return e}function wfu_filedetails_showhide(e,a,t){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+a),i=document.getElementById("wfu_messageblock_subheader_"+e+"_"+a),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+a);t?(s.style.display="",n.style.display="none",i.style.display="",l.value=""):(s.style.display="none",n.style.display="",i.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var a=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),t="wfu_messageblock_"+e+"_",s=[];null!=a;)1===a.nodeType&&a.id.substr(0,t.length)==t&&s.push(a.id.substr(a.id.lastIndexOf("_")+1)),a=a.nextSibling;return s}function wfu_get_filelist(e,a){a="undefined"!=typeof a?a:!0;var t=document.getElementById("upfile_"+e),s=t.files;return s||(s=t.value?[{name:t.value}]:[]),a&&"undefined"!=typeof t.filearray&&(s=t.filearray),s}function wfu_add_files(e,a){var t=document.getElementById("upfile_"+e);"undefined"==typeof t.filearray&&(t.filearray=Array(),t.filearrayprops=Array()),document.getElementById("uploadform_"+e).reset(),t.filearray.length=t.filearrayprops.length=0;for(var s=0;s<a.length;s++)t.filearray.push(a[s].file),t.filearrayprops.push(a[s].props)}function wfu_filedetails_toggle(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a));wfu_filedetails_showhide(e,a,"none"==t.style.display)}function wfu_headerdetails_showhide(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up")),s=document.getElementById("wfu_messageblock_arrow_"+e+"_down"),n=document.getElementById("wfu_messageblock_subheader_"+e),i=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),r=document.getElementById("wfu_messageblock_header_"+e+"_state"),o=wfu_get_file_ids(e);if(a){t.style.display="",s.style.display="none",("none"!=i.style.display||"none"!=l.style.display)&&(n.style.display=""),r.value="";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+o[_]).value}else{t.style.display="none",s.style.display="",n.style.display="none",r.value="none";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var a=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==a.style.display)}function wfu_attach_cancel_event(e,a,t,s){var n=document.getElementById("fileName_"+e);n&&(n.onkeyup=function(i){if(27==i.keyCode&&GlobalData[e]&&0!=GlobalData[e].xhrs.length){var l=confirm(GlobalData.consts.cancel_upload_prompt);if(1==l){for(var r=wfu_get_filelist(e),o=[],_=[],d=0;d<r.length;d++)o.push(null),_.push(r[d].name);for(var d=0;d<GlobalData[e].xhrs.length;d++){var u=GlobalData[e].xhrs[d].file_id-1;u>=0&&null==o[u]&&(o[u]=GlobalData[e].xhrs[d])}"true"==s.debugmode&&console.log("upload cancelled!");for(var d=0;d<o.length;d++)if(null==o[d]&&(o[d]=wfu_GetHttpRequestObject(),null!=o[d]&&wfu_initialize_fileupload_xhr(o[d],e,a,t,s,d,_[d])),-1!=o[d]){var c={target:{responseText:"force_cancel_code",shortcode_id:e}};wfu_uploadComplete.call(o[d],c)}n.onkeyup=null}}})}function wfu_dettach_cancel_event(e){var a=document.getElementById("fileName_"+e);a&&(a.onkeyup=null)}function wfu_selectbutton_changed(e,a){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(a=0);var t=document.getElementById("upfile_"+e),s=wfu_get_filelist(e,!1);if(1==a){"undefined"==typeof t.filearray&&(t.filearray=Array());for(var n=0;n<s.length;n++)t.filearray.push(s[n])}else"undefined"!=typeof t.filearray&&delete t.filearray;wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var a=document.getElementById("wordpress_file_upload_message_"+e);a&&(a.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var t=document.getElementById("fileName_"+e);t&&(t.value="",t.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var a=document.getElementById("upload_"+e);if(a){var t=wfu_get_filelist(e),s=t.length>0;s=wfu_Code_Objects[e].apply_filters("uploadbutton_status",s),a.disabled=!s}}function wfu_update_filename_text(e){var a=document.getElementById("fileName_"+e);if(a){for(var t=wfu_get_filelist(e),s="",n=0;n<t.length;n++)""!=s&&(s+=", "),s+=t[n].name.replace(/c:\\fakepath\\/i,"");a.value=s}}function wfu_selectsubdir_check(e){var a=document.getElementById("selectsubdir_"+e);if(!a)return!0;var t=document.getElementById("selectsubdiredit_"+e),s="none"!=t.style.display;return s&&a.selectedIndex>0&&(t.value=a.value.replace(/^\s+/,""),t.className="file_item_clean_match subfolder_autoplus_match",wfu_selectsubdiredit_change(e)),s?document.getElementById("hiddeninput_"+e).value=t.value:document.getElementById("hiddeninput_"+e).value=a.selectedIndex,!s&&0==a.selectedIndex||s&&(""==t.value||"file_item_clean_empty subfolder_autoplus_empty"==t.className)?(s?(a.className="subfolder_autoplus_dropdown_prompt",t.value="",GlobalData.FreeChangeHandler=!0,t.className="file_item_clean_prompt subfolder_autoplus_prompt",GlobalData.FreeChangeHandler=!1):a.className="file_item_clean_prompt subfolder_dropdown_prompt",!1):(s?a.className="subfolder_autoplus_dropdown":a.className="file_item_clean subfolder_dropdown",s&&"file_item_clean_prompt subfolder_autoplus_prompt"==t.className&&(t.className="file_item_clean subfolder_autoplus"),a.options[0].style.display="none",!0)}function wfu_selectsubdiredit_enter(e){var a=document.getElementById("selectsubdir_"+e),t=document.getElementById("selectsubdiredit_"+e);"file_item_clean_empty subfolder_autoplus_empty"==t.className&&(t.value=""),a.className="subfolder_autoplus_dropdown",t.className="file_item_clean subfolder_autoplus"}function wfu_selectsubdiredit_exit(e){var a=document.getElementById("selectsubdiredit_"+e);""==a.value&&(a.value=GlobalData.consts.wfu_subdir_typedir,a.className="file_item_clean_empty subfolder_autoplus_empty")}function wfu_selectsubdiredit_change(e){if(!GlobalData.FreeChangeHandler){var a=document.getElementById("selectsubdir_"+e),t=document.getElementById("selectsubdiredit_"+e);if("none"!=t.style.display){if("file_item_clean_empty subfolder_autoplus_empty"==t.className)return a.selectedIndex=0,void(document.getElementById("hiddeninput_"+e).value="");document.getElementById("hiddeninput_"+e).value=t.value;for(var s,n=!1,i=1;i<a.options.length;i++)s=a.options[i].value.replace(/^\s+/,"").toLowerCase(),t.value.length>=3?s.substr(0,t.value.length)==t.value.toLowerCase()?a.options[i].style.display="block":a.options[i].style.display="none":a.options[i].style.display="block",a.options[i].value.replace(/^\s+/,"")==t.value&&(a.selectedIndex=i,t.className="file_item_clean_match subfolder_autoplus_match",n=!0);n||(a.selectedIndex=0,t.className="file_item_clean subfolder_autoplus")}}}function wfu_selectsubdir_disable_onoff(e,a){var t=document.getElementById("selectsubdir_"+e);if(!t)return!0;var s=document.getElementById("selectsubdiredit_"+e),n="none"!=s.style.display;t.disabled=a,n&&(s.disabled=a)}function wfu_userdata_focused(e){var a=document.getElementById(e.id.replace("_field_","_fieldwrapper_"));if("file_userdata_fieldwrapper_required_empty"==a.className){a.className="file_userdata_fieldwrapper_required";var t=document.getElementById(e.id.replace("_field_","_hint_"));t.style.display="none"}}function wfu_Redirect(e){window.location=e}function wfu_loadStart(e){}function wfu_update_upload_metrics(e){for(var a=0,t=0,s=0,n=Array(),i=wfu_get_filelist(e),l=0;l<i.length;l++)n[l]={size:i[l].size,aborted:!1,loaded:0,delta:0};for(var l=0;l<GlobalData[e].xhrs.length;l++){var r=GlobalData[e].xhrs[l].file_id;r>0&&GlobalData[e].xhrs[l].aborted&&(n[r-1].aborted=!0)}for(var l=0;l<GlobalData[e].xhrs.length;l++){var r=GlobalData[e].xhrs[l].file_id;r>0&&!n[r-1].aborted&&(n[r-1].size=Math.max(GlobalData[e].xhrs[l].totalsize,n[r-1].size),n[r-1].loaded+=GlobalData[e].xhrs[l].sizeloaded,n[r-1].delta+=Math.max(GlobalData[e].xhrs[l].deltaloaded,0))}for(var l=0;l<i.length;l++){var o=GlobalData[e].metrics[l];!n[l].aborted&&n[l].size>0?(o.size=n[l].size,"incremental"==GlobalData.consts.wfu_uploadprogress_mode?o.progress_pos=Math.min(o.progress_pos+(1-o.progress_pos)*n[l].delta/(o.size-o.loaded),1):o.progress_pos=n[l].loaded/n[l].size,o.loaded=n[l].loaded,a+=o.size,t+=o.loaded,s+=n[l].delta):(o.size=0,o.progress_pos=0,o.loaded=0)}var o=GlobalData[e].metricstotal;o.size=a,"incremental"==GlobalData.consts.wfu_uploadprogress_mode?o.progress_pos=Math.min(o.progress_pos+(1-o.progress_pos)*s/(o.size-o.loaded),1):o.progress_pos=t/a,o.loaded=t}function wfu_uploadProgress(e,a,t,s){s&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[a].xhrs[t];if(0!=n.file_id){var i=0,l=0,r=document.getElementById("progressbar_"+a+"_animation");if(e.lengthComputable){if(n.deltaloaded=e.loaded-n.sizeloaded,n.sizeloaded=e.loaded,n.size<e.total&&e.total>0){l=e.total-n.size,n.deltasize+=l,n.size+=l;for(var o=0;o<GlobalData[a].xhrs.length;o++)GlobalData[a].xhrs[o].file_id==n.file_id&&(GlobalData[a].xhrs[o].totalsize+=l)}wfu_update_upload_metrics(a),n.deltaloaded=0,r&&(i=Math.round(100*GlobalData[a].metricstotal.progress_pos),r.style.width=i.toString()+"%")}else r&&(r.style.width="0%")}}function wfu_notify_WPFilebase(e,a){var t=wfu_GetHttpRequestObject();if(null==t){var s=document.createElement("iframe");return s.style.display="none",s.src=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_notify_wpfilebase&params_index="+e+"&session_token="+a,void document.body.appendChild(s)}var n=GlobalData.consts.ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_notify_wpfilebase",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=e,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=a;for(var i="",s=0;s<params.length;s++)i+=(s>0?"&":"")+params[s][0]+"="+encodeURI(params[s][1]);t.open("POST",n,!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){},t.send(i)}function wfu_send_email_notification(e,a,t,s,n,i,l,r,o){var _=wfu_GetHttpRequestObject();if(null!=_){var d=GlobalData.consts.ajax_url,u=wfu_get_userdata_count(e);params=new Array(7+u),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_send_email_notification",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=t,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=s,params[3]=new Array(2),params[3][0]="only_filename_list",params[3][1]=n,params[4]=new Array(2),params[4][0]="target_path_list",params[4][1]=i,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="uniqueuploadid_"+e,params[6][1]=a;for(var c=0;u>c;c++)params[7+c]=new Array(2),params[7+c][0]="userdata_"+c,params[7+c][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+c).value);for(var m="",c=0;c<params.length;c++)m+=(c>0?"&":"")+params[c][0]+"="+encodeURI(params[c][1]);wfu_initialize_fileupload_xhr(_,e,s,a,{params_index:t,debugmode:r,is_admin:o,fail_colors:GlobalData.consts.fail_colors,error_header:""},-1,""),_.error_adminmessage_unknown="",_.open("POST",d,!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded"),_.addEventListener("load",wfu_uploadComplete,!1),_.addEventListener("error",wfu_uploadFailed,!1),_.addEventListener("abort",wfu_uploadCanceled,!1),_.send(m)}}function wfu_format_debug_data(e,a){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+a,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>",output}function wfu_uploadComplete(e){var a=new Date,t=this.shortcode_id,s=(this.file_id,!1),n="",i="",l="",r="unknown",o="",_="",d="wfu_fileupload_success:";this.loading=!1,this.end_time=a.getTime();var u=e.target.responseText,c=u,m="error";if(-1!=u&&(u.indexOf("force_errorabort_code")>-1&&(m="errorabort",u=u.replace("force_errorabort_code","")),u.indexOf("force_cancel_code")>-1&&(m="errorcancel",u=u.replace("force_cancel_code",""))),-1!=u){var f=u.indexOf(d);if(f>-1&&("true"==this.debugmode&&(_=u.substr(0,f)),c=u.substr(f+d.length),f=c.indexOf(":"),n=c.substr(0,f),c=c.substr(f+1),f=c.indexOf(":"),l=c.substr(0,f),i=c.substr(f+1)),""!=_){var p="";"fileupload"==this.requesttype?p=" - File: "+this.file_id:"email"==this.requesttype&&(p=" - Email Notification"),_=wfu_format_debug_data(_,p)}if(""!=l){var w=l.split(";");if(1==parseInt(w[2])){var b=w[3].split(",");r=wfu_plugin_decode_string(b[0]),o=b[4]}}}if(""==i||""==l){var g=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=t,y.general.unique_id=this.unique_id,y.general.state=7,y.general.files_count="fileupload"==this.requesttype?1:0,y.general.upload_finish_time=this.finish_time,"errorcancel"!=m?(y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+c)):(y.general.fail_message=GlobalData.consts.file_cancelled,y.general.fail_admin_message=""),y.general.files_count>0?(y[0]={},y[0].color=g[0],y[0].bgcolor=g[1],y[0].borcolor=g[2],y[0].message_type=m,r=m,y[0].header=this.error_message_header,y[0].message=GlobalData.consts.message_timelimit,y[0].admin_messages="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:""):y.general.admin_messages.other="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:"",y.general.upload_finish_time>0&&a.getTime()<y.general.upload_finish_time&&(y.general.files_count>0?(y[0].message=y.general.fail_message,y[0].admin_messages="true"==this.is_admin?y.general.fail_admin_message:""):y.general.admin_messages.other="true"==this.is_admin?y.general.fail_admin_message:"")}return s=""==i||""==l?wfu_ProcessUploadComplete(t,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,_,this.is_admin],this.requesttype,""):wfu_ProcessUploadComplete(t,this.file_id,i,this.unique_id,this.params_index,this.session_token,l,[this.debugmode,_,this.is_admin],this.requesttype,n),s&&(wfu_dettach_cancel_event(t),wfu_unlock_upload(t),wfu_hide_simple_progressbar(t),wfu_clear(t)),e.target.return_status?r:void 0}function wfu_ProcessUploadComplete(sid,file_id,upload_params,unique_id,params_index,session_token,safe_output,debug_data,request_type,js_script_enc){if(sid&&!(0>sid)&&null!=upload_params&&""!=upload_params&&""!=unique_id&&("no-ajax"==unique_id||GlobalData[sid])){var do_redirect=!1;if("string"==typeof upload_params){upload_params=wfu_plugin_decode_string(upload_params.replace(/^\s+|\s+$/g,""));var Params=null;try{Params=JSON.parse(upload_params)}catch(e){}if(null==Params){var safe_parts=safe_output.split(";");Params=wfu_Initialize_Params(),Params.general.shortcode_id=sid,Params.general.unique_id=unique_id,Params.general.state=safe_parts[0],4==Params.general.state&&Params.general.state++;var default_colors=safe_parts[1].split(","),filedata="",error_jsonparse_filemessage=GlobalData.consts.jsonparse_filemessage,error_jsonparse_message=GlobalData.consts.jsonparse_message,error_jsonparse_adminmessage=GlobalData.consts.jsonparse_adminmessage;Params.general.files_count=parseInt(safe_parts[2]);for(var i=0;i<Params.general.files_count;i++)Params[i]={},Params[i].color=default_colors[0],Params[i].bgcolor=default_colors[1],Params[i].borcolor=default_colors[2],filedata=safe_parts[i+3].split(","),Params[i].message_type=wfu_plugin_decode_string(filedata[0]),Params[i].header=wfu_plugin_decode_string(filedata[1]),"success"==Params[i].message_type&&(Params[i].header+=error_jsonparse_filemessage,Params[i].message_type="warning"),Params[i].message=wfu_join_strings("<br />",error_jsonparse_message,wfu_plugin_decode_string(filedata[2])),Params[i].admin_messages=wfu_join_strings("<br />",error_jsonparse_adminmessage,wfu_plugin_decode_string(filedata[3]))}}else{if("object"!=typeof upload_params)return;var Params=upload_params}for(i=0;Params[i];)Params[i].message_type&&"error"==Params[i].message_type.substr(0,5)&&(Params[i].message_type=Params[i].message_type.substr(0,5)),i++;var message_table=document.getElementById("wfu_messageblock_"+sid),UploadStates_Ok=!0;if(!UploadStates[sid]&&message_table){var upload_states=document.getElementById("wfu_messageblock_header_"+sid+"_states").value;upload_states=wfu_plugin_decode_string(upload_states.replace(/^\s+|\s+$/g,"")),UploadStates[sid]=null;try{UploadStates[sid]=JSON.parse(upload_states)}catch(e){}null==UploadStates[sid]&&(UploadStates_Ok=!1)}GlobalData[sid]||(GlobalData[sid]=Object());var G=GlobalData[sid];if("no-ajax"==unique_id)G.last=!1,G.unique_id="",G.files_count=Params.general.files_count,0==Params.general.state&&(Params.general.files_count=0),G.files_processed=Params.general.files_count,UploadStates_Ok?G.upload_state=Params.general.state:G.upload_state=10,G.message=Params.general.message,G.update_wpfilebase=Params.general.update_wpfilebase,G.redirect_link=Params.general.redirect_link,G.notify_only_filename_list="",G.notify_target_path_list="",G.notify_attachment_list="",G.admin_messages={},G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase,G.admin_messages.notify=Params.general.admin_messages.notify,G.admin_messages.redirect=Params.general.admin_messages.redirect,G.admin_messages.debug=debug_data[1],G.admin_messages.other=Params.general.admin_messages.other,G.errors={},G.errors.wpfilebase=Params.general.errors.wpfilebase,G.errors.notify=Params.general.errors.notify,G.errors.redirect=Params.general.errors.redirect,G.current_size=0,G.total_size=0;else{if(""==G.unique_id||G.unique_id!=unique_id||G.unique_id!=Params.general.unique_id)return;if(G.last)return;0==Params.general.files_count&&Params[0]&&"error"==Params[0].message_type&&(Params.general.files_count=1);for(var file_status="",i=0;i<Params.general.files_count;i++)file_status="error"==Params[i].message_type&&0==G.files_processed?"error1":"error"==Params[i].message_type&&G.files_processed>0?"error2":Params[i].message_type,G.upload_state=GlobalData.filestatematch[file_status][G.upload_state];UploadStates_Ok||(G.upload_state=10),G.files_processed+=Params.general.files_count,G.message=wfu_join_strings("<br />",G.message,Params.general.message),""==G.update_wpfilebase&&(G.update_wpfilebase=Params.general.update_wpfilebase),(!request_type||request_type&&"email"!=request_type)&&(G.redirect_link=Params.general.redirect_link),G.notify_only_filename_list=wfu_join_strings(", ",G.notify_only_filename_list,Params.general.notify_only_filename_list),G.notify_target_path_list=wfu_join_strings(", ",G.notify_target_path_list,Params.general.notify_target_path_list),G.notify_attachment_list=wfu_join_strings(",",G.notify_attachment_list,Params.general.notify_attachment_list),G.admin_messages.debug=wfu_join_strings("<br />",G.admin_messages.debug,debug_data[1]),G.admin_messages.other=wfu_join_strings("<br />",G.admin_messages.other,Params.general.admin_messages.other),""==G.admin_messages.wpfilebase&&(G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase),""==G.admin_messages.notify&&(G.admin_messages.notify=Params.general.admin_messages.notify),""==G.admin_messages.redirect&&(G.admin_messages.redirect=Params.general.admin_messages.redirect),""==G.errors.wpfilebase&&(G.errors.wpfilebase=Params.general.errors.wpfilebase),""==G.errors.notify&&(G.errors.notify=Params.general.errors.notify),""==G.errors.redirect&&(G.errors.redirect=Params.general.errors.redirect)}G.files_processed==G.files_count&&(G.last=!0,""!=G.update_wpfilebase&&(G.admin_messages.wpfilebase="",wfu_notify_WPFilebase(params_index,session_token)),""!=G.notify_only_filename_list&&(G.admin_messages.notify="",wfu_send_email_notification(sid,unique_id,params_index,session_token,G.notify_only_filename_list,G.notify_target_path_list,G.notify_attachment_list,debug_data[0],debug_data[2]),G.last=!1,G.notify_only_filename_list=""),G.last&&("no-ajax"!=unique_id&&wfu_notify_server_upload_ended(sid,unique_id,params_index,session_token),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+unique_id+"\\]","g"),"")),""!=G.errors.redirect&&(G.redirect_link=""),""!=G.redirect_link&&G.last&&""==GlobalData.UploadInProgressString.trim()&&(G.upload_state=11,do_redirect=!0));var nonadmin_message=G.message,admin_message=wfu_join_strings("<br />",G.admin_messages.other,G.admin_messages.wpfilebase,G.admin_messages.notify,G.admin_messages.redirect,G.admin_messages.debug);if(!UploadStates_Ok){var error_jsonparse_headermessage=GlobalData.consts.jsonparse_headermessage,error_jsonparse_headeradminmessage=GlobalData.consts.jsonparse_headeradminmessage;nonadmin_message=wfu_join_strings("<br />",error_jsonparse_headermessage,nonadmin_message),admin_message=wfu_join_strings("<br />",error_jsonparse_headeradminmessage,admin_message)}if(G.last){0==G.files_count&&12!=G.upload_state?G.upload_state=8:G.upload_state<4&&(G.upload_state+=4);var admin_messages_exist=""!=G.admin_messages.wpfilebase||""!=G.admin_messages.notify||""!=G.admin_messages.redirect||""!=G.admin_messages.other;4==G.upload_state&&""!=admin_message?G.upload_state++:5==G.upload_state&&""==!admin_message&&""==nonadmin_message&&G.upload_state--}if(message_table){var subheader_state=document.getElementById("wfu_messageblock_header_"+sid+"_state"),single_file_shown=1==G.files_count&&""==nonadmin_message&&""==admin_message&&G.last&&!do_redirect;if(single_file_shown)document.getElementById("wfu_messageblock_header_"+sid).style.display="none";else{document.getElementById("wfu_messageblock_header_"+sid).style.display="";var header_container=document.getElementById("wfu_messageblock_header_"+sid+"_container");if(UploadStates_Ok){var suffix="";1!=G.files_count||5!=G.upload_state&&7!=G.upload_state||(suffix="_singlefile"),header_container.innerHTML=UploadStates[sid]["State"+G.upload_state+suffix]}else{header_container.innerHTML="";var safe_container=document.getElementById("wfu_messageblock_header_"+sid+"_safecontainer");header_container.innerHTML=safe_container.innerHTML.replace(/_safe/g,"")}var subheader_show=!1;""!=nonadmin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_messagelabel").innerHTML=nonadmin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="none",""!=admin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessagelabel").innerHTML=admin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="none",subheader_show?document.getElementById("wfu_messageblock_subheader_"+sid).style.display=subheader_state.value:document.getElementById("wfu_messageblock_subheader_"+sid).style.display="none",subheader_show||G.files_processed>0?(header_container.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+sid).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+sid).style.display="none",header_container.colSpan=3)}for(var next_block=document.getElementById("wfu_messageblock_subheader_"+sid),next_block_id=0,file_block=null,file_template_container=document.getElementById("wfu_messageblock_"+sid+"_filetemplate"),file_contents="",door=document.getElementById("wfu_messageblock_"+sid+"_door"),ii=0,headerspan=1,subheaderspan=2,file_template=wfu_plugin_decode_string(file_template_container.value.replace(/^\s+|\s+$/g,"")),i=0;i<Params.general.files_count;i++){for(ii=i+file_id,file_contents=file_template.replace(/\[file_id\]/g,ii),file_contents=file_contents.replace(/\[filenumber_display\]/g,""),file_contents=file_contents.replace(/\[fileheader_color\]/g,Params[i].color),file_contents=file_contents.replace(/\[fileheader_bgcolor\]/g,Params[i].bgcolor),file_contents=file_contents.replace(/\[fileheader_borcolor\]/g,Params[i].borcolor),file_contents=file_contents.replace(/\[fileheader_message\]/g,Params[i].header),file_contents=file_contents.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_message\]/g,Params[i].message),file_contents=file_contents.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_adminmessage\]/g,Params[i].admin_messages),file_contents="<table><tbody>"+file_contents+"</tbody></table>",door.innerHTML=file_contents,headerspan=1,subheaderspan=2,subheader_show=!1,file_block=document.getElementById("wfu_messageblock_"+sid+"_"+ii),1==G.files_count?(document.getElementById("wfu_messageblock_"+sid+"_filenumber_"+ii).style.display="none",document.getElementById("wfu_messageblock_subheader_"+sid+"_fileempty_"+ii).style.display="none",single_file_shown?file_block.style.display="":file_block.style.display=subheader_state.value,headerspan++,subheaderspan++):file_block.style.display=subheader_state.value,""!=Params[i].message&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_message_"+ii).style.display="",subheader_show=!0),""!=Params[i].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage_"+ii).style.display="",subheader_show=!0),subheader_show||(document.getElementById("wfu_messageblock_arrow_"+sid+"_"+ii).style.display="none",headerspan++),document.getElementById("wfu_messageblock_header_"+sid+"_container_"+ii).colSpan=headerspan,document.getElementById("wfu_messageblock_subheader_"+sid+"_container_"+ii).colSpan=subheaderspan;ii>next_block_id&&(next_block=next_block.nextSibling,null!=next_block);)1===next_block.nodeType&&(next_block_id=next_block.id.substr(next_block.id.lastIndexOf("_")+1));message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block.nextSibling,file_block=document.getElementById("wfu_messageblock_subheader_"+sid+"_"+ii),message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block,next_block_id=ii}single_file_shown&&(document.getElementById("wfu_messageblock_"+sid+"_1").style.display=""),message_table.style.display="",document.getElementById("wordpress_file_upload_message_"+sid).style.display=""}return js_script_enc&&eval(wfu_plugin_decode_string(js_script_enc)),do_redirect&&wfu_Redirect(G.redirect_link),G.last}}function wfu_uploadFailed(e,a){a&&(console.log("failure report following"),console.log(e));var t=e.target,s={target:{responseText:"",shortcode_id:t.shortcode_id}};wfu_uploadComplete.call(t,s)}function wfu_uploadCanceled(e){}function wfu_notify_server_upload_ended(e,a,t,s){var n=wfu_GetHttpRequestObject();if(null!=n){var i=GlobalData.consts.ajax_url;params=new Array(6),
2
+ params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="wfu_uploader_nonce",params[1][1]=document.getElementById("wfu_uploader_nonce_"+e).value,params[2]=new Array(2),params[2][0]="uniqueuploadid_"+e,params[2][1]=a,params[3]=new Array(2),params[3][0]="params_index",params[3][1]=t,params[4]=new Array(2),params[4][0]="session_token",params[4][1]=s,params[5]=new Array(2),params[5][0]="upload_finished",params[5][1]=1;for(var l="",r=0;r<params.length;r++)l+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);n.open("POST",i,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&200==n.status&&wfu_Code_Objects[e].do_action("after_upload",n.responseText)},n.send(l)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",e.general.state=0,e.general.files_count=0,e.general.update_wpfilebase="",e.general.redirect_link="",e.general.upload_finish_time=0,e.general.message="",e.general.message_type="",e.general.admin_messages={},e.general.admin_messages.wpfilebase="",e.general.admin_messages.notify="",e.general.admin_messages.redirect="",e.general.admin_messages.other="",e.general.errors={},e.general.errors.wpfilebase="",e.general.errors.notify="",e.general.errors.redirect="",e.general.color="",e.general.bgcolor="",e.general.borcolor="",e.general.notify_only_filename_list="",e.general.notify_target_path_list="",e.general.notify_attachment_list="",e.general.fail_message="",e.general.fail_admin_message="",e}function wfu_redirect_to_classic(e,a,t,s){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e,!0)&&wfu_Code_Objects[e].apply_filters("pre_start_check",!0)&&wfu_redirect_to_classic_cont(e,a,t,s)}function wfu_redirect_to_classic_cont(e,a,t,s){var n=function(n){var l="",r="wfu_askserver_success:",o="wfu_askserver_error:",_=n.indexOf(r),d=n.indexOf(o);if(_>-1){l=n.substr(_+r.length),wfu_Code_Objects[e].do_action("askserver_success",l,"no-ajax");var u=wfu_Initialize_Params();if(u.general.shortcode_id=e,u.general.unique_id="",u.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,u,"no-ajax","",a,"",["false","","false"]),1==t){var c="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+c}s>0?document.getElementById("adminerrorcodes_"+e).value=s:document.getElementById("adminerrorcodes_"+e).value="",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=i,document.getElementById("uploadform_"+e).submit()}else d>-1&&(l=n.substr(d+o.length),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_error",l))},i=wfu_randomString(10);wfu_lock_upload(e),wfu_Code_Objects[e].do_action("pre_start");var l="",r=wfu_Code_Objects[e].apply_filters("askserver_pass_params",{});for(var o in r)r.hasOwnProperty(o)&&(l+="&"+o+"="+r[o]);var _=new Date,d=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_ask_server&wfu_uploader_nonce="+document.getElementById("wfu_uploader_nonce_"+e).value+"&sid="+e+"&unique_id="+i+"&start_time="+_.getTime()+"&session_token="+a+l,u=wfu_GetHttpRequestObject();if(null==u){var c=document.createElement("iframe");return c?(c.style.display="none",c.src=d,document.body.appendChild(c),void(c.onload=function(){n(c.contentDocument.body.innerHTML)})):void wfu_Code_Objects[e].do_action("not_supported")}u.open("GET",d,!0),u.onreadystatechange=function(){4==u.readyState&&(200==u.status?n(u.responseText):(alert(GlobalData.consts.remoteserver_noresult),wfu_Code_Objects[e].do_action("askserver_noresult")))},u.send(null)}function wfu_filesselected(e){var a=document.getElementById("fileName_"+e),t=wfu_get_filelist(e);return 0==t.length&&a&&(a.value=GlobalData.consts.nofilemessage,a.className="file_input_textbox_nofile"),t.length}function wfu_check_required_userdata(e,a){for(var t=wfu_get_userdata_count(e),s=!1,n=0;t>n;n++){var i=document.getElementById("hiddeninput_"+e+"_userdata_"+n),l=document.getElementById("userdata_"+e+"_fieldwrapper_"+n),r=document.getElementById("userdata_"+e+"_field_"+n),o=document.getElementById("userdata_"+e+"_"+n),_=document.getElementById("userdata_"+e+"_hint_"+n);i.value=window["userdata_"+e+"_codes_"+n].value(r);for(var d={hintposition:"none"},u=document.getElementById("userdata_"+e+"_props_"+n).value.split("|"),c=0;c<u.length;c++)"p:"==u[c].substr(0,2)&&(d.hintposition=u[c].substr(2));var m="";if("file_userdata_fieldwrapper_required"==l.className.substr(0,35)&&(m=window["userdata_"+e+"_codes_"+n].empty(i)),""===m&&window["userdata_"+e+"_codes_"+n].validate&&(m=window["userdata_"+e+"_codes_"+n].validate(i)),""!==m){if(a)if("none"==d.hintposition)_.className="file_userdata_hint_none";else{l.className="file_userdata_fieldwrapper_required_empty";var f=o.getBoundingClientRect(),p=l.getBoundingClientRect();"inline"==d.hintposition?(_.className="file_userdata_hint_inline",_.style.left=parseInt(p.left-f.left)+"px",_.style.top=parseInt(p.top-f.top)+"px",_.style.right=parseInt(f.right-p.right)+"px",_.style.bottom=parseInt(f.bottom-p.bottom)+"px"):"top"==d.hintposition?(_.className="file_userdata_hint_top",_.style.left=parseInt(p.left-f.left)+"px",_.style.bottom=parseInt(f.bottom-p.top)+"px"):"right"==d.hintposition?(_.className="file_userdata_hint_right",_.style.left=parseInt(p.right-f.left)+"px",_.style.top=parseInt(p.top-f.top)+"px"):"bottom"==d.hintposition?(_.className="file_userdata_hint_bottom",_.style.left=parseInt(p.left-f.left)+"px",_.style.top=parseInt(p.bottom-f.top)+"px"):"left"==d.hintposition&&(_.className="file_userdata_hint_left",_.style.right=parseInt(f.right-p.left)+"px",_.style.top=parseInt(p.top-f.top)+"px"),_.innerHTML=m,_.style.display="block"}s=!0}}return!s}function wfu_HTML5UploadFile(e,a,t){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,t,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,t,1,2);a=wfu_plugin_decode_string(a.replace(/^\s+|\s+$/g,""));var s=null;try{s=JSON.parse(a)}catch(n){}if(null==s)return void wfu_redirect_to_classic(e,t,1,3);var i=wfu_GetHttpRequestObject();if(null!=i){var l=wfu_filesselected(e);if(0!=l){var r=document.getElementById("upload_"+e),o=!r;if(!wfu_selectsubdir_check(e))return void(o&&wfu_clear_files(e));var _=l;if(_+=_,!wfu_check_required_userdata(e,!0))return void(o&&wfu_clear_files(e));if(wfu_Code_Objects[e].apply_filters("pre_start_check",!0)){var d=wfu_randomString(10);if(wfu_lock_upload(e),wfu_Code_Objects[e].do_action("pre_start"),wfu_Code_Objects[e].apply_filters("pre_start_ask_server",!1,s.has_filters)){var u=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_ask_server",params[1]=new Array(2),params[1][0]="session_token",params[1][1]=t,params[2]=new Array(2),params[2][0]="sid",params[2][1]=e,params[3]=new Array(2),params[3][0]="unique_id",params[3][1]=d,params[4]=new Array(2),params[4][0]="wfu_uploader_nonce",params[4][1]=document.getElementById("wfu_uploader_nonce_"+e).value;var c=wfu_Code_Objects[e].apply_filters("askserver_pass_params",{});for(var m in c)c.hasOwnProperty(m)&&params.push([m,c[m]]);for(var f="",p=0;p<params.length;p++)f+=(p>0?"&":"")+params[p][0]+"="+encodeURI(params[p][1]);i.open("POST",u,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){if(4==i.readyState)if(200==i.status){var a=i.responseText,n="",l="wfu_askserver_success:",r="wfu_askserver_error:",o=a.indexOf(l),_=a.indexOf(r);o>-1?(n=a.substr(o+l.length),wfu_Code_Objects[e].do_action("askserver_success",n,"ajax"),wfu_HTML5UploadFile_cont(e,s,t,d)):_>-1&&(n=a.substr(_+r.length),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_error",n))}else alert(GlobalData.consts.remoteserver_noresult),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_noresult")},i.send(f)}else wfu_HTML5UploadFile_cont(e,s,t,d)}}}}function wfu_HTML5UploadFile_cont(e,a,t,s){function n(l,r,o,u){m=!0;var f=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=f&&null!=p){var w=null,b=null;try{var w=new FormData,b=new FormData}catch(g){}if(null!=w&&null!=b){w.append("action","wfu_ajax_action"),w.append("wfu_uploader_nonce",document.getElementById("wfu_uploader_nonce_"+e).value),o||w.append("uploadedfile_"+e+d,r),w.append("uploadedfile_"+e+"_index",l),w.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(_[l].name)),w.append("uploadedfile_"+e+"_size",_[l].size),w.append("uniqueuploadid_"+e,s),w.append("params_index",a.params_index),w.append("subdir_sel_index",i),o?w.append("only_check","1"):w.append("only_check","0"),w.append("session_token",t);var y=wfu_Code_Objects[e].apply_filters("upload_pass_params",{},"ajax");for(var h in y)y.hasOwnProperty(h)&&w.append(h,y[h]);for(var v=wfu_get_userdata_count(e),k=0;v>k;k++)w.append("hiddeninput_"+e+"_userdata_"+k,document.getElementById("hiddeninput_"+e+"_userdata_"+k).value);if(wfu_initialize_fileupload_xhr(f,e,t,s,a,l,_[l].name),f.loading=!0,o||(f.size=r.size,f.totalsize=_[l].size),u){b.append("action","wfu_ajax_action"),b.append("wfu_uploader_nonce",document.getElementById("wfu_uploader_nonce_"+e).value),b.append("params_index",a.params_index),b.append("session_token",t),b.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(b)}catch(I){}m=p.responseText.indexOf("success")>-1}if(m)o?(f.addEventListener("load",function(a){a={target:{responseText:a.target.responseText,shortcode_id:e,return_status:!0}};var t=wfu_uploadComplete.call(f,a);f.file_id=0,m="success"==t||"warning"==t,m&&n(l,r,!1,!1)},!1),f.addEventListener("error",function(e){},!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(w)):(f.upload.xhr=f,f.upload.dummy=1,f.upload.addEventListener("loadstart",wfu_loadStart,!1),f.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+f.xhrid+", "+a.debugmode+");"),!1),f.addEventListener("load",wfu_uploadComplete,!1),f.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+a.debugmode+");"),!1),f.addEventListener("abort",wfu_uploadCanceled,!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(w));else{var B={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(f,B)}return c++,m}}}var i=-1,l=document.getElementById("selectsubdir_"+e);if(l){var r=document.getElementById("selectsubdiredit_"+e),o="none"!=r.style.display;i=o?r.value:l.selectedIndex}var _=wfu_get_filelist(e),d="";GlobalData.UploadInProgressString+="["+s+"]",GlobalData[e]={},GlobalData[e].unique_id=s,GlobalData[e].last=!1,GlobalData[e].files_count=1,GlobalData[e].files_processed=0,GlobalData[e].upload_state=0,GlobalData[e].message="",GlobalData[e].update_wpfilebase="",GlobalData[e].redirect_link="",GlobalData[e].notify_only_filename_list="",GlobalData[e].notify_target_path_list="",GlobalData[e].notify_attachment_list="",GlobalData[e].admin_messages={},GlobalData[e].admin_messages.wpfilebase="",GlobalData[e].admin_messages.notify="",GlobalData[e].admin_messages.redirect="",GlobalData[e].admin_messages.debug="",GlobalData[e].admin_messages.other="",GlobalData[e].errors={},GlobalData[e].errors.wpfilebase="",GlobalData[e].errors.notify="",GlobalData[e].errors.redirect="",GlobalData[e].xhrs=Array(),GlobalData[e].metricstotal={size:_[0].size,loaded:0,progress_pos:0},GlobalData[e].metrics=[{size:_[0].size,loaded:0,progress_pos:0}],wfu_show_simple_progressbar(a.shortcode_id,"progressive"),wfu_attach_cancel_event(e,t,s,a);var u=wfu_Initialize_Params();u.general.shortcode_id=e,u.general.unique_id=s,wfu_ProcessUploadComplete(e,0,u,s,a.params_index,t,"",["false","","false"]);var c=0,m=!0,f=0;n(f,_[f],!0,!1)}function wfu_initialize_fileupload_xhr(e,a,t,s,n,i,l){var r=i>=0?GlobalData[a].xhrs.push(e)-1:-1,o=new Date;e.xhrid=r,e.shortcode_id=a,e.requesttype=i>=0?"fileupload":"email",e.file_id=i+1,e.size=0,e.totalsize=0,e.loading=!1,e.deltasize=0,e.deltaloaded=0,e.sizeloaded=0,e.aborted=!1,e.unique_id=s,e.params_index=n.params_index,e.session_token=t,e.debugmode=n.debugmode,e.is_admin=n.is_admin,e.start_time=o.getTime(),e.end_time=e.start_time,e.finish_time=e.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),e.fail_colors=n.fail_colors,e.error_message_header=n.error_header.replace(/%username%/g,"no data"),e.error_message_header=e.error_message_header.replace(/%useremail%/g,"no data"),e.error_message_header=e.error_message_header.replace(/%filename%/g,l),e.error_message_header=e.error_message_header.replace(/%filepath%/g,l),e.error_message_failed=GlobalData.consts.message_failed,e.error_message_cancelled=GlobalData.consts.message_cancelled,e.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%filename%/g,l),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%filepath%/g,l)}function wfu_get_userdata_count(e){for(var a=0;document.getElementById("userdata_"+e+"_"+a);)a++;return a}function wfu_lock_upload(e){document.getElementById("fileName_"+e);document.getElementById("input_"+e).disabled=!0,document.getElementById("upfile_"+e).disabled=!0,wfu_selectsubdir_disable_onoff(e,!0);var a=document.getElementById("upload_"+e);a&&(a.disabled=!0);for(var t=wfu_get_userdata_count(e),s=0;t>s;s++)window["userdata_"+e+"_codes_"+s].lock(document.getElementById("userdata_"+e+"_field_"+s));wfu_Code_Objects[e].do_action("lock_upload")}function wfu_unlock_upload(e){document.getElementById("fileName_"+e);document.getElementById("input_"+e).disabled=!1,document.getElementById("upfile_"+e).disabled=!1,wfu_selectsubdir_disable_onoff(e,!1);var a=document.getElementById("upload_"+e);a&&(a.disabled=!1);for(var t=wfu_get_userdata_count(e),s=0;t>s;s++)window["userdata_"+e+"_codes_"+s].unlock(document.getElementById("userdata_"+e+"_field_"+s));wfu_Code_Objects[e].do_action("unlock_upload")}function wfu_clear_files(e){document.getElementById("uploadform_"+e).reset();var a=document.getElementById("upfile_"+e);"undefined"!=typeof a.filearray&&(a.filearray.length=0,a.filearrayprops.length=0);var t=document.getElementById("fileName_"+e);t&&(t.value="",t.className="file_input_textbox")}function wfu_clear(e){wfu_clear_files(e);var a=document.getElementById("selectsubdir_"+e);if(a){var t=document.getElementById("selectsubdiredit_"+e),s="none"!=t.style.display;s?(a.selectedIndex=-1,t.value=""):(a.options[0].style.display="block",a.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value),a.selectedIndex<0&&(a.selectedIndex=0))}for(var n=wfu_get_userdata_count(e),i=0;n>i;i++)window["userdata_"+e+"_codes_"+i].reset(document.getElementById("userdata_"+e+"_field_"+i),document.getElementById("hiddeninput_"+e+"_userdata_"+i));wfu_Code_Objects[e].do_action("clear_upload")}function wfu_reset_message(e){var a=document.getElementById("wfu_messageblock_"+e);if(a){document.getElementById("wfu_messageblock_header_"+e).style.display="";var t=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(t.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",t.colSpan=3,document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none";for(var s=wfu_get_file_ids(e),n=1;n<=s.length;n++)a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,a){var t=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");t&&("progressive"==a?(t.style.width="0%",t.className="file_progress_progressive",s.style.display="none",t.style.display="block"):wfu_BrowserCaps.supportsAnimation?(t.style.width="25%",t.className="file_progress_shuffle",s.style.display="none",t.style.display="block"):(t.style.width="0%",t.className="file_progress_noanimation",t.style.display="none",s.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var a=document.getElementById("progressbar_"+e+"_animation"),t=document.getElementById("progressbar_"+e+"_imagesafe");a&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",a.style.width="0%",a.className="file_progress_noanimation",t.style.display="none",a.style.display="block")}function wfu_invoke_shortcode_editor(e,a,t,s){for(var n=document.getElementsByTagName("BUTTON"),i=0,l=null,r=0;r<n.length;r++)n[r].parentNode&&n[r].parentNode.id==s+"_editor_"+e&&(l=n[r],i++);if(0!=i){if(i>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){l.parentNode.style.display="none",document.getElementById(s+"_overlay_"+e).style.display="block";var _=GlobalData.consts.ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_edit_shortcode",params[1]=new Array(2),params[1][0]="upload_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="post_id",params[2][1]=a,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=t,params[4]=new Array(2),params[4][0]="shortcode_tag",params[4][1]=s,params[5]=new Array(2),params[5][0]="widget_id",params[5][1]=document.getElementById(s+"_"+e+"_widgetid")?document.getElementById(s+"_"+e+"_widgetid").value:"";for(var d="",r=0;r<params.length;r++)d+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);o.open("POST",_,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById(s+"_overlay_"+e).style.display="none",l.parentNode.removeAttribute("style");var a="wfu_edit_shortcode:",t=o.responseText.indexOf(a);-1==t&&(t=o.responseText.length);var n=(o.responseText.substr(0,t),o.responseText.substr(t+a.length,o.responseText.length-t-a.length));t=n.indexOf(":");var i=n.substr(0,t);if(txt_value=n.substr(t+1,n.length-t-1),"success"==i){var r=window.open(wfu_plugin_decode_string(txt_value),"_blank");r?r.plugin_window=window:alert(GlobalData.consts.enable_popups)}else"check_page_obsolete"==i&&alert(txt_value)}},o.send(d)}}}GlobalData={},UploadStates={},Code_Initializators=[],GlobalData.filestatematch={},GlobalData.filestatematch.success=[0,1,2,2],GlobalData.filestatematch.warning=[1,1,2,2],GlobalData.filestatematch.error1=[3,3,2,3],GlobalData.filestatematch.error2=[2,2,2,3],GlobalData.UploadInProgressString="",GlobalData.FreeChangeHandler=!1,wfu_Check_Browser_Capabilities(),Code_Initializators[Code_Initializators.length]=function(sid){var CBUV_Code_Objects={};return CBUV_Code_Objects.pre_start_ask_server=function(e,a){if(e)return e;this.sid;return"true"==a},CBUV_Code_Objects.askserver_pass_params=function(e){for(var a=this.sid,t=wfu_get_filelist(a),s="",n="",i=0;i<t.length;i++)i>0&&(s+=";",n+=";"),s+=wfu_plugin_encode_string(t[i].name),n+=t[i].size;return e.filenames=s,e.filesizes=n,e},CBUV_Code_Objects.askserver_success=function(response,mode){var sid=this.sid,upload_status="success",txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";""!=txt_header&&eval(txt_header)},CBUV_Code_Objects.askserver_error=function(response,mode){var sid=this.sid,upload_status="error",txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";if(""!=txt_header&&eval(txt_header),txt_match=response.match(/CBUV\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"",""!=txt_header){var Params=wfu_Initialize_Params();Params.general.shortcode_id=sid,Params.general.message=txt_header,Params.general.state=12,wfu_ProcessUploadComplete(sid,0,Params,"no-ajax","","","",["false","","false"]),wfu_clear(sid)}},CBUV_Code_Objects.after_upload=function(response){var sid=this.sid,txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";""!=txt_header&&eval(txt_header)},CBUV_Code_Objects},wfu_initialize_webcam=function(e,a,t,s,n,i,l,r,o){"undefined"==typeof wfu_parse_video_width&&(wfu_parse_video_width=function(e){var a=parseInt(e);a>0&&(this.empty=!1,this.video.width=a)}),"undefined"==typeof wfu_parse_video_height&&(wfu_parse_video_height=function(e){var a=parseInt(e);a>0&&(this.empty=!1,this.video.height=a)}),"undefined"==typeof wfu_parse_video_aspectratio&&(wfu_parse_video_aspectratio=function(e){var a=parseFloat(e);a>0&&(this.empty=!1,this.video.aspectRatio=a)}),"undefined"==typeof wfu_parse_video_framerate&&(wfu_parse_video_framerate=function(e){var a=parseFloat(e);a>0&&(this.empty=!1,this.video.frameRate=a)}),"undefined"==typeof wfu_parse_video_facingmode&&(wfu_parse_video_facingmode=function(e){var a="front"==e?"user":"back"==e?"environment":"";""!=a&&(this.empty=!1,this.video.facingMode=a)});var _={empty:!0,video:{}};wfu_parse_video_width.call(_,s),wfu_parse_video_height.call(_,n),wfu_parse_video_aspectratio.call(_,i),wfu_parse_video_framerate.call(_,l),wfu_parse_video_facingmode.call(_,r);var d={mode:a,audio:"true"==t,video:_.empty?!0:_.video,maxrecordtime:o};window["wfu_webcam_props_"+e]=d,wfu_reinitialize_webcam(e)},wfu_reinitialize_webcam=function(e){window["wfu_webcam_props_"+e].active=!0,window["wfu_webcam_props_"+e].width=0,window["wfu_webcam_props_"+e].width=0,window["wfu_webcam_props_"+e].timeStart=0,window["wfu_webcam_props_"+e].duration=0,window["wfu_webcam_props_"+e].counting=!1,window["wfu_webcam_props_"+e].stream=null,window["wfu_webcam_props_"+e].media=null,window["wfu_webcam_props_"+e].blobs=null,window["wfu_webcam_props_"+e].playing=!1;var a=window["wfu_webcam_props_"+e],t=document.getElementById("webcam_"+e+"_box"),s=document.getElementById("webcam_"+e+"_webcamoff");s.style.display="none",t.style.display="block";var n={audio:a.audio,video:a.video};"undefined"==typeof Promise&&(Promise=function(e){this.mainCallback=e,this.then=function(e){return this.successCallback=e,this},this["catch"]=function(a){e(this.successCallback,a)}},PromiseRejected=function(e){this.then=function(e){return this},this["catch"]=function(a){a(e)}},Promise.reject=function(e){return new PromiseRejected(e)});var i=function(e,a,t){var s=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return s&&"undefined"!=typeof MediaRecorder?new Promise(function(a,t){s.call(navigator,e,a,t)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))};void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=i),navigator.mediaDevices.getUserMedia(n).then(function(s){window["wfu_webcam_props_"+e].stream=s,t.autoplay=!0,t.ontimeupdate=null,t.onerror=null,t.onloadeddata=function(a){wfu_webcam_init_callback(e)},t.src=window.URL.createObjectURL(s),wfu_initialize_webcam_nav(e,a.mode)})["catch"](function(a){console.log("Video not supported!",a),document.getElementById("webcam_"+e+"_inner").className="wfu_file_webcam_inner wfu_webcam_notsupported"})},wfu_webcam_init_callback=function(e){var a=document.getElementById("webcam_"+e+"_inner"),t=document.getElementById("webcam_"+e+"_box");window["wfu_webcam_props_"+e].width=t.videoWidth,window["wfu_webcam_props_"+e].height=t.videoHeight;var s='<svg xmlns="http://www.w3.org/2000/svg" width="'+t.videoWidth+'" height="'+t.videoHeight+'"></svg>',n=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),i=document.getElementById("webcam_"+e+"_webcamoff_img");i.src=window.URL.createObjectURL(n),i.style.width=a.clientWidth+"px",i.style.height=a.clientHeight+"px"},wfu_initialize_webcam_nav=function(e,a){"undefined"==typeof SVGInjector&&!function(e,a){"use strict";function t(e){e=e.split(" ");for(var a={},t=e.length,s=[];t--;)a.hasOwnProperty(e[t])||(a[e[t]]=1,s.unshift(e[t]));return s.join(" ")}var s="file:"===e.location.protocol,n=a.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),i=Array.prototype.forEach||function(e,a){if(void 0===this||null===this||"function"!=typeof e)throw new TypeError;var t,s=this.length>>>0;for(t=0;s>t;++t)t in this&&e.call(a,this[t],t,this)},l={},r=0,o=[],_=[],d={},u=function(e){return e.cloneNode(!0)},c=function(e,a){_[e]=_[e]||[],_[e].push(a)},m=function(e){for(var a=0,t=_[e].length;t>a;a++)!function(a){setTimeout(function(){_[e][a](u(l[e]))},0)}(a)},f=function(a,t){if(void 0!==l[a])l[a]instanceof SVGSVGElement?t(u(l[a])):c(a,t);else{if(!e.XMLHttpRequest)return t("Browser does not support XMLHttpRequest"),!1;l[a]={},c(a,t);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(404===n.status||null===n.responseXML)return t("Unable to load SVG file: "+a),s&&t("Note: SVG injection ajax calls do not work locally without adjusting security setting in your browser. Or consider using a local webserver."),t(),!1;if(!(200===n.status||s&&0===n.status))return t("There was a problem injecting the SVG: "+n.status+" "+n.statusText),!1;if(n.responseXML instanceof Document)l[a]=n.responseXML.documentElement;else if(DOMParser&&DOMParser instanceof Function){var e;try{var i=new DOMParser;e=i.parseFromString(n.responseText,"text/xml")}catch(r){e=void 0}if(!e||e.getElementsByTagName("parsererror").length)return t("Unable to parse SVG file: "+a),!1;l[a]=e.documentElement}m(a)}},n.open("GET",a),n.overrideMimeType&&n.overrideMimeType("text/xml"),n.send()}},p=function(a,s,l,_){var u=a.getAttribute("data-src")||a.getAttribute("src");if(!/\.svg/i.test(u))return void _("Attempted to inject a file with a non-svg extension: "+u);if(!n){var c=a.getAttribute("data-fallback")||a.getAttribute("data-png");return void(c?(a.setAttribute("src",c),_(null)):l?(a.setAttribute("src",l+"/"+u.split("/").pop().replace(".svg",".png")),_(null)):_("This browser does not support SVG and no PNG fallback was defined."))}-1===o.indexOf(a)&&(o.push(a),a.setAttribute("src",""),f(u,function(n){if("undefined"==typeof n||"string"==typeof n)return _(n),!1;var l=a.getAttribute("id");l&&n.setAttribute("id",l);var c=a.getAttribute("title");c&&n.setAttribute("title",c);var m=[].concat(n.getAttribute("class")||[],"injected-svg",a.getAttribute("class")||[]).join(" ");n.setAttribute("class",t(m));var f=a.getAttribute("style");f&&n.setAttribute("style",f);var p=[].filter.call(a.attributes,function(e){return/^data-\w[\w\-]*$/.test(e.name)});i.call(p,function(e){e.name&&e.value&&n.setAttribute(e.name,e.value)});var w,b,g,y,h,v={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],pattern:["fill","stroke"],radialGradient:["fill","stroke"]};Object.keys(v).forEach(function(e){w=e,g=v[e],b=n.querySelectorAll("defs "+w+"[id]");for(var a=0,t=b.length;t>a;a++){y=b[a].id,h=y+"-"+r;var s;i.call(g,function(e){s=n.querySelectorAll("["+e+'*="'+y+'"]');for(var a=0,t=s.length;t>a;a++)s[a].setAttribute(e,"url(#"+h+")")}),b[a].id=h}}),n.removeAttribute("xmlns:a");for(var k,I,B=n.querySelectorAll("script"),G=[],x=0,E=B.length;E>x;x++)I=B[x].getAttribute("type"),I&&"application/ecmascript"!==I&&"application/javascript"!==I||(k=B[x].innerText||B[x].textContent,G.push(k),n.removeChild(B[x]));if(G.length>0&&("always"===s||"once"===s&&!d[u])){for(var D=0,j=G.length;j>D;D++)new Function(G[D])(e);d[u]=!0}var P=n.querySelectorAll("style");i.call(P,function(e){e.textContent+=""}),a.parentNode.replaceChild(n,a),delete o[o.indexOf(a)],a=null,r++,_(n)}))},w=function(e,a,t){a=a||{};var s=a.evalScripts||"always",n=a.pngFallback||!1,l=a.each;if(void 0!==e.length){var r=0;i.call(e,function(a){p(a,s,n,function(a){l&&"function"==typeof l&&l(a),t&&e.length===++r&&t(r)})})}else e?p(e,s,n,function(a){l&&"function"==typeof l&&l(a),t&&t(1),e=null}):t&&t(0)};"object"==typeof module&&"object"==typeof module.exports?module.exports=exports=w:"function"==typeof define&&define.amd?define(function(){return w}):"object"==typeof e&&(e.SVGInjector=w)}(window,document),"1"!=document.getElementById("webcam_"+e+"_btns_converted").value&&(SVGInjector(document.getElementById("webcam_"+e+"_btns")),document.getElementById("webcam_"+e+"_btns_converted").value="1"),"capture video"==a?wfu_webcam_set_nav_status(e,"idle_only_video"):"take photos"==a?wfu_webcam_set_nav_status(e,"idle_only_pictures"):"both"==a?wfu_webcam_set_nav_status(e,"idle_video_and_pictures"):wfu_webcam_set_nav_status(e,"idle_only_video")},wfu_webcam_set_nav_status=function(e,a){var t=document.getElementById("webcam_"+e+"_btn_onoff"),s=document.getElementById("webcam_"+e+"_nav"),n=document.getElementById("webcam_"+e+"_btn_video"),i=document.getElementById("webcam_"+e+"_btn_record"),l=document.getElementById("webcam_"+e+"_btn_play"),r=document.getElementById("webcam_"+e+"_btn_stop"),o=document.getElementById("webcam_"+e+"_btn_pause"),_=document.getElementById("webcam_"+e+"_btn_pos"),d=document.getElementById("webcam_"+e+"_btn_back"),u=document.getElementById("webcam_"+e+"_btn_fwd"),c=document.getElementById("webcam_"+e+"_btn_time"),m=document.getElementById("webcam_"+e+"_btn_picture"),f=document.getElementById("webcam_"+e+"_screenshot");t.style.display="block","hidden"==a?s.style.display="none":"recording"==a?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_recording",n.style.display="none",i.style.display="block",i.style.visibility="visible",i.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_record wfu_recording"),r.style.display="block",r.style.visibility="visible",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):"after_recording"==a?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="hidden",m.style.display="none",f.style.display="block"):"ready_playback"==a?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="visible",l.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_play"),o.style.display="block",o.style.visibility="visible",o.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_pause_disabled"),_.style.display="block",_.style.visibility="visible",d.style.display="block",d.style.visibility="visible",u.style.display="block",u.style.visibility="visible",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):"after_screenshot"==a?(s.removeAttribute("style"),
3
+ s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="hidden",m.style.display="none",f.style.display="block"):"playing"==a?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_video_disabled"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="visible",l.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_play_disabled"),o.style.display="block",o.style.visibility="visible",o.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_pause"),_.style.display="block",_.style.visibility="visible",d.style.display="block",d.style.visibility="visible",u.style.display="block",u.style.visibility="visible",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_rec_ready",n.style.display="none",i.style.display="none",r.style.display="none",l.style.display="none",o.style.display="none",_.style.display="none",d.style.display="none",u.style.display="none",c.style.display="none",m.style.display="none",f.style.display="none",("idle_only_video"==a||"idle_video_and_pictures"==a)&&(i.style.display="block",i.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_record")),("idle_only_pictures"==a||"idle_video_and_pictures"==a)&&(m.style.display="block"))},wfu_webcam_counter_status=function(e,a){if("start"==a){var t=new Date;window["wfu_webcam_props_"+e].duration=0,window["wfu_webcam_props_"+e].timeStart=t.getTime()/1e3,window["wfu_webcam_props_"+e].counting=!0,wfu_webcam_update_counter(e)}else{var t=new Date;window["wfu_webcam_props_"+e].duration=t.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart,window["wfu_webcam_props_"+e].counting=!1}},wfu_webcam_update_counter=function(e){if(window["wfu_webcam_props_"+e].counting){var a=new Date,t=a.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart;wfu_webcam_update_timer(e,t),setTimeout(function(){wfu_webcam_update_counter(e)},100)}},wfu_webcam_update_timer=function(e,a){var t=Math.floor(a/3600);a-=3600*t;var s=Math.floor(a/60);a-=60*s;var n=Math.floor(a);1e3*(a-Math.floor(a));document.getElementById("webcam_"+e+"_btn_time_label").innerHTML=(t>0?t+":":"")+(10>s?"0":"")+s+":"+(10>n?"0":"")+n},wfu_webcam_onoff=function(e){if(window["wfu_webcam_props_"+e].active){var a=document.getElementById("webcam_"+e+"_inner"),t=document.getElementById("webcam_"+e+"_box"),s=document.getElementById("webcam_"+e+"_webcamoff"),n=document.getElementById("webcam_"+e+"_webcamoff_img");n.style.width=a.clientWidth+"px",n.style.height=a.clientHeight+"px",t.pause(),t.src="",t.load(),window["wfu_webcam_props_"+e].stream&&window["wfu_webcam_props_"+e].stream.stop&&window["wfu_webcam_props_"+e].stream.stop(),window["wfu_webcam_props_"+e].stream=null,window["wfu_webcam_props_"+e].media=null,window["wfu_webcam_props_"+e].blobs=null,wfu_webcam_set_nav_status(e,"hidden"),t.style.display="none",document.getElementById("webcam_"+e+"_screenshot").src="",s.style.display="block",window["wfu_webcam_props_"+e].active=!1}else wfu_reinitialize_webcam(e);wfu_selectbutton_clicked(e)},wfu_webcam_golive=function(e){window["wfu_webcam_props_"+e].playing||(wfu_reinitialize_webcam(e),wfu_add_files(e,[],!1),wfu_selectbutton_clicked(e),wfu_update_uploadbutton_status(e))},wfu_webcam_start_rec=function(e){if(!window["wfu_webcam_props_"+e].media||!window["wfu_webcam_props_"+e].media.state||"recording"!=window["wfu_webcam_props_"+e].media.state){try{window["wfu_webcam_props_"+e].media=new MediaRecorder(window["wfu_webcam_props_"+e].stream)}catch(a){return void alert(document.getElementById("webcam_"+e+"_video_notsupported").value)}window["wfu_webcam_props_"+e].blobs=[],window["wfu_webcam_props_"+e].media.ondataavailable=function(a){var t=new Date,s=t.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart;-1==window["wfu_webcam_props_"+e].maxrecordtime||window["wfu_webcam_props_"+e].maxrecordtime>0&&s<=window["wfu_webcam_props_"+e].maxrecordtime?a.data&&a.data.size>0&&window["wfu_webcam_props_"+e].blobs.push(a.data):wfu_webcam_stop_rec(e)},wfu_webcam_set_nav_status(e,"recording"),wfu_webcam_counter_status(e,"start"),window["wfu_webcam_props_"+e].media.onstop=function(a){wfu_webcam_counter_status(e,"stop"),wfu_webcam_set_nav_status(e,"after_recording"),wfu_webcam_onstop(a,e)},window["wfu_webcam_props_"+e].media.start(10)}},wfu_webcam_stop_rec=function(e){window["wfu_webcam_props_"+e].media.stop()},wfu_webcam_onstop=function(e,a){if(0==window["wfu_webcam_props_"+a].blobs.length)alert(document.getElementById("webcam_"+a+"_video_nothingrecorded").value),wfu_webcam_golive(a);else{var t=document.getElementById("webcam_"+a+"_box"),s=document.getElementById("webcam_"+a+"_canvas"),n=document.getElementById("webcam_"+a+"_screenshot");if(window["wfu_webcam_props_"+a].stream){s.width=t.clientWidth,s.height=t.clientHeight;var i=s.getContext("2d");i.drawImage(t,0,0,t.clientWidth,t.clientHeight),n.src=s.toDataURL("image/webp")}var l=new Blob(window["wfu_webcam_props_"+a].blobs,{type:"video/mp4"});t.autoplay=!1,t.ontimeupdate=function(e){wfu_webcam_update_pos(a)},t.onended=function(e){wfu_webcam_ended(a)},t.onloadeddata=function(e){t.readyState>=2&&wfu_webcam_set_nav_status(a,"ready_playback")},t.onerror=function(e){t.onloadeddata=null,t.src=window.URL.createObjectURL(window["wfu_webcam_props_"+a].stream)},t.src=window.URL.createObjectURL(l),l.name="video.mp4",wfu_add_files(a,[{file:l,props:{}}],!1),wfu_update_uploadbutton_status(a)}},wfu_webcam_play=function(e){if(!window["wfu_webcam_props_"+e].playing){var a=document.getElementById("webcam_"+e+"_box");wfu_webcam_set_nav_status(e,"playing"),window["wfu_webcam_props_"+e].playing=!0,a.play()}},wfu_webcam_ended=function(e){var a=document.getElementById("webcam_"+e+"_box");a.src=a.src,wfu_webcam_set_nav_status(e,"ready_playback"),window["wfu_webcam_props_"+e].playing=!1},wfu_webcam_pause=function(e){var a=document.getElementById("webcam_"+e+"_box");a.pause(),wfu_webcam_set_nav_status(e,"ready_playback"),window["wfu_webcam_props_"+e].playing=!1},wfu_webcam_back=function(e){var a=document.getElementById("webcam_"+e+"_box");a.src=a.src,a.currentTime=0},wfu_webcam_fwd=function(e){var a=document.getElementById("webcam_"+e+"_box");a.currentTime=isFinite(a.duration)?a.duration:2*window["wfu_webcam_props_"+e].duration},wfu_webcam_take_picture=function(e){var a=document.getElementById("webcam_"+e+"_box"),t=document.getElementById("webcam_"+e+"_canvas"),s=document.getElementById("webcam_"+e+"_screenshot");if(window["wfu_webcam_props_"+e].stream){t.width=a.clientWidth,t.height=a.clientHeight;var n=t.getContext("2d");n.drawImage(a,0,0,a.clientWidth,a.clientHeight),s.src=t.toDataURL("image/webp"),wfu_webcam_set_nav_status(e,"after_screenshot"),window.wfu_toBlob_function_initialized||(!function(e){"use strict";var a=e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype,t=e.Blob&&function(){try{return Boolean(new Blob)}catch(e){return!1}}(),s=t&&e.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}}(),n=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||e.MSBlobBuilder,i=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,l=(t||n)&&e.atob&&e.ArrayBuffer&&e.Uint8Array&&function(e){var a,l,r,o,_,d,u,c,m;if(a=e.match(i),!a)throw new Error("invalid data URI");for(l=a[2]?a[1]:"text/plain"+(a[3]||";charset=US-ASCII"),r=!!a[4],o=e.slice(a[0].length),_=r?atob(o):decodeURIComponent(o),d=new ArrayBuffer(_.length),u=new Uint8Array(d),c=0;c<_.length;c+=1)u[c]=_.charCodeAt(c);return t?new Blob([s?u:d],{type:l}):(m=new n,m.append(d),m.getBlob(l))};e.HTMLCanvasElement&&!a.toBlob&&(a.mozGetAsFile?a.toBlob=function(e,t,s){e(s&&a.toDataURL&&l?l(this.toDataURL(t,s)):this.mozGetAsFile("blob",t))}:a.toDataURL&&l&&(a.toBlob=function(e,a,t){e(l(this.toDataURL(a,t)))})),"function"==typeof define&&define.amd?define(function(){return l}):"object"==typeof module&&module.exports?module.exports=l:e.dataURLtoBlob=l}(window),window.wfu_toBlob_function_initialized=!0),t.toBlob&&t.toBlob(function(a){a.name="image.png",wfu_add_files(e,[{file:a,props:{}}],!1),wfu_update_uploadbutton_status(e)},"image/png")}},wfu_webcam_update_pos=function(e){var a=document.getElementById("webcam_"+e+"_box"),t=document.getElementById("webcam_"+e+"_btn_pointer"),s=isFinite(a.duration)?a.duration:window["wfu_webcam_props_"+e].duration,n=Math.round(a.currentTime/s*100);t.style.left=n+"%",wfu_webcam_update_timer(e,a.currentTime)};
lib/wfu_ajaxactions.php CHANGED
@@ -408,7 +408,7 @@ function wfu_ajax_action_download_file_invoker() {
408
  $filerec = wfu_get_file_rec($filepath, true);
409
  $userdata = array();
410
  foreach ( $filerec->userdata as $data )
411
- array_push($userdata, array( "label" => $data->property, "value" => propvalue ));
412
  $additional_data = array(
413
  "file_action" => "download",
414
  "filepath" => $filepath,
@@ -452,7 +452,7 @@ function wfu_ajax_action_download_file_invoker() {
452
  function wfu_ajax_action_download_file_monitor() {
453
  $file_code = (isset($_POST['file']) ? $_POST['file'] : (isset($_GET['file']) ? $_GET['file'] : ''));
454
  $id = (isset($_POST['id']) ? $_POST['id'] : (isset($_GET['id']) ? $_GET['id'] : ''));
455
- if ( $file_enc == '' || $id == '' ) die();
456
 
457
  //ensure that this is not a CSRF attack by checking validity of a security ticket
458
  if ( !isset($_SESSION['wfu_download_monitor_ticket_'.$id]) || time() > $_SESSION['wfu_download_monitor_ticket_'.$id] ) die();
408
  $filerec = wfu_get_file_rec($filepath, true);
409
  $userdata = array();
410
  foreach ( $filerec->userdata as $data )
411
+ array_push($userdata, array( "label" => $data->property, "value" => $data->propvalue ));
412
  $additional_data = array(
413
  "file_action" => "download",
414
  "filepath" => $filepath,
452
  function wfu_ajax_action_download_file_monitor() {
453
  $file_code = (isset($_POST['file']) ? $_POST['file'] : (isset($_GET['file']) ? $_GET['file'] : ''));
454
  $id = (isset($_POST['id']) ? $_POST['id'] : (isset($_GET['id']) ? $_GET['id'] : ''));
455
+ if ( $file_code == '' || $id == '' ) die();
456
 
457
  //ensure that this is not a CSRF attack by checking validity of a security ticket
458
  if ( !isset($_SESSION['wfu_download_monitor_ticket_'.$id]) || time() > $_SESSION['wfu_download_monitor_ticket_'.$id] ) die();
lib/wfu_constants.php CHANGED
@@ -271,6 +271,7 @@ $GLOBALS["WFU_GLOBALS"] = array(
271
  );
272
  //other plugin values
273
  $GLOBALS["WFU_GLOBALS"] += array(
 
274
  "WFU_DOS_ATTACKS_CHECK" => array( "Check for Denial-Of-Service Attacks", "string", "true", "If it is true then then plugin will check if the number of files uploaded within a specific amount of time exceeds the limit, thus protecting from DOS attacks. It can be 'true' or 'false'." ),
275
  "WFU_DOS_ATTACKS_FILE_LIMIT" => array( "Denial-Of-Service File Limit", "integer", 10000, "Defines the maximum number of files that are allowed to be uploaded within a specific amount of time. It can be any positive integer." ),
276
  "WFU_DOS_ATTACKS_TIME_INTERVAL" => array( "Denial-Of-Service Time Interval", "integer", 3600, "Defines the time interval for DOS attacks check. The time interval is given in seconds." ),
@@ -369,7 +370,8 @@ function wfu_set_javascript_constants() {
369
  "response_url" => WFU_RESPONSE_URL,
370
  "ajax_url" => wfu_ajaxurl(),
371
  "wfu_pageexit_prompt" => WFU_PAGEEXIT_PROMPT,
372
- "wfu_subdir_typedir" => WFU_SUBDIR_TYPEDIR
 
373
  );
374
  $consts_txt = "";
375
  foreach ( $consts as $key => $val )
271
  );
272
  //other plugin values
273
  $GLOBALS["WFU_GLOBALS"] += array(
274
+ "WFU_UPLOADPROGRESS_MODE" => array( "Upload Progress Mode", "string", "incremental", "Defines how the upload progress is calculated. It can be 'incremental' or 'absolute'. Default value is 'incremental'." ),
275
  "WFU_DOS_ATTACKS_CHECK" => array( "Check for Denial-Of-Service Attacks", "string", "true", "If it is true then then plugin will check if the number of files uploaded within a specific amount of time exceeds the limit, thus protecting from DOS attacks. It can be 'true' or 'false'." ),
276
  "WFU_DOS_ATTACKS_FILE_LIMIT" => array( "Denial-Of-Service File Limit", "integer", 10000, "Defines the maximum number of files that are allowed to be uploaded within a specific amount of time. It can be any positive integer." ),
277
  "WFU_DOS_ATTACKS_TIME_INTERVAL" => array( "Denial-Of-Service Time Interval", "integer", 3600, "Defines the time interval for DOS attacks check. The time interval is given in seconds." ),
370
  "response_url" => WFU_RESPONSE_URL,
371
  "ajax_url" => wfu_ajaxurl(),
372
  "wfu_pageexit_prompt" => WFU_PAGEEXIT_PROMPT,
373
+ "wfu_subdir_typedir" => WFU_SUBDIR_TYPEDIR,
374
+ "wfu_uploadprogress_mode" => WFU_VAR("WFU_UPLOADPROGRESS_MODE")
375
  );
376
  $consts_txt = "";
377
  foreach ( $consts as $key => $val )
readme.txt CHANGED
@@ -139,6 +139,11 @@ There is an option in plugin's settings in Dashboard to relax the CSS rules, so
139
 
140
  == Changelog ==
141
 
 
 
 
 
 
142
  = 3.9.4 =
143
  * added option to enable admin to change the upload user of a file
144
  * code improvements and bug fixes related to file download feature
139
 
140
  == Changelog ==
141
 
142
+ = 3.9.5 =
143
+ * added environment variable 'Upload Progress Mode' that defines how upload progress is calculated
144
+ * improved progress bar calculation
145
+ * minor bug fixes in AJAX functions mentioned by Hanneke Hoogstrate http://www.blagoworks.nl/
146
+
147
  = 3.9.4 =
148
  * added option to enable admin to change the upload user of a file
149
  * code improvements and bug fixes related to file download feature
release_notes.txt CHANGED
@@ -1 +1,3 @@
1
- <span><strong>Latest release notes: </strong>This is a regular release that introduces some new features and fixes some minor bugs. The most important new feature is that administrators can now change the upload user of a file. Furthermore, Italian translation was added, kindly provided by </span><a href="https://www.marcuz.it/">Enrico Marcolini</a><span>.</span><br /><br /><span>For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span>
 
 
1
+ <!-- --><span><strong>Latest release notes: </strong>This is a regular release that introduces an improved upload progress calculation. Two calculation modes are provided, determined by the environment variable <strong>Upload Progress Mode</strong>. The '<em>incremental</em>' mode (default) provides a smoother upload progress, while the '<em>absolute</em>' mode provides a more precise but less smooth one. Some additional improvements are included in the Professional version of the plugin.</span><!-- --><!-- --><br /><br /><span>
2
+
3
+ For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span>
wordpress_file_upload.php CHANGED
@@ -4,7 +4,7 @@ if( !session_id() ) { session_start(); }
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
- Version: 3.9.4
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
+ Version: 3.9.5
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */