mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
es5 -> es2015 (last stage)
Signature plugin fixes Add view decorator A large number of fixes
This commit is contained in:
parent
e88c193334
commit
17669b7be0
153 changed files with 21193 additions and 21115 deletions
|
|
@ -1,60 +1,55 @@
|
|||
|
||||
var
|
||||
_ = require('_'),
|
||||
key = require('key'),
|
||||
import _ from '_';
|
||||
import key from 'key';
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
import {KeyState, Magics} from 'Common/Enums';
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView');
|
||||
import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function KeyboardShortcutsHelpPopupView()
|
||||
@view({
|
||||
name: 'View/Popup/KeyboardShortcutsHelp',
|
||||
type: ViewType.Popup,
|
||||
templateID: 'PopupsKeyboardShortcutsHelp'
|
||||
})
|
||||
class KeyboardShortcutsHelpPopupView extends AbstractViewNext
|
||||
{
|
||||
AbstractView.call(this, 'Popups', 'PopupsKeyboardShortcutsHelp');
|
||||
constructor() {
|
||||
super();
|
||||
this.sDefaultKeyScope = KeyState.PopupKeyboardShortcutsHelp;
|
||||
}
|
||||
|
||||
this.sDefaultKeyScope = Enums.KeyState.PopupKeyboardShortcutsHelp;
|
||||
onBuild(dom) {
|
||||
key('tab, shift+tab, left, right', KeyState.PopupKeyboardShortcutsHelp, _.throttle((event, handler) => {
|
||||
|
||||
kn.constructorEnd(this);
|
||||
if (event && handler)
|
||||
{
|
||||
const
|
||||
$tabs = dom.find('.nav.nav-tabs > li'),
|
||||
isNext = handler && ('tab' === handler.shortcut || 'right' === handler.shortcut);
|
||||
|
||||
let index = $tabs.index($tabs.filter('.active'));
|
||||
if (!isNext && 0 < index)
|
||||
{
|
||||
index -= 1;
|
||||
}
|
||||
else if (isNext && index < $tabs.length - 1)
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = isNext ? 0 : $tabs.length - 1;
|
||||
}
|
||||
|
||||
$tabs.eq(index).find('a[data-toggle="tab"]').tab('show');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}, Magics.Time100ms));
|
||||
}
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/Popup/KeyboardShortcutsHelp', 'PopupsKeyboardShortcutsHelpViewModel'], KeyboardShortcutsHelpPopupView);
|
||||
_.extend(KeyboardShortcutsHelpPopupView.prototype, AbstractView.prototype);
|
||||
|
||||
KeyboardShortcutsHelpPopupView.prototype.onBuild = function(oDom)
|
||||
{
|
||||
key('tab, shift+tab, left, right', Enums.KeyState.PopupKeyboardShortcutsHelp, _.throttle(function(event, handler) {
|
||||
|
||||
if (event && handler)
|
||||
{
|
||||
var
|
||||
$tabs = oDom.find('.nav.nav-tabs > li'),
|
||||
isNext = handler && ('tab' === handler.shortcut || 'right' === handler.shortcut),
|
||||
index = $tabs.index($tabs.filter('.active'));
|
||||
|
||||
if (!isNext && 0 < index)
|
||||
{
|
||||
index -= 1;
|
||||
}
|
||||
else if (isNext && index < $tabs.length - 1)
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = isNext ? 0 : $tabs.length - 1;
|
||||
}
|
||||
|
||||
$tabs.eq(index).find('a[data-toggle="tab"]').tab('show');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}, Enums.Magics.Time100ms));
|
||||
};
|
||||
|
||||
module.exports = KeyboardShortcutsHelpPopupView;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue