Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor motion & sidebar affix global fix. #1829

Merged
merged 9 commits into from
Aug 27, 2017
Merged

Refactor motion & sidebar affix global fix. #1829

merged 9 commits into from
Aug 27, 2017

Conversation

ivan-nginx
Copy link
Collaborator

@ivan-nginx ivan-nginx commented Aug 27, 2017

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.
  • Tests for the changes have been added (for bug fixes / features).
  • Docs have been added / updated (for bug fixes / features).

PR Type

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe:

What is the current behavior?

  1. Sidebar affix don't work globally (block extra was wrong usage).
  2. Issue Number(s): “分类”“标签”“关于”页面中正文部分没有动画 #967.

What is the new behavior?

  1. Sidebar affix now must work globally.
  2. Now motion option have more options:
    • Breaking changes: rename use_motion to motion in main NexT config.
    • Option to async loading. That's mean effects on logo, menu, post will load in same time if true; if false — this items will load after each other.
    • Motion effects now work for all pages (“分类”“标签”“关于”页面中正文部分没有动画 #967) and tags/category headers too.
    • Transition variants (see config comments).

In NexT _config.yml:

-# Motion
-use_motion: true
# Use velocity to animate everything.
motion:
  enable: true
  async: false
  transition:
    # Transition variants:
    # fadeIn | fadeOut | flipXIn | flipXOut | flipYIn | flipYOut | flipBounceXIn | flipBounceXOut | flipBounceYIn | flipBounceYOut
    # swoopIn | swoopOut | whirlIn | whirlOut | shrinkIn | shrinkOut | expandIn | expandOut
    # bounceIn | bounceOut | bounceUpIn | bounceUpOut | bounceDownIn | bounceDownOut | bounceLeftIn | bounceLeftOut | bounceRightIn | bounceRightOut
    # slideUpIn | slideUpOut | slideDownIn | slideDownOut | slideLeftIn | slideLeftOut | slideRightIn | slideRightOut
    # slideUpBigIn | slideUpBigOut | slideDownBigIn | slideDownBigOut | slideLeftBigIn | slideLeftBigOut | slideRightBigIn | slideRightBigOut
    # perspectiveUpIn | perspectiveUpOut | perspectiveDownIn | perspectiveDownOut | perspectiveLeftIn | perspectiveLeftOut | perspectiveRightIn | perspectiveRightOut
    post_block: fadeIn
    post_header: slideDownIn
    post_body: slideDownIn
    coll_header: slideLeftIn

P.S. U can comment any of 4 elements if u don't want to use effects on they.
E.g. comment post_block: fadeIn — will not add motion effects to blocks on all posts.

  • Screens with this changes: N/A
  • Link to demo site with this changes: N/A

Does this PR introduce a breaking change?

  • Yes.
  • No.

1. Remove `use_motion` condition [block script extra].
2. Remove `post-details.swig` [block script extra] (for sidebar affix global fix).
3. Remove `motion-element` from swig because was added to external js (disable motion state fix).
4. Add `seo` condition on archive header.
1. Refactor motion effect option.
2. Global fix sidebar affix on all posts and pages [block script_extra].
if (CONFIG.motion.transition.post_body) {
$postBody.velocity('transition.' + $postBodyTransition, postMotionOptions);
}
if (CONFIG.motion.transition.coll_header) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier 'coll_header' is not in camel case.

if (CONFIG.motion.transition.post_header) {
$postHeader.velocity('transition.' + $postHeaderTransition, postMotionOptions);
}
if (CONFIG.motion.transition.post_body) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier 'post_body' is not in camel case.

if (CONFIG.motion.transition.post_block) {
$postBlock.velocity('transition.' + $postBlockTransition, postMotionOptions);
}
if (CONFIG.motion.transition.post_header) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier 'post_header' is not in camel case.

@@ -293,7 +314,19 @@ $(document).ready(function () {
integrator.next();
};

$post.velocity('transition.slideDownIn', postMotionOptions);
//$post.velocity('transition.slideDownIn', postMotionOptions);
if (CONFIG.motion.transition.post_block) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier 'post_block' is not in camel case.

var $postBody = $('.post-body');
var $postBodyTransition = CONFIG.motion.transition.post_body;
var $collHeader = $('.collection-title, .archive-year');
var $collHeaderTransition = CONFIG.motion.transition.coll_header;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier 'coll_header' is not in camel case.

var $postHeader = $('.post-header');
var $postHeaderTransition = CONFIG.motion.transition.post_header;
var $postBody = $('.post-body');
var $postBodyTransition = CONFIG.motion.transition.post_body;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier 'post_body' is not in camel case.

var $postBlock = $('.post-block');
var $postBlockTransition = CONFIG.motion.transition.post_block;
var $postHeader = $('.post-header');
var $postHeaderTransition = CONFIG.motion.transition.post_header;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier 'post_header' is not in camel case.

var hasPost = $post.size() > 0;
//var $post = $('.post');
var $postBlock = $('.post-block');
var $postBlockTransition = CONFIG.motion.transition.post_block;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier 'post_block' is not in camel case.

@ivan-nginx ivan-nginx merged commit 6fbb328 into iissnan:master Aug 27, 2017
ivan-nginx added a commit that referenced this pull request Sep 16, 2017
As affix & sidebar autoopenning for now use in global , need to remove `post-details.swig` from post and any other pages instead of `_layout.swig`.
zqjimlove added a commit to zqjimlove/hexo-theme-next that referenced this pull request Sep 28, 2017
* source.master: (1260 commits)
  [skip ci]
  Update PULL_REQUEST_TEMPLATE.md
  Update PULL_REQUEST_TEMPLATE.md
  Fix font-size only for mobile
  MOD: caution for Safari bug in `font` settings.
  Fix to iissnan#1881.
  Update pagination.styl
  Remove line-height declaration
  FIX: to iissnan#1829 global affix fix.
  Fix Mist font-size for Posts on mobile
  Update PULL_REQUEST_TEMPLATE.md
  Improve font configurations for global and headings
  Revert "FIX: Better way to adjust footer position in Pisces."
  Fix caption position
  Add Italian translation
  Fix fancybox style
  Uncomment `archives` after new option `override`.
  Update _config.yml
  Fix HoundCI issues
  Allow the user to override the whole configuration
  ...

# Conflicts:
#	_config.yml
wafer-li pushed a commit to wafer-li/hexo-theme-next that referenced this pull request Dec 29, 2017
As affix & sidebar autoopenning for now use in global , need to remove `post-details.swig` from post and any other pages instead of `_layout.swig`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants