You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ij...@apache.org on 2012/05/10 20:01:50 UTC
svn commit: r1336816 - /jena/site/trunk/content/js/jena-navigation.js
Author: ijd
Date: Thu May 10 18:01:50 2012
New Revision: 1336816
URL: http://svn.apache.org/viewvc?rev=1336816&view=rev
Log:
Fix busy-loop in current section determiner
Modified:
jena/site/trunk/content/js/jena-navigation.js
Modified: jena/site/trunk/content/js/jena-navigation.js
URL: http://svn.apache.org/viewvc/jena/site/trunk/content/js/jena-navigation.js?rev=1336816&r1=1336815&r2=1336816&view=diff
==============================================================================
--- jena/site/trunk/content/js/jena-navigation.js (original)
+++ jena/site/trunk/content/js/jena-navigation.js Thu May 10 18:01:50 2012
@@ -49,17 +49,14 @@ var JenaNavigation = function() {
*/
var getLocation = function() {
var url = checkForDefaultPage();
- if (url.match( /\/jena\/index.html$/ )) {
+ if (url.match( /\/index.html$/ )) {
currentSection.fileName = "about-jena";
currentPage.fileName = "index.html";
}
else {
- var current = url.split( "/" );
- while (current.shift() != "jena") {}
-
- // next is the section ID, rest is the page ID
- currentSection.fileName = current.shift();
- currentPage.fileName = current.join( "/" );
+ var matches = url.match( /^.*jena.apache.org\/([^\/]*)\/(.*)$/ );
+ currentSection.fileName = matches[1];
+ currentPage.fileName = matches[2];
}
currentPage.title = asTitle( currentPage.fileName.replace( /.html$/, '' ) );
@@ -136,7 +133,7 @@ var JenaNavigation = function() {
init : init
};
-}(); // "revealing module" pattern
+}();
// Initialize on load
$(function(){ JenaNavigation.init(); });