mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +03:00
Code refactoring
Fixed owncloud password encoder/decoder (#291) Fixed ckeditor in ownCloud iframe (Closes #302) Release commit
This commit is contained in:
parent
7a374ebe03
commit
06274c6a7c
112 changed files with 2667 additions and 1862 deletions
130
dev/Knoin/AbstractView.js
Normal file
130
dev/Knoin/AbstractView.js
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Globals = require('Common/Globals')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string=} sPosition = ''
|
||||
* @param {string=} sTemplate = ''
|
||||
*/
|
||||
function AbstractView(sPosition, sTemplate)
|
||||
{
|
||||
this.bDisabeCloseOnEsc = false;
|
||||
this.sPosition = Utils.pString(sPosition);
|
||||
this.sTemplate = Utils.pString(sTemplate);
|
||||
|
||||
this.sDefaultKeyScope = Enums.KeyState.None;
|
||||
this.sCurrentKeyScope = this.sDefaultKeyScope;
|
||||
|
||||
this.viewModelVisibility = ko.observable(false);
|
||||
this.modalVisibility = ko.observable(false).extend({'rateLimit': 0});
|
||||
|
||||
this.viewModelName = '';
|
||||
this.viewModelNames = [];
|
||||
this.viewModelDom = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
AbstractView.prototype.bDisabeCloseOnEsc = false;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.sPosition = '';
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.sTemplate = '';
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.sDefaultKeyScope = Enums.KeyState.None;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.sCurrentKeyScope = Enums.KeyState.None;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
AbstractView.prototype.viewModelName = '';
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
AbstractView.prototype.viewModelNames = [];
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
AbstractView.prototype.viewModelDom = null;
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
AbstractView.prototype.viewModelTemplate = function ()
|
||||
{
|
||||
return this.sTemplate;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
AbstractView.prototype.viewModelPosition = function ()
|
||||
{
|
||||
return this.sPosition;
|
||||
};
|
||||
|
||||
AbstractView.prototype.cancelCommand = function () {};
|
||||
AbstractView.prototype.closeCommand = function () {};
|
||||
|
||||
AbstractView.prototype.storeAndSetKeyScope = function ()
|
||||
{
|
||||
this.sCurrentKeyScope = Globals.keyScope();
|
||||
Globals.keyScope(this.sDefaultKeyScope);
|
||||
};
|
||||
|
||||
AbstractView.prototype.restoreKeyScope = function ()
|
||||
{
|
||||
Globals.keyScope(this.sCurrentKeyScope);
|
||||
};
|
||||
|
||||
AbstractView.prototype.registerPopupKeyDown = function ()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
Globals.$win.on('keydown', function (oEvent) {
|
||||
if (oEvent && self.modalVisibility && self.modalVisibility())
|
||||
{
|
||||
if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
|
||||
{
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
return false;
|
||||
}
|
||||
else if (Enums.EventKeyCode.Backspace === oEvent.keyCode && !Utils.inFocus())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = AbstractView;
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue