1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 23:32:40 +01:00
phorge-phorge/webroot/rsrc/js/application/differential/behavior-comment-jump.js
Joshua Spence a0d63322b1 Remove unused JavaScript variables.
Summary: There are a bunch of unused variables in JavaScript files. These were identified with JSHint.

Test Plan: It's pretty hard to test this thoroughly... on inspection, it seems that everything //should// be okay (unless we are doing weird things with the JavaScript).

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9676
2014-06-24 03:27:47 +10:00

32 lines
1,005 B
JavaScript

/**
* @provides javelin-behavior-differential-comment-jump
* @requires javelin-behavior
* javelin-stratcom
* javelin-dom
*/
JX.behavior('differential-comment-jump', function() {
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));
});