Fix html parser

Add "login.active_backgroud" setting
This commit is contained in:
RainLoop Team 2016-10-20 22:38:29 +03:00
parent 52018b40e8
commit 1b7c6f76d1
5 changed files with 32 additions and 66 deletions

View file

@ -18,35 +18,6 @@ class LoginUserScreen extends AbstractScreen
onShow() {
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));
}
}

View file

@ -447,6 +447,11 @@ class LoginUserView extends AbstractViewNext
}, Magics.Time50ms);
triggerAutocompleteInputChange(true);
if (Settings.appSettingsGet('activeBackgroud'))
{
this.initActiveBackgroud();
}
}
submitForm() {
@ -471,6 +476,26 @@ class LoginUserView extends AbstractViewNext
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};

View file

@ -117,7 +117,7 @@ class HtmlUtils
/**
* @param \DOMDocument|\DOMElement $oElem
*
* @return type
* @return string
*/
private static function domToString($oElem, $oDom = null)
{
@ -196,7 +196,6 @@ class HtmlUtils
else
{
$sResult = self::domToString($oDiv, $oDom);
$sResult = \MailSo\Base\HtmlUtils::UnWrapTag($sResult);
}
}
else
@ -210,36 +209,6 @@ class HtmlUtils
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 $sHtmlAttrs = ''
@ -288,8 +257,6 @@ class HtmlUtils
$sHtmlAttrs = trim($sHtmlAttrs);
$sBodyAttrs = trim($sBodyAttrs);
$sHtml = \MailSo\Base\HtmlUtils::UnWrapTag($sHtml);
return $sHtml;
}
@ -1242,7 +1209,8 @@ class HtmlUtils
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);
if (0 < \count($aRemovedAttrs))

View file

@ -1457,6 +1457,7 @@ class Actions
'registrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
'loginGlassStyle' => (bool) $oConfig->Get('login', 'glass_style', true),
'hideSubmitButton' => (bool) $oConfig->Get('login', 'hide_submit_button', true),
'activeBackgroud' => (bool) $oConfig->Get('login', 'active_backgroud', true),
'jsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
'useImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
'useImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),

View file

@ -249,8 +249,9 @@ class Application extends \RainLoop\Config\AbstractConfig
'welcome_page' => array(false, ''),
'glass_style' => array(true, ''),
'hide_submit_button' => array(true, ''),
'glass_style' => array(true),
'hide_submit_button' => array(true),
'active_backgroud' => array(true),
'forgot_password_link_url' => array('', ''),
'registration_link_url' => array('', ''),