mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01: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; }
|
.remarkup-code .rbw_v { color: violet; }
|
||||||
|
|
||||||
.repository-crossreference .remarkup-code .nc,
|
.repository-crossreference .remarkup-code .nc,
|
||||||
|
.repository-crossreference .remarkup-code .na,
|
||||||
.repository-crossreference .remarkup-code .nf {
|
.repository-crossreference .remarkup-code .nf {
|
||||||
cursor: help;
|
cursor: help;
|
||||||
border-bottom: 1px dotted #bbddbb;
|
border-bottom: 1px dotted #bbddbb;
|
||||||
|
|
|
@ -21,17 +21,23 @@ JX.behavior('repository-crossreference', function(config) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var target = e.getTarget();
|
var target = e.getTarget();
|
||||||
var map = {nc : 'class', nf : 'function'};
|
var map = {nc : 'class', nf : 'function', na : null};
|
||||||
while (target !== document.body) {
|
while (target !== document.body) {
|
||||||
if (JX.DOM.isNode(target, 'span') && (target.className in map)) {
|
if (JX.DOM.isNode(target, 'span') && (target.className in map)) {
|
||||||
var symbol = target.textContent || target.innerText;
|
var symbol = target.textContent || target.innerText;
|
||||||
var uri = JX.$U('/diffusion/symbol/' + symbol + '/');
|
var uri = JX.$U('/diffusion/symbol/' + symbol + '/');
|
||||||
uri.addQueryParams({
|
var query = {
|
||||||
type : map[target.className],
|
|
||||||
lang : config.lang,
|
lang : config.lang,
|
||||||
projects : config.projects.join(','),
|
projects : config.projects.join(','),
|
||||||
jump : true
|
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);
|
window.open(uri);
|
||||||
e.kill();
|
e.kill();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue