diff --git a/css/mainStyle.css b/css/mainStyle.css index a0795b9..ad2e6e4 100644 --- a/css/mainStyle.css +++ b/css/mainStyle.css @@ -43,8 +43,13 @@ span.expanded { font-size: 30px; } +.navbar-default .navbar-nav>.disabled>a, .navbar-default .navbar-nav>.disabled>a:focus, .navbar-default .navbar-nav>.disabled>a:hover { + background-color:#FFFFFF; +} + .navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>.active>a:focus{ background-color: #FFFFFF; + border:3px solid #616d77; color:#b2382a; } @@ -54,12 +59,13 @@ span.expanded { text-align: center; color:#000000; border-radius: 15px; - border: 0px solid; + border:3px solid transparent; } .navbar-default .navbar-nav>li>a:hover{ - background-color: #666b75; - text-emphasis: bold; + background-color: #666b75; + text-emphasis: bold; + border:3px solid transparent; } .navbar-inner{ @@ -90,4 +96,4 @@ span.expanded { .nopadding { padding: 0 !important; margin: 0 !important; -} \ No newline at end of file +} diff --git a/js/main.js b/js/main.js index 7669404..cdc74d9 100644 --- a/js/main.js +++ b/js/main.js @@ -8,8 +8,18 @@ var ibuyproperties=(function(){ function navShow(cls,ele){ $("."+cls).addClass('hide'); $("#pnl_"+ele).removeClass('hide'); - $(".topNav"+cls).removeClass('active'); - $(".topNav"+ele).addClass('active'); + $(".topNav"+cls).removeClass('active disabled'); + $(".topNav"+cls).removeAttr('href'); + + $.each($(".topNav"+cls+">a"),function(pos,ele){ + $(ele).attr("href", $(ele).attr("mytargeturl")); + }); + + + $($(".topNav"+ele)[0]).addClass('active disabled'); + $($(".topNav"+ele)[0]).addClass('active disabled'); + $($(".topNav"+ele+">a")[0]).removeAttr('href'); + } function toggleButton(elEnable,elDisable){ @@ -38,6 +48,7 @@ $(document).ready(function(){ if (ibuyproperties.isDebugMode) { $("body").append(ibuyproperties.templateHelper.get("debug")({})); } + ibuyproperties.router.route(); $(window).on('hashchange', ibuyproperties.router.route); }); diff --git a/js/router.js b/js/router.js index 85df2e2..cde8a9a 100644 --- a/js/router.js +++ b/js/router.js @@ -2,7 +2,7 @@ ibuyproperties.router=(function(){ var allRoutes=[]; - + function route() { var hash = window.location.hash; var lastLocation = null; @@ -14,12 +14,18 @@ ibuyproperties.router=(function(){ if (lastLocation != hash) { this.lastLocation=hash; + var routeFoundMainNav=false; + var promisesMainNav=[]; // Generic routing based on template names $.each(ibuyproperties.templates.getType("mainPages"),function(pos,name){ + var def = new $.Deferred(); + promisesMainNav.push(def); + var re=new RegExp("^#" + name + "[/]*"); if (ibuyproperties.isDebugMode) { console.log("Generic Router - test ",name);} // debugger; if (hash.match(re)) { + routeFoundMainNav=true; if (ibuyproperties.isDebugMode) { console.log("Generic Router - match ",name);} if ($("#pnl_" +name).length === 0) { $("#content").empty().append(ibuyproperties.templateHelper.get(name)({templateName:name})); @@ -27,30 +33,40 @@ ibuyproperties.router=(function(){ ibuyproperties.navShow('mainScreen',name); $('.in,.open').removeClass('in open'); } + def.resolve(); }); - + $.when.apply(undefined,promisesMainNav).then(function(){if (!routeFoundMainNav) {console.error("NO matching Navigation tab route found");}}); + + var promisesDyn=[]; + var routeFoundDynamic=false; // Dynamic route handling $.each(allRoutes,function(pos,theRoute){ + var def = new $.Deferred(); + promisesDyn.push(def); if (ibuyproperties.isDebugMode) { console.log("Dynamic Router - test ",hash ,theRoute);} - + var re=new RegExp(theRoute.re); if (hash.match(re)) { + routeFoundDynamic=true; if (ibuyproperties.isDebugMode) { console.log("Dynamic Router - match ",hash,theRoute);} theRoute.cb.call(); return false; // exit the loop } + def.resolve(); }); - + $.when.apply(undefined,promisesDyn).then(function(){if (!routeFoundDynamic) {console.error("NO matching Dynamic route found");}}); + + } } - + function addRoute(re, callBack){ var theRoute={re:re,cb:callBack}; allRoutes.push(theRoute); - + } return { route:route, addRoute:addRoute }; -}()); \ No newline at end of file +}()); diff --git a/templates/nav.html b/templates/nav.html index 509dbb9..b54ebf6 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -25,10 +25,10 @@ -
+
+
Phone