Replace home_tab_active with home_tab_obscured

(imported from commit fb8c47079e63594a22c3d47fcf373887bda6e499)
This commit is contained in:
Keegan McAllister
2012-12-03 14:54:29 -05:00
parent c9c94c6696
commit 2401fab25c
2 changed files with 9 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ function process_hotkey(e) {
// Disable hotkeys on settings page etc., and when a modal pop-up
// is visible.
if (!ui.home_tab_active())
if (ui.home_tab_obscured())
return false;
// Process hotkeys specially when in an input, textarea, or send button

View File

@@ -2,9 +2,13 @@ var ui = (function () {
var exports = {};
// Is the home tab visible, and not covered by a modal?
exports.home_tab_active = function () {
return $('#home').hasClass('active') && ($('.modal:visible').length === 0);
// What, if anything, obscures the home tab?
exports.home_tab_obscured = function () {
if ($('.modal:visible').length > 0)
return 'modal';
if (! $('#home').hasClass('active'))
return 'other_tab';
return false;
};
// We want to remember how far we were scrolled on each 'tab'.
@@ -414,7 +418,7 @@ $(function () {
//
// We don't handle the compose box here, because it *should* work to
// select the compose box and then wheel over the message stream.
if (exports.home_tab_active()) {
if (!exports.home_tab_obscured()) {
throttled_mousewheelhandler(e, delta);
} else {
// We need to call preventDefault() on the events that would be