diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index fc9f3c43d..f48ae26f1 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -756,8 +756,14 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno changeBrowseRepository=function(){ var selectedRepository=getSelectedBrowsingRepository(); // #browse~internal/org.apache.maven + // or #artifact~snapshots/org.apache.maven.plugins/maven-compiler-plugin var currentHash=window.location.hash; - var newLocation = "#browse"; + + + + $.log("currentHash:"+currentHash); + + var newLocation = currentHash.substringBeforeFirst("/");// "#browse"; if (selectedRepository){ newLocation+="~"+selectedRepository; } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index cbaeefd4f..9fb10cc86 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -402,6 +402,14 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() { return this.substring(0,this.lastIndexOf(str)); } + String.prototype.substringBeforeFirst = function(str) { + var idx = this.indexOf(str); + if(idx<0){ + return this; + } + return this.substring(0,idx); + } + String.prototype.substringAfterLast = function(str) { return this.substring(this.lastIndexOf(str)+1); }