var base64={base64map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("")};base64=$.extend({base64DeMap:!function(){var n={};return $.each(base64.base64map,function(t,i){n[i]=t}),n}(),encode:function(n){for(var t=[],u=base64.base64map,f=n.length,i,r=0;r<f;)i=n[r]<<16|n[r+1]<<8|n[r+2],t.push(u[i>>18],u[i>>12&63],u[i>>6&63],u[i&63]),r+=3;return f%3==1?(t.pop(),t.pop(),t.push("=","=")):(t.pop(),t.push("=")),t.join("")},decode:function(n){var f=[],t=n.split(""),r=base64.base64DeMap,e=t.length,u,i=0;if(e%4)return null;while(i<e)u=r[t[i]]<<18|r[t[i+1]]<<12|r[t[i+2]]<<6|r[t[i+3]],f.push(u>>16,u>>8&255,u&255),i+=4;while(t[--e]=="=")f.pop();return f},encodeArrayBuffer:function(n){for(var i=new DataView(n),u=i.byteLength,r=[],t=0;t<u;t++)r.push(i.getUint8(t));return base64.encode(r)},toObjectUrl:function(n,t){return"data:"+t+";base64,"+n}},base64);$(function(){document.addEventListener("ajaxproxy",function(t){var u=t.detail,r=u.data,i={success:null,status:null,statusText:null,url:r.url,text:null,model:null,request:r,index:u.index};r.headers={"Fish-Referer":r.refer||null,"Fish-User-Agent":"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)","Fish-Origin":/(https?:\/\/[^/]+\/)/.exec(r.url)[1]};$.ajax(r).done(function(t,r,u){i.success=!0;i.status=u.status;i.statusText=u.statusText;i.text=u.responseText;i.model=t;n(i)}).fail(function(t){i.success=!1;i.status=t.status;i.statusText=t.statusText||"";i.text=t.responseText||"";i.model=null;n(i)});t.preventDefault()});var n=function(n){var t=new CustomEvent("ajaxproxyfinished",{detail:n});document.dispatchEvent(t)};document.addEventListener("ajaxLoadVerifyCode",function(n){var i=n.detail,t=new XMLHttpRequest;t.open("GET",i.url,!0);t.onreadystatechange=function(){if(t.readyState==4)if(t.status!=200)alert("加载验证码失败，请点击验证码刷新");else{var n=base64.toObjectUrl(base64.encodeArrayBuffer(t.response),"image/jpeg");document.dispatchEvent(new CustomEvent("ajaxproxyfinished",{detail:{url:n,success:!0,index:i.index}}))}};t.responseType="arraybuffer";t.setRequestHeader("Fish-Referer",i.refer);t.setRequestHeader("Fish-User-Agent","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)");t.setRequestHeader("Fish-Origin",/(https?:\/\/[^/]+\/)/.exec(i.url)[1]);t.send(null);n.preventDefault()});document.dispatchEvent(new CustomEvent("mobileSupportInitialized"))})