// Learn cc.Class: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html // Learn Attribute: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html 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 += "&"; } } });