2022-02-28 09:59:05 +08:00
/**
* Created by hoteas on 2017/1/19.
*/
var H = {
//新增
list : { },
constructor () {
// 收集订阅信息,调度中心
this . list = {};
},
// 订阅
$on ( name , fn ) {
this . list [ name ] = this . list [ name ] || [];
this . list [ name ]. push ( fn );
},
// 发布
$emit ( name , data ) {
if ( this . list [ name ]) {
this . list [ name ]. forEach (( fn ) => {
fn ( data );
});
}
},
// 取消订阅
$off ( name ) {
if ( this . list [ name ]) {
delete this . list [ name ];
}
},
2022-03-03 21:23:57 +08:00
url : location . protocol + "//" + window . location . host + "/" ,
methodUrl : location . protocol + "//" + window . location . host + "/" , //修改
wsUrl : "wss://" + window . location . host + "/" ,
2022-02-28 09:59:05 +08:00
methodType : 'json' ,
ctrType : "html" ,
//获取load的data
loadData : function ( key ) {
if ( window . tempHotime . loadData == null ){
return null
}
return window . tempHotime . loadData [ key ];
},
initEditor : function ( path , callback ) {
$ ( 'html' ). append ( '<div class="hotime-editor-frame" style="display: none"></div>' );
$ ( '.hotime-editor-frame' ). load ( path + "/index.htm" , function () {
H . init ();
H . editor . config . path = path
if ( callback != null ){
callback ();
}
});
},
//网络错误回调
webError : function ( res ) {
},
//loadcallback是load的callback前置写入
init : function ( loadcallback ) {
//初始化次数保证
if ( window . tempHotime != null ){
if ( loadcallback != null ){
tempHotime . loadCallback = $ . extend ( tempHotime . loadCallback , loadcallback );
}
return ;
}
window . tempHotime = {
loadData : {}, //load的数据写入
loadCallback : {},
loading : false ,
history : [ location . href ],
historyNow : 0 ,
data : {},
};
window . history . _back = window . history . back
window . history . back = function ( i ) {
window . tempHotime . historyNow = window . tempHotime . historyNow + i ;
window . history . _back ( i );
}
if ( loadcallback != null ){
tempHotime . loadCallback = $ . extend ( tempHotime . loadCallback , loadcallback );
}
this . tpt . init (); //模板初始化
//hash监听
if ( window . onhashchange == null ){
window . onhashchange = function () {
// console.log("dasdas")
H . tpt . hashChangeCallBack ();
}
}
},
load : function ( obj , url , data , callback ) {
return this . tpt . load ( obj , url , data , callback )
},
loadDefault : function ( obj , url , data , callback ) {
return this . tpt . loadDefault ( obj , url , data , callback )
},
output : function ( key , data , callback ) {
return this . tpt . output ( key , data , callback );
},
//tool.getParam
getParam : function ( name ){
return this . tool . getParam ( name );
},
//格式化时间timestamp 2006-01-02 03:04 PM
formatTime : function ( unixTime , timestamp ) {
return this . tool . formatTime ( unixTime , timestamp )
},
//url跳转
upUrl : function ( url , data ){
window . location . href = this . makeUrl ( url , data );
},
cookie : function ( key , value , global ){
return this . tool . cookie ( key , value , global );
},
makeWsUrl : function ( url , data , type ) {
if ( url . indexOf ( '.' ) < 0 ){
if ( type == null )
type = this . ctrType ;
else {
type = this . methodType ;
}
// url= url+"."+type;
}
if ( url . indexOf ( 'ws://' ) < 0 ){
if ( url . indexOf ( '.' + H . ctrType ) > 0 )
url = H . url + url ;
else
url = H . wsUrl + url ;
}
if ( data == null ){
data = {}
}
for ( var p in data ){
//url+=
if ( url . indexOf ( '?' ) > 0 ){
url += '&' + p + '=' + data [ p ];
} else {
url += '?' + p + '=' + data [ p ];
}
}
return url ;
},
//制作url
makeUrl : function ( url , data , type ){
//$data=url;
if ( url . indexOf ( '.' ) < 0 ){
if ( type == null )
type = this . ctrType ;
else {
type = this . methodType ;
}
// url= url+"."+type;
}
2022-03-06 23:55:14 +08:00
if ( url . indexOf ( 'http' ) < 0 && url . indexOf ( '/' ) != 0 ){
2022-02-28 09:59:05 +08:00
if ( url . indexOf ( '.' + H . ctrType ) > 0 )
url = H . url + url ;
else
url = H . methodUrl + url ;
}
if ( data == null ){
data = {}
}
for ( var p in data ){
//url+=
if ( url . indexOf ( '?' ) > 0 ){
url += '&' + p + '=' + data [ p ];
} else {
url += '?' + p + '=' + data [ p ];
}
}
return url ;
},
/***
*
* @param url 请求简称
* @param data 请求的数据
* @param func 回调的函数
* @param error 错误的回调函数
*/
post : function ( url , data , func , error ){
url = this . makeUrl ( url , null , this . methodType );
var callBack = this . webError ;
$ . post ( url , data , func , 'json' )
// .error(function (res) {
// if (callBack!=null){
// callBack(res)
// }
// if (error!=null){
// error(res);
// }
// });
},
/***
*
* @param url 请求简称
* @param data 请求的数据
* @param func 回调的函数
* @param error 错误的回调函数
*/
get : function ( url , data , func , error ){
url = this . makeUrl ( url , null , this . methodType );
var callBack = this . webError ;
$ . get ( url , data , func , 'json' )
// .error(function (res) {
// if (callBack!=null){
// callBack(res)
// }
// if (error!=null){
// error(res);
// }
// }
// );
},
/**
* HoTime模板引擎
*/
tpt : {
data : null , //模版数据
type : 'h' , //模版标志
isLoadShowData : false , //url是否显示明码
loadAll : function ( urlData ) {
var ins = this ;
for ( var objStr in urlData ){
if ( urlData [ objStr ] == null ){
continue ;
}
var url = urlData [ objStr ][ "url" ];
obj = $ ( objStr );
// console.log(obj)
if ( obj . length != 0 ){
window . tempHotime . loadData = $ . extend ( window . tempHotime . loadData , urlData [ objStr ]);
if ( url == null ){
ins . getCallbackLoadAll ( obj , ins , urlData , null , objStr );
return ;
}
if ( tempHotime . loadData [ url ] != null ){
ins . getCallbackLoadAll ( obj , ins , urlData , tempHotime . loadData [ url ], objStr )
} else {
$ . get ( url , function ( res ) {
ins . getCallbackLoadAll ( obj , ins , urlData , res , objStr );
tempHotime . loadData [ url ] = res
}, 'html' );
}
break ;
}
}
},
getCallbackLoadAll : function ( obj , ins , urlData , res , objStr ) {
if ( res != null ){
window . tempHotime . loading = true ;
obj . html ( "" );
window . tempHotime . loading = true ;
obj . html ( res );
}
window . tempHotime . loading = false ;
var callback = null ;
//callback已经内置则执行内置的
if ( window . tempHotime . loadCallback [ urlData [ objStr ][ "callback" ]] != null ){
callback = window . tempHotime . loadCallback [ urlData [ objStr ][ "callback" ]];
} else if ( urlData [ objStr ][ "callback" ] != null ){
callback = new Function ( "return " + urlData [ objStr ][ "callback" ]);
callback = callback ()
// console.log(callback)
}
//延迟执行callback以及防止历史不执行
setTimeout ( function () {
if ( obj . length != 0 && res != null && obj . html (). length == res . length ){
var jss = obj . find ( "script" );
for ( var i = 0 ; i < jss . length ; i ++ ){
var jsx = new Function ( jss . eq ( i ). html ());
jsx ();
}
}
if ( callback != null ){
callback ()
}
} , 30 );
urlData [ objStr ] = null ;
ins . loadAll ( urlData );
},
//延迟防止未加载成功
getCallbackLoad : function ( obj , ins , data , res , callback ) {
if ( res != null ){
window . tempHotime . loading = true ;
$ ( obj ). html ( "" );
//
// ins.loadType=JSON.stringify(data);
window . tempHotime . loading = true ;
$ ( obj ). html ( res );
}
window . tempHotime . loading = false ;
//延迟防止未加载成功
setTimeout ( function () {
if ( window . tempHotime . loadCallback [ callback ] != null ){
window . tempHotime . loadCallback [ callback ]();
} else if ( typeof callback == "function" ){
callback ();
}
} , 30 )
},
decodeHash : function () {
var hash = location . hash ;
if ( hash . length <= 2 || hash [ 0 ] != "#" || hash [ 1 ] != "!" ){
if ( this . isLoadShowData ){
hash = "{}"
} else {
hash = "e30="
}
} else {
hash = hash . substring ( 2 , hash . length )
}
var urlData = {};
try {
if ( this . isLoadShowData ){
urlData = JSON . parse ( hash );
} else {
urlData = JSON . parse ( H . base64 . decode ( decodeURIComponent ( hash )));
}
} catch ( e ){
console . log ( "url is error" + e );
return null ;
}
return urlData
},
loadDefault : function ( obj , url , data , callback ) {
//将数据存入缓存
var urlData = {};
if ( typeof url == "function" ){
callback = url ;
url = null ;
data = null ;
}
if ( typeof data == "function" ){
callback = data ;
data = null ;
}
if ( typeof data == "string" ){
callback = data ;
data = null ;
}
if ( data == null ){
data = {}
}
if ( callback != null ){
data [ "callback" ] = callback . toString ();
}
data [ "url" ] = url ;
urlData [ obj ] = data ;
if ( window . tempHotime == null ){
H . init ()
}
window . tempHotime . loadDefaultData = $ . extend ( true ,{}, urlData );
//获取hash如果默认不为空停止执行
var urldata = this . decodeHash ();
if ( urldata [ obj ] != null ){
return ;
}
this . load ( obj , url , data , callback , true );
},
//使用该load才会生效
load : function ( obj , url , data , callback , type ) {
var ins = this ;
// ins.initWhile();
var urlData = ins . decodeHash ();
if ( urlData == null ){
urlData = {};
}
// console.log(url)
if ( typeof url == "function" ){
callback = url ;
url = null ;
data = null ;
}
if ( typeof data == "function" ){
callback = data ;
data = null ;
}
if ( typeof data == "string" ){
callback = data ;
data = null ;
}
if ( data == null ){
data = {}
}
if ( callback != null ){
data [ "callback" ] = callback . toString ();
}
data [ "url" ] = url ;
urlData [ obj ] = data ;
window . tempHotime . loading = true ;
if ( type != true ){
var hash = "" ;
if ( this . isLoadShowData ) {
hash = JSON . stringify ( urlData );
} else {
hash = encodeURIComponent ( H . base64 . encode ( JSON . stringify ( urlData )));
}
if ( window . tempHotime . loadDefaultData != null ){
var key ;
for ( key in tempHotime . loadDefaultData ){
break
}
if ( JSON . stringify ( urlData [ key ]) == JSON . stringify ( tempHotime . loadDefaultData [ key ])){
window . location . hash = "" ;
} else {
window . tempHotime . hashChangeUrl = "#!" + hash
window . location . hash = window . tempHotime . hashChangeUrl ;
}
} else {
window . tempHotime . hashChangeUrl = "#!" + hash
window . location . hash = window . tempHotime . hashChangeUrl ;
}
tempHotime . history [ ++ tempHotime . historyNow ] = location . href
}
// this.loadData=data;
window . tempHotime . loadData = $ . extend ( window . tempHotime . loadData , data );
if ( url == null ){
ins . getCallbackLoad ( obj , ins , data , null , callback );
return ;
}
if ( tempHotime . loadData [ url ] != null ){
ins . getCallbackLoad ( obj , ins , data , tempHotime . loadData [ url ], callback )
} else {
$ . get ( url , function ( res ) {
ins . getCallbackLoad ( obj , ins , data , res , callback );
tempHotime . loadData [ url ] = res
}, "html" );
}
},
initLoad : function () {
var urlData = this . decodeHash ();
if ( urlData == null ){
return ;
}
urlLth = 0 ;
for ( var key in urlData ){
urlLth ++ ;
}
if ( urlLth == 0 ){
return ;
}
H . tpt . loadAll ( urlData );
var hash = "" ;
if ( this . isLoadShowData ) {
hash = JSON . stringify ( urlData );
} else {
hash = encodeURIComponent ( H . base64 . encode ( JSON . stringify ( urlData )));
}
window . tempHotime . hashChangeUrl = "#!" + hash ;
},
hashChangeCallBack : function () {
if ( window . tempHotime . hashChangeUrl == location . hash ){
return
}
window . tempHotime . hashChangeUrl = location . hash ;
if ( window . tempHotime . loading ){
window . tempHotime . loading = false ;
return ;
}
var urlData = this . decodeHash ();
if ( urlData == null ){
urlData = {}
}
urlLth = 0 ;
for ( var key in urlData ){
urlLth ++ ;
}
if ( urlLth == 0 ){
if ( window . tempHotime . loadDefaultData != null ){
H . tpt . loadAll ( $ . extend ( true ,{}, window . tempHotime . loadDefaultData ));
}
} else {
H . tpt . loadAll ( urlData );
}
},
/**
* 初始化模版引擎
*/
init : function (){
this . initLoad ();
this . getHtml ();
},
/**
* 单行解析输出
* @param key 模版块名 if {"state":{"0":"li","1":"li"}
* @param data 模版块内数据
* @param callback function(data){return data}//部分修改模块
* @returns {*} 返回字符串
*/
outputa : function ( keys , data , callback ){
//结果替换
if ( callback != null ){
var temp = callback ( data );
if ( temp != null ){
data = temp ;
}
}
//if语句解析
if ( keys instanceof Object ){
for ( var n in keys ){
if ( data [ n ] == null ){
if ( this . temp == null ){
return '' ;
} else {
key = this . temp ;
}
} else {
key = keys [ n ][ data [ n ]];
this . temp = key ;
}
break ;
}
} else {
key = keys ;
}
if ( tempHotime . data [ key ] == null ){
//再次判断是否存在未获取得模板
this . getHtml ();
if ( tempHotime . data [ key ] == null ){
return '' ;
}
}
var res = tempHotime . data [ key ];
for ( var p in data ){ //遍历json对象的每个key/value对,p为key
var x = res ;
var ses = '[' + p + ']' ;
if ( res . indexOf ( ses ) !=- 1 ){
res = res . replace ( ses , this . output ( p , data [ p ], callback ));
}
if ( x == res ){
while ( true ){
res = res . replace ( '{' + p + '}' , data [ p ]);
if ( x == res ){
break ;
} else {
x = res ;
}
}
}
}
for ( var p in tempHotime . data ){
res = res . replace ( '[' + p + ']' , '' );
}
return res ;
},
/**
* 单多行解析输出
* @param key 模版块名 if {"state":{"0":"li","1":"li"}}
* @param data 模版块内数据
* @param callback function(data){return data}//部分修改模块
* @returns {*} 返回字符串
*/
output : function ( key , data , callback ){
if ( window . tempHotime == null ){
H . init ()
}
var x = '' ;
if ( data instanceof Array ){
for ( var i = 0 ; data . length > i ; i ++ ){
x += this . outputa ( key , data [ i ], callback );
}
} else {
x = this . outputa ( key , data , callback );
}
return x ;
},
/**
* 将模板解析到引擎中
*/
getHtml : function (){
var t = '[' + this . type + ']' ;
var ins = $ ( t );
// window.tempHotimeChange=new Date().getTime();
for ( var i = ins . length - 1 ; i >= 0 ; i -- ){
var e = ins . eq ( i );
var name = e . attr ( this . type );
e . attr ( this . type , null );
tempHotime . data [ name ] = e . prop ( "outerHTML" );
var temp = tempHotime . data [ name ];
//替换关键字
while ( true ){
// window.tempHotimeChange=new Date().getTime();
tempHotime . data [ name ] = tempHotime . data [ name ]. replace ( " h-" , " " );
if ( temp == tempHotime . data [ name ]){
break ;
} else {
temp = tempHotime . data [ name ];
// console.log("1:"+temp)
}
}
if ( e . parents ( t ). length != 0 )
e . replaceWith ( '[' + name + ']' );
else
e . replaceWith ( '' );
}
}
}
};
H . tool = {
//格式化时间timestamp 2006-01-02 03:04 PM
formatTime : function ( unixTime , timestamp ) {
if ( unixTime < 10000000000 ){
unixTime = unixTime * 1000
}
var date = new Date ( unixTime );
function buling ( t ) {
if ( t < 10 ){
t = "0" + t
}
return t
}
timestamp = timestamp . replace ( "2006" , "{x}" )
timestamp = timestamp . replace ( "01" , "{a}" )
timestamp = timestamp . replace ( "02" , "{b}" )
timestamp = timestamp . replace ( "03" , "{c}" )
timestamp = timestamp . replace ( "04" , "{d}" )
timestamp = timestamp . replace ( "05" , "{e}" )
timestamp = timestamp . replace ( "15" , "{f}" )
timestamp = timestamp . replace ( "PM" , "{PM}" )
timestamp = timestamp . replace ( "1" , "{1}" )
timestamp = timestamp . replace ( "2" , "{2}" )
timestamp = timestamp . replace ( "3" , "{3}" )
timestamp = timestamp . replace ( "4" , "{4}" )
timestamp = timestamp . replace ( "5" , "{5}" )
timestamp = timestamp . replace ( "{x}" , date . getFullYear ())
timestamp = timestamp . replace ( "{a}" , buling ( date . getMonth () + 1 ))
timestamp = timestamp . replace ( "{b}" , buling ( date . getDate ()))
timestamp = timestamp . replace ( "{f}" , buling ( date . getHours ()))
timestamp = timestamp . replace ( "{d}" , buling ( date . getMinutes ()))
timestamp = timestamp . replace ( "{e}" , buling ( date . getSeconds ()))
timestamp = timestamp . replace ( "{1}" , date . getMonth () + 1 )
timestamp = timestamp . replace ( "{2}" , date . getDate ())
timestamp = timestamp . replace ( "{5}" , date . getSeconds ())
timestamp = timestamp . replace ( "{4}" , date . getMinutes ())
timestamp = timestamp . replace ( "{3}" , date . getHours ())
if ( date . getHours () > 12 ){
timestamp = timestamp . replace ( "{c}" , buling ( date . getHours () - 12 ))
timestamp = timestamp . replace ( "{PM}" , "PM" )
} else {
timestamp = timestamp . replace ( "{PM}" , "AM" )
timestamp = timestamp . replace ( "{c}" , buling ( date . getHours ()))
}
return timestamp ;
},
//压缩图片返回base64数据
compressImage : function ( event , callback ) {
var reader = new FileReader (),
img = new Image ();
var canvas = document . createElement ( 'canvas' );
var context = canvas . getContext ( '2d' );
// base64地址图片加载完毕后
img . onload = function () {
// 图片原始尺寸
var originWidth = this . width ;
var originHeight = this . height ;
// 最大尺寸限制,可通过国设置宽高来实现图片压缩程度
var maxWidth = 800 ,
maxHeight = 800 ;
// 目标尺寸
var targetWidth = originWidth ,
targetHeight = originHeight ;
// 图片尺寸超过400x400的限制
if ( originWidth > maxWidth || originHeight > maxHeight ) {
if ( originWidth / originHeight > maxWidth / maxHeight ) {
// 更宽,按照宽度限定尺寸
targetWidth = maxWidth ;
targetHeight = Math . round ( maxWidth * ( originHeight / originWidth ));
} else {
targetHeight = maxHeight ;
targetWidth = Math . round ( maxHeight * ( originWidth / originHeight ));
}
}
// canvas对图片进行缩放
canvas . width = targetWidth ;
canvas . height = targetHeight ;
// 清除画布
context . clearRect ( 0 , 0 , targetWidth , targetHeight );
// 图片压缩
context . drawImage ( img , 0 , 0 , targetWidth , targetHeight );
var newUrl = canvas . toDataURL ( 'image/jpeg' , 0.92 ); //base64 格式
if ( callback != null ){
callback ( newUrl )
}
};
reader . onload = function ( e ) {
img . src = e . target . result ;
};
var file = event . target . files [ 0 ];
// 选择的文件是图片
if ( file . type . indexOf ( "image" ) == 0 ) {
reader . readAsDataURL ( file );
}
},
/**
* 获取get参数
* @param name 参数名
* @returns {null}
*/
getParam : function ( name ){
var url = location . href ;
if ( url . indexOf ( "#" ) !=- 1 ){
url = url . substring ( 0 , url . indexOf ( "#" ))
}
var paraString = url . substring ( url . indexOf ( "?" ) + 1 , url . length ). split ( "&" );
var paraObj = {};
for ( i = 0 ; j = paraString [ i ]; i ++ ) {
paraObj [ j . substring ( 0 , j . indexOf ( "=" )). toLowerCase ()] = j . substring ( j . indexOf ( "=" ) + 1 , j . length );
}
var returnValue = paraObj [ name . toLowerCase ()];
if ( typeof ( returnValue ) == "undefined" ) {
return null ;
} else {
//t=new String(returnValue.getBytes("ISO8859_1"),"UTF-8");
//return t;
return decodeURI ( returnValue );
}
},
/**
*
* @param key 键名
* @param value 键值
* @param global 是否是全局数据
* @returns {*}
*/
cookie : function ( key , value , globals ){
value = JSON . stringify ( value );
if ( value == null ){
var data = $ . cookie ( key )
if ( data != null ){
data = JSON . parse ( data )
}
return data ;
}
if ( globals != true )
globals == false ;
if ( globals )
$ . cookie ( key , value ,{ path : '/' });
else {
$ . cookie ( key , value );
}
},
};
H . base64 = {
base64EncodeChars : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ,
base64DecodeChars : new Array (
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 62 , - 1 , - 1 , - 1 , 63 ,
52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
- 1 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 ,
15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , - 1 , - 1 , - 1 , - 1 , - 1 ,
- 1 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 ,
41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , - 1 , - 1 , - 1 , - 1 , - 1 ),
encode : function ( str ) {
str = this . utf16to8 ( str )
var out , i , len ;
var c1 , c2 , c3 ;
len = str . length ;
i = 0 ;
out = "" ;
while ( i < len ) {
c1 = str . charCodeAt ( i ++ ) & 0xff ;
if ( i == len )
{
out += this . base64EncodeChars . charAt ( c1 >> 2 );
out += this . base64EncodeChars . charAt (( c1 & 0x3 ) << 4 );
out += "==" ;
break ;
}
c2 = str . charCodeAt ( i ++ );
if ( i == len )
{
out += this . base64EncodeChars . charAt ( c1 >> 2 );
out += this . base64EncodeChars . charAt ((( c1 & 0x3 ) << 4 ) | (( c2 & 0xF0 ) >> 4 ));
out += this . base64EncodeChars . charAt (( c2 & 0xF ) << 2 );
out += "=" ;
break ;
}
c3 = str . charCodeAt ( i ++ );
out += this . base64EncodeChars . charAt ( c1 >> 2 );
out += this . base64EncodeChars . charAt ((( c1 & 0x3 ) << 4 ) | (( c2 & 0xF0 ) >> 4 ));
out += this . base64EncodeChars . charAt ((( c2 & 0xF ) << 2 ) | (( c3 & 0xC0 ) >> 6 ));
out += this . base64EncodeChars . charAt ( c3 & 0x3F );
}
return out ;
},
decode : function ( str ) {
var c1 , c2 , c3 , c4 ;
var i , len , out ;
len = str . length ;
i = 0 ;
out = "" ;
while ( i < len ) {
/* c1 */
do {
c1 = this . base64DecodeChars [ str . charCodeAt ( i ++ ) & 0xff ];
} while ( i < len && c1 == - 1 );
if ( c1 == - 1 )
break ;
/* c2 */
do {
c2 = this . base64DecodeChars [ str . charCodeAt ( i ++ ) & 0xff ];
} while ( i < len && c2 == - 1 );
if ( c2 == - 1 )
break ;
out += String . fromCharCode (( c1 << 2 ) | (( c2 & 0x30 ) >> 4 ));
/* c3 */
do {
c3 = str . charCodeAt ( i ++ ) & 0xff ;
if ( c3 == 61 )
return out ;
c3 = this . base64DecodeChars [ c3 ];
} while ( i < len && c3 == - 1 );
if ( c3 == - 1 )
break ;
out += String . fromCharCode ((( c2 & 0XF ) << 4 ) | (( c3 & 0x3C ) >> 2 ));
/* c4 */
do {
c4 = str . charCodeAt ( i ++ ) & 0xff ;
if ( c4 == 61 )
return out ;
c4 = this . base64DecodeChars [ c4 ];
} while ( i < len && c4 == - 1 );
if ( c4 == - 1 )
break ;
out += String . fromCharCode ((( c3 & 0x03 ) << 6 ) | c4 );
}
return this . utf8to16 ( out );
},
utf16to8 : function ( str ) {
var out , i , len , c ;
out = "" ;
len = str . length ;
for ( i = 0 ; i < len ; i ++ ) {
c = str . charCodeAt ( i );
if (( c >= 0x0001 ) && ( c <= 0x007F )) {
out += str . charAt ( i );
} else if ( c > 0x07FF ) {
out += String . fromCharCode ( 0xE0 | (( c >> 12 ) & 0x0F ));
out += String . fromCharCode ( 0x80 | (( c >> 6 ) & 0x3F ));
out += String . fromCharCode ( 0x80 | (( c >> 0 ) & 0x3F ));
} else {
out += String . fromCharCode ( 0xC0 | (( c >> 6 ) & 0x1F ));
out += String . fromCharCode ( 0x80 | (( c >> 0 ) & 0x3F ));
}
}
return out ;
},
utf8to16 : function ( str ) {
var out , i , len , c ;
var char2 , char3 ;
out = "" ;
len = str . length ;
i = 0 ;
while ( i < len ) {
c = str . charCodeAt ( i ++ );
switch ( c >> 4 )
{
case 0 : case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : case 7 :
// 0xxxxxxx
out += str . charAt ( i - 1 );
break ;
case 12 : case 13 :
// 110x xxxx 10xx xxxx
char2 = str . charCodeAt ( i ++ );
out += String . fromCharCode ((( c & 0x1F ) << 6 ) | ( char2 & 0x3F ));
break ;
case 14 :
// 1110 xxxx 10xx xxxx 10xx xxxx
char2 = str . charCodeAt ( i ++ );
char3 = str . charCodeAt ( i ++ );
out += String . fromCharCode ((( c & 0x0F ) << 12 ) |
(( char2 & 0x3F ) << 6 ) |
(( char3 & 0x3F ) << 0 ));
break ;
}
}
return out ;
},
CharToHex : function ( str ) {
var out , i , len , c , h ;
out = "" ;
len = str . length ;
i = 0 ;
while ( i < len )
{
c = str . charCodeAt ( i ++ );
h = c . toString ( 16 );
if ( h . length < 2 )
h = "0" + h ;
out += "\\x" + h + " " ;
if ( i > 0 && i % 8 == 0 )
out += "\r\n" ;
}
return out ;
}
}
/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
! function ( a , b ){ "object" == typeof module && "object" == typeof module . exports ? module . exports = a . document ? b ( a , ! 0 ) : function ( a ){ if ( ! a . document ) throw new Error ( "jQuery requires a window with a document" ); return b ( a )} : b ( a )}( "undefined" != typeof window ? window : this , function ( a , b ){ var c = [], d = c . slice , e = c . concat , f = c . push , g = c . indexOf , h = {}, i = h . toString , j = h . hasOwnProperty , k = {}, l = a . document , m = "2.1.4" , n = function ( a , b ){ return new n . fn . init ( a , b )}, o = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g , p = /^-ms-/ , q = /-([\da-z])/gi , r = function ( a , b ){ return b . toUpperCase ()}; n . fn = n . prototype = { jquery : m , constructor : n , selector : "" , length : 0 , toArray : function (){ return d . call ( this )}, get : function ( a ){ return null != a ? 0 > a ? this [ a + this . length ] : this [ a ] : d . call ( this )}, pushStack : function ( a ){ var b = n . merge ( this . constructor (), a ); return b . prevObject = this , b . context = this . context , b }, each : function ( a , b ){ return n . each ( this , a , b )}, map : function ( a ){ return this . pushStack ( n . map ( this , function ( b , c ){ return a . call ( b , c , b )}))}, slice : function (){ return this . pushStack ( d . apply ( this , arguments ))}, first : function (){ return this . eq ( 0 )}, last : function (){ return this . eq ( - 1 )}, eq : function ( a ){ var b = this . length , c =+ a + ( 0 > a ? b : 0 ); return this . pushStack ( c >= 0 && b > c ? [ this [ c ]] : [])}, end : function (){ return this . prevObject || this . constructor ( null )}, push : f , sort : c . sort , splice : c . splice }, n . extend = n . fn . extend = function (){ var a , b , c , d , e , f , g = arguments [ 0 ] || {}, h = 1 , i = arguments . length , j =! 1 ; for ( "boolean" == typeof g && ( j = g , g = arguments [ h ] || {}, h ++ ), "object" == typeof g || n . isFunction ( g ) || ( g = {}), h === i && ( g = this , h -- ); i > h ; h ++ ) if ( null != ( a = arguments [ h ])) for ( b in a ) c = g [ b ], d = a [ b ], g !== d && ( j && d && ( n . isPlainObject ( d ) || ( e = n . isArray ( d ))) ? ( e ? ( e =! 1 , f = c && n . isArray ( c ) ? c : []) : f = c && n . isPlainObject ( c ) ? c : {}, g [ b ] = n . extend ( j , f , d )) : void 0 !== d && ( g [ b ] = d )); return g }, n . extend ({ expando : "jQuery" + ( m + Math . random ()). replace ( /\D/g , "" ), isReady :! 0 , error : function ( a ){ throw new Error ( a )}, noop : function (){}, isFunction : function ( a ){ return "function" === n . type ( a )}, isArray : Array . isArray , isWindow : function ( a ){ return null != a && a === a . window }, isNumeric : function ( a ){ return ! n . isArray ( a ) && a - parseFloat ( a ) + 1 >= 0 }, isPlainObject : function ( a ){ return "object" !== n . type ( a ) || a . nodeType || n . isWindow ( a ) ?! 1 : a . constructor &&! j . call ( a . constructor . prototype , "isPrototypeOf" ) ?! 1 :! 0 }, isEmptyObject : function ( a ){ var b ; for ( b in a ) return ! 1 ; return ! 0 }, type : function ( a ){ return null == a ? a + "" : "object" == typeof a || "function" == typeof a ? h [ i . call ( a )] || "object" : typeof a }, globalEval : function ( a ){ var b , c = eval ; a = n . trim ( a ), a && ( 1 === a . indexOf ( "use strict" ) ? ( b = l . createElement ( "script" ), b . text = a , l . head . appendChild ( b ). parentNode . removeChild ( b )) : c ( a ))}, camelCase : function ( a ){ return a . replace ( p , "ms-" ). replace ( q , r )}, nodeName : function ( a , b ){ return a . nodeName && a . nodeName . toLowerCase () === b . toLowerCase ()}, each : function ( a , b , c ){ var d , e = 0 , f = a . length , g = s ( a ); if ( c ){ if ( g ){ for (; f > e ; e ++ ) if ( d = b . apply ( a [ e ], c ), d ===! 1 ) break } else for ( e in a ) if ( d = b . apply ( a [ e ], c ), d ===! 1 ) break } else if ( g ){ for (; f > e ; e ++ ) if ( d = b . call ( a [ e ], e , a [ e ]), d ===! 1 ) break } else for ( e in a ) if ( d = b . call ( a [ e ], e , a [ e ]), d ===! 1 ) break ; return a }, trim : function ( a ){ return null == a ? "" : ( a + "" ). replace ( o , "" )}, makeArray : function ( a , b ){ var c = b || []; return null != a && ( s ( Object ( a )) ? n . merge ( c , "string" == typeof a ? [ a ] : a ) : f . call ( c , a )), c }, inArray : function ( a , b , c ){ return null == b ?- 1 : g . call ( b , a , c )}, merge : function ( a , b ){ for ( var c =+ b . length , d = 0 , e = a . length ; c > d ; d ++ ) a [ e ++ ] = b [ d ]; return a . length = e , a }, grep : function ( a , b , c ){ for ( var d , e = [], f = 0 , g = a . length , h =! c ; g > f ; f ++ ) d =! b ( a [ f ], f ), d !== h && e . push ( a [ f ]); return e }, map : function ( a , b , c ){ var d , f = 0 , g = a . length , h = s ( a ), i = []; if ( h ) for (; g > f ; f ++ ) d = b ( a [ f ], f , c ), null != d && i . push ( d ); else for ( f in a ) d = b ( a [ f ], f , c ), null != d && i . push ( d ); return e . apply ([], i )}, guid : 1 , proxy : function ( a , b ){ var c , e , f ; return "string" == typeof b && ( c = a [ b ], b = a , a = c ), n . isFunction ( a ) ? ( e = d . call ( arguments , 2 ), f = function (){ return a . apply ( b || this , e . concat ( d . call ( arguments )))}, f . guid = a . guid = a . guid || n . guid ++ , f ) : void 0 }, now : Date . now , support : k }), n . each ( "Boolean Number String Function Array Date RegExp Object Error" . split ( " " ), function ( a , b ){ h [ "[object " + b + "]" ] = b . toLowerCase ()}); function s ( a ){ var b = "length" in a && a . length , c = n . type ( a ); return "function" === c || n . isWindow ( a ) ?! 1 : 1 === a . nodeType && b ?! 0 : "array" =
return M . access ( a , b , c )}, removeData : function ( a , b ){ M . remove ( a , b )}, _data : function ( a , b , c ){ return L . access ( a , b , c )}, _removeData : function ( a , b ){ L . remove ( a , b )}}), n . fn . extend ({ data : function ( a , b ){ var c , d , e , f = this [ 0 ], g = f && f . attributes ; if ( void 0 === a ){ if ( this . length && ( e = M . get ( f ), 1 === f . nodeType &&! L . get ( f , "hasDataAttrs" ))){ c = g . length ; while ( c -- ) g [ c ] && ( d = g [ c ]. name , 0 === d . indexOf ( "data-" ) && ( d = n . camelCase ( d . slice ( 5 )), P ( f , d , e [ d ]))); L . set ( f , "hasDataAttrs" , ! 0 )} return e } return "object" == typeof a ? this . each ( function (){ M . set ( this , a )}) : J ( this , function ( b ){ var c , d = n . camelCase ( a ); if ( f && void 0 === b ){ if ( c = M . get ( f , a ), void 0 !== c ) return c ; if ( c = M . get ( f , d ), void 0 !== c ) return c ; if ( c = P ( f , d , void 0 ), void 0 !== c ) return c } else this . each ( function (){ var c = M . get ( this , d ); M . set ( this , d , b ), - 1 !== a . indexOf ( "-" ) && void 0 !== c && M . set ( this , a , b )})}, null , b , arguments . length > 1 , null , ! 0 )}, removeData : function ( a ){ return this . each ( function (){ M . remove ( this , a )})}}), n . extend ({ queue : function ( a , b , c ){ var d ; return a ? ( b = ( b || "fx" ) + "queue" , d = L . get ( a , b ), c && ( ! d || n . isArray ( c ) ? d = L . access ( a , b , n . makeArray ( c )) : d . push ( c )), d || []) : void 0 }, dequeue : function ( a , b ){ b = b || "fx" ; var c = n . queue ( a , b ), d = c . length , e = c . shift (), f = n . _queueHooks ( a , b ), g = function (){ n . dequeue ( a , b )}; "inprogress" === e && ( e = c . shift (), d -- ), e && ( "fx" === b && c . unshift ( "inprogress" ), delete f . stop , e . call ( a , g , f )), ! d && f && f . empty . fire ()}, _queueHooks : function ( a , b ){ var c = b + "queueHooks" ; return L . get ( a , c ) || L . access ( a , c ,{ empty : n . Callbacks ( "once memory" ). add ( function (){ L . remove ( a ,[ b + "queue" , c ])})})}}), n . fn . extend ({ queue : function ( a , b ){ var c = 2 ; return "string" != typeof a && ( b = a , a = "fx" , c -- ), arguments . length < c ? n . queue ( this [ 0 ], a ) : void 0 === b ? this : this . each ( function (){ var c = n . queue ( this , a , b ); n . _queueHooks ( this , a ), "fx" === a && "inprogress" !== c [ 0 ] && n . dequeue ( this , a )})}, dequeue : function ( a ){ return this . each ( function (){ n . dequeue ( this , a )})}, clearQueue : function ( a ){ return this . queue ( a || "fx" ,[])}, promise : function ( a , b ){ var c , d = 1 , e = n . Deferred (), f = this , g = this . length , h = function (){ -- d || e . resolveWith ( f ,[ f ])}; "string" != typeof a && ( b = a , a = void 0 ), a = a || "fx" ; while ( g -- ) c = L . get ( f [ g ], a + "queueHooks" ), c && c . empty && ( d ++ , c . empty . add ( h )); return h (), e . promise ( b )}}); var Q = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ . source , R = [ "Top" , "Right" , "Bottom" , "Left" ], S = function ( a , b ){ return a = b || a , "none" === n . css ( a , "display" ) ||! n . contains ( a . ownerDocument , a )}, T = /^(?:checkbox|radio)$/i ; ! function (){ var a = l . createDocumentFragment (), b = a . appendChild ( l . createElement ( "div" )), c = l . createElement ( "input" ); c . setAttribute ( "type" , "radio" ), c . setAttribute ( "checked" , "checked" ), c . setAttribute ( "name" , "t" ), b . appendChild ( c ), k . checkClone = b . cloneNode ( ! 0 ). cloneNode ( ! 0 ). lastChild . checked , b . innerHTML = "<textarea>x</textarea>" , k . noCloneChecked =!! b . cloneNode ( ! 0 ). lastChild . defaultValue }(); var U = "undefined" ; k . focusinBubbles = "onfocusin" in a ; var V = /^key/ , W = /^(?:mouse|pointer|contextmenu)|click/ , X = /^(?:focusinfocus|focusoutblur)$/ , Y = /^([^.]*)(?:\.(.+)|)$/ ; function Z (){ return ! 0 } function $ (){ return ! 1 } function _ (){ try { return l . activeElement } catch ( a ){}} n . event = { global : {}, add : function ( a , b , c , d , e ){ var f , g , h , i , j , k , l , m , o , p , q , r = L . get ( a ); if ( r ){ c . handler && ( f = c , c = f . handler , e = f . selector ), c . guid || ( c . guid = n . guid ++ ),( i = r . events ) || ( i = r . events = {}),( g = r . handle ) || ( g = r . handle = function ( b ){ return typeof n !== U && n . event . triggered !== b . type ? n . event . dispatch . apply ( a , arguments ) : void 0 }), b = ( b || "" ). match ( E ) || [ "" ], j = b . length ; while ( j -- ) h = Y . exec ( b [ j ]) || [], o = q = h [ 1 ], p = ( h [ 2 ] || "" ). split ( "." ). sort (), o && ( l = n . event . special [ o ] || {}, o = ( e ? l . delegateType : l . bindType ) || o , l = n . event . special [ o ] || {}, k = n . extend ({ type : o , origType : q , data : d , handler : c , guid : c . guid , selector : e , needsContext : e && n . expr . match . needsContext . test ( e ), namespace : p . join ( "." )}, f ),( m = i [ o ]) || ( m = i [ o ] = [], m . delegateCount = 0 , l . setup && l . setup . call ( a , d , p , g ) !==! 1 || a . addEventListener && a . addEventListener ( o , g , ! 1 )), l . add && ( l . add . call ( a , k ), k . handler . guid || ( k . handler . guid = c . guid )), e ? m . splice ( m . delegateCount ++ , 0 , k ) : m . push ( k ), n . event . global [ o ] =! 0 )}}, remove : function ( a , b , c , d , e ){ var f , g , h , i , j , k , l , m , o , p , q , r = L . hasData ( a ) && L . get ( a ); if ( r && ( i = r . events )){ b = ( b || "" ). match ( E ) || [ "" ], j = b . length ; while ( j -- ) if ( h = Y . exec ( b [ j ]) || [], o = q = h [ 1 ], p = ( h [ 2 ] || "" ). split ( "." ). sort (), o ){ l = n . event . spe
void 0 === c ? d && "get" in d && null !== ( e = d . get ( a , b )) ? e : ( e = n . find . attr ( a , b ), null == e ? void 0 : e ) : null !== c ? d && "set" in d && void 0 !== ( e = d . set ( a , c , b )) ? e : ( a . setAttribute ( b , c + "" ), c ) : void n . removeAttr ( a , b ))}, removeAttr : function ( a , b ){ var c , d , e = 0 , f = b && b . match ( E ); if ( f && 1 === a . nodeType ) while ( c = f [ e ++ ]) d = n . propFix [ c ] || c , n . expr . match . bool . test ( c ) && ( a [ d ] =! 1 ), a . removeAttribute ( c )}, attrHooks : { type : { set : function ( a , b ){ if ( ! k . radioValue && "radio" === b && n . nodeName ( a , "input" )){ var c = a . value ; return a . setAttribute ( "type" , b ), c && ( a . value = c ), b }}}}}), Za = { set : function ( a , b , c ){ return b ===! 1 ? n . removeAttr ( a , c ) : a . setAttribute ( c , c ), c }}, n . each ( n . expr . match . bool . source . match ( /\w+/g ), function ( a , b ){ var c = $a [ b ] || n . find . attr ; $a [ b ] = function ( a , b , d ){ var e , f ; return d || ( f = $a [ b ], $a [ b ] = e , e = null != c ( a , b , d ) ? b . toLowerCase () : null , $a [ b ] = f ), e }}); var _a = /^(?:input|select|textarea|button)$/i ; n . fn . extend ({ prop : function ( a , b ){ return J ( this , n . prop , a , b , arguments . length > 1 )}, removeProp : function ( a ){ return this . each ( function (){ delete this [ n . propFix [ a ] || a ]})}}), n . extend ({ propFix : { "for" : "htmlFor" , "class" : "className" }, prop : function ( a , b , c ){ var d , e , f , g = a . nodeType ; if ( a && 3 !== g && 8 !== g && 2 !== g ) return f = 1 !== g ||! n . isXMLDoc ( a ), f && ( b = n . propFix [ b ] || b , e = n . propHooks [ b ]), void 0 !== c ? e && "set" in e && void 0 !== ( d = e . set ( a , c , b )) ? d : a [ b ] = c : e && "get" in e && null !== ( d = e . get ( a , b )) ? d : a [ b ]}, propHooks : { tabIndex : { get : function ( a ){ return a . hasAttribute ( "tabindex" ) || _a . test ( a . nodeName ) || a . href ? a . tabIndex :- 1 }}}}), k . optSelected || ( n . propHooks . selected = { get : function ( a ){ var b = a . parentNode ; return b && b . parentNode && b . parentNode . selectedIndex , null }}), n . each ([ "tabIndex" , "readOnly" , "maxLength" , "cellSpacing" , "cellPadding" , "rowSpan" , "colSpan" , "useMap" , "frameBorder" , "contentEditable" ], function (){ n . propFix [ this . toLowerCase ()] = this }); var ab = /[\t\r\n\f]/g ; n . fn . extend ({ addClass : function ( a ){ var b , c , d , e , f , g , h = "string" == typeof a && a , i = 0 , j = this . length ; if ( n . isFunction ( a )) return this . each ( function ( b ){ n ( this ). addClass ( a . call ( this , b , this . className ))}); if ( h ) for ( b = ( a || "" ). match ( E ) || []; j > i ; i ++ ) if ( c = this [ i ], d = 1 === c . nodeType && ( c . className ? ( " " + c . className + " " ). replace ( ab , " " ) : " " )){ f = 0 ; while ( e = b [ f ++ ]) d . indexOf ( " " + e + " " ) < 0 && ( d += e + " " ); g = n . trim ( d ), c . className !== g && ( c . className = g )} return this }, removeClass : function ( a ){ var b , c , d , e , f , g , h = 0 === arguments . length || "string" == typeof a && a , i = 0 , j = this . length ; if ( n . isFunction ( a )) return this . each ( function ( b ){ n ( this ). removeClass ( a . call ( this , b , this . className ))}); if ( h ) for ( b = ( a || "" ). match ( E ) || []; j > i ; i ++ ) if ( c = this [ i ], d = 1 === c . nodeType && ( c . className ? ( " " + c . className + " " ). replace ( ab , " " ) : "" )){ f = 0 ; while ( e = b [ f ++ ]) while ( d . indexOf ( " " + e + " " ) >= 0 ) d = d . replace ( " " + e + " " , " " ); g = a ? n . trim ( d ) : "" , c . className !== g && ( c . className = g )} return this }, toggleClass : function ( a , b ){ var c = typeof a ; return "boolean" == typeof b && "string" === c ? b ? this . addClass ( a ) : this . removeClass ( a ) : this . each ( n . isFunction ( a ) ? function ( c ){ n ( this ). toggleClass ( a . call ( this , c , this . className , b ), b )} : function (){ if ( "string" === c ){ var b , d = 0 , e = n ( this ), f = a . match ( E ) || []; while ( b = f [ d ++ ]) e . hasClass ( b ) ? e . removeClass ( b ) : e . addClass ( b )} else ( c === U || "boolean" === c ) && ( this . className && L . set ( this , "__className__" , this . className ), this . className = this . className || a ===! 1 ? "" : L . get ( this , "__className__" ) || "" )})}, hasClass : function ( a ){ for ( var b = " " + a + " " , c = 0 , d = this . length ; d > c ; c ++ ) if ( 1 === this [ c ]. nodeType && ( " " + this [ c ]. className + " " ). replace ( ab , " " ). indexOf ( b ) >= 0 ) return ! 0 ; return ! 1 }}); var bb = /\r/g ; n . fn . extend ({ val : function ( a ){ var b , c , d , e = this [ 0 ];{ if ( arguments . length ) return d = n . isFunction ( a ), this . each ( function ( c ){ var e ; 1 === this . nodeType && ( e = d ? a . call ( this , c , n ( this ). val ()) : a , null == e ? e = "" : "number" == typeof e ? e += "" : n . isArray ( e ) && ( e = n . map ( e , function ( a ){ return null == a ? "" : a + "" })), b = n . valHooks [ this . type ] || n . valHooks [ this . nodeName . toLowerCase ()], b && "set" in b && void 0 !== b . set ( this , e , "value" ) || ( this . value = e ))}); if ( e ) return b = n . valHooks [ e . type ] || n . valHooks [ e . nodeName . toLowerCase ()], b && "get" in b && void 0 !== ( c = b . get ( e , "value" )) ? c : ( c = e . value , "string" == typeof c ? c . replace ( bb , "" ) : null == c ? "" : c )}}}), n . extend ({ valHooks : { option : { get : function ( a ){ var b = n . find . attr ( a , "value" ); return null != b ? b : n . trim ( n . text ( a ))}}, select : { get : function ( a ){ for ( var b , c , d = a . options , e
//# sourceMappingURL=jquery.min.map
//websocket 断线重连
! function ( a , b ){ "function" == typeof define && define . amd ? define ([], b ) : "undefined" != typeof module && module . exports ? module . exports = b () : a . ReconnectingWebSocket = b ()}( this , function (){ function a ( b , c , d ){ function l ( a , b ){ var c = document . createEvent ( "CustomEvent" ); return c . initCustomEvent ( a , ! 1 , ! 1 , b ), c } var e = { debug :! 1 , automaticOpen :! 0 , reconnectInterval : 1e3 , maxReconnectInterval : 3e4 , reconnectDecay : 1.5 , timeoutInterval : 2e3 }; d || ( d = {}); for ( var f in e ) this [ f ] = "undefined" != typeof d [ f ] ? d [ f ] : e [ f ]; this . url = b , this . reconnectAttempts = 0 , this . readyState = WebSocket . CONNECTING , this . protocol = null ; var h , g = this , i =! 1 , j =! 1 , k = document . createElement ( "div" ); k . addEventListener ( "open" , function ( a ){ g . onopen ( a )}), k . addEventListener ( "close" , function ( a ){ g . onclose ( a )}), k . addEventListener ( "connecting" , function ( a ){ g . onconnecting ( a )}), k . addEventListener ( "message" , function ( a ){ g . onmessage ( a )}), k . addEventListener ( "error" , function ( a ){ g . onerror ( a )}), this . addEventListener = k . addEventListener . bind ( k ), this . removeEventListener = k . removeEventListener . bind ( k ), this . dispatchEvent = k . dispatchEvent . bind ( k ), this . open = function ( b ){ h = new WebSocket ( g . url , c || []), b || k . dispatchEvent ( l ( "connecting" )),( g . debug || a . debugAll ) && console . debug ( "ReconnectingWebSocket" , "attempt-connect" , g . url ); var d = h , e = setTimeout ( function (){( g . debug || a . debugAll ) && console . debug ( "ReconnectingWebSocket" , "connection-timeout" , g . url ), j =! 0 , d . close (), j =! 1 }, g . timeoutInterval ); h . onopen = function (){ clearTimeout ( e ),( g . debug || a . debugAll ) && console . debug ( "ReconnectingWebSocket" , "onopen" , g . url ), g . protocol = h . protocol , g . readyState = WebSocket . OPEN , g . reconnectAttempts = 0 ; var d = l ( "open" ); d . isReconnect = b , b =! 1 , k . dispatchEvent ( d )}, h . onclose = function ( c ){ if ( clearTimeout ( e ), h = null , i ) g . readyState = WebSocket . CLOSED , k . dispatchEvent ( l ( "close" )); else { g . readyState = WebSocket . CONNECTING ; var d = l ( "connecting" ); d . code = c . code , d . reason = c . reason , d . wasClean = c . wasClean , k . dispatchEvent ( d ), b || j || (( g . debug || a . debugAll ) && console . debug ( "ReconnectingWebSocket" , "onclose" , g . url ), k . dispatchEvent ( l ( "close" ))); var e = g . reconnectInterval * Math . pow ( g . reconnectDecay , g . reconnectAttempts ); setTimeout ( function (){ g . reconnectAttempts ++ , g . open ( ! 0 )}, e > g . maxReconnectInterval ? g . maxReconnectInterval : e )}}, h . onmessage = function ( b ){( g . debug || a . debugAll ) && console . debug ( "ReconnectingWebSocket" , "onmessage" , g . url , b . data ); var c = l ( "message" ); c . data = b . data , k . dispatchEvent ( c )}, h . onerror = function ( b ){( g . debug || a . debugAll ) && console . debug ( "ReconnectingWebSocket" , "onerror" , g . url , b ), k . dispatchEvent ( l ( "error" ))}}, 1 == this . automaticOpen && this . open ( ! 1 ), this . send = function ( b ){ if ( h ) return ( g . debug || a . debugAll ) && console . debug ( "ReconnectingWebSocket" , "send" , g . url , b ), h . send ( b ); throw "INVALID_STATE_ERR : Pausing to reconnect websocket" }, this . close = function ( a , b ){ "undefined" == typeof a && ( a = 1e3 ), i =! 0 , h && h . close ( a , b )}, this . refresh = function (){ h && h . close ()}} return a . prototype . onopen = function (){}, a . prototype . onclose = function (){}, a . prototype . onconnecting = function (){}, a . prototype . onmessage = function (){}, a . prototype . onerror = function (){}, a . debugAll =! 1 , a . CONNECTING = WebSocket . CONNECTING , a . OPEN = WebSocket . OPEN , a . CLOSING = WebSocket . CLOSING , a . CLOSED = WebSocket . CLOSED , a });
/***
* tap支援
*/
( function () {
$ . fn . extend ({ "tap" : function ( callback ) {
$ ( this ). on ( 'touchstart' , function () {
window . tempBindtouchendIns = $ ( this );
window . tempBindtouchendIns . unbind ( 'touchend' );
window . tempBindtouchendIns . on ( 'touchend' , function () {
window . tempBindtouchendIns . unbind ( 'touchend' );
if ( callback != null ){
$ . fn . extend ({ "tapCallback" : callback })
$ ( this ). tapCallback ()
}
})
})
}})
})
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
( function ( factory ) {
if ( typeof define === 'function' && define . amd ) {
// AMD
define ([ 'jquery' ], factory );
} else if ( typeof exports === 'object' ) {
// CommonJS
factory ( require ( 'jquery' ));
} else {
// Browser globals
factory ( jQuery );
}
}( function ( $ ) {
var pluses = /\+/g ;
function encode ( s ) {
return config . raw ? s : encodeURIComponent ( s );
}
function decode ( s ) {
return config . raw ? s : decodeURIComponent ( s );
}
function stringifyCookieValue ( value ) {
return encode ( config . json ? JSON . stringify ( value ) : String ( value ));
}
function parseCookieValue ( s ) {
if ( s . indexOf ( '"' ) === 0 ) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s . slice ( 1 , - 1 ). replace ( /\\"/g , '"' ). replace ( /\\\\/g , '\\' );
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent ( s . replace ( pluses , ' ' ));
return config . json ? JSON . parse ( s ) : s ;
} catch ( e ) {}
}
function read ( s , converter ) {
var value = config . raw ? s : parseCookieValue ( s );
return $ . isFunction ( converter ) ? converter ( value ) : value ;
}
var config = $ . cookie = function ( key , value , options ) {
// Write
if ( value !== undefined && ! $ . isFunction ( value )) {
options = $ . extend ({}, config . defaults , options );
if ( typeof options . expires === 'number' ) {
var days = options . expires , t = options . expires = new Date ();
t . setTime ( + t + days * 864e+5 );
}
return ( document . cookie = [
encode ( key ), '=' , stringifyCookieValue ( value ),
options . expires ? '; expires=' + options . expires . toUTCString () : '' , // use expires attribute, max-age is not supported by IE
options . path ? '; path=' + options . path : '' ,
options . domain ? '; domain=' + options . domain : '' ,
options . secure ? '; secure' : ''
]. join ( '' ));
}
// Read
var result = key ? undefined : {};
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document . cookie ? document . cookie . split ( '; ' ) : [];
for ( var i = 0 , l = cookies . length ; i < l ; i ++ ) {
var parts = cookies [ i ]. split ( '=' );
var name = decode ( parts . shift ());
var cookie = parts . join ( '=' );
if ( key && key === name ) {
// If second argument (value) is a function it's a converter...
result = read ( cookie , value );
break ;
}
// Prevent storing a cookie that we couldn't decode.
if ( ! key && ( cookie = read ( cookie )) !== undefined ) {
result [ name ] = cookie ;
}
}
return result ;
};
config . defaults = {};
$ . removeCookie = function ( key , options ) {
if ( $ . cookie ( key ) === undefined ) {
return false ;
}
// Must not alter options, thus extending a fresh object...
$ . cookie ( key , '' , $ . extend ({}, options , { expires : - 1 }));
return ! $ . cookie ( key );
};
}));
$ ( '<style>[h]{display: none!important;}</style>' ). prependTo ( "head" );
$ ( window ). bind ( "load" , function () {
H . init ()
});
// H.mz={"data":[{"id":"01","name":"汉族"},{"id":"02","name":"蒙古族"},{"id":"03","name":"回族"},
// {"id":"04","name":"藏族"},{"id":"05","name":"维吾尔族"},{"id":"06","name":"苗族"},
// {"id":"07","name":"彝族"},{"id":"08","name":"壮族"},{"id":"09","name":"布依族"},
// {"id":"10","name":"朝鲜族"},{"id":"11","name":"满族"},{"id":"12","name":"侗族"},
// {"id":"13","name":"瑶族"},{"id":"14","name":"白族"},{"id":"15","name":"土家族"},
// {"id":"16","name":"哈尼族"},{"id":"17","name":"哈萨克族"},{"id":"18","name":"傣族"},
// {"id":"19","name":"黎族"},{"id":"20","name":"傈僳族"},{"id":"21","name":"佤族"},
// {"id":"22","name":"畲族"},{"id":"23","name":"高山族"},{"id":"24","name":"拉祜族"},
// {"id":"25","name":"水族"},{"id":"26","name":"东乡族"},{"id":"27","name":"纳西族"},
// {"id":"28","name":"景颇族"},{"id":"29","name":"柯尔克孜族"},{"id":"30","name":"土族"},
// {"id":"31","name":"达斡尔族"},{"id":"32","name":"仫佬族"},{"id":"33","name":"羌族"},
// {"id":"34","name":"布朗族"},{"id":"35","name":"撒拉族"},{"id":"36","name":"毛难族"},
// {"id":"37","name":"仡佬族"},{"id":"38","name":"锡伯族"},{"id":"39","name":"阿昌族"},
// {"id":"40","name":"普米族"},{"id":"41","name":"塔吉克族"},{"id":"42","name":"怒族"},
// {"id":"43","name":"乌孜别克族"},{"id":"44","name":"俄罗斯族"},{"id":"45","name":"鄂温克族"},
// {"id":"46","name":"崩龙族"},{"id":"47","name":"保安族"},{"id":"48","name":"裕固族"},
// {"id":"49","name":"京族"},{"id":"50","name":"塔塔尔族"},{"id":"51","name":"独龙族"},
// {"id":"52","name":"鄂伦春族"},{"id":"53","name":"赫哲族"},{"id":"54","name":"门巴族"},
// {"id":"55","name":"珞巴族"},{"id":"56","name":"基诺族"}]}