Skip to content
New issue

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

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

Already on GitHub? # to your account

support theme-next refresh #165

Merged
merged 2 commits into from
Jan 26, 2021
Merged

support theme-next refresh #165

merged 2 commits into from
Jan 26, 2021

Conversation

val3344
Copy link
Contributor

@val3344 val3344 commented Jan 25, 2021

修改原因

使用 NexT 主题,页面加载完成后,会调用 NexT.boot.refresh() 方法对页面进行初始化,其中包含代码高亮、图片缩放、懒加载、外部链接处理等操作:

NexT.boot.refresh = function() {

  /**
   * Register JS handlers by condition option.
   * Need to add config option in Front-End at 'scripts/helpers/next-config.js' file.
   */
  CONFIG.prism && window.Prism.highlightAll();
  CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox();
  CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img', {
    background: 'var(--content-bg-color)'
  });
  CONFIG.lazyload && window.lozad('.post-body img').observe();
  CONFIG.pangu && window.pangu.spacingPage();

  CONFIG.exturl && NexT.utils.registerExtURL();
  NexT.utils.registerCopyCode();
  NexT.utils.registerTabsTag();
  NexT.utils.registerActiveMenuItem();
  NexT.utils.registerLangSelect();
  NexT.utils.registerSidebarTOC();
  NexT.utils.wrapTableWithBox();
  NexT.utils.registerVideoIframe();
};

修改内容

模板 html5 lazyload 代码,在解锁完成后,通过 window.NexT 判断是否使用了 NexT 主题,如果使用了,则调用 NexT.boot.refresh() 进行初始化。

@D0n9X1n D0n9X1n merged commit dc74810 into D0n9X1n:master Jan 26, 2021
@D0n9X1n
Copy link
Owner

D0n9X1n commented Jan 26, 2021

Will be in v3.1.4. Thanks a lot!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants