mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +01:00
0569218201
Summary: If `jsxmin` is not available, use a pure PHP implementation instead (JsShrink). Test Plan: - Ran `arc lint --lintall` on all JS and fixed every relevant warning. - Forced minification on and browsed around the site using JS behaviors. Didn't hit anything problematic. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5670
32 lines
1,011 B
JavaScript
32 lines
1,011 B
JavaScript
/**
|
|
* @provides javelin-behavior-differential-comment-jump
|
|
* @requires javelin-behavior
|
|
* javelin-stratcom
|
|
* javelin-dom
|
|
*/
|
|
|
|
JX.behavior('differential-comment-jump', function(config) {
|
|
function handle_jump(offset) {
|
|
return (function(e) {
|
|
var parent = JX.$('differential-review-stage');
|
|
var clicked = e.getNode('differential-inline-comment');
|
|
var inlines = JX.DOM.scry(parent, 'div', 'differential-inline-comment');
|
|
var jumpto = null;
|
|
|
|
for (var ii = 0; ii < inlines.length; ii++) {
|
|
if (inlines[ii] == clicked) {
|
|
jumpto = inlines[(ii + offset + inlines.length) % inlines.length];
|
|
break;
|
|
}
|
|
}
|
|
JX.Stratcom.invoke('differential-toggle-file-request', null, {
|
|
element: jumpto
|
|
});
|
|
JX.DOM.scrollTo(jumpto);
|
|
e.kill();
|
|
});
|
|
}
|
|
|
|
JX.Stratcom.listen('click', 'differential-inline-prev', handle_jump(-1));
|
|
JX.Stratcom.listen('click', 'differential-inline-next', handle_jump(+1));
|
|
});
|