mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Link scoped symbols
Summary: Elements with class na are now linked to symbol lookup. The context is passed if we got one. See D3214. Test Plan: Load Diffusion. Examine DOM and click on things. Reviewers: epriestley Reviewed By: epriestley CC: nh, aran, Korvin Maniphest Tasks: T1602 Differential Revision: https://secure.phabricator.com/D3215
This commit is contained in:
parent
d4cbb00d3b
commit
660119915c
2 changed files with 11 additions and 4 deletions
|
@ -131,6 +131,7 @@
|
|||
.remarkup-code .rbw_v { color: violet; }
|
||||
|
||||
.repository-crossreference .remarkup-code .nc,
|
||||
.repository-crossreference .remarkup-code .na,
|
||||
.repository-crossreference .remarkup-code .nf {
|
||||
cursor: help;
|
||||
border-bottom: 1px dotted #bbddbb;
|
||||
|
|
|
@ -21,17 +21,23 @@ JX.behavior('repository-crossreference', function(config) {
|
|||
return;
|
||||
}
|
||||
var target = e.getTarget();
|
||||
var map = {nc : 'class', nf : 'function'};
|
||||
var map = {nc : 'class', nf : 'function', na : null};
|
||||
while (target !== document.body) {
|
||||
if (JX.DOM.isNode(target, 'span') && (target.className in map)) {
|
||||
var symbol = target.textContent || target.innerText;
|
||||
var uri = JX.$U('/diffusion/symbol/' + symbol + '/');
|
||||
uri.addQueryParams({
|
||||
type : map[target.className],
|
||||
var query = {
|
||||
lang : config.lang,
|
||||
projects : config.projects.join(','),
|
||||
jump : true
|
||||
});
|
||||
};
|
||||
if (map[target.className]) {
|
||||
query.type = map[target.className];
|
||||
}
|
||||
if (target.hasAttribute('data-symbol-context')) {
|
||||
query.context = target.getAttribute('data-symbol-context');
|
||||
}
|
||||
uri.addQueryParams(query);
|
||||
window.open(uri);
|
||||
e.kill();
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue