Fixed active nav item issue

The navigation was working correctly before the javascript refactor, and
seemed to be working correctly after as well, except when clicking on
links to tag pages or posts from within #page-content. When an internal
link to a post or tag page is clicked the navigation should set the
"blog" menuitem to be active. Unfortunately, this was not the case
before this commit but luckily this commit rectifies this.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
Cette révision appartient à :
Collin J. Doering 2016-02-08 19:39:10 -05:00
Parent 6979e8cbd4
révision de27657196
1 fichiers modifiés avec 16 ajouts et 8 suppressions

Voir le fichier

@ -240,11 +240,7 @@ var _paq = _paq || [];
}()),
site = (function () {
var spec = {
init: init
},
status = (function () {
var status = (function () {
var messages = [],
validIndicators = ["error", "success", "info"],
spec = {
@ -341,7 +337,13 @@ var _paq = _paq || [];
});
return spec;
}());
}()),
spec = {
init: init,
nav: nav,
status: status
};
function appCacheUpdateReady () {
window.applicationCache.swapCache();
@ -366,11 +368,17 @@ var _paq = _paq || [];
// Initialize routes
router.route({ // Post pages handler
acceptUrls: /posts\/.*\.html/
acceptUrls: /posts\/.*\.html/,
onSuccess: function (url, dta) {
site.nav.setActive('/blog1.html');
}
});
router.route({ // Tag pages handler
acceptUrls: /tags\/.*(\d*)\.html/
acceptUrls: /tags\/.*(\d*)\.html/,
onSuccess: function (url, dta) {
site.nav.setActive('/blog1.html');
}
});
router.route({ // Blog pages handler