Added "Custom Theme Configuration" (background)

This commit is contained in:
RainLoop Team 2014-11-08 00:21:10 +04:00
parent 0587d66d45
commit ef81865ef2
45 changed files with 1151 additions and 73654 deletions

View file

@ -1,3 +1,4 @@
// Base64 encode / decode
// http://www.webtoolkit.info/

View file

@ -15,6 +15,15 @@
'Unload': 'unload'
};
/**
* @enum {number}
*/
Enums.SpoolerType = {
'Delay': 0,
'MessageList': 1,
'Move': 2
};
/**
* @enum {number}
*/

View file

@ -152,6 +152,15 @@
return this.sServer + '/Raw/0/Avatar/' + Utils.encodeURIComponent(sEmail) + '/';
};
/**
* @param {string} sHash
* @return {string}
*/
Links.prototype.publicLink = function (sHash)
{
return this.sServer + '/Raw/0/Public/' + sHash + '/';
};
/**
* @param {string} sInboxFolderName = 'INBOX'
* @return {string}

View file

@ -1031,6 +1031,8 @@
oData.theme = ko.observable('');
oData.themes = ko.observableArray([]);
oData.themeBackgroundName = ko.observable('');
oData.themeBackgroundHash = ko.observable('');
oData.mainTheme = ko.computed({
'read': oData.theme,
@ -2074,7 +2076,7 @@
Utils.__themeTimer = 0;
Utils.__themeAjax = null;
Utils.changeTheme = function (sValue, themeTrigger)
Utils.changeTheme = function (sValue, sHash, themeTrigger, Links)
{
var
oThemeLink = $('#rlThemeLink'),
@ -2091,6 +2093,7 @@
{
sUrl = sUrl.toString().replace(/\/-\/[^\/]+\/\-\//, '/-/' + sValue + '/-/');
sUrl = sUrl.toString().replace(/\/Css\/[^\/]+\/User\//, '/Css/0/User/');
sUrl = sUrl.toString().replace(/\/Hash\/[^\/]+\//, '/Hash/-/');
if ('Json/' !== sUrl.substring(sUrl.length - 5, sUrl.length))
{
@ -2122,7 +2125,7 @@
if (oThemeStyle && oThemeStyle[0])
{
oThemeStyle.attr('data-href', sUrl).attr('data-theme', aData[0]);
if (oThemeStyle && oThemeStyle[0] && oThemeStyle[0].styleSheet && !Utils.isUnd(oThemeStyle[0].styleSheet.cssText))
if (oThemeStyle[0].styleSheet && !Utils.isUnd(oThemeStyle[0].styleSheet.cssText))
{
oThemeStyle[0].styleSheet.cssText = aData[1];
}
@ -2132,6 +2135,26 @@
}
}
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);
}