mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
CommonJS (research/2)
This commit is contained in:
parent
56607de87c
commit
586abbb802
115 changed files with 16201 additions and 9943 deletions
|
|
@ -1,46 +1,63 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
*/
|
||||
function PopupsKeyboardShortcutsHelpViewModel()
|
||||
{
|
||||
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsKeyboardShortcutsHelp');
|
||||
(function (module) {
|
||||
|
||||
this.sDefaultKeyScope = Enums.KeyState.PopupKeyboardShortcutsHelp;
|
||||
'use strict';
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
}
|
||||
var
|
||||
_ = require('../../External/underscore.js'),
|
||||
key = require('../../External/key.js'),
|
||||
Enums = require('../../Common/Enums.js'),
|
||||
Utils = require('../../Common/Utils.js'),
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
||||
Utils.extendAsViewModel('PopupsKeyboardShortcutsHelpViewModel', PopupsKeyboardShortcutsHelpViewModel);
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
*/
|
||||
function PopupsKeyboardShortcutsHelpViewModel()
|
||||
{
|
||||
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsKeyboardShortcutsHelp');
|
||||
|
||||
PopupsKeyboardShortcutsHelpViewModel.prototype.onBuild = function (oDom)
|
||||
{
|
||||
key('tab, shift+tab, left, right', Enums.KeyState.PopupKeyboardShortcutsHelp, _.bind(function (event, handler) {
|
||||
if (event && handler)
|
||||
{
|
||||
var
|
||||
$tabs = oDom.find('.nav.nav-tabs > li'),
|
||||
bNext = handler && ('tab' === handler.shortcut || 'right' === handler.shortcut),
|
||||
iIndex = $tabs.index($tabs.filter('.active'))
|
||||
;
|
||||
this.sDefaultKeyScope = Enums.KeyState.PopupKeyboardShortcutsHelp;
|
||||
|
||||
if (!bNext && iIndex > 0)
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel('PopupsKeyboardShortcutsHelpViewModel', PopupsKeyboardShortcutsHelpViewModel);
|
||||
|
||||
PopupsKeyboardShortcutsHelpViewModel.prototype.onBuild = function (oDom)
|
||||
{
|
||||
key('tab, shift+tab, left, right', Enums.KeyState.PopupKeyboardShortcutsHelp, _.bind(function (event, handler) {
|
||||
if (event && handler)
|
||||
{
|
||||
iIndex--;
|
||||
}
|
||||
else if (bNext && iIndex < $tabs.length - 1)
|
||||
{
|
||||
iIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
iIndex = bNext ? 0 : $tabs.length - 1;
|
||||
}
|
||||
var
|
||||
$tabs = oDom.find('.nav.nav-tabs > li'),
|
||||
bNext = handler && ('tab' === handler.shortcut || 'right' === handler.shortcut),
|
||||
iIndex = $tabs.index($tabs.filter('.active'))
|
||||
;
|
||||
|
||||
$tabs.eq(iIndex).find('a[data-toggle="tab"]').tab('show');
|
||||
return false;
|
||||
}
|
||||
}, this));
|
||||
};
|
||||
if (!bNext && iIndex > 0)
|
||||
{
|
||||
iIndex--;
|
||||
}
|
||||
else if (bNext && iIndex < $tabs.length - 1)
|
||||
{
|
||||
iIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
iIndex = bNext ? 0 : $tabs.length - 1;
|
||||
}
|
||||
|
||||
$tabs.eq(iIndex).find('a[data-toggle="tab"]').tab('show');
|
||||
return false;
|
||||
}
|
||||
}, this));
|
||||
};
|
||||
|
||||
module.exports = new AdminPaneViewModel();
|
||||
|
||||
}(module));
|
||||
Loading…
Add table
Add a link
Reference in a new issue