From: Olivier Lamy Date: Mon, 21 May 2012 17:22:15 +0000 (+0000) Subject: implements a basic go to anchot mechanism X-Git-Tag: archiva-1.4-M3~702 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=eac9ee57f1b82878b9a516f6cbde591b66f309f8;p=archiva.git implements a basic go to anchot mechanism git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341117 13f79535-47bb-0310-9956-ffa450edef68 --- 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 b927169d4..f4eb806de 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 @@ -295,11 +295,10 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock url: pomContentUrl, dataType: "text", success: function(data) { - $.log("foo"); - $.log("data:"+data); var text = data.replace(//g,">"); mainContent.find("#artifact-content-text" ).html(text); + goToAnchor("artifact-content-text-header"); } }); return; @@ -334,6 +333,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock var text = data.replace(//g,">"); mainContent.find("#artifact-content-text" ).html(text); + goToAnchor("artifact-content-text-header"); } }); } 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 69a575e36..605b7a5fd 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 @@ -373,6 +373,12 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() { return sorted?res.sort():res; } + goToAnchor=function(anchor){ + var curHref = window.location.href; + curHref=curHref.substringBeforeLast("#"); + window.location.href=curHref+"#"+anchor; + } + //------------------------------------ // utils javascript string extensions //------------------------------------ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html index 544b90155..a44be1ca8 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html @@ -823,8 +823,8 @@ -

Content

+

Content

-

+         
\ No newline at end of file