mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-30 10:37:54 +08:00
Add social redirect animation
This commit is contained in:
parent
f64cf601ce
commit
0a6a84b3d7
5 changed files with 157 additions and 55 deletions
40
dev/Styles/_social.css
Normal file
40
dev/Styles/_social.css
Normal file
|
@ -0,0 +1,40 @@
|
|||
@keyframes redirectingRotation {
|
||||
to {
|
||||
transform: rotate(1turn);
|
||||
}
|
||||
}
|
||||
.social-icon-wrp {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.social-icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
font-size: 140px;
|
||||
margin: -60px 0 0 -60px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.redirecting:after{
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 240px;
|
||||
height: 240px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -120px;
|
||||
margin-left: -120px;
|
||||
|
||||
border: 8px solid transparent;
|
||||
border-color: transparent;
|
||||
border-top-color: #999;
|
||||
animation: redirectingRotation 1s infinite ease-in-out;
|
||||
|
||||
border-radius: 50%;
|
||||
z-index: 1;
|
||||
}
|
38
gulpfile.js
38
gulpfile.js
|
@ -137,6 +137,13 @@ cfg.paths.css = {
|
|||
'node_modules/pikaday/css/pikaday.css',
|
||||
cfg.paths.staticCSS + cfg.paths.less.main.name
|
||||
]
|
||||
},
|
||||
social: {
|
||||
name: 'social.css',
|
||||
src: [
|
||||
'vendors/fontastic/styles.css',
|
||||
'dev/Styles/_social.css'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -229,12 +236,18 @@ gulp.task('less:main', function() {
|
|||
.on('error', gutil.log);
|
||||
});
|
||||
|
||||
gulp.task('css:main-begin', ['less:main'], function() {
|
||||
|
||||
var
|
||||
autoprefixer = require('gulp-autoprefixer')
|
||||
;
|
||||
gulp.task('css:social', function() {
|
||||
var autoprefixer = require('gulp-autoprefixer');
|
||||
return gulp.src(cfg.paths.css.social.src)
|
||||
.pipe(concat(cfg.paths.css.social.name))
|
||||
.pipe(autoprefixer('last 3 versions', '> 1%', 'ie 9', 'Firefox ESR', 'Opera 12.1'))
|
||||
.pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/'))
|
||||
.pipe(eol('\n', true))
|
||||
.pipe(gulp.dest(cfg.paths.staticCSS));
|
||||
});
|
||||
|
||||
gulp.task('css:main-begin', ['less:main', 'css:social'], function() {
|
||||
var autoprefixer = require('gulp-autoprefixer');
|
||||
return gulp.src(cfg.paths.css.main.src)
|
||||
.pipe(concat(cfg.paths.css.main.name))
|
||||
.pipe(autoprefixer('last 3 versions', '> 1%', 'ie 9', 'Firefox ESR', 'Opera 12.1'))
|
||||
|
@ -262,7 +275,7 @@ gulp.task('css:clear-less', ['css:main-begin'], function() {
|
|||
gulp.task('css:main', ['css:clear-less']);
|
||||
|
||||
gulp.task('css:main:min', ['css:main'], function() {
|
||||
var cleanCSS = require('gulp-clean-css');
|
||||
var cleanCSS = require('gulp-clean-css');
|
||||
return gulp.src(cfg.paths.staticCSS + cfg.paths.css.main.name)
|
||||
.pipe(cleanCSS())
|
||||
.pipe(rename({suffix: '.min'}))
|
||||
|
@ -270,6 +283,17 @@ gulp.task('css:main:min', ['css:main'], function() {
|
|||
.pipe(gulp.dest(cfg.paths.staticCSS));
|
||||
});
|
||||
|
||||
gulp.task('css:social:min', ['css:social'], function() {
|
||||
var cleanCSS = require('gulp-clean-css');
|
||||
return gulp.src(cfg.paths.staticCSS + cfg.paths.css.social.name)
|
||||
.pipe(cleanCSS())
|
||||
.pipe(rename({suffix: '.min'}))
|
||||
.pipe(eol('\n', true))
|
||||
.pipe(gulp.dest(cfg.paths.staticCSS));
|
||||
});
|
||||
|
||||
gulp.task('css:min', ['css:main:min', 'css:social:min']);
|
||||
|
||||
// JS
|
||||
gulp.task('js:encrypt', function() {
|
||||
return gulp.src(cfg.paths.js.encrypt.src)
|
||||
|
@ -640,7 +664,7 @@ gulp.task('rainloop:owncloud:shortname', ['rainloop:owncloud:md5'], function(cal
|
|||
// MAIN
|
||||
gulp.task('js:pgp', ['js:openpgp', 'js:openpgpworker']);
|
||||
|
||||
gulp.task('default', ['js:libs', 'js:pgp', 'js:min', 'css:main:min', 'ckeditor', 'fontastic']);
|
||||
gulp.task('default', ['js:libs', 'js:pgp', 'js:min', 'css:min', 'ckeditor', 'fontastic']);
|
||||
gulp.task('fast-', ['js:app', 'js:admin', 'css:main']);
|
||||
|
||||
gulp.task('fast', ['package:community-on', 'fast-']);
|
||||
|
|
|
@ -447,6 +447,7 @@ Enables caching in the system'),
|
|||
'replace_env_in_configuration' => array(''),
|
||||
'startup_url' => array(''),
|
||||
'emogrifier' => array(true),
|
||||
'nice_social_redirect' => array(true),
|
||||
'dev_email' => array(''),
|
||||
'dev_password' => array('')
|
||||
),
|
||||
|
|
|
@ -125,9 +125,70 @@ class Social
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GooglePopupService($bGmail = false)
|
||||
public function popupServiceResult($sTypeStr, $sLoginUrl, $bLogin, $iErrorCode)
|
||||
{
|
||||
$sResult = '';
|
||||
$bNiceSocialRedirect = $this->oActions->Config()->Get('labs', 'nice_social_redirect', true);
|
||||
$bAppCssDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_css', false);
|
||||
|
||||
$sIcon = $sTypeStr;
|
||||
if ('facebook' === $sIcon)
|
||||
{
|
||||
$sIcon = $sIcon.'-alt';
|
||||
}
|
||||
|
||||
if ($sLoginUrl)
|
||||
{
|
||||
if (!$bNiceSocialRedirect)
|
||||
{
|
||||
$this->oActions->Location($sLoginUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->oHttp->ServerNoCache();
|
||||
@\header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Social.html'), array(
|
||||
'{{RefreshMeta}}' => '<meta http-equiv="refresh" content="0; URL='.$sLoginUrl.'" />',
|
||||
'{{Stylesheet}}' => $this->oActions->StaticPath('css/social'.($bAppCssDebug ? '' : '.min').'.css'),
|
||||
'{{Icon}}' => $sIcon,
|
||||
'{{Script}}' => ''
|
||||
));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->oHttp->ServerNoCache();
|
||||
@\header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$sCallBackType = $bLogin ? '_login' : '';
|
||||
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_'.$sTypeStr.$sCallBackType.'_service';
|
||||
|
||||
if (!$bNiceSocialRedirect)
|
||||
{
|
||||
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Social.html'), array(
|
||||
'{{RefreshMeta}}' => '',
|
||||
'{{Stylesheet}}' => $this->oActions->StaticPath('css/social'.($bAppCssDebug ? '' : '.min').'.css'),
|
||||
'{{Icon}}' => $sIcon,
|
||||
'{{Script}}' => '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GooglePopupService($bGmail = false)
|
||||
{
|
||||
$sLoginUrl = '';
|
||||
$oAccount = null;
|
||||
|
||||
|
@ -276,20 +337,7 @@ class Social
|
|||
$this->oActions->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
|
||||
}
|
||||
|
||||
if ($sLoginUrl)
|
||||
{
|
||||
$this->oActions->Location($sLoginUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
@\header('Content-Type: text/html; charset=utf-8');
|
||||
$sCallBackType = $bLogin ? '_login' : '';
|
||||
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_google'.$sCallBackType.'_service';
|
||||
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
return $this->popupServiceResult('google', $sLoginUrl, $bLogin, $iErrorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,7 +345,6 @@ class Social
|
|||
*/
|
||||
public function FacebookPopupService()
|
||||
{
|
||||
$sResult = '';
|
||||
$sLoginUrl = '';
|
||||
$sSocialName = '';
|
||||
|
||||
|
@ -393,23 +440,7 @@ class Social
|
|||
}
|
||||
}
|
||||
|
||||
if ($sLoginUrl)
|
||||
{
|
||||
$this->oActions->Location($sLoginUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->oHttp->ServerNoCache();
|
||||
|
||||
@\header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$sCallBackType = $bLogin ? '_login' : '';
|
||||
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_facebook'.$sCallBackType.'_service';
|
||||
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
return $this->popupServiceResult('facebook', $sLoginUrl, $bLogin, $iErrorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -417,7 +448,6 @@ class Social
|
|||
*/
|
||||
public function TwitterPopupService()
|
||||
{
|
||||
$sResult = '';
|
||||
$sLoginUrl = '';
|
||||
|
||||
$sSocialName = '';
|
||||
|
@ -585,20 +615,7 @@ class Social
|
|||
$this->oActions->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
|
||||
}
|
||||
|
||||
if ($sLoginUrl)
|
||||
{
|
||||
$this->oActions->Location($sLoginUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
@\header('Content-Type: text/html; charset=utf-8');
|
||||
$sCallBackType = $bLogin ? '_login' : '';
|
||||
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_twitter'.$sCallBackType.'_service';
|
||||
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
return $this->popupServiceResult('twitter', $sLoginUrl, $bLogin, $iErrorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
20
rainloop/v/0.0.0/app/templates/Social.html
Normal file
20
rainloop/v/0.0.0/app/templates/Social.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
{{RefreshMeta}}
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="google" content="notranslate" />
|
||||
<meta name="robots" content="noindex,nofollow,noodp" />
|
||||
<link type="text/css" rel="stylesheet" href="{{Stylesheet}}" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="social-icon-wrp redirecting">
|
||||
<div class="social-icon">
|
||||
<i class="icon-{{Icon}}"></i>
|
||||
</div>
|
||||
</div>
|
||||
{{Script}}
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue