44 lines
891 B
JavaScript
44 lines
891 B
JavaScript
|
|
module.exports = cc.Class({
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {},
|
|
|
|
// start () {},
|
|
|
|
// update (dt) {},
|
|
__ctor__ (url){
|
|
this.orginurl = url;
|
|
this.baseurl = url;
|
|
this.checked = false;
|
|
},
|
|
|
|
addKV(key, value){
|
|
if(typeof(value) == 'undefined'){
|
|
return this;
|
|
}
|
|
this._checkurl();
|
|
var str = encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
|
this.baseurl += str;
|
|
return this;
|
|
},
|
|
|
|
clear(){
|
|
this.baseurl = this.orginurl;
|
|
this.checked = false;
|
|
},
|
|
|
|
_checkurl(){
|
|
if(!this.checked){
|
|
if(this.baseurl.indexOf("?") == -1){
|
|
this.baseurl += "?";
|
|
}else{
|
|
this.baseurl += "&";
|
|
}
|
|
this.checked = true;
|
|
}else{
|
|
this.baseurl += "&";
|
|
}
|
|
|
|
}
|
|
}); |