From 0bcfd50f8f6608dad324c9cb3afb1edebc684ab9 Mon Sep 17 00:00:00 2001 From: Stephen Hoogendijk Date: Mon, 3 Feb 2014 16:42:40 +0100 Subject: [PATCH] Small naming fix --- js/bootstrap-remote-tabs.js | 18 +++++++++--------- js/bootstrap-remote-tabs.min.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/js/bootstrap-remote-tabs.js b/js/bootstrap-remote-tabs.js index c855b28..2d9c462 100644 --- a/js/bootstrap-remote-tabs.js +++ b/js/bootstrap-remote-tabs.js @@ -53,8 +53,8 @@ var RemoteTabs = function() { me.hasLoadingMask = !!hasLoadingMask; // enable all remote data tabs - $('[data-toggle=tab], [data-toggle=collapse]').each(function(k, tab) { - var bsObj = $(tab), + $('[data-toggle=tab], [data-toggle=collapse]').each(function(k, obj) { + var bsObj = $(obj), bsDiv, bsData, bsCallback, @@ -164,10 +164,10 @@ var RemoteTabs = function() { * @param customData * @param callbackFn * @param trigger - * @param tabContainer + * @param dataContainer * @private */ - _executeRemoteCall: function(url, customData, callbackFn, trigger, tabContainer) { + _executeRemoteCall: function(url, customData, callbackFn, trigger, dataContainer) { var me = this; @@ -177,23 +177,23 @@ var RemoteTabs = function() { success: function(data) { trigger.removeClass('loading'); if(me.hasLoadingMask) { - tabContainer.unmask(); + dataContainer.unmask(); } if (data) { if(typeof window[callbackFn] == 'function') { - window[callbackFn].call(null, data, trigger, tabContainer, customData); + window[callbackFn].call(null, data, trigger, dataContainer, customData); } if(!trigger.hasClass("loaded")) { trigger.addClass("loaded"); } - tabContainer.html(data); + dataContainer.html(data); } }, error: function(data, status, error) { - tabContainer.html("An error occured while loading the data: " + error); + dataContainer.html("An error occured while loading the data: " + error); trigger.removeClass('loading'); if(me.hasLoadingMask) { - tabContainer.unmask(); + dataContainer.unmask(); } } }); diff --git a/js/bootstrap-remote-tabs.min.js b/js/bootstrap-remote-tabs.min.js index 3aa4b66..31c423e 100644 --- a/js/bootstrap-remote-tabs.min.js +++ b/js/bootstrap-remote-tabs.min.js @@ -11,4 +11,4 @@ var $=jQuery; * @returns {{hasLoadingMask: boolean, load: Function, _executeRemoteCall: Function}} * @constructor */ -var hasLoadingMask=(jQuery().mask?true:false),bootstrapVersion2=(jQuery().typeahead?true:false);var tabShowEvent=(bootstrapVersion2?"show":"show.bs.tab");var accordionShowEvent=(bootstrapVersion2?"show":"show.bs.collapse");$(function(){var c=document.location.hash;if(c){var a=$("[data-toggle=tab][href="+c+"]");if(a){a.tab("show")}var b=$("[data-toggle=collapse][href="+c+"]");if(b){if(b[0]!=$("[data-toggle=collapse]:first")[0]){b.click()}}}});var RemoteTabs=function(){var a={hasLoadingMask:false,load:function(c){var b=this;b.hasLoadingMask=!!c;$("[data-toggle=tab], [data-toggle=collapse]").each(function(h,g){var p=$(g),j,m,n,d,l,f,i=false,e;if(p.is("[data-tab-url]")){d=p.attr("data-tab-url");j=$("#"+p.attr("href").split("#")[1]);m=p.attr("data-tab-json")||[];n=p.attr("data-tab-callback")||null;l=p.attr("data-tab-delay")||null;f=(p.is("[data-tab-always-refresh]")&&p.attr("data-tab-always-refresh")=="true")||null,e=p,showEvent=(p.attr("data-toggle")=="tab"?tabShowEvent:accordionShowEvent);if(m.length>0){try{m=$.parseJSON(m)}catch(o){console.log("Invalid json passed to data-tab-json");console.log(o)}}if(showEvent==accordionShowEvent){i=j.hasClass("in");if(bootstrapVersion2){p=p.parent()}else{p=p.parents(".panel")}if(i){b._triggerChange(null,d,m,n,p,j,l,f,e)}}p.on(showEvent,function(k){b._triggerChange(k,d,m,n,p,j,l,f,e)})}})},_triggerChange:function(f,b,j,k,l,g,i,d,c){var h=this;if(f){if(typeof f.target.hash!="undefined"){window.location.hash=f.target.hash}else{window.location.hash=c.prop("hash")}}if((!l.hasClass("loaded")||d)&&!l.hasClass("loading")){if(h.hasLoadingMask){g.mask("Loading...")}l.addClass("loading");if(i){clearTimeout(window.timer);window.timer=setTimeout(function(){h._executeRemoteCall(b,j,k,l,g)},i)}else{h._executeRemoteCall(b,j,k,l,g)}}},_executeRemoteCall:function(e,g,c,d,b){var f=this;$.ajax({url:e,data:g||[],success:function(h){d.removeClass("loading");if(f.hasLoadingMask){b.unmask()}if(h){if(typeof window[c]=="function"){window[c].call(null,h,d,b,g)}if(!d.hasClass("loaded")){d.addClass("loaded")}b.html(h)}},error:function(j,h,i){b.html("An error occured while loading the data: "+i);d.removeClass("loading");if(f.hasLoadingMask){b.unmask()}}})}};a.load(hasLoadingMask);return a};var remoteTabsPluginLoaded=new RemoteTabs(); \ No newline at end of file +var hasLoadingMask=(jQuery().mask?true:false),bootstrapVersion2=(jQuery().typeahead?true:false);var tabShowEvent=(bootstrapVersion2?"show":"show.bs.tab");var accordionShowEvent=(bootstrapVersion2?"show":"show.bs.collapse");$(function(){var c=document.location.hash;if(c){var a=$("[data-toggle=tab][href="+c+"]");if(a){a.tab("show")}var b=$("[data-toggle=collapse][href="+c+"]");if(b){if(b[0]!=$("[data-toggle=collapse]:first")[0]){b.click()}}}});var RemoteTabs=function(){var a={hasLoadingMask:false,load:function(c){var b=this;b.hasLoadingMask=!!c;$("[data-toggle=tab], [data-toggle=collapse]").each(function(g,i){var p=$(i),j,m,n,d,l,f,h=false,e;if(p.is("[data-tab-url]")){d=p.attr("data-tab-url");j=$("#"+p.attr("href").split("#")[1]);m=p.attr("data-tab-json")||[];n=p.attr("data-tab-callback")||null;l=p.attr("data-tab-delay")||null;f=(p.is("[data-tab-always-refresh]")&&p.attr("data-tab-always-refresh")=="true")||null,e=p,showEvent=(p.attr("data-toggle")=="tab"?tabShowEvent:accordionShowEvent);if(m.length>0){try{m=$.parseJSON(m)}catch(o){console.log("Invalid json passed to data-tab-json");console.log(o)}}if(showEvent==accordionShowEvent){h=j.hasClass("in");if(bootstrapVersion2){p=p.parent()}else{p=p.parents(".panel")}if(h){b._triggerChange(null,d,m,n,p,j,l,f,e)}}p.on(showEvent,function(k){b._triggerChange(k,d,m,n,p,j,l,f,e)})}})},_triggerChange:function(f,b,j,k,l,g,i,d,c){var h=this;if(f){if(typeof f.target.hash!="undefined"){window.location.hash=f.target.hash}else{window.location.hash=c.prop("hash")}}if((!l.hasClass("loaded")||d)&&!l.hasClass("loading")){if(h.hasLoadingMask){g.mask("Loading...")}l.addClass("loading");if(i){clearTimeout(window.timer);window.timer=setTimeout(function(){h._executeRemoteCall(b,j,k,l,g)},i)}else{h._executeRemoteCall(b,j,k,l,g)}}},_executeRemoteCall:function(d,g,b,c,f){var e=this;$.ajax({url:d,data:g||[],success:function(h){c.removeClass("loading");if(e.hasLoadingMask){f.unmask()}if(h){if(typeof window[b]=="function"){window[b].call(null,h,c,f,g)}if(!c.hasClass("loaded")){c.addClass("loaded")}f.html(h)}},error:function(j,h,i){f.html("An error occured while loading the data: "+i);c.removeClass("loading");if(e.hasLoadingMask){f.unmask()}}})}};a.load(hasLoadingMask);return a};var remoteTabsPluginLoaded=new RemoteTabs(); \ No newline at end of file