Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangesetList.js
| Show All 13 Lines | construct: function() { | ||||
| JX.Stratcom.listen('click', 'differential-load', onload); | JX.Stratcom.listen('click', 'differential-load', onload); | ||||
| var onmore = JX.bind(this, this._ifawake, this._onmore); | var onmore = JX.bind(this, this._ifawake, this._onmore); | ||||
| JX.Stratcom.listen('click', 'show-more', onmore); | JX.Stratcom.listen('click', 'show-more', onmore); | ||||
| var onmenu = JX.bind(this, this._ifawake, this._onmenu); | var onmenu = JX.bind(this, this._ifawake, this._onmenu); | ||||
| JX.Stratcom.listen('click', 'differential-view-options', onmenu); | JX.Stratcom.listen('click', 'differential-view-options', onmenu); | ||||
| var onhide = JX.bind(this, this._ifawake, this._onhide); | var oncollapse = JX.bind(this, this._ifawake, this._oncollapse, true); | ||||
| JX.Stratcom.listen('click', 'hide-inline', onhide); | JX.Stratcom.listen('click', 'hide-inline', oncollapse); | ||||
| var onreveal = JX.bind(this, this._ifawake, this._onreveal); | var onexpand = JX.bind(this, this._ifawake, this._oncollapse, false); | ||||
| JX.Stratcom.listen('click', 'reveal-inline', onreveal); | JX.Stratcom.listen('click', 'reveal-inline', onexpand); | ||||
| var onedit = JX.bind(this, this._ifawake, this._onaction, 'edit'); | var onedit = JX.bind(this, this._ifawake, this._onaction, 'edit'); | ||||
| JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
| 'click', | 'click', | ||||
| ['differential-inline-comment', 'differential-inline-edit'], | ['differential-inline-comment', 'differential-inline-edit'], | ||||
| onedit); | onedit); | ||||
| var ondone = JX.bind(this, this._ifawake, this._onaction, 'done'); | var ondone = JX.bind(this, this._ifawake, this._onaction, 'done'); | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | wake: function() { | ||||
| this._installJumpKey('K', label, -1, 'file'); | this._installJumpKey('K', label, -1, 'file'); | ||||
| label = pht('Jump to next inline comment.'); | label = pht('Jump to next inline comment.'); | ||||
| this._installJumpKey('n', label, 1, 'comment'); | this._installJumpKey('n', label, 1, 'comment'); | ||||
| label = pht('Jump to previous inline comment.'); | label = pht('Jump to previous inline comment.'); | ||||
| this._installJumpKey('p', label, -1, 'comment'); | this._installJumpKey('p', label, -1, 'comment'); | ||||
| label = pht('Jump to next inline comment, including hidden comments.'); | label = pht('Jump to next inline comment, including collapsed comments.'); | ||||
| this._installJumpKey('N', label, 1, 'comment', true); | this._installJumpKey('N', label, 1, 'comment', true); | ||||
| label = pht( | label = pht( | ||||
| 'Jump to previous inline comment, including hidden comments.'); | 'Jump to previous inline comment, including collapsed comments.'); | ||||
| this._installJumpKey('P', label, -1, 'comment', true); | this._installJumpKey('P', label, -1, 'comment', true); | ||||
| label = pht('Hide or show the current file.'); | label = pht('Hide or show the current file.'); | ||||
| this._installKey('h', label, this._onkeytogglefile); | this._installKey('h', label, this._onkeytogglefile); | ||||
| label = pht('Jump to the table of contents.'); | label = pht('Jump to the table of contents.'); | ||||
| this._installKey('t', label, this._ontoc); | this._installKey('t', label, this._ontoc); | ||||
| label = pht('Reply to selected inline comment or change.'); | label = pht('Reply to selected inline comment or change.'); | ||||
| this._installKey('r', label, JX.bind(this, this._onkeyreply, false)); | this._installKey('r', label, JX.bind(this, this._onkeyreply, false)); | ||||
| label = pht('Reply and quote selected inline comment.'); | label = pht('Reply and quote selected inline comment.'); | ||||
| this._installKey('R', label, JX.bind(this, this._onkeyreply, true)); | this._installKey('R', label, JX.bind(this, this._onkeyreply, true)); | ||||
| label = pht('Edit selected inline comment.'); | label = pht('Edit selected inline comment.'); | ||||
| this._installKey('e', label, this._onkeyedit); | this._installKey('e', label, this._onkeyedit); | ||||
| label = pht('Mark or unmark selected inline comment as done.'); | label = pht('Mark or unmark selected inline comment as done.'); | ||||
| this._installKey('w', label, this._onkeydone); | this._installKey('w', label, this._onkeydone); | ||||
| label = pht('Hide or show inline comment.'); | label = pht('Collapse or expand inline comment.'); | ||||
| this._installKey('q', label, this._onkeyhide); | this._installKey('q', label, this._onkeycollapse); | ||||
| }, | }, | ||||
| isAsleep: function() { | isAsleep: function() { | ||||
| return this._asleep; | return this._asleep; | ||||
| }, | }, | ||||
| newChangesetForNode: function(node) { | newChangesetForNode: function(node) { | ||||
| var changeset = JX.DiffChangeset.getForNode(node); | var changeset = JX.DiffChangeset.getForNode(node); | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | members: { | ||||
| _installKey: function(key, label, handler) { | _installKey: function(key, label, handler) { | ||||
| handler = JX.bind(this, this._ifawake, handler); | handler = JX.bind(this, this._ifawake, handler); | ||||
| return new JX.KeyboardShortcut(key, label) | return new JX.KeyboardShortcut(key, label) | ||||
| .setHandler(handler) | .setHandler(handler) | ||||
| .register(); | .register(); | ||||
| }, | }, | ||||
| _installJumpKey: function(key, label, delta, filter, show_hidden) { | _installJumpKey: function(key, label, delta, filter, show_collapsed) { | ||||
| filter = filter || null; | filter = filter || null; | ||||
| var options = { | var options = { | ||||
| filter: filter, | filter: filter, | ||||
| hidden: show_hidden | collapsed: show_collapsed | ||||
| }; | }; | ||||
| var handler = JX.bind(this, this._onjumpkey, delta, options); | var handler = JX.bind(this, this._onjumpkey, delta, options); | ||||
| return this._installKey(key, label, handler); | return this._installKey(key, label, handler); | ||||
| }, | }, | ||||
| _ontoc: function(manager) { | _ontoc: function(manager) { | ||||
| var toc = JX.$('toc'); | var toc = JX.$('toc'); | ||||
| ▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | _onkeytogglefile: function() { | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| var pht = this.getTranslations(); | var pht = this.getTranslations(); | ||||
| this._warnUser(pht('You must select a file to hide or show.')); | this._warnUser(pht('You must select a file to hide or show.')); | ||||
| }, | }, | ||||
| _onkeyhide: function() { | _onkeycollapse: function() { | ||||
| var cursor = this._cursorItem; | var cursor = this._cursorItem; | ||||
| if (cursor) { | if (cursor) { | ||||
| if (cursor.type == 'comment') { | if (cursor.type == 'comment') { | ||||
| var inline = cursor.target; | var inline = cursor.target; | ||||
| if (inline.canHide()) { | if (inline.canCollapse()) { | ||||
| this.setFocus(null); | this.setFocus(null); | ||||
| inline.setHidden(!inline.isHidden()); | inline.setCollapsed(!inline.isCollapsed()); | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| var pht = this.getTranslations(); | var pht = this.getTranslations(); | ||||
| this._warnUser(pht('You must select a comment to hide.')); | this._warnUser(pht('You must select a comment to hide.')); | ||||
| }, | }, | ||||
| _warnUser: function(message) { | _warnUser: function(message) { | ||||
| new JX.Notification() | new JX.Notification() | ||||
| .setContent(message) | .setContent(message) | ||||
| .alterClassName('jx-notification-alert', true) | .alterClassName('jx-notification-alert', true) | ||||
| .setDuration(1000) | .setDuration(1000) | ||||
| .show(); | .show(); | ||||
| }, | }, | ||||
| _onjumpkey: function(delta, options) { | _onjumpkey: function(delta, options) { | ||||
| var state = this._getSelectionState(); | var state = this._getSelectionState(); | ||||
| var filter = options.filter || null; | var filter = options.filter || null; | ||||
| var hidden = options.hidden || false; | var collapsed = options.collapsed || false; | ||||
| var wrap = options.wrap || false; | var wrap = options.wrap || false; | ||||
| var attribute = options.attribute || null; | var attribute = options.attribute || null; | ||||
| var cursor = state.cursor; | var cursor = state.cursor; | ||||
| var items = state.items; | var items = state.items; | ||||
| // If there's currently no selection and the user tries to go back, | // If there's currently no selection and the user tries to go back, | ||||
| // don't do anything. | // don't do anything. | ||||
| Show All 35 Lines | _onjumpkey: function(delta, options) { | ||||
| // If we're selecting things of a particular type (like only files) | // If we're selecting things of a particular type (like only files) | ||||
| // and the next item isn't of that type, move past it. | // and the next item isn't of that type, move past it. | ||||
| if (filter !== null) { | if (filter !== null) { | ||||
| if (items[cursor].type !== filter) { | if (items[cursor].type !== filter) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| // If the item is hidden, don't select it when iterating with jump | // If the item is collapsed, don't select it when iterating with jump | ||||
| // keys. It can still potentially be selected in other ways. | // keys. It can still potentially be selected in other ways. | ||||
| if (!hidden) { | if (!collapsed) { | ||||
| if (items[cursor].hidden) { | if (items[cursor].collapsed) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| // If the item has been deleted, don't select it when iterating. The | // If the item has been deleted, don't select it when iterating. The | ||||
| // cursor may remain on it until it is removed. | // cursor may remain on it until it is removed. | ||||
| if (items[cursor].deleted) { | if (items[cursor].deleted) { | ||||
| continue; | continue; | ||||
| ▲ Show 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | _onmenu: function(e) { | ||||
| } | } | ||||
| }); | }); | ||||
| data.menu = menu; | data.menu = menu; | ||||
| menu.open(); | menu.open(); | ||||
| }, | }, | ||||
| _onhide: function(e) { | _oncollapse: function(is_collapse, e) { | ||||
| this._onhidereveal(e, true); | |||||
| }, | |||||
| _onreveal: function(e) { | |||||
| this._onhidereveal(e, false); | |||||
| }, | |||||
| _onhidereveal: function(e, is_hide) { | |||||
| e.kill(); | e.kill(); | ||||
| var inline = this._getInlineForEvent(e); | var inline = this._getInlineForEvent(e); | ||||
| inline.setHidden(is_hide); | inline.setCollapsed(is_collapse); | ||||
| }, | }, | ||||
| _onresize: function() { | _onresize: function() { | ||||
| this._redrawFocus(); | this._redrawFocus(); | ||||
| this._redrawSelection(); | this._redrawSelection(); | ||||
| this._redrawHover(); | this._redrawHover(); | ||||
| // Force a banner redraw after a resize event. Particularly, this makes | // Force a banner redraw after a resize event. Particularly, this makes | ||||
| ▲ Show 20 Lines • Show All 729 Lines • Show Last 20 Lines | |||||