mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 23:32:40 +01:00
0534002894
Summary: Fixes T10816. The way these work is a little unusual since these chunks of file-rendering code are unusuall performance-sensitive, so the Differential version doesn't adapt directly to Diffusion. Both can possibly be unified at some point in the future, although they do slightly different things. Test Plan: {F1220170} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10816 Differential Revision: https://secure.phabricator.com/D15719
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-diffusion-browse-file
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-util
|
|
* phabricator-tooltip
|
|
*/
|
|
|
|
JX.behavior('diffusion-browse-file', function(config, statics) {
|
|
if (statics.installed) {
|
|
return;
|
|
}
|
|
statics.installed = true;
|
|
|
|
var map = config.labels;
|
|
|
|
JX.Stratcom.listen(
|
|
['mouseover', 'mouseout'],
|
|
['phabricator-source', 'tag:td'],
|
|
function(e) {
|
|
var target = e.getTarget();
|
|
|
|
// NOTE: We're using raw classnames instead of sigils and metadata here
|
|
// because these elements are unusual: there are a lot of them on the
|
|
// page, and rendering all the extra metadata to do this in a normal way
|
|
// would be needlessly expensive. This is an unusual case.
|
|
|
|
if (!target.className.match(/cov-/)) {
|
|
return;
|
|
}
|
|
|
|
if (e.getType() == 'mouseout') {
|
|
JX.Tooltip.hide();
|
|
return;
|
|
}
|
|
|
|
for (var k in map) {
|
|
if (!target.className.match(k)) {
|
|
continue;
|
|
}
|
|
|
|
var label = map[k];
|
|
JX.Tooltip.show(target, 300, 'E', label);
|
|
break;
|
|
}
|
|
});
|
|
});
|