一部のラッパー関数

js```

//解析URLの
関数parseURLを(URL){
VARのA =のdocument.createElement( 'A');
a.href = URL;
リターン{
源:URL、
プロトコル:a.protocol.replace( ':'、 '')、
ホスト:a.hostname、
ポート:a.port、
クエリ:a.search、
paramsは:(関数(){
VARのRET = {}、
SEG = a.search.replace(/ ^ /、 '?')スプリット( '&')、
= seg.length lenは、I = 0、S;
のための(; iがLEN <; Iは++){
もし(![I] SEG){続ける;}
S = SEG [I] .split( '=');
RET [S [0] = sの[1];
}
戻りRET;
})()、
ファイル( a.pathname.match(//([^ \ /#?] +)$ / I)|| [ ''])[1]、
ハッシュ:a.hash.replace( '#'、 '')、
パス:。
相対:(TPS / a.href.match(?:// [^ \ /] +(+)/)|| [ ''])[1]、
セグメント:a.pathname.replace(/ ^ / /,'').split('/ ')
}。
}

//对象复制
機能cloneObjectFn(OBJ){
戻りJSON.parse(JSON.stringify(OBJ))
}
跑马灯
関数fontRound(btnId){
VARのlinkTag = G(btnId + '.font')。
VAR textLen = STRLEN(linkTag.innerText)。
VAR文= linkTag.innerText + ''
$$ removeClass(btnId + '.font'、 "省略記号");

//にconsole.log(textLen)
IF(textLen> 18){
linkTag.innerHTML =テキスト。
}
VAR myTimer =たsetInterval(
関数(){
IF(linkTag){
VARテキスト= linkTag.innerText;
IF(textLen <= 18)リターン;
VARをnewText = text.substr(1)+ text.charAt(0);
コンソール。ログ(をnewText);
linkTag.innerHTML =をnewText;
}

    }, 500
);

return myTimer;

}
`` `

おすすめ

転載: www.cnblogs.com/hyx626/p/11781076.html