mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Code improvements
This commit is contained in:
parent
c43e35530e
commit
06d3dac310
13 changed files with 121 additions and 50 deletions
|
|
@ -23,7 +23,7 @@ class AbstractApp extends AbstractBoot
|
|||
{
|
||||
super();
|
||||
|
||||
this.iframe = $('<iframe style="display:none" />').appendTo('body');
|
||||
this.iframe = $('<iframe class="internal-hiddden" />').appendTo('body');
|
||||
|
||||
Globals.$win.on('error', function (oEvent) {
|
||||
if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
|
||||
|
|
|
|||
|
|
@ -28,6 +28,12 @@ window.__rlah_clear = () => {
|
|||
}
|
||||
};
|
||||
|
||||
function getComputedStyle(id, name)
|
||||
{
|
||||
var element = window.document.getElementById(id);
|
||||
return element.currentStyle ? element.currentStyle[name] : (window.getComputedStyle ? window.getComputedStyle(element, null).getPropertyValue(name) : null);
|
||||
}
|
||||
|
||||
function includeStyle(styles)
|
||||
{
|
||||
window.document.write(unescape('%3Csty' + 'le%3E' + styles + '"%3E%3C/' + 'sty' + 'le%3E'));
|
||||
|
|
@ -41,10 +47,16 @@ function includeScr(src)
|
|||
function includeLayout()
|
||||
{
|
||||
const
|
||||
css = require('Styles/@Boot.css'),
|
||||
layout = require('Html/Layout.html'),
|
||||
app = window.document.getElementById('rl-app')
|
||||
;
|
||||
|
||||
if (css)
|
||||
{
|
||||
includeStyle(css);
|
||||
}
|
||||
|
||||
if (app && layout)
|
||||
{
|
||||
app.innerHTML = layout.replace(/[\r\n\t]+/g, '');
|
||||
|
|
@ -163,12 +175,6 @@ function runApp()
|
|||
libs = window.jassl(appData.StaticLibJsLink).then(() => {
|
||||
if (window.$)
|
||||
{
|
||||
if (!window.$('#rl-check').is(':visible'))
|
||||
{
|
||||
window.$('html').addClass('no-css');
|
||||
throw new Error('no-css');
|
||||
}
|
||||
|
||||
window.$('#rl-check').remove();
|
||||
|
||||
if (appData.IncludeBackground)
|
||||
|
|
@ -224,7 +230,7 @@ window.__initAppData = function(data) {
|
|||
|
||||
if (rlAppDataStorage.NewThemeLink)
|
||||
{
|
||||
window.document.getElementById('app-theme-link').href = rlAppDataStorage.NewThemeLink;
|
||||
(window.document.getElementById('app-theme-link') || {}).href = rlAppDataStorage.NewThemeLink;
|
||||
}
|
||||
|
||||
if (rlAppDataStorage.IncludeCss)
|
||||
|
|
@ -244,6 +250,12 @@ window.__runBoot = function() {
|
|||
window.document.location.replace('./?/NoCookie');
|
||||
}
|
||||
|
||||
if ('none' !== getComputedStyle('rl-check', 'display'))
|
||||
{
|
||||
const root = document.documentElement;
|
||||
root.className += ' no-css';
|
||||
}
|
||||
|
||||
if (includeLayout())
|
||||
{
|
||||
includeAppScr(getRainloopBootData());
|
||||
|
|
|
|||
|
|
@ -1532,6 +1532,25 @@
|
|||
}
|
||||
};
|
||||
|
||||
Utils.appendStyles = function ($styleTag, css)
|
||||
{
|
||||
if ($styleTag && $styleTag[0])
|
||||
{
|
||||
if ($styleTag[0].styleSheet && !Utils.isUnd($styleTag[0].styleSheet.cssText))
|
||||
{
|
||||
$styleTag[0].styleSheet.cssText = css;
|
||||
}
|
||||
else
|
||||
{
|
||||
$styleTag.text(css);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
Utils.__themeTimer = 0;
|
||||
Utils.__themeAjax = null;
|
||||
|
||||
|
|
@ -1583,14 +1602,9 @@
|
|||
|
||||
if (oThemeStyle && oThemeStyle[0])
|
||||
{
|
||||
oThemeStyle.attr('data-href', sUrl).attr('data-theme', aData[0]);
|
||||
if (oThemeStyle[0].styleSheet && !Utils.isUnd(oThemeStyle[0].styleSheet.cssText))
|
||||
if (Utils.appendStyles(oThemeStyle, aData[1]))
|
||||
{
|
||||
oThemeStyle[0].styleSheet.cssText = aData[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
oThemeStyle.text(aData[1]);
|
||||
oThemeStyle.attr('data-href', sUrl).attr('data-theme', aData[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
Knoin.prototype.hideLoading = function ()
|
||||
{
|
||||
$('#rl-content').show();
|
||||
$('#rl-content').addClass('rl-content-show');
|
||||
$('#rl-loading').hide().remove();
|
||||
};
|
||||
|
||||
|
|
@ -422,9 +422,9 @@
|
|||
*/
|
||||
Knoin.prototype.startScreens = function (aScreensClasses)
|
||||
{
|
||||
$('#rl-content').css({
|
||||
'visibility': 'hidden'
|
||||
});
|
||||
// $('#rl-content').css({
|
||||
// 'visibility': 'hidden'
|
||||
// });
|
||||
|
||||
_.each(aScreensClasses, function (CScreen) {
|
||||
|
||||
|
|
@ -468,9 +468,9 @@
|
|||
hasher.changed.add(oCross.parse, oCross);
|
||||
hasher.init();
|
||||
|
||||
$('#rl-content').css({
|
||||
'visibility': 'visible'
|
||||
});
|
||||
// $('#rl-content').css({
|
||||
// 'visibility': 'visible'
|
||||
// });
|
||||
|
||||
_.delay(function () {
|
||||
Globals.$html.removeClass('rl-started-trigger').addClass('rl-started');
|
||||
|
|
|
|||
57
dev/Styles/@Boot.css
Normal file
57
dev/Styles/@Boot.css
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
#rl-content{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.internal-hiddden{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
html.no-css, html.no-css body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Arial, Verdana, Geneva, sans-serif;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
html.no-css #rl-content, html.no-css #rl-loading{
|
||||
display: none;
|
||||
}
|
||||
|
||||
html.no-css #rl-loading-error {
|
||||
position: absolute;
|
||||
font-size: 30px;
|
||||
line-height: 130%;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
height: 65px;
|
||||
margin: 0;
|
||||
margin-top: -60px;
|
||||
background-color: transparent;
|
||||
text-align: center;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
html.no-css .progressjs-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html.no-css .thm-body {
|
||||
color: #333;
|
||||
background-color: #aaa;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
html.no-css .thm-loading {
|
||||
color: #333 !important;
|
||||
text-shadow: none !important;
|
||||
|
||||
.e-spinner .e-bounce {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
html.no-css .thm-login-desc .desc {
|
||||
color: #333 !important;
|
||||
text-shadow: none !important;
|
||||
}
|
||||
|
|
@ -375,7 +375,11 @@ html.rl-ctrl-key-pressed {
|
|||
}
|
||||
|
||||
#rl-check{
|
||||
display: block;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.rl-content-show {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
html.rl-mobile .hide-on-mobile {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue