Array.prototype.removeByIndex = function(index) { return this.splice(index, 1); } function showLoading(text, after) { $.mobile.loading("show", {             text: text,             textVisible: true,             theme: 'g',             textonly: false,             html: ''     }); if(after) { setTimeout(function(){ hideLoading(); }, after); } } function hideLoading() { $.mobile.loading("hide"); }