2011-01-31 20:38:13 -08:00
|
|
|
/**
|
|
|
|
|
* @provides javelin-behavior-differential-show-more
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-03 15:11:55 -07:00
|
|
|
* @requires javelin-behavior
|
|
|
|
|
* javelin-dom
|
|
|
|
|
* javelin-request
|
|
|
|
|
* javelin-util
|
|
|
|
|
* javelin-stratcom
|
2011-01-31 20:38:13 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
JX.behavior('differential-show-more', function(config) {
|
|
|
|
|
|
|
|
|
|
function onresponse(origin, response) {
|
Bring Javelin into Phabricator via git submodule, not copy-and-paste
Summary:
Javelin is currently embedded in Phabricator via copy-and-paste of prebuilt
packages. This is not so great.
Pull it in as a submodule instead and make all the Phabriator resources declare
proper dependency trees. Add Javelin linting.
Test Plan:
I tried to run through pretty much all the JS functionality on the site. This is
still a high-risk change, but I did a pretty thorough test
Differential: inline comments, revealing diffs, list tokenizers, comment
preview, editing/deleting comments, add review action.
Maniphest: list tokenizer, comment actions
Herald: rule editing, tokenizers, add/remove rows
Reviewed By: tomo
Reviewers: aran, tomo, mroch, jungejason, tuomaspelkonen
CC: aran, tomo, epriestley
Differential Revision: 223
2011-05-03 15:11:55 -07:00
|
|
|
var div = JX.$N('div', {}, JX.$H(response));
|
2011-01-31 20:38:13 -08:00
|
|
|
var anchor = origin.getNode('context-target');
|
|
|
|
|
var root = anchor.parentNode;
|
|
|
|
|
copyRows(root, div, anchor);
|
|
|
|
|
root.removeChild(anchor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JX.Stratcom.listen(
|
|
|
|
|
'click',
|
|
|
|
|
'show-more',
|
|
|
|
|
function(e) {
|
|
|
|
|
var context = e.getNodes()['context-target'];
|
|
|
|
|
var container = JX.DOM.find(context, 'td');
|
|
|
|
|
JX.DOM.setContent(container, 'Loading...');
|
|
|
|
|
JX.DOM.alterClass(context, 'differential-show-more-loading', true);
|
2011-02-02 10:10:25 -08:00
|
|
|
var data = e.getNodeData('show-more');
|
2011-01-31 20:38:13 -08:00
|
|
|
new JX.Request(config.uri, JX.bind(null, onresponse, e))
|
|
|
|
|
.setData(data)
|
|
|
|
|
.send();
|
|
|
|
|
e.kill();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|