mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
Fix html parser
Add "login.active_backgroud" setting
This commit is contained in:
parent
52018b40e8
commit
1b7c6f76d1
5 changed files with 32 additions and 66 deletions
|
|
@ -18,35 +18,6 @@ class LoginUserScreen extends AbstractScreen
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
getApp().setWindowTitle('');
|
getApp().setWindowTitle('');
|
||||||
this.initFunBackgroud();
|
|
||||||
}
|
|
||||||
|
|
||||||
getHeightAndWidth() {
|
|
||||||
const
|
|
||||||
height = $win.height(),
|
|
||||||
width = $win.width();
|
|
||||||
|
|
||||||
return {height, width};
|
|
||||||
}
|
|
||||||
|
|
||||||
initFunBackgroud() {
|
|
||||||
|
|
||||||
const
|
|
||||||
$bg = $('#rl-bg'),
|
|
||||||
movementStrength = 25,
|
|
||||||
winHeight = $win.height(),
|
|
||||||
winWidth = $win.width(),
|
|
||||||
height = movementStrength / winHeight,
|
|
||||||
width = movementStrength / winWidth,
|
|
||||||
winHeightHalf = winHeight / 2,
|
|
||||||
winWidthHalf = winWidth / 2;
|
|
||||||
|
|
||||||
$('#rl-app').on('mousemove', _.throttle((e) => {
|
|
||||||
$bg.css({
|
|
||||||
top: height * (e.pageY - winHeightHalf) * -1 - movementStrength,
|
|
||||||
left: width * (e.pageX - winWidthHalf) * -1 - movementStrength
|
|
||||||
});
|
|
||||||
}, 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -447,6 +447,11 @@ class LoginUserView extends AbstractViewNext
|
||||||
}, Magics.Time50ms);
|
}, Magics.Time50ms);
|
||||||
|
|
||||||
triggerAutocompleteInputChange(true);
|
triggerAutocompleteInputChange(true);
|
||||||
|
|
||||||
|
if (Settings.appSettingsGet('activeBackgroud'))
|
||||||
|
{
|
||||||
|
this.initActiveBackgroud();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
|
@ -471,6 +476,26 @@ class LoginUserView extends AbstractViewNext
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initActiveBackgroud() {
|
||||||
|
|
||||||
|
const
|
||||||
|
$bg = $('#rl-bg'),
|
||||||
|
movementStrength = 25,
|
||||||
|
winHeight = $win.height(),
|
||||||
|
winWidth = $win.width(),
|
||||||
|
height = movementStrength / winHeight,
|
||||||
|
width = movementStrength / winWidth,
|
||||||
|
winHeightHalf = winHeight / 2,
|
||||||
|
winWidthHalf = winWidth / 2;
|
||||||
|
|
||||||
|
$('#rl-app').on('mousemove', _.throttle((e) => {
|
||||||
|
$bg.css({
|
||||||
|
top: height * (e.pageY - winHeightHalf) * -1 - movementStrength,
|
||||||
|
left: width * (e.pageX - winWidthHalf) * -1 - movementStrength
|
||||||
|
});
|
||||||
|
}, 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export {LoginUserView, LoginUserView as default};
|
export {LoginUserView, LoginUserView as default};
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ class HtmlUtils
|
||||||
/**
|
/**
|
||||||
* @param \DOMDocument|\DOMElement $oElem
|
* @param \DOMDocument|\DOMElement $oElem
|
||||||
*
|
*
|
||||||
* @return type
|
* @return string
|
||||||
*/
|
*/
|
||||||
private static function domToString($oElem, $oDom = null)
|
private static function domToString($oElem, $oDom = null)
|
||||||
{
|
{
|
||||||
|
|
@ -196,7 +196,6 @@ class HtmlUtils
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sResult = self::domToString($oDiv, $oDom);
|
$sResult = self::domToString($oDiv, $oDom);
|
||||||
$sResult = \MailSo\Base\HtmlUtils::UnWrapTag($sResult);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -210,36 +209,6 @@ class HtmlUtils
|
||||||
return $sResult;
|
return $sResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $sHtml
|
|
||||||
* @param string $sTag = 'div'
|
|
||||||
* @param string $iUnwrapCount = 10
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function UnWrapTag($sHtml, $sTag = 'div', $iUnwrapCount = 5)
|
|
||||||
{
|
|
||||||
$iUnwrapCount = 0 < $iUnwrapCount ? $iUnwrapCount : 1;
|
|
||||||
$iUnwrapCount = 10 < $iUnwrapCount ? 10 : $iUnwrapCount;
|
|
||||||
|
|
||||||
$sTag = $sTag ? $sTag : 'div';
|
|
||||||
$iTagLen = \strlen($sTag);
|
|
||||||
|
|
||||||
while (0 < $iUnwrapCount)
|
|
||||||
{
|
|
||||||
$sHtml = \trim($sHtml);
|
|
||||||
if (0 === \strpos($sHtml, '<'.$sTag.'>') && '</'.$sTag.'>' === \substr($sHtml, -3 - $iTagLen))
|
|
||||||
{
|
|
||||||
$sHtml = \substr(\substr($sHtml, 2 + $iTagLen), 0, -3 - $iTagLen);
|
|
||||||
$sHtml = \trim($sHtml);
|
|
||||||
}
|
|
||||||
|
|
||||||
$iUnwrapCount--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sHtml;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sHtml
|
* @param string $sHtml
|
||||||
* @param string $sHtmlAttrs = ''
|
* @param string $sHtmlAttrs = ''
|
||||||
|
|
@ -288,8 +257,6 @@ class HtmlUtils
|
||||||
$sHtmlAttrs = trim($sHtmlAttrs);
|
$sHtmlAttrs = trim($sHtmlAttrs);
|
||||||
$sBodyAttrs = trim($sBodyAttrs);
|
$sBodyAttrs = trim($sBodyAttrs);
|
||||||
|
|
||||||
$sHtml = \MailSo\Base\HtmlUtils::UnWrapTag($sHtml);
|
|
||||||
|
|
||||||
return $sHtml;
|
return $sHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1242,7 +1209,8 @@ class HtmlUtils
|
||||||
|
|
||||||
if (\MailSo\Config::$HtmlStrictDebug && 0 < \count($aRemovedAttrs))
|
if (\MailSo\Config::$HtmlStrictDebug && 0 < \count($aRemovedAttrs))
|
||||||
{
|
{
|
||||||
unset($aRemovedAttrs['class'], $aRemovedAttrs['target'], $aRemovedAttrs['id'], $aRemovedAttrs['name']);
|
unset($aRemovedAttrs['class'], $aRemovedAttrs['target'], $aRemovedAttrs['id'], $aRemovedAttrs['name'],
|
||||||
|
$aRemovedAttrs['itemprop'], $aRemovedAttrs['itemscope'], $aRemovedAttrs['itemtype']);
|
||||||
|
|
||||||
$aRemovedAttrs = \array_keys($aRemovedAttrs);
|
$aRemovedAttrs = \array_keys($aRemovedAttrs);
|
||||||
if (0 < \count($aRemovedAttrs))
|
if (0 < \count($aRemovedAttrs))
|
||||||
|
|
|
||||||
|
|
@ -1457,6 +1457,7 @@ class Actions
|
||||||
'registrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
|
'registrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
|
||||||
'loginGlassStyle' => (bool) $oConfig->Get('login', 'glass_style', true),
|
'loginGlassStyle' => (bool) $oConfig->Get('login', 'glass_style', true),
|
||||||
'hideSubmitButton' => (bool) $oConfig->Get('login', 'hide_submit_button', true),
|
'hideSubmitButton' => (bool) $oConfig->Get('login', 'hide_submit_button', true),
|
||||||
|
'activeBackgroud' => (bool) $oConfig->Get('login', 'active_backgroud', true),
|
||||||
'jsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
|
'jsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
|
||||||
'useImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
|
'useImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
|
||||||
'useImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
|
'useImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
|
||||||
|
|
|
||||||
|
|
@ -249,8 +249,9 @@ class Application extends \RainLoop\Config\AbstractConfig
|
||||||
|
|
||||||
'welcome_page' => array(false, ''),
|
'welcome_page' => array(false, ''),
|
||||||
|
|
||||||
'glass_style' => array(true, ''),
|
'glass_style' => array(true),
|
||||||
'hide_submit_button' => array(true, ''),
|
'hide_submit_button' => array(true),
|
||||||
|
'active_backgroud' => array(true),
|
||||||
|
|
||||||
'forgot_password_link_url' => array('', ''),
|
'forgot_password_link_url' => array('', ''),
|
||||||
'registration_link_url' => array('', ''),
|
'registration_link_url' => array('', ''),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue