mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 16:30:59 +01:00
Allow double click and drag in crossreference
Summary: Also simplifies the code. Test Plan: Clicked, selected, double clicked, double clicked and dragged. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin, s.o.butler Differential Revision: https://secure.phabricator.com/D5048
This commit is contained in:
parent
4f5e57283f
commit
d643282385
2 changed files with 29 additions and 38 deletions
|
@ -1873,7 +1873,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-pholio-mock-view' =>
|
||||
array(
|
||||
'uri' => '/res/efec5d7a/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
|
||||
'uri' => '/res/18129e67/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -1954,7 +1954,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-repository-crossreference' =>
|
||||
array(
|
||||
'uri' => '/res/244c5251/rsrc/js/application/repository/repository-crossreference.js',
|
||||
'uri' => '/res/4b5fab1c/rsrc/js/application/repository/repository-crossreference.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -3546,7 +3546,7 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/8aaacd1b/differential.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'95d0d865' =>
|
||||
'fafc8cdb' =>
|
||||
array(
|
||||
'name' => 'differential.pkg.js',
|
||||
'symbols' =>
|
||||
|
@ -3571,7 +3571,7 @@ celerity_register_resource_map(array(
|
|||
17 => 'javelin-behavior-differential-toggle-files',
|
||||
18 => 'javelin-behavior-differential-user-select',
|
||||
),
|
||||
'uri' => '/res/pkg/95d0d865/differential.pkg.js',
|
||||
'uri' => '/res/pkg/fafc8cdb/differential.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'c8ce2d88' =>
|
||||
|
@ -3669,7 +3669,7 @@ celerity_register_resource_map(array(
|
|||
'aphront-typeahead-control-css' => 'acc46105',
|
||||
'differential-changeset-view-css' => '8aaacd1b',
|
||||
'differential-core-view-css' => '8aaacd1b',
|
||||
'differential-inline-comment-editor' => '95d0d865',
|
||||
'differential-inline-comment-editor' => 'fafc8cdb',
|
||||
'differential-local-commits-view-css' => '8aaacd1b',
|
||||
'differential-results-table-css' => '8aaacd1b',
|
||||
'differential-revision-add-comment-css' => '8aaacd1b',
|
||||
|
@ -3687,24 +3687,24 @@ celerity_register_resource_map(array(
|
|||
'javelin-behavior-aphlict-dropdown' => 'd29c1557',
|
||||
'javelin-behavior-aphlict-listen' => 'd29c1557',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => 'd29c1557',
|
||||
'javelin-behavior-aphront-drag-and-drop' => '95d0d865',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '95d0d865',
|
||||
'javelin-behavior-aphront-drag-and-drop' => 'fafc8cdb',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => 'fafc8cdb',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => 'd29c1557',
|
||||
'javelin-behavior-audit-preview' => 'f96657b8',
|
||||
'javelin-behavior-dark-console' => 'dca4a03d',
|
||||
'javelin-behavior-device' => 'd29c1557',
|
||||
'javelin-behavior-differential-accept-with-errors' => '95d0d865',
|
||||
'javelin-behavior-differential-add-reviewers-and-ccs' => '95d0d865',
|
||||
'javelin-behavior-differential-comment-jump' => '95d0d865',
|
||||
'javelin-behavior-differential-diff-radios' => '95d0d865',
|
||||
'javelin-behavior-differential-dropdown-menus' => '95d0d865',
|
||||
'javelin-behavior-differential-edit-inline-comments' => '95d0d865',
|
||||
'javelin-behavior-differential-feedback-preview' => '95d0d865',
|
||||
'javelin-behavior-differential-keyboard-navigation' => '95d0d865',
|
||||
'javelin-behavior-differential-populate' => '95d0d865',
|
||||
'javelin-behavior-differential-show-more' => '95d0d865',
|
||||
'javelin-behavior-differential-toggle-files' => '95d0d865',
|
||||
'javelin-behavior-differential-user-select' => '95d0d865',
|
||||
'javelin-behavior-differential-accept-with-errors' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-add-reviewers-and-ccs' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-comment-jump' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-diff-radios' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-dropdown-menus' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-edit-inline-comments' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-feedback-preview' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-keyboard-navigation' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-populate' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-show-more' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-toggle-files' => 'fafc8cdb',
|
||||
'javelin-behavior-differential-user-select' => 'fafc8cdb',
|
||||
'javelin-behavior-diffusion-commit-graph' => 'f96657b8',
|
||||
'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8',
|
||||
'javelin-behavior-error-log' => 'dca4a03d',
|
||||
|
@ -3720,7 +3720,7 @@ celerity_register_resource_map(array(
|
|||
'javelin-behavior-phabricator-autofocus' => 'd29c1557',
|
||||
'javelin-behavior-phabricator-keyboard-shortcuts' => 'd29c1557',
|
||||
'javelin-behavior-phabricator-nav' => 'd29c1557',
|
||||
'javelin-behavior-phabricator-object-selector' => '95d0d865',
|
||||
'javelin-behavior-phabricator-object-selector' => 'fafc8cdb',
|
||||
'javelin-behavior-phabricator-oncopy' => 'd29c1557',
|
||||
'javelin-behavior-phabricator-remarkup-assist' => 'd29c1557',
|
||||
'javelin-behavior-phabricator-reveal-content' => 'd29c1557',
|
||||
|
@ -3728,7 +3728,7 @@ celerity_register_resource_map(array(
|
|||
'javelin-behavior-phabricator-tooltips' => 'd29c1557',
|
||||
'javelin-behavior-phabricator-watch-anchor' => 'd29c1557',
|
||||
'javelin-behavior-refresh-csrf' => 'd29c1557',
|
||||
'javelin-behavior-repository-crossreference' => '95d0d865',
|
||||
'javelin-behavior-repository-crossreference' => 'fafc8cdb',
|
||||
'javelin-behavior-toggle-class' => 'd29c1557',
|
||||
'javelin-behavior-workflow' => 'd29c1557',
|
||||
'javelin-dom' => 'a69b9f1f',
|
||||
|
@ -3758,7 +3758,7 @@ celerity_register_resource_map(array(
|
|||
'phabricator-core-css' => 'acc46105',
|
||||
'phabricator-crumbs-view-css' => 'acc46105',
|
||||
'phabricator-directory-css' => 'acc46105',
|
||||
'phabricator-drag-and-drop-file-upload' => '95d0d865',
|
||||
'phabricator-drag-and-drop-file-upload' => 'fafc8cdb',
|
||||
'phabricator-dropdown-menu' => 'd29c1557',
|
||||
'phabricator-file-upload' => 'd29c1557',
|
||||
'phabricator-filetree-view-css' => 'acc46105',
|
||||
|
@ -3780,7 +3780,7 @@ celerity_register_resource_map(array(
|
|||
'phabricator-prefab' => 'd29c1557',
|
||||
'phabricator-project-tag-css' => 'e30a3fa8',
|
||||
'phabricator-remarkup-css' => 'acc46105',
|
||||
'phabricator-shaped-request' => '95d0d865',
|
||||
'phabricator-shaped-request' => 'fafc8cdb',
|
||||
'phabricator-side-menu-view-css' => 'acc46105',
|
||||
'phabricator-standard-page-view' => 'acc46105',
|
||||
'phabricator-textareautils' => 'd29c1557',
|
||||
|
|
|
@ -12,22 +12,20 @@ JX.behavior('repository-crossreference', function(config) {
|
|||
// constrained by the markup generated by the syntax highlighters.
|
||||
|
||||
function link(element, lang) {
|
||||
var timeout;
|
||||
|
||||
JX.DOM.alterClass(element, 'repository-crossreference', true);
|
||||
JX.DOM.listen(
|
||||
element,
|
||||
'click',
|
||||
'tag:span',
|
||||
function(e) {
|
||||
if (window.getSelection && !window.getSelection().isCollapsed) {
|
||||
return;
|
||||
}
|
||||
var target = e.getTarget();
|
||||
var map = {nc : 'class', nf : 'function', na : null};
|
||||
while (target !== document.body) {
|
||||
if (JX.DOM.isNode(target, 'span') && (target.className in map)) {
|
||||
timeout = setTimeout(function() {
|
||||
var timeout = function() {
|
||||
if (window.getSelection && !window.getSelection().isCollapsed) {
|
||||
return;
|
||||
}
|
||||
var symbol = target.textContent || target.innerText;
|
||||
var query = {
|
||||
lang : lang,
|
||||
|
@ -46,21 +44,14 @@ JX.behavior('repository-crossreference', function(config) {
|
|||
var uri = JX.$U('/diffusion/symbol/' + symbol + '/');
|
||||
uri.addQueryParams(query);
|
||||
window.open(uri);
|
||||
}, 250);
|
||||
};
|
||||
setTimeout(timeout, 250);
|
||||
e.kill();
|
||||
break;
|
||||
}
|
||||
target = target.parentNode;
|
||||
}
|
||||
});
|
||||
|
||||
JX.DOM.listen(
|
||||
element,
|
||||
'dblclick',
|
||||
'tag:span',
|
||||
function(e) {
|
||||
clearTimeout(timeout);
|
||||
});
|
||||
}
|
||||
|
||||
function linkAll(section) {
|
||||
|
|
Loading…
Reference in a new issue