implements a basic go to anchot mechanism

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-05-21 17:22:15 +00:00
parent d58465581a
commit eac9ee57f1
3 changed files with 10 additions and 4 deletions

View File

@ -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,'&lt;');
text=text.replace(/>/g,"&gt;");
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,'&lt;');
text=text.replace(/>/g,"&gt;");
mainContent.find("#artifact-content-text" ).html(text);
goToAnchor("artifact-content-text-header");
}
});
}

View File

@ -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
//------------------------------------

View File

@ -823,8 +823,8 @@
</div>
</div>
</div>
<h4>Content</h4>
<h4 id="artifact-content-text-header">Content</h4>
<div>
<pre id="artifact-content-text"></pre>
<pre><code id="artifact-content-text"></code></pre>
</div>
</script>