User background image optimization

This commit is contained in:
RainLoop Team 2015-02-05 09:14:13 +04:00
parent 98e110fcc7
commit 47cc73c992
8 changed files with 114 additions and 106 deletions

View file

@ -126,10 +126,10 @@
{
_.delay(function () {
$('#rl-bg').attr('style', 'background-image: none !important;')
.backstretch(Links.publicLink(Settings.settingsGet('UserBackgroundHash')), {
'fade': Globals.bAnimationSupported ? 1000 : 0
.backstretch(Links.userBackground(Settings.settingsGet('UserBackgroundHash')), {
'fade': Globals.bAnimationSupported ? 1000 : 0, 'centeredX': true, 'centeredY': true
}).removeAttr('style');
}, 2000);
}, 1000);
}
this.socialUsers = _.bind(this.socialUsers, this);

View file

@ -171,6 +171,16 @@
return this.sServer + '/Raw/0/Public/' + sHash + '/';
};
/**
* @param {string} sHash
* @return {string}
*/
Links.prototype.userBackground = function (sHash)
{
return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/UserBackground/' +
this.sSubSubQuery + sHash;
};
/**
* @param {string} sInboxFolderName = 'INBOX'
* @return {string}

View file

@ -1614,7 +1614,7 @@
Utils.__themeTimer = 0;
Utils.__themeAjax = null;
Utils.changeTheme = function (sValue, sHash, themeTrigger, Links)
Utils.changeTheme = function (sValue, themeTrigger)
{
var
oThemeLink = $('#rlThemeLink'),
@ -1673,26 +1673,6 @@
}
}
if (Links)
{
var $oBg = $('#rl-bg');
if (!sHash)
{
if ($oBg.data('backstretch'))
{
$oBg.backstretch('destroy').attr('style', '');
}
}
else
{
$oBg.backstretch(Links.publicLink(sHash), {
'fade': Globals.bAnimationSupported ? 1000 : 0,
'centeredX': true,
'centeredY': true
});
}
}
themeTrigger(Enums.SaveSettingsStep.TrueResult);
}

View file

@ -93,7 +93,7 @@
self.theme.subscribe(function (sValue) {
Utils.changeTheme(sValue, '', self.themeTrigger);
Utils.changeTheme(sValue, self.themeTrigger);
Remote.saveAdminConfig(f3, {
'Theme': Utils.trim(sValue)

View file

@ -5,6 +5,7 @@
var
_ = require('_'),
$ = require('$'),
ko = require('ko'),
Jua = require('Jua'),
@ -49,7 +50,7 @@
oTheme.selected(sValue === oTheme.name);
});
Utils.changeTheme(sValue, this.background.hash(), this.themeTrigger, Links);
Utils.changeTheme(sValue, this.themeTrigger);
Remote.saveSettings(null, {
'Theme': sValue
@ -58,7 +59,23 @@
}, this);
this.background.hash.subscribe(function (sValue) {
Utils.changeTheme(this.theme(), sValue, this.themeTrigger, Links);
var $oBg = $('#rl-bg');
if (!sValue)
{
if ($oBg.data('backstretch'))
{
$oBg.backstretch('destroy').attr('style', '');
}
}
else
{
$('#rl-bg').attr('style', 'background-image: none !important;').backstretch(
Links.userBackground(sValue), {
'fade': 1000, 'centeredX': true, 'centeredY': true
}).removeAttr('style');
}
}, this);
}

View file

@ -104,7 +104,7 @@ html.rl-started-trigger.no-mobile .b-login-content .loginFormWrapper {
&.csstransitions .modal.fade {
.transition(all 200ms ease-out);
transform: scale(.9);
transform: scale(1.1);
&.in {
transform: none;