Summary: - Show a tip in the margin about what coverage colors mean. - Highlight the line when mousing over coverage. - Randomly change the colors to different colors. - Fix a bug with "show more" that I introduced with the other coverage diff (oops!) Test Plan: Moused over coverage things. Reviewers: tuomaspelkonen, btrahan Reviewed By: tuomaspelkonen CC: aran, epriestley Maniphest Tasks: T965 Differential Revision: https://secure.phabricator.com/D1874
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-differential-show-more
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-workflow
|
|
* javelin-util
|
|
* javelin-stratcom
|
|
*/
|
|
|
|
JX.behavior('differential-show-more', function(config) {
|
|
|
|
function onresponse(context, response) {
|
|
var div = JX.$N('div', {}, JX.$H(response.changeset));
|
|
var root = context.parentNode;
|
|
copyRows(root, div, context);
|
|
root.removeChild(context);
|
|
}
|
|
|
|
JX.Stratcom.listen(
|
|
'click',
|
|
'show-more',
|
|
function(e) {
|
|
var event_data = {
|
|
context : e.getNodes()['context-target'],
|
|
show : e.getNodes()['show-more']
|
|
};
|
|
|
|
JX.Stratcom.invoke('differential-reveal-context', null, event_data);
|
|
e.kill();
|
|
});
|
|
|
|
JX.Stratcom.listen(
|
|
'differential-reveal-context',
|
|
null,
|
|
function(e) {
|
|
var context = e.getData().context;
|
|
var data = JX.Stratcom.getData(e.getData().show);
|
|
|
|
var container = JX.DOM.find(context, 'td');
|
|
JX.DOM.setContent(container, 'Loading...');
|
|
JX.DOM.alterClass(context, 'differential-show-more-loading', true);
|
|
data['whitespace'] = config.whitespace;
|
|
new JX.Workflow(config.uri, data)
|
|
.setHandler(JX.bind(null, onresponse, context))
|
|
.start();
|
|
});
|
|
|
|
});
|
|
|
|
function copyRows(dst, src, before) {
|
|
var rows = JX.DOM.scry(src, 'tr');
|
|
for (var ii = 0; ii < rows.length; ii++) {
|
|
if (before) {
|
|
dst.insertBefore(rows[ii], before);
|
|
} else {
|
|
dst.appendChild(rows[ii]);
|
|
}
|
|
}
|
|
return rows;
|
|
}
|