Improvements of message displaying (internal styles)

This commit is contained in:
RainLoop Team 2015-05-31 21:40:54 +04:00
parent 0bba7146a6
commit 4457cdbc23
46 changed files with 1967 additions and 359 deletions

View file

@ -36,6 +36,8 @@
{
AbstractView.call(this, 'Center', 'Login');
this.welcome = ko.observable(!!Settings.settingsGet('UseLoginWelcomePage'));
this.email = ko.observable('');
this.password = ko.observable('');
this.signMe = ko.observable(false);
@ -294,11 +296,12 @@
});
this.googleLoginEnabled = ko.observable(false);
this.googleFastLoginEnabled = ko.observable(false);
this.googleCommand = Utils.createCommand(this, function () {
window.open(Links.socialGoogle(), 'Google',
'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes');
'left=200,top=100,width=650,height=500,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true;
@ -306,15 +309,15 @@
return !this.submitRequest() && this.googleLoginEnabled();
});
this.googleXAuthCommand = Utils.createCommand(this, function () {
this.googleFastCommand = Utils.createCommand(this, function () {
window.open(Links.socialGoogle(true), 'Google',
'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes');
'left=200,top=100,width=650,height=500,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true;
}, function () {
return !this.submitRequest() && this.googleLoginEnabled();
return !this.submitRequest() && this.googleFastLoginEnabled();
});
this.twitterLoginEnabled = ko.observable(false);
@ -347,6 +350,11 @@
kn.extendAsViewModel(['View/User/Login', 'View/App/Login', 'LoginViewModel'], LoginUserView);
_.extend(LoginUserView.prototype, AbstractView.prototype);
LoginUserView.prototype.displayMainForm = function ()
{
this.welcome(false);
};
LoginUserView.prototype.onShow = function ()
{
kn.routeOff();
@ -404,6 +412,8 @@
this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') &&
!!Settings.settingsGet('AllowGoogleSocialAuth'));
this.googleFastLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') &&
!!Settings.settingsGet('AllowGoogleSocialAuthFast'));
switch (sSignMe)
{
@ -433,7 +443,7 @@
this.email(AppStore.devEmail);
this.password(AppStore.devPassword);
if (this.googleLoginEnabled())
if (this.googleLoginEnabled() || this.googleFastLoginEnabled())
{
window['rl_' + sJsHash + '_google_login_service'] = fSocial;
}

View file

@ -24,8 +24,6 @@
Cache = require('Common/Cache'),
EmailModel = require('Model/Email'),
SocialStore = require('Stores/Social'),
AppStore = require('Stores/User/App'),
SettingsStore = require('Stores/User/Settings'),
@ -66,6 +64,8 @@
this.oHeaderDom = null;
this.oMessageScrollerDom = null;
this.bodyBackgroundColor = ko.observable('');
this.pswp = null;
this.allowComposer = !!Settings.capa(Enums.Capa.Composer);
@ -353,6 +353,10 @@
}, this);
this.messageActiveDom.subscribe(function (oDom) {
this.bodyBackgroundColor(oDom ? this.detectDomBackgroundColor(oDom): '');
}, this);
this.message.subscribe(function (oMessage) {
this.messageActiveDom(null);
@ -466,6 +470,59 @@
kn.extendAsViewModel(['View/User/MailBox/MessageView', 'View/App/MailBox/MessageView', 'MailBoxMessageViewViewModel'], MessageViewMailBoxUserView);
_.extend(MessageViewMailBoxUserView.prototype, AbstractView.prototype);
MessageViewMailBoxUserView.prototype.detectDomBackgroundColor = function (oDom)
{
var
iLimit = 5,
sResult = '',
aC = null,
fFindDom = function (oDom) {
var aC = oDom ? oDom.children() : null;
return (aC && 1 === aC.length && aC.is('table,div,center')) ? aC : null;
},
fFindColor = function (oDom) {
var sResult = '';
if (oDom)
{
sResult = oDom.css('background-color') || '';
if (!oDom.is('table'))
{
sResult = 'rgba(0, 0, 0, 0)' === sResult || 'transparent' === sResult ? '' : sResult;
}
}
return sResult;
}
;
if (oDom && 1 === oDom.length)
{
aC = oDom;
while ('' === sResult)
{
iLimit--;
if (0 >= iLimit)
{
break;
}
aC = fFindDom(aC);
if (aC)
{
sResult = fFindColor(aC);
}
else
{
break;
}
}
sResult = 'rgba(0, 0, 0, 0)' === sResult || 'transparent' === sResult ? '' : sResult;
}
return sResult;
};
MessageViewMailBoxUserView.prototype.isPgpActionVisible = function ()
{
return Enums.SignedVerifyStatus.Success !== this.viewPgpSignedVerifyStatus();
@ -552,27 +609,28 @@
* @todo
* @param {string} sEmail
*/
MessageViewMailBoxUserView.prototype.displayMailToPopup = function (sMailToUrl)
{
sMailToUrl = sMailToUrl.replace(/\?.+$/, '');
var
sResult = '',
aTo = [],
fParseEmailLine = function (sLine) {
return sLine ? _.compact(_.map([window.decodeURIComponent(sLine)], function (sItem) {
var oEmailModel = new EmailModel();
oEmailModel.mailsoParse(sItem);
return '' !== oEmailModel.email ? oEmailModel : null;
})) : null;
}
;
aTo = fParseEmailLine(sMailToUrl);
sResult = aTo && aTo[0] ? aTo[0].email : '';
window.console.log(sResult);
};
// MessageViewMailBoxUserView.prototype.displayMailToPopup = function (sMailToUrl)
// {
// sMailToUrl = sMailToUrl.replace(/\?.+$/, '');
//
// var
// sResult = '',
// aTo = [],
// EmailModel = require('Model/Email'),
// fParseEmailLine = function (sLine) {
// return sLine ? _.compact(_.map([window.decodeURIComponent(sLine)], function (sItem) {
// var oEmailModel = new EmailModel();
// oEmailModel.mailsoParse(sItem);
// return '' !== oEmailModel.email ? oEmailModel : null;
// })) : null;
// }
// ;
//
// aTo = fParseEmailLine(sMailToUrl);
// sResult = aTo && aTo[0] ? aTo[0].email : '';
//
// return sResult;
// };
MessageViewMailBoxUserView.prototype.onBuild = function (oDom)
{
@ -592,6 +650,7 @@
}
}, this);
this.showAttachmnetControls.subscribe(fCheckHeaderHeight);
this.fullScreenMode.subscribe(fCheckHeaderHeight);
this.showFullInfo.subscribe(fCheckHeaderHeight);
this.message.subscribe(fCheckHeaderHeight);
@ -806,18 +865,6 @@
this.initShortcuts();
};
MessageViewMailBoxUserView.prototype.selectSelectedThreadMessage = function ()
{
var self = this;
_.delay(function () {
var oLast = self.oDom ? $('.thread-list .e-item.thread-list-message.real-msg.selected a.e-link', self.oDom) : null;
if (oLast && oLast[0])
{
oLast.focus();
}
}, 30);
};
/**
* @return {boolean}
*/
@ -1196,6 +1243,8 @@
{
oMessage.showExternalImages(true);
}
this.checkHeaderHeight();
};
/**
@ -1217,6 +1266,8 @@
{
oMessage.verifyPgpSignedClearMessage();
}
this.checkHeaderHeight();
};
/**
@ -1248,6 +1299,8 @@
require('App/User').reloadFlagsCurrentMessageListAndMessageFromCache();
}
this.checkHeaderHeight();
};
module.exports = MessageViewMailBoxUserView;