emulator/fc/js/jcfw/urlbuilder.js
2019-03-29 20:02:56 +08:00

36 lines
882 B
JavaScript

require.register('common/urlbuilder', function(module, exports, require) {
module.exports = function(url){
this.orginurl = url;
this.baseurl = url;
this.checked = false;
this.addKV=function(key, value){
if(typeof(value) == 'undefined'){
return this;
}
this._checkurl();
var str = encodeURIComponent(key) + '=' + encodeURIComponent(value);
this.baseurl += str;
return this;
};
this.clear=function(){
this.baseurl = this.orginurl;
this.checked = false;
};
this._checkurl=function(){
if(!this.checked){
if(this.baseurl.indexOf("?") == -1){
this.baseurl += "?";
}else{
this.baseurl += "&";
}
this.checked = true;
}else{
this.baseurl += "&";
}
};
};
});