From 1b7c6f76d15b409b49c44061d91d4dc04e38cb55 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Thu, 20 Oct 2016 22:38:29 +0300 Subject: [PATCH] Fix html parser Add "login.active_backgroud" setting --- dev/Screen/User/Login.js | 29 -------------- dev/View/User/Login.js | 25 ++++++++++++ .../app/libraries/MailSo/Base/HtmlUtils.php | 38 ++----------------- .../0.0.0/app/libraries/RainLoop/Actions.php | 1 + .../libraries/RainLoop/Config/Application.php | 5 ++- 5 files changed, 32 insertions(+), 66 deletions(-) diff --git a/dev/Screen/User/Login.js b/dev/Screen/User/Login.js index 58f25a6ee..d4430a37c 100644 --- a/dev/Screen/User/Login.js +++ b/dev/Screen/User/Login.js @@ -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)); } } diff --git a/dev/View/User/Login.js b/dev/View/User/Login.js index 54714c0dc..299f952a7 100644 --- a/dev/View/User/Login.js +++ b/dev/View/User/Login.js @@ -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}; diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php b/rainloop/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php index 3dd21ae1f..374007506 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php @@ -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.'>') && '' === \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)) diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 2acff064d..08e9ba71b 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -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), diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 146111798..d6d9073da 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -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('', ''),