Browse Source

Site updated: 2020-05-13 20:52:40

schtonn 4 years ago
parent
commit
a80d6ee17f
12 changed files with 471 additions and 1424 deletions
  1. 9 0
      3749t1li44aBVT5hu7WQ4IM7Et/z8pfnQb44HJ50B88qK4s7pk8Zm32b.txt
  2. 0 35
      bird.js
  3. 0 0
      css/main.css
  4. 27 93
      js/bird.js
  5. 99 173
      js/motion.js
  6. 54 111
      js/next-boot.js
  7. 52 157
      js/trail.js
  8. 230 408
      js/utils.js
  9. 0 103
      motion.js
  10. 0 57
      next-boot.js
  11. 0 52
      trail.js
  12. 0 235
      utils.js

+ 9 - 0
3749t1li44aBVT5hu7WQ4IM7Et/z8pfnQb44HJ50B88qK4s7pk8Zm32b.txt

@@ -0,0 +1,9 @@
+music163 NEtEa2E483-d
+
+aliyun.com Al4yD83-SC700d
+
+bilibili B6Dje-hy48-3h
+
+mail wh-28DSH0sd-saef
+
+xmind XMc38-dsef6k

+ 0 - 35
bird.js

@@ -1,35 +0,0 @@
-'use strict';
-var game = new Phaser.Game(400, 490, Phaser.AUTO, 'game_div'), game_state = {
-        main: function () {
-        }
-    };
-game_state.main.prototype = {
-    preload: function () {
-        this.game.stage.backgroundColor = '#71c5cf', this.game.load.image('bird', '/../images/bird.png'), this.game.load.image('pipe', '/../images/pipe.png');
-    },
-    create: function () {
-        this.bird = this.game.add.sprite(100, 245, 'bird'), this.bird.body.gravity.y = 1000, this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR).onDown.add(this.jump, this), this.pipes = game.add.group(), this.pipes.createMultiple(20, 'pipe'), this.timer = this.game.time.events.loop(1500, this.add_row_of_pipes, this), this.score = 0;
-        this.label_score = this.game.add.text(20, 20, '0', {
-            font: '30px Arial',
-            fill: '#ffffff'
-        });
-    },
-    update: function () {
-        0 == this.bird.inWorld && this.restart_game(), this.game.physics.overlap(this.bird, this.pipes, this.restart_game, null, this);
-    },
-    jump: function () {
-        this.bird.body.velocity.y = -350;
-    },
-    restart_game: function () {
-        this.game.time.events.remove(this.timer), this.game.state.start('main');
-    },
-    add_one_pipe: function (t, e) {
-        var i = this.pipes.getFirstDead();
-        i.reset(t, e), i.body.velocity.x = -200, i.outOfBoundsKill = !0;
-    },
-    add_row_of_pipes: function () {
-        for (var t = Math.floor(5 * Math.random()) + 1, e = 0; e < 8; e++)
-            e != t && e != t + 1 && this.add_one_pipe(400, 60 * e + 10);
-        this.score += 1, this.label_score.content = this.score;
-    }
-}, game.state.add('main', game_state.main), game.state.start('main');

File diff suppressed because it is too large
+ 0 - 0
css/main.css


+ 27 - 93
js/bird.js

@@ -1,101 +1,35 @@
-// Initialize Phaser, and creates a 400x490px game
-var game = new Phaser.Game(400, 490, Phaser.AUTO, 'game_div');
-var game_state = {};
-
-// Creates a new 'main' state that will contain the game
-game_state.main = function() { };  
+'use strict';
+var game = new Phaser.Game(400, 490, Phaser.AUTO, 'game_div'), game_state = {
+        main: function () {
+        }
+    };
 game_state.main.prototype = {
-
-    // Function called first to load all the assets
-    preload: function() { 
-        // Change the background color of the game
-        this.game.stage.backgroundColor = '#71c5cf';
-
-        // Load the bird sprite
-        this.game.load.image('bird', '/../images/bird.png');
-
-        // Load the pipe sprite
-        this.game.load.image('pipe', '/../images/pipe.png');
+    preload: function () {
+        this.game.stage.backgroundColor = '#71c5cf', this.game.load.image('bird', '/../images/bird.png'), this.game.load.image('pipe', '/../images/pipe.png');
     },
-
-    // Fuction called after 'preload' to setup the game 
-    create: function() { 
-        // Display the bird on the screen
-        this.bird = this.game.add.sprite(100, 245, 'bird');
-        
-        // Add gravity to the bird to make it fall
-        this.bird.body.gravity.y = 1000; 
-
-        // Call the 'jump' function when the spacekey is hit
-        var space_key = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
-        space_key.onDown.add(this.jump, this); 
-
-        // Create a group of 20 pipes
-        this.pipes = game.add.group();
-        this.pipes.createMultiple(20, 'pipe');  
-
-        // Timer that calls 'add_row_of_pipes' ever 1.5 seconds
-        this.timer = this.game.time.events.loop(1500, this.add_row_of_pipes, this);           
-
-        // Add a score label on the top left of the screen
-        this.score = 0;
-        var style = { font: "30px Arial", fill: "#ffffff" };
-        this.label_score = this.game.add.text(20, 20, "0", style);  
+    create: function () {
+        this.bird = this.game.add.sprite(100, 245, 'bird'), this.bird.body.gravity.y = 1000, this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR).onDown.add(this.jump, this), this.pipes = game.add.group(), this.pipes.createMultiple(20, 'pipe'), this.timer = this.game.time.events.loop(1500, this.add_row_of_pipes, this), this.score = 0;
+        this.label_score = this.game.add.text(20, 20, '0', {
+            font: '30px Arial',
+            fill: '#ffffff'
+        });
     },
-
-    // This function is called 60 times per second
-    update: function() {
-        // If the bird is out of the world (too high or too low), call the 'restart_game' function
-        if (this.bird.inWorld == false)
-            this.restart_game(); 
-
-        // If the bird overlap any pipes, call 'restart_game'
-        this.game.physics.overlap(this.bird, this.pipes, this.restart_game, null, this);      
+    update: function () {
+        0 == this.bird.inWorld && this.restart_game(), this.game.physics.overlap(this.bird, this.pipes, this.restart_game, null, this);
     },
-
-    // Make the bird jump 
-    jump: function() {
-        // Add a vertical velocity to the bird
+    jump: function () {
         this.bird.body.velocity.y = -350;
     },
-
-    // Restart the game
-    restart_game: function() {
-        // Remove the timer
-        this.game.time.events.remove(this.timer);
-
-        // Start the 'main' state, which restarts the game
-        this.game.state.start('main');
+    restart_game: function () {
+        this.game.time.events.remove(this.timer), this.game.state.start('main');
     },
-
-    // Add a pipe on the screen
-    add_one_pipe: function(x, y) {
-        // Get the first dead pipe of our group
-        var pipe = this.pipes.getFirstDead();
-
-        // Set the new position of the pipe
-        pipe.reset(x, y);
-
-         // Add velocity to the pipe to make it move left
-        pipe.body.velocity.x = -200; 
-               
-        // Kill the pipe when it's no longer visible 
-        pipe.outOfBoundsKill = true;
+    add_one_pipe: function (t, e) {
+        var i = this.pipes.getFirstDead();
+        i.reset(t, e), i.body.velocity.x = -200, i.outOfBoundsKill = !0;
     },
-
-    // Add a row of 6 pipes with a hole somewhere in the middle
-    add_row_of_pipes: function() {
-        var hole = Math.floor(Math.random()*5)+1;
-        
-        for (var i = 0; i < 8; i++)
-            if (i != hole && i != hole +1) 
-                this.add_one_pipe(400, i*60+10);   
-    
-        this.score += 1;
-        this.label_score.content = this.score;  
-    },
-};
-
-// Add and start the 'main' state to start the game
-game.state.add('main', game_state.main);  
-game.state.start('main'); 
+    add_row_of_pipes: function () {
+        for (var t = Math.floor(5 * Math.random()) + 1, e = 0; e < 8; e++)
+            e != t && e != t + 1 && this.add_one_pipe(400, 60 * e + 10);
+        this.score += 1, this.label_score.content = this.score;
+    }
+}, game.state.add('main', game_state.main), game.state.start('main');

+ 99 - 173
js/motion.js

@@ -1,177 +1,103 @@
-/* global NexT, CONFIG, Velocity */
-
-if (window.$ && window.$.Velocity) window.Velocity = window.$.Velocity;
-
-NexT.motion = {};
-
-NexT.motion.integrator = {
-  queue : [],
-  cursor: -1,
-  init  : function() {
-    this.queue = [];
-    this.cursor = -1;
-    return this;
-  },
-  add: function(fn) {
-    this.queue.push(fn);
-    return this;
-  },
-  next: function() {
-    this.cursor++;
-    var fn = this.queue[this.cursor];
-    typeof fn === 'function' && fn(NexT.motion.integrator);
-  },
-  bootstrap: function() {
-    this.next();
-  }
-};
-
-NexT.motion.middleWares = {
-  logo: function(integrator) {
-    var sequence = [];
-    var brand = document.querySelector('.brand');
-    var image = document.querySelector('.custom-logo-image');
-    var title = document.querySelector('.site-title');
-    var subtitle = document.querySelector('.site-subtitle');
-    var logoLineTop = document.querySelector('.logo-line-before i');
-    var logoLineBottom = document.querySelector('.logo-line-after i');
-
-    brand && sequence.push({
-      e: brand,
-      p: {opacity: 1},
-      o: {duration: 200}
-    });
-
-    function getMistLineSettings(element, translateX) {
-      return {
-        e: element,
-        p: {translateX},
-        o: {
-          duration     : 500,
-          sequenceQueue: false
-        }
-      };
-    }
-
-    function pushImageToSequence() {
-      sequence.push({
-        e: image,
-        p: {opacity: 1, top: 0},
-        o: {duration: 200}
-      });
-    }
-
-    CONFIG.scheme === 'Mist' && logoLineTop && logoLineBottom
-    && sequence.push(
-      getMistLineSettings(logoLineTop, '100%'),
-      getMistLineSettings(logoLineBottom, '-100%')
-    );
-
-    CONFIG.scheme === 'Muse' && image && pushImageToSequence();
-
-    title && sequence.push({
-      e: title,
-      p: {opacity: 1, top: 0},
-      o: {duration: 200}
-    });
-
-    subtitle && sequence.push({
-      e: subtitle,
-      p: {opacity: 1, top: 0},
-      o: {duration: 200}
-    });
-
-    (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') && image && pushImageToSequence();
-
-    if (sequence.length > 0) {
-      sequence[sequence.length - 1].o.complete = function() {
-        integrator.next();
-      };
-      Velocity.RunSequence(sequence);
-    } else {
-      integrator.next();
-    }
-
-    if (CONFIG.motion.async) {
-      integrator.next();
-    }
-  },
-
-  menu: function(integrator) {
-    Velocity(document.querySelectorAll('.menu-item'), 'transition.slideDownIn', {
-      display : null,
-      duration: 200,
-      complete: function() {
-        integrator.next();
-      }
-    });
-
-    if (CONFIG.motion.async) {
-      integrator.next();
+'use strict';
+window.$ && window.$.Velocity && (window.Velocity = window.$.Velocity), NexT.motion = {}, NexT.motion.integrator = {
+    queue: [],
+    cursor: -1,
+    init: function () {
+        return this.queue = [], this.cursor = -1, this;
+    },
+    add: function (t) {
+        return this.queue.push(t), this;
+    },
+    next: function () {
+        this.cursor++;
+        var t = this.queue[this.cursor];
+        'function' == typeof t && t(NexT.motion.integrator);
+    },
+    bootstrap: function () {
+        this.next();
     }
-  },
-
-  subMenu: function(integrator) {
-    var subMenuItem = document.querySelectorAll('.sub-menu .menu-item');
-    if (subMenuItem.length > 0) {
-      subMenuItem.forEach(element => {
-        element.style.opacity = 1;
-      });
-    }
-    integrator.next();
-  },
-
-  postList: function(integrator) {
-    var postBlock = document.querySelectorAll('.post-block, .pagination, .comments');
-    var postBlockTransition = CONFIG.motion.transition.post_block;
-    var postHeader = document.querySelectorAll('.post-header');
-    var postHeaderTransition = CONFIG.motion.transition.post_header;
-    var postBody = document.querySelectorAll('.post-body');
-    var postBodyTransition = CONFIG.motion.transition.post_body;
-    var collHeader = document.querySelectorAll('.collection-header');
-    var collHeaderTransition = CONFIG.motion.transition.coll_header;
-
-    if (postBlock.length > 0) {
-      var postMotionOptions = window.postMotionOptions || {
-        stagger : 100,
-        drag    : true,
-        complete: function() {
-          integrator.next();
+}, NexT.motion.middleWares = {
+    logo: function (t) {
+        var e = [], o = document.querySelector('.brand'), n = document.querySelector('.custom-logo-image'), i = document.querySelector('.site-title'), r = document.querySelector('.site-subtitle'), c = document.querySelector('.logo-line-before i'), u = document.querySelector('.logo-line-after i');
+        function s(t, e) {
+            return {
+                e: t,
+                p: { translateX: e },
+                o: {
+                    duration: 500,
+                    sequenceQueue: !1
+                }
+            };
         }
-      };
-
-      if (CONFIG.motion.transition.post_block) {
-        Velocity(postBlock, 'transition.' + postBlockTransition, postMotionOptions);
-      }
-      if (CONFIG.motion.transition.post_header) {
-        Velocity(postHeader, 'transition.' + postHeaderTransition, postMotionOptions);
-      }
-      if (CONFIG.motion.transition.post_body) {
-        Velocity(postBody, 'transition.' + postBodyTransition, postMotionOptions);
-      }
-      if (CONFIG.motion.transition.coll_header) {
-        Velocity(collHeader, 'transition.' + collHeaderTransition, postMotionOptions);
-      }
-    }
-    if (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') {
-      integrator.next();
-    }
-  },
-
-  sidebar: function(integrator) {
-    var sidebarAffix = document.querySelector('.sidebar-inner');
-    var sidebarAffixTransition = CONFIG.motion.transition.sidebar;
-    // Only for Pisces | Gemini.
-    if (sidebarAffixTransition && (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini')) {
-      Velocity(sidebarAffix, 'transition.' + sidebarAffixTransition, {
-        display : null,
-        duration: 200,
-        complete: function() {
-          // After motion complete need to remove transform from sidebar to let affix work on Pisces | Gemini.
-          sidebarAffix.style.transform = 'initial';
+        function l() {
+            e.push({
+                e: n,
+                p: {
+                    opacity: 1,
+                    top: 0
+                },
+                o: { duration: 200 }
+            });
+        }
+        o && e.push({
+            e: o,
+            p: { opacity: 1 },
+            o: { duration: 200 }
+        }), 'Mist' === CONFIG.scheme && c && u && e.push(s(c, '100%'), s(u, '-100%')), 'Muse' === CONFIG.scheme && n && l(), i && e.push({
+            e: i,
+            p: {
+                opacity: 1,
+                top: 0
+            },
+            o: { duration: 200 }
+        }), r && e.push({
+            e: r,
+            p: {
+                opacity: 1,
+                top: 0
+            },
+            o: { duration: 200 }
+        }), 'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme || !n || l(), 0 < e.length ? (e[e.length - 1].o.complete = function () {
+            t.next();
+        }, Velocity.RunSequence(e)) : t.next(), CONFIG.motion.async && t.next();
+    },
+    menu: function (t) {
+        Velocity(document.querySelectorAll('.menu-item'), 'transition.slideDownIn', {
+            display: null,
+            duration: 200,
+            complete: function () {
+                t.next();
+            }
+        }), CONFIG.motion.async && t.next();
+    },
+    subMenu: function (t) {
+        var e = document.querySelectorAll('.sub-menu .menu-item');
+        0 < e.length && e.forEach(function (t) {
+            t.style.opacity = 1;
+        }), t.next();
+    },
+    postList: function (t) {
+        var e = document.querySelectorAll('.post-block, .pagination, .comments'), o = CONFIG.motion.transition.post_block, n = document.querySelectorAll('.post-header'), i = CONFIG.motion.transition.post_header, r = document.querySelectorAll('.post-body'), c = CONFIG.motion.transition.post_body, u = document.querySelectorAll('.collection-header'), s = CONFIG.motion.transition.coll_header;
+        if (0 < e.length) {
+            var l = window.postMotionOptions || {
+                stagger: 100,
+                drag: !0,
+                complete: function () {
+                    t.next();
+                }
+            };
+            CONFIG.motion.transition.post_block && Velocity(e, 'transition.' + o, l), CONFIG.motion.transition.post_header && Velocity(n, 'transition.' + i, l), CONFIG.motion.transition.post_body && Velocity(r, 'transition.' + c, l), CONFIG.motion.transition.coll_header && Velocity(u, 'transition.' + s, l);
         }
-      });
+        'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme || t.next();
+    },
+    sidebar: function (t) {
+        var e = document.querySelector('.sidebar-inner'), o = CONFIG.motion.transition.sidebar;
+        !o || 'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme || Velocity(e, 'transition.' + o, {
+            display: null,
+            duration: 200,
+            complete: function () {
+                e.style.transform = 'initial';
+            }
+        }), t.next();
     }
-    integrator.next();
-  }
-};
+};

+ 54 - 111
js/next-boot.js

@@ -1,114 +1,57 @@
-/* global NexT, CONFIG, Velocity */
-
-NexT.boot = {};
-
-NexT.boot.registerEvents = function() {
-
-  NexT.utils.registerScrollPercent();
-  NexT.utils.registerCanIUseTag();
-
-  // Mobile top menu bar.
-  document.querySelector('.site-nav-toggle .toggle').addEventListener('click', () => {
-    event.currentTarget.classList.toggle('toggle-close');
-    var siteNav = document.querySelector('.site-nav');
-    var animateAction = siteNav.classList.contains('site-nav-on') ? 'slideUp' : 'slideDown';
-
-    if (typeof Velocity === 'function') {
-      Velocity(siteNav, animateAction, {
-        duration: 200,
-        complete: function() {
-          siteNav.classList.toggle('site-nav-on');
-        }
-      });
-    } else {
-      siteNav.classList.toggle('site-nav-on');
+'use strict';
+function _toConsumableArray(e) {
+    if (Array.isArray(e)) {
+        for (var t = 0, i = Array(e.length); t < e.length; t++)
+            i[t] = e[t];
+        return i;
     }
-  });
-
-  var TAB_ANIMATE_DURATION = 200;
-  document.querySelectorAll('.sidebar-nav li').forEach((element, index) => {
-    element.addEventListener('click', event => {
-      var item = event.currentTarget;
-      var activeTabClassName = 'sidebar-nav-active';
-      var activePanelClassName = 'sidebar-panel-active';
-      if (item.classList.contains(activeTabClassName)) return;
-
-      var targets = document.querySelectorAll('.sidebar-panel');
-      var target = targets[index];
-      var currentTarget = targets[1 - index];
-      window.anime({
-        targets : currentTarget,
-        duration: TAB_ANIMATE_DURATION,
-        easing  : 'linear',
-        opacity : 0,
-        complete: () => {
-          // Prevent adding TOC to Overview if Overview was selected when close & open sidebar.
-          currentTarget.classList.remove(activePanelClassName);
-          target.style.opacity = 0;
-          target.classList.add(activePanelClassName);
-          window.anime({
-            targets : target,
-            duration: TAB_ANIMATE_DURATION,
-            easing  : 'linear',
-            opacity : 1
-          });
+    return Array.from(e);
+}
+NexT.boot = {}, NexT.boot.registerEvents = function () {
+    NexT.utils.registerScrollPercent(), NexT.utils.registerCanIUseTag(), document.querySelector('.site-nav-toggle .toggle').addEventListener('click', function () {
+        event.currentTarget.classList.toggle('toggle-close');
+        var e = document.querySelector('.site-nav'), t = e.classList.contains('site-nav-on') ? 'slideUp' : 'slideDown';
+        'function' == typeof Velocity ? Velocity(e, t, {
+            duration: 200,
+            complete: function () {
+                e.classList.toggle('site-nav-on');
+            }
+        }) : e.classList.toggle('site-nav-on');
+    });
+    document.querySelectorAll('.sidebar-nav li').forEach(function (e, s) {
+        e.addEventListener('click', function (e) {
+            var t = e.currentTarget, i = 'sidebar-nav-active', o = 'sidebar-panel-active';
+            if (!t.classList.contains(i)) {
+                var n = document.querySelectorAll('.sidebar-panel'), a = n[s], r = n[1 - s];
+                window.anime({
+                    targets: r,
+                    duration: 200,
+                    easing: 'linear',
+                    opacity: 0,
+                    complete: function () {
+                        r.classList.remove(o), a.style.opacity = 0, a.classList.add(o), window.anime({
+                            targets: a,
+                            duration: 200,
+                            easing: 'linear',
+                            opacity: 1
+                        });
+                    }
+                }), [].concat(_toConsumableArray(t.parentNode.children)).forEach(function (e) {
+                    e.classList.remove(i);
+                }), t.classList.add(i);
+            }
+        });
+    }), window.addEventListener('resize', NexT.utils.initSidebarDimension), window.addEventListener('hashchange', function () {
+        var e = location.hash;
+        if ('' !== e && !e.match(/%\S{2}/)) {
+            var t = document.querySelector('.tabs ul.nav-tabs li a[href="' + e + '"]');
+            t && t.click();
         }
-      });
-
-      [...item.parentNode.children].forEach(element => {
-        element.classList.remove(activeTabClassName);
-      });
-      item.classList.add(activeTabClassName);
     });
-  });
-
-  window.addEventListener('resize', NexT.utils.initSidebarDimension);
-
-  window.addEventListener('hashchange', () => {
-    var tHash = location.hash;
-    if (tHash !== '' && !tHash.match(/%\S{2}/)) {
-      var target = document.querySelector(`.tabs ul.nav-tabs li a[href="${tHash}"]`);
-      target && target.click();
-    }
-  });
-};
-
-NexT.boot.refresh = function() {
-
-  /**
-   * Register JS handlers by condition option.
-   * Need to add config option in Front-End at 'layout/_partials/head.swig' file.
-   */
-  CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox();
-  CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img');
-  CONFIG.lazyload && window.lozad('.post-body img').observe();
-  CONFIG.pangu && window.pangu.spacingPage();
-
-  CONFIG.exturl && NexT.utils.registerExtURL();
-  CONFIG.copycode.enable && NexT.utils.registerCopyCode();
-  NexT.utils.registerTabsTag();
-  NexT.utils.registerActiveMenuItem();
-  NexT.utils.registerLangSelect();
-  NexT.utils.registerSidebarTOC();
-  NexT.utils.wrapTableWithBox();
-  NexT.utils.registerVideoIframe();
-};
-
-NexT.boot.motion = function() {
-  // Define Motion Sequence & Bootstrap Motion.
-  if (CONFIG.motion.enable) {
-    NexT.motion.integrator
-      .add(NexT.motion.middleWares.logo)
-      .add(NexT.motion.middleWares.menu)
-      .add(NexT.motion.middleWares.postList)
-      .add(NexT.motion.middleWares.sidebar)
-      .bootstrap();
-  }
-  NexT.utils.updateSidebarPosition();
-};
-
-window.addEventListener('DOMContentLoaded', () => {
-  NexT.boot.registerEvents();
-  NexT.boot.refresh();
-  NexT.boot.motion();
-});
+}, NexT.boot.refresh = function () {
+    CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox(), CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img'), CONFIG.lazyload && window.lozad('.post-body img').observe(), CONFIG.pangu && window.pangu.spacingPage(), CONFIG.exturl && NexT.utils.registerExtURL(), CONFIG.copycode.enable && NexT.utils.registerCopyCode(), NexT.utils.registerTabsTag(), NexT.utils.registerActiveMenuItem(), NexT.utils.registerLangSelect(), NexT.utils.registerSidebarTOC(), NexT.utils.wrapTableWithBox(), NexT.utils.registerVideoIframe();
+}, NexT.boot.motion = function () {
+    CONFIG.motion.enable && NexT.motion.integrator.add(NexT.motion.middleWares.logo).add(NexT.motion.middleWares.menu).add(NexT.motion.middleWares.postList).add(NexT.motion.middleWares.sidebar).bootstrap(), NexT.utils.updateSidebarPosition();
+}, window.addEventListener('DOMContentLoaded', function () {
+    NexT.boot.registerEvents(), NexT.boot.refresh(), NexT.boot.motion();
+});

+ 52 - 157
js/trail.js

@@ -1,157 +1,52 @@
-	
-	/**
-	 * With love.
-	 * http://hakim.se/experiments/
-	 * http://twitter.com/hakimel
-	 */
-	
-	var SCREEN_WIDTH = window.innerWidth;
-	var SCREEN_HEIGHT = window.innerHeight;
-	
-	var RADIUS = 60;
-	
-	var RADIUS_SCALE = 1;
-	var RADIUS_SCALE_MIN = 1;
-	var RADIUS_SCALE_MAX = 1.5;
-	
-	// The number of particles that are used to generate the trail
-	var QUANTITY = 25;
-
-	var canvas;
-	var context;
-	var particles;
-	
-	var mouseX = SCREEN_WIDTH * 0.5;
-	var mouseY = SCREEN_HEIGHT * 0.5;
-	var mouseIsDown = false;
-
-	init();
-
-	function init() {
-
-		canvas = document.getElementById( 'world' );
-		
-		if (canvas && canvas.getContext) {
-			context = canvas.getContext('2d');
-			
-			document.addEventListener('mousemove', documentMouseMoveHandler, false);
-			document.addEventListener('mousedown', documentMouseDownHandler, false);
-			document.addEventListener('mouseup', documentMouseUpHandler, false);
-			document.addEventListener('touchstart', documentTouchStartHandler, false);
-			document.addEventListener('touchmove', documentTouchMoveHandler, false);
-			window.addEventListener('resize', windowResizeHandler, false);
-			
-			createParticles();
-			
-			windowResizeHandler();
-			
-			setInterval( loop, 1000 / 60 );
-		}
-	}
-
-	function createParticles() {
-		particles = [];
-		
-		for (var i = 0; i < QUANTITY; i++) {
-			var particle = {
-				position: { x: mouseX, y: mouseY },
-				shift: { x: mouseX, y: mouseY },
-				size: 1,
-				angle: 0,
-				speed: 0.01+Math.random()*0.04,
-				targetSize: 1,
-				fillColor: '#' + (Math.random() * 0x404040 + 0xaaaaaa | 0).toString(16),
-				orbit: RADIUS*.5 + (RADIUS * .5 * Math.random())
-			};
-			
-			particles.push( particle );
-		}
-	}
-	
-	function documentMouseMoveHandler(event) {
-		mouseX = event.clientX;
-		mouseY = event.clientY;
-	}
-	
-	function documentMouseDownHandler(event) {
-		mouseIsDown = true;
-	}
-	
-	function documentMouseUpHandler(event) {
-		mouseIsDown = false;
-	}
-
-	function documentTouchStartHandler(event) {
-		if(event.touches.length == 1) {
-			event.preventDefault();
-
-			mouseX = event.touches[0].pageX - (window.innerWidth - SCREEN_WIDTH) * .5;
-			mouseY = event.touches[0].pageY - (window.innerHeight - SCREEN_HEIGHT) * .5;
-		}
-	}
-	
-	function documentTouchMoveHandler(event) {
-		if(event.touches.length == 1) {
-			event.preventDefault();
-
-			mouseX = event.touches[0].pageX - (window.innerWidth - SCREEN_WIDTH) * .5;
-			mouseY = event.touches[0].pageY - (window.innerHeight - SCREEN_HEIGHT) * .5;
-		}
-	}
-	
-	function windowResizeHandler() {
-		SCREEN_WIDTH = window.innerWidth;
-		SCREEN_HEIGHT = window.innerHeight;
-		
-		canvas.width = SCREEN_WIDTH;
-		canvas.height = SCREEN_HEIGHT;
-	}
-	
-	function loop() {
-		
-		context.shadowBlur = 3;
-		
-		if( mouseIsDown ) {
-			// Scale upward to the max scale
-			RADIUS_SCALE += ( RADIUS_SCALE_MAX - RADIUS_SCALE ) * (0.02);
-		}
-		else {
-			// Scale downward to the min scale
-			RADIUS_SCALE -= ( RADIUS_SCALE - RADIUS_SCALE_MIN ) * (0.02);
-		}
-		
-		RADIUS_SCALE = Math.min( RADIUS_SCALE, RADIUS_SCALE_MAX );
-		
-		for (i = 0, len = particles.length; i < len; i++) {
-			var particle = particles[i];
-			
-			// Rotation
-			particle.angle += particle.speed;
-			
-			// Follow mouse with some lag
-			particle.shift.x += ( mouseX - particle.shift.x) * (particle.speed);
-			particle.shift.y += ( mouseY - particle.shift.y) * (particle.speed);
-			
-			// Apply position
-			particle.position.x = particle.shift.x + Math.cos(i + particle.angle) * (particle.orbit*RADIUS_SCALE);
-			particle.position.y = particle.shift.y + Math.sin(i + particle.angle) * (particle.orbit*RADIUS_SCALE);
-			
-			// Limit to screen bounds
-			particle.position.x = Math.max( Math.min( particle.position.x, SCREEN_WIDTH ), 0 );
-			particle.position.y = Math.max( Math.min( particle.position.y, SCREEN_HEIGHT ), 0 );
-			
-			particle.size += ( particle.targetSize - particle.size ) * 0.05;
-			
-			if( Math.round( particle.size ) == Math.round( particle.targetSize ) ) {
-				particle.targetSize = 1 + Math.random() * 7;
-			}
-			
-			context.beginPath();
-			context.fillStyle = particle.fillColor;;
-			context.moveTo(particle.position.x, particle.position.y);
-			context.arc(particle.position.x, particle.position.y, particle.size, 0, Math.PI*2, true);
-			context.fill();
-		}
-	}
-	
-	
+'use strict';
+var canvas, context, particles, SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight, RADIUS = 60, RADIUS_SCALE = 1, RADIUS_SCALE_MIN = 1, RADIUS_SCALE_MAX = 1.5, QUANTITY = 25, mouseX = 0.5 * SCREEN_WIDTH, mouseY = 0.5 * SCREEN_HEIGHT, mouseIsDown = !1;
+function init() {
+    (canvas = document.getElementById('world')) && canvas.getContext && (context = canvas.getContext('2d'), document.addEventListener('mousemove', documentMouseMoveHandler, !1), document.addEventListener('mousedown', documentMouseDownHandler, !1), document.addEventListener('mouseup', documentMouseUpHandler, !1), document.addEventListener('touchstart', documentTouchStartHandler, !1), document.addEventListener('touchmove', documentTouchMoveHandler, !1), window.addEventListener('resize', windowResizeHandler, !1), createParticles(), windowResizeHandler(), setInterval(loop, 1000 / 60));
+}
+function createParticles() {
+    particles = [];
+    for (var e = 0; e < QUANTITY; e++) {
+        var t = {
+            position: {
+                x: mouseX,
+                y: mouseY
+            },
+            shift: {
+                x: mouseX,
+                y: mouseY
+            },
+            size: 1,
+            angle: 0,
+            speed: 0.01 + 0.04 * Math.random(),
+            targetSize: 1,
+            fillColor: '#' + (4210752 * Math.random() + 11184810 | 0).toString(16),
+            orbit: 0.5 * RADIUS + 0.5 * RADIUS * Math.random()
+        };
+        particles.push(t);
+    }
+}
+function documentMouseMoveHandler(e) {
+    mouseX = e.clientX, mouseY = e.clientY;
+}
+function documentMouseDownHandler(e) {
+    mouseIsDown = !0;
+}
+function documentMouseUpHandler(e) {
+    mouseIsDown = !1;
+}
+function documentTouchStartHandler(e) {
+    1 == e.touches.length && (e.preventDefault(), mouseX = e.touches[0].pageX - 0.5 * (window.innerWidth - SCREEN_WIDTH), mouseY = e.touches[0].pageY - 0.5 * (window.innerHeight - SCREEN_HEIGHT));
+}
+function documentTouchMoveHandler(e) {
+    1 == e.touches.length && (e.preventDefault(), mouseX = e.touches[0].pageX - 0.5 * (window.innerWidth - SCREEN_WIDTH), mouseY = e.touches[0].pageY - 0.5 * (window.innerHeight - SCREEN_HEIGHT));
+}
+function windowResizeHandler() {
+    SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight, canvas.width = SCREEN_WIDTH, canvas.height = SCREEN_HEIGHT;
+}
+function loop() {
+    for (context.shadowBlur = 3, mouseIsDown ? RADIUS_SCALE += 0.02 * (RADIUS_SCALE_MAX - RADIUS_SCALE) : RADIUS_SCALE -= 0.02 * (RADIUS_SCALE - RADIUS_SCALE_MIN), RADIUS_SCALE = Math.min(RADIUS_SCALE, RADIUS_SCALE_MAX), i = 0, len = particles.length; i < len; i++) {
+        var e = particles[i];
+        e.angle += e.speed, e.shift.x += (mouseX - e.shift.x) * e.speed, e.shift.y += (mouseY - e.shift.y) * e.speed, e.position.x = e.shift.x + Math.cos(i + e.angle) * (e.orbit * RADIUS_SCALE), e.position.y = e.shift.y + Math.sin(i + e.angle) * (e.orbit * RADIUS_SCALE), e.position.x = Math.max(Math.min(e.position.x, SCREEN_WIDTH), 0), e.position.y = Math.max(Math.min(e.position.y, SCREEN_HEIGHT), 0), e.size += 0.05 * (e.targetSize - e.size), Math.round(e.size) == Math.round(e.targetSize) && (e.targetSize = 1 + 7 * Math.random()), context.beginPath(), context.fillStyle = e.fillColor, context.moveTo(e.position.x, e.position.y), context.arc(e.position.x, e.position.y, e.size, 0, 2 * Math.PI, !0), context.fill();
+    }
+}
+init();

+ 230 - 408
js/utils.js

@@ -1,413 +1,235 @@
-/* global NexT, CONFIG */
-
-HTMLElement.prototype.wrap = function(wrapper) {
-  this.parentNode.insertBefore(wrapper, this);
-  this.parentNode.removeChild(this);
-  wrapper.appendChild(this);
-};
-
-NexT.utils = {
-
-  /**
-   * Wrap images with fancybox.
-   */
-  wrapImageWithFancyBox: function() {
-    document.querySelectorAll('.post-body :not(a) > img, .post-body > img').forEach(element => {
-      var $image = $(element);
-      var imageLink = $image.attr('data-src') || $image.attr('src');
-      var $imageWrapLink = $image.wrap(`<a class="fancybox fancybox.image" href="${imageLink}" itemscope itemtype="http://schema.org/ImageObject" itemprop="url"></a>`).parent('a');
-      if ($image.is('.post-gallery img')) {
-        $imageWrapLink.attr('data-fancybox', 'gallery').attr('rel', 'gallery');
-      } else if ($image.is('.group-picture img')) {
-        $imageWrapLink.attr('data-fancybox', 'group').attr('rel', 'group');
-      } else {
-        $imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default');
-      }
-
-      var imageTitle = $image.attr('title') || $image.attr('alt');
-      if (imageTitle) {
-        $imageWrapLink.append(`<p class="image-caption">${imageTitle}</p>`);
-        // Make sure img title tag will show correctly in fancybox
-        $imageWrapLink.attr('title', imageTitle).attr('data-caption', imageTitle);
-      }
-    });
-
-    $.fancybox.defaults.hash = false;
-    $('.fancybox').fancybox({
-      loop   : true,
-      helpers: {
-        overlay: {
-          locked: false
-        }
-      }
-    });
-  },
-
-  registerExtURL: function() {
-    document.querySelectorAll('span.exturl').forEach(element => {
-      let link = document.createElement('a');
-      // https://stackoverflow.com/questions/30106476/using-javascripts-atob-to-decode-base64-doesnt-properly-decode-utf-8-strings
-      link.href = decodeURIComponent(atob(element.dataset.url).split('').map(c => {
-        return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
-      }).join(''));
-      link.rel = 'noopener external nofollow noreferrer';
-      link.target = '_blank';
-      link.className = element.className;
-      link.innerHTML = element.innerHTML;
-      element.parentNode.replaceChild(link, element);
-    });
-  },
-
-  /**
-   * One-click copy code support.
-   */
-  registerCopyCode: function() {
-    document.querySelectorAll('figure.highlight').forEach(element => {
-      const box = document.createElement('div');
-      element.wrap(box);
-      box.classList.add('highlight-container');
-      box.insertAdjacentHTML('beforeend', '<div class="copy-btn"><i class="fa fa-clipboard"></i></div>');
-      var button = element.parentNode.querySelector('.copy-btn');
-      button.addEventListener('click', event => {
-        var target = event.currentTarget;
-        var code = [...target.parentNode.querySelectorAll('.code .line')].map(line => line.innerText).join('\n');
-        var ta = document.createElement('textarea');
-        ta.style.top = window.scrollY + 'px'; // Prevent page scrolling
-        ta.style.position = 'absolute';
-        ta.style.opacity = '0';
-        ta.readOnly = true;
-        ta.value = code;
-        document.body.append(ta);
-        const selection = document.getSelection();
-        const selected = selection.rangeCount > 0 ? selection.getRangeAt(0) : false;
-        ta.select();
-        ta.setSelectionRange(0, code.length);
-        ta.readOnly = false;
-        var result = document.execCommand('copy');
-        if (CONFIG.copycode.show_result) {
-          target.querySelector('i').className = result ? 'fa fa-check' : 'fa fa-times';
-        }
-        ta.blur(); // For iOS
-        target.blur();
-        if (selected) {
-          selection.removeAllRanges();
-          selection.addRange(selected);
-        }
-        document.body.removeChild(ta);
-      });
-      button.addEventListener('mouseleave', event => {
-        setTimeout(() => {
-          event.target.querySelector('i').className = 'fa fa-clipboard';
-        }, 300);
-      });
-    });
-  },
-
-  wrapTableWithBox: function() {
-    document.querySelectorAll('table').forEach(element => {
-      const box = document.createElement('div');
-      box.className = 'table-container';
-      element.wrap(box);
-    });
-  },
-
-  registerVideoIframe: function() {
-    document.querySelectorAll('iframe').forEach(element => {
-      const supported = [
-        'www.youtube.com',
-        'player.vimeo.com',
-        'player.youku.com',
-        'player.bilibili.com',
-        'www.tudou.com'
-      ].some(host => element.src.includes(host));
-      if (supported && !element.parentNode.matches('.video-container')) {
-        const box = document.createElement('div');
-        box.className = 'video-container';
-        element.wrap(box);
-        let width = Number(element.width);
-        let height = Number(element.height);
-        if (width && height) {
-          element.parentNode.style.paddingTop = (height / width * 100) + '%';
-        }
-      }
-    });
-  },
-
-  registerScrollPercent: function() {
-    var THRESHOLD = 50;
-    var backToTop = document.querySelector('.back-to-top');
-    var readingProgressBar = document.querySelector('.reading-progress-bar');
-    // For init back to top in sidebar if page was scrolled after page refresh.
-    window.addEventListener('scroll', () => {
-      if (backToTop || readingProgressBar) {
-        var docHeight = document.querySelector('.container').offsetHeight;
-        var winHeight = window.innerHeight;
-        var contentVisibilityHeight = docHeight > winHeight ? docHeight - winHeight : document.body.scrollHeight - winHeight;
-        var scrollPercent = Math.min(100 * window.scrollY / contentVisibilityHeight, 100);
-        if (backToTop) {
-          backToTop.classList.toggle('back-to-top-on', window.scrollY > THRESHOLD);
-          backToTop.querySelector('span').innerText = Math.round(scrollPercent) + '%';
-        }
-        if (readingProgressBar) {
-          readingProgressBar.style.width = scrollPercent.toFixed(2) + '%';
-        }
-      }
-    });
-
-    backToTop && backToTop.addEventListener('click', () => {
-      window.anime({
-        targets  : document.scrollingElement,
-        duration : 500,
-        easing   : 'linear',
-        scrollTop: 0
-      });
-    });
-  },
-
-  /**
-   * Tabs tag listener (without twitter bootstrap).
-   */
-  registerTabsTag: function() {
-    // Binding `nav-tabs` & `tab-content` by real time permalink changing.
-    document.querySelectorAll('.tabs ul.nav-tabs .tab').forEach(element => {
-      element.addEventListener('click', event => {
-        event.preventDefault();
-        var target = event.currentTarget;
-        // Prevent selected tab to select again.
-        if (!target.classList.contains('active')) {
-          // Add & Remove active class on `nav-tabs` & `tab-content`.
-          [...target.parentNode.children].forEach(element => {
-            element.classList.remove('active');
-          });
-          target.classList.add('active');
-          var tActive = document.getElementById(target.querySelector('a').getAttribute('href').replace('#', ''));
-          [...tActive.parentNode.children].forEach(element => {
-            element.classList.remove('active');
-          });
-          tActive.classList.add('active');
-          // Trigger event
-          tActive.dispatchEvent(new Event('tabs:click', {
-            bubbles: true
-          }));
-        }
-      });
-    });
-
-    window.dispatchEvent(new Event('tabs:register'));
-  },
-
-  registerCanIUseTag: function() {
-    // Get responsive height passed from iframe.
-    window.addEventListener('message', ({ data }) => {
-      if ((typeof data === 'string') && data.includes('ciu_embed')) {
-        var featureID = data.split(':')[1];
-        var height = data.split(':')[2];
-        document.querySelector(`iframe[data-feature=${featureID}]`).style.height = parseInt(height, 10) + 5 + 'px';
-      }
-    }, false);
-  },
-
-  registerActiveMenuItem: function() {
-    document.querySelectorAll('.menu-item').forEach(element => {
-      var target = element.querySelector('a[href]');
-      if (!target) return;
-      var isSamePath = target.pathname === location.pathname || target.pathname === location.pathname.replace('index.html', '');
-      var isSubPath = !CONFIG.root.startsWith(target.pathname) && location.pathname.startsWith(target.pathname);
-      element.classList.toggle('menu-item-active', target.hostname === location.hostname && (isSamePath || isSubPath));
-    });
-  },
-
-  registerLangSelect: function() {
-    let sel = document.querySelector('.lang-select');
-    if (!sel) return;
-    sel.value = CONFIG.page.lang;
-    sel.addEventListener('change', () => {
-      let target = sel.options[sel.selectedIndex];
-      document.querySelector('.lang-select-label span').innerText = target.text;
-      let url = target.dataset.href;
-      window.pjax ? window.pjax.loadUrl(url) : window.location.href = url;
-    });
-  },
-
-  registerSidebarTOC: function() {
-    const navItems = document.querySelectorAll('.post-toc li');
-    const sections = [...navItems].map(element => {
-      var link = element.querySelector('a.nav-link');
-      // TOC item animation navigate.
-      link.addEventListener('click', event => {
-        event.preventDefault();
-        var target = document.getElementById(event.currentTarget.getAttribute('href').replace('#', ''));
-        var offset = target.getBoundingClientRect().top + window.scrollY;
-        window.anime({
-          targets  : document.scrollingElement,
-          duration : 500,
-          easing   : 'linear',
-          scrollTop: offset + 10
-        });
-      });
-      return document.getElementById(link.getAttribute('href').replace('#', ''));
-    });
-
-    var tocElement = document.querySelector('.post-toc-wrap');
-    function activateNavByIndex(target) {
-      if (target.classList.contains('active-current')) return;
-
-      document.querySelectorAll('.post-toc .active').forEach(element => {
-        element.classList.remove('active', 'active-current');
-      });
-      target.classList.add('active', 'active-current');
-      var parent = target.parentNode;
-      while (!parent.matches('.post-toc')) {
-        if (parent.matches('li')) parent.classList.add('active');
-        parent = parent.parentNode;
-      }
-      // Scrolling to center active TOC element if TOC content is taller then viewport.
-      window.anime({
-        targets  : tocElement,
-        duration : 200,
-        easing   : 'linear',
-        scrollTop: tocElement.scrollTop - (tocElement.offsetHeight / 2) + target.getBoundingClientRect().top - tocElement.getBoundingClientRect().top
-      });
+'use strict';
+function _toConsumableArray(e) {
+    if (Array.isArray(e)) {
+        for (var t = 0, n = Array(e.length); t < e.length; t++)
+            n[t] = e[t];
+        return n;
     }
-
-    function findIndex(entries) {
-      let index = 0;
-      let entry = entries[index];
-      if (entry.boundingClientRect.top > 0) {
-        index = sections.indexOf(entry.target);
-        return index === 0 ? 0 : index - 1;
-      }
-      for (; index < entries.length; index++) {
-        if (entries[index].boundingClientRect.top <= 0) {
-          entry = entries[index];
-        } else {
-          return sections.indexOf(entry.target);
+    return Array.from(e);
+}
+HTMLElement.prototype.wrap = function (e) {
+    this.parentNode.insertBefore(e, this), this.parentNode.removeChild(this), e.appendChild(this);
+}, NexT.utils = {
+    wrapImageWithFancyBox: function () {
+        document.querySelectorAll('.post-body :not(a) > img, .post-body > img').forEach(function (e) {
+            var t = $(e), n = t.attr('data-src') || t.attr('src'), a = t.wrap('<a class="fancybox fancybox.image" href="' + n + '" itemscope itemtype="http://schema.org/ImageObject" itemprop="url"></a>').parent('a');
+            t.is('.post-gallery img') ? a.attr('data-fancybox', 'gallery').attr('rel', 'gallery') : t.is('.group-picture img') ? a.attr('data-fancybox', 'group').attr('rel', 'group') : a.attr('data-fancybox', 'default').attr('rel', 'default');
+            var r = t.attr('title') || t.attr('alt');
+            r && (a.append('<p class="image-caption">' + r + '</p>'), a.attr('title', r).attr('data-caption', r));
+        }), $.fancybox.defaults.hash = !1, $('.fancybox').fancybox({
+            loop: !0,
+            helpers: { overlay: { locked: !1 } }
+        });
+    },
+    registerExtURL: function () {
+        document.querySelectorAll('span.exturl').forEach(function (e) {
+            var t = document.createElement('a');
+            t.href = decodeURIComponent(atob(e.dataset.url).split('').map(function (e) {
+                return '%' + ('00' + e.charCodeAt(0).toString(16)).slice(-2);
+            }).join('')), t.rel = 'noopener external nofollow noreferrer', t.target = '_blank', t.className = e.className, t.innerHTML = e.innerHTML, e.parentNode.replaceChild(t, e);
+        });
+    },
+    registerCopyCode: function () {
+        document.querySelectorAll('figure.highlight').forEach(function (e) {
+            var t = document.createElement('div');
+            e.wrap(t), t.classList.add('highlight-container'), t.insertAdjacentHTML('beforeend', '<div class="copy-btn"><i class="fa fa-clipboard"></i></div>');
+            var n = e.parentNode.querySelector('.copy-btn');
+            n.addEventListener('click', function (e) {
+                var t = e.currentTarget, n = [].concat(_toConsumableArray(t.parentNode.querySelectorAll('.code .line'))).map(function (e) {
+                        return e.innerText;
+                    }).join('\n'), a = document.createElement('textarea');
+                a.style.top = window.scrollY + 'px', a.style.position = 'absolute', a.style.opacity = '0', a.readOnly = !0, a.value = n, document.body.append(a);
+                var r = document.getSelection(), o = 0 < r.rangeCount && r.getRangeAt(0);
+                a.select(), a.setSelectionRange(0, n.length), a.readOnly = !1;
+                var i = document.execCommand('copy');
+                CONFIG.copycode.show_result && (t.querySelector('i').className = i ? 'fa fa-check' : 'fa fa-times'), a.blur(), t.blur(), o && (r.removeAllRanges(), r.addRange(o)), document.body.removeChild(a);
+            }), n.addEventListener('mouseleave', function (e) {
+                setTimeout(function () {
+                    e.target.querySelector('i').className = 'fa fa-clipboard';
+                }, 300);
+            });
+        });
+    },
+    wrapTableWithBox: function () {
+        document.querySelectorAll('table').forEach(function (e) {
+            var t = document.createElement('div');
+            t.className = 'table-container', e.wrap(t);
+        });
+    },
+    registerVideoIframe: function () {
+        document.querySelectorAll('iframe').forEach(function (t) {
+            if (["www.youtube.com","player.vimeo.com","player.youku.com","player.bilibili.com","www.tudou.com"].some(function (e) {
+                    return t.src.includes(e);
+                }) && !t.parentNode.matches('.video-container')) {
+                var e = document.createElement('div');
+                e.className = 'video-container', t.wrap(e);
+                var n = Number(t.width), a = Number(t.height);
+                n && a && (t.parentNode.style.paddingTop = a / n * 100 + '%');
+            }
+        });
+    },
+    registerScrollPercent: function () {
+        var r = document.querySelector('.back-to-top'), o = document.querySelector('.reading-progress-bar');
+        window.addEventListener('scroll', function () {
+            if (r || o) {
+                var e = document.querySelector('.container').offsetHeight, t = window.innerHeight, n = t < e ? e - t : document.body.scrollHeight - t, a = Math.min(100 * window.scrollY / n, 100);
+                r && (r.classList.toggle('back-to-top-on', 50 < window.scrollY), r.querySelector('span').innerText = Math.round(a) + '%'), o && (o.style.width = a.toFixed(2) + '%');
+            }
+        }), r && r.addEventListener('click', function () {
+            window.anime({
+                targets: document.scrollingElement,
+                duration: 500,
+                easing: 'linear',
+                scrollTop: 0
+            });
+        });
+    },
+    registerTabsTag: function () {
+        document.querySelectorAll('.tabs ul.nav-tabs .tab').forEach(function (e) {
+            e.addEventListener('click', function (e) {
+                e.preventDefault();
+                var t = e.currentTarget;
+                if (!t.classList.contains('active')) {
+                    [].concat(_toConsumableArray(t.parentNode.children)).forEach(function (e) {
+                        e.classList.remove('active');
+                    }), t.classList.add('active');
+                    var n = document.getElementById(t.querySelector('a').getAttribute('href').replace('#', ''));
+                    [].concat(_toConsumableArray(n.parentNode.children)).forEach(function (e) {
+                        e.classList.remove('active');
+                    }), n.classList.add('active'), n.dispatchEvent(new Event('tabs:click', { bubbles: !0 }));
+                }
+            });
+        }), window.dispatchEvent(new Event('tabs:register'));
+    },
+    registerCanIUseTag: function () {
+        window.addEventListener('message', function (e) {
+            var t = e.data;
+            if ('string' == typeof t && t.includes('ciu_embed')) {
+                var n = t.split(':')[1], a = t.split(':')[2];
+                document.querySelector('iframe[data-feature=' + n + ']').style.height = parseInt(a, 10) + 5 + 'px';
+            }
+        }, !1);
+    },
+    registerActiveMenuItem: function () {
+        document.querySelectorAll('.menu-item').forEach(function (e) {
+            var t = e.querySelector('a[href]');
+            if (t) {
+                var n = t.pathname === location.pathname || t.pathname === location.pathname.replace('index.html', ''), a = !CONFIG.root.startsWith(t.pathname) && location.pathname.startsWith(t.pathname);
+                e.classList.toggle('menu-item-active', t.hostname === location.hostname && (n || a));
+            }
+        });
+    },
+    registerLangSelect: function () {
+        var n = document.querySelector('.lang-select');
+        n && (n.value = CONFIG.page.lang, n.addEventListener('change', function () {
+            var e = n.options[n.selectedIndex];
+            document.querySelector('.lang-select-label span').innerText = e.text;
+            var t = e.dataset.href;
+            window.pjax ? window.pjax.loadUrl(t) : window.location.href = t;
+        }));
+    },
+    registerSidebarTOC: function () {
+        var i = document.querySelectorAll('.post-toc li'), c = [].concat(_toConsumableArray(i)).map(function (e) {
+                var t = e.querySelector('a.nav-link');
+                return t.addEventListener('click', function (e) {
+                    e.preventDefault();
+                    var t = document.getElementById(e.currentTarget.getAttribute('href').replace('#', '')).getBoundingClientRect().top + window.scrollY;
+                    window.anime({
+                        targets: document.scrollingElement,
+                        duration: 500,
+                        easing: 'linear',
+                        scrollTop: t + 10
+                    });
+                }), document.getElementById(t.getAttribute('href').replace('#', ''));
+            }), l = document.querySelector('.post-toc-wrap');
+        !function r(o) {
+            o = Math.floor(o + 10000);
+            var t = new IntersectionObserver(function (e, t) {
+                var n = document.documentElement.scrollHeight + 100;
+                if (o < n)
+                    return t.disconnect(), void r(n);
+                var a = function (e) {
+                    var t = 0, n = e[t];
+                    if (0 < n.boundingClientRect.top)
+                        return 0 === (t = c.indexOf(n.target)) ? 0 : t - 1;
+                    for (; t < e.length; t++) {
+                        if (!(e[t].boundingClientRect.top <= 0))
+                            return c.indexOf(n.target);
+                        n = e[t];
+                    }
+                    return c.indexOf(n.target);
+                }(e);
+                !function (e) {
+                    if (!e.classList.contains('active-current')) {
+                        document.querySelectorAll('.post-toc .active').forEach(function (e) {
+                            e.classList.remove('active', 'active-current');
+                        }), e.classList.add('active', 'active-current');
+                        for (var t = e.parentNode; !t.matches('.post-toc');)
+                            t.matches('li') && t.classList.add('active'), t = t.parentNode;
+                        window.anime({
+                            targets: l,
+                            duration: 200,
+                            easing: 'linear',
+                            scrollTop: l.scrollTop - l.offsetHeight / 2 + e.getBoundingClientRect().top - l.getBoundingClientRect().top
+                        });
+                    }
+                }(i[a]);
+            }, {
+                rootMargin: o + 'px 0px -100% 0px',
+                threshold: 0
+            });
+            c.forEach(function (e) {
+                e && t.observe(e);
+            });
+        }(document.documentElement.scrollHeight);
+    },
+    hasMobileUA: function () {
+        var e = navigator.userAgent;
+        return /iPad|iPhone|Android|Opera Mini|BlackBerry|webOS|UCWEB|Blazer|PSP|IEMobile|Symbian/g.test(e);
+    },
+    isTablet: function () {
+        return window.screen.width < 992 && 767 < window.screen.width && this.hasMobileUA();
+    },
+    isMobile: function () {
+        return window.screen.width < 767 && this.hasMobileUA();
+    },
+    isDesktop: function () {
+        return !this.isTablet() && !this.isMobile();
+    },
+    supportsPDFs: function () {
+        var e = navigator.userAgent, t = e.includes('irefox') && 18 < parseInt(e.split('rv:')[1].split('.')[0], 10), n = void 0 !== navigator.mimeTypes['application/pdf'], a = /iphone|ipad|ipod/i.test(e.toLowerCase());
+        return t || n && !a;
+    },
+    initSidebarDimension: function () {
+        var e = document.querySelector('.sidebar-nav'), t = 'none' !== e.style.display ? e.offsetHeight : 0, n = CONFIG.sidebar.offset || 12, a = CONFIG.back2top.enable && CONFIG.back2top.sidebar ? document.querySelector('.back-to-top').offsetHeight : 0, r = 2 * CONFIG.sidebar.padding + t + a;
+        'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme || (r += 2 * n - 22);
+        var o = document.body.offsetHeight - r + 'px';
+        document.querySelector('.site-overview-wrap').style.maxHeight = o, document.querySelector('.post-toc-wrap').style.maxHeight = o;
+    },
+    updateSidebarPosition: function () {
+        var e = document.querySelector('.sidebar-nav'), t = document.querySelector('.post-toc');
+        if (t ? (e.style.display = '', e.classList.add('motion-element'), document.querySelector('.sidebar-nav-toc').click()) : (e.style.display = 'none', e.classList.remove('motion-element'), document.querySelector('.sidebar-nav-overview').click()), NexT.utils.initSidebarDimension(), this.isDesktop() && 'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme) {
+            var n = CONFIG.page.sidebar;
+            'boolean' != typeof n && (n = 'always' === CONFIG.sidebar.display || 'post' === CONFIG.sidebar.display && t), n && window.dispatchEvent(new Event('sidebar:show'));
         }
-      }
-      return sections.indexOf(entry.target);
-    }
-
-    function createIntersectionObserver(marginTop) {
-      marginTop = Math.floor(marginTop + 10000);
-      let intersectionObserver = new IntersectionObserver((entries, observe) => {
-        let scrollHeight = document.documentElement.scrollHeight + 100;
-        if (scrollHeight > marginTop) {
-          observe.disconnect();
-          createIntersectionObserver(scrollHeight);
-          return;
+    },
+    getScript: function (e, n, t) {
+        if (t)
+            n();
+        else {
+            var a = document.createElement('script');
+            a.onload = a.onreadystatechange = function (e, t) {
+                !t && a.readyState && !/loaded|complete/.test(a.readyState) || (a.onload = a.onreadystatechange = null, a = void 0, !t && n && setTimeout(n, 0));
+            }, a.src = e, document.head.appendChild(a);
         }
-        let index = findIndex(entries);
-        activateNavByIndex(navItems[index]);
-      }, {
-        rootMargin: marginTop + 'px 0px -100% 0px',
-        threshold : 0
-      });
-      sections.forEach(element => {
-        element && intersectionObserver.observe(element);
-      });
-    }
-    createIntersectionObserver(document.documentElement.scrollHeight);
-  },
-
-  hasMobileUA: function() {
-    let ua = navigator.userAgent;
-    let pa = /iPad|iPhone|Android|Opera Mini|BlackBerry|webOS|UCWEB|Blazer|PSP|IEMobile|Symbian/g;
-    return pa.test(ua);
-  },
-
-  isTablet: function() {
-    return window.screen.width < 992 && window.screen.width > 767 && this.hasMobileUA();
-  },
-
-  isMobile: function() {
-    return window.screen.width < 767 && this.hasMobileUA();
-  },
-
-  isDesktop: function() {
-    return !this.isTablet() && !this.isMobile();
-  },
-
-  supportsPDFs: function() {
-    let ua = navigator.userAgent;
-    let isFirefoxWithPDFJS = ua.includes('irefox') && parseInt(ua.split('rv:')[1].split('.')[0], 10) > 18;
-    let supportsPdfMimeType = typeof navigator.mimeTypes['application/pdf'] !== 'undefined';
-    let isIOS = /iphone|ipad|ipod/i.test(ua.toLowerCase());
-    return isFirefoxWithPDFJS || (supportsPdfMimeType && !isIOS);
-  },
-
-  /**
-   * Init Sidebar & TOC inner dimensions on all pages and for all schemes.
-   * Need for Sidebar/TOC inner scrolling if content taller then viewport.
-   */
-  initSidebarDimension: function() {
-    var sidebarNav = document.querySelector('.sidebar-nav');
-    var sidebarNavHeight = sidebarNav.style.display !== 'none' ? sidebarNav.offsetHeight : 0;
-    var sidebarOffset = CONFIG.sidebar.offset || 12;
-    var sidebarb2tHeight = CONFIG.back2top.enable && CONFIG.back2top.sidebar ? document.querySelector('.back-to-top').offsetHeight : 0;
-    var sidebarSchemePadding = (CONFIG.sidebar.padding * 2) + sidebarNavHeight + sidebarb2tHeight;
-    // Margin of sidebar b2t: -4px -10px -18px, brings a different of 22px.
-    if (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') sidebarSchemePadding += (sidebarOffset * 2) - 22;
-    // Initialize Sidebar & TOC Height.
-    var sidebarWrapperHeight = document.body.offsetHeight - sidebarSchemePadding + 'px';
-    document.querySelector('.site-overview-wrap').style.maxHeight = sidebarWrapperHeight;
-    document.querySelector('.post-toc-wrap').style.maxHeight = sidebarWrapperHeight;
-  },
-
-  updateSidebarPosition: function() {
-    var sidebarNav = document.querySelector('.sidebar-nav');
-    var hasTOC = document.querySelector('.post-toc');
-    if (hasTOC) {
-      sidebarNav.style.display = '';
-      sidebarNav.classList.add('motion-element');
-      document.querySelector('.sidebar-nav-toc').click();
-    } else {
-      sidebarNav.style.display = 'none';
-      sidebarNav.classList.remove('motion-element');
-      document.querySelector('.sidebar-nav-overview').click();
-    }
-    NexT.utils.initSidebarDimension();
-    if (!this.isDesktop() || CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') return;
-    // Expand sidebar on post detail page by default, when post has a toc.
-    var display = CONFIG.page.sidebar;
-    if (typeof display !== 'boolean') {
-      // There's no definition sidebar in the page front-matter.
-      display = CONFIG.sidebar.display === 'always' || (CONFIG.sidebar.display === 'post' && hasTOC);
-    }
-    if (display) {
-      window.dispatchEvent(new Event('sidebar:show'));
-    }
-  },
-
-  getScript: function(url, callback, condition) {
-    if (condition) {
-      callback();
-    } else {
-      var script = document.createElement('script');
-      script.onload = script.onreadystatechange = function(_, isAbort) {
-        if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) {
-          script.onload = script.onreadystatechange = null;
-          script = undefined;
-          if (!isAbort && callback) setTimeout(callback, 0);
+    },
+    loadComments: function (e, n) {
+        if (CONFIG.comments.lazyload && e) {
+            var t = new IntersectionObserver(function (e, t) {
+                e[0].isIntersecting && (n(), t.disconnect());
+            });
+            return t.observe(e), t;
         }
-      };
-      script.src = url;
-      document.head.appendChild(script);
-    }
-  },
-
-  loadComments: function(element, callback) {
-    if (!CONFIG.comments.lazyload || !element) {
-      callback();
-      return;
+        n();
     }
-    let intersectionObserver = new IntersectionObserver((entries, observer) => {
-      let entry = entries[0];
-      if (entry.isIntersecting) {
-        callback();
-        observer.disconnect();
-      }
-    });
-    intersectionObserver.observe(element);
-    return intersectionObserver;
-  }
-};
+};

+ 0 - 103
motion.js

@@ -1,103 +0,0 @@
-'use strict';
-window.$ && window.$.Velocity && (window.Velocity = window.$.Velocity), NexT.motion = {}, NexT.motion.integrator = {
-    queue: [],
-    cursor: -1,
-    init: function () {
-        return this.queue = [], this.cursor = -1, this;
-    },
-    add: function (t) {
-        return this.queue.push(t), this;
-    },
-    next: function () {
-        this.cursor++;
-        var t = this.queue[this.cursor];
-        'function' == typeof t && t(NexT.motion.integrator);
-    },
-    bootstrap: function () {
-        this.next();
-    }
-}, NexT.motion.middleWares = {
-    logo: function (t) {
-        var e = [], o = document.querySelector('.brand'), n = document.querySelector('.custom-logo-image'), i = document.querySelector('.site-title'), r = document.querySelector('.site-subtitle'), c = document.querySelector('.logo-line-before i'), u = document.querySelector('.logo-line-after i');
-        function s(t, e) {
-            return {
-                e: t,
-                p: { translateX: e },
-                o: {
-                    duration: 500,
-                    sequenceQueue: !1
-                }
-            };
-        }
-        function l() {
-            e.push({
-                e: n,
-                p: {
-                    opacity: 1,
-                    top: 0
-                },
-                o: { duration: 200 }
-            });
-        }
-        o && e.push({
-            e: o,
-            p: { opacity: 1 },
-            o: { duration: 200 }
-        }), 'Mist' === CONFIG.scheme && c && u && e.push(s(c, '100%'), s(u, '-100%')), 'Muse' === CONFIG.scheme && n && l(), i && e.push({
-            e: i,
-            p: {
-                opacity: 1,
-                top: 0
-            },
-            o: { duration: 200 }
-        }), r && e.push({
-            e: r,
-            p: {
-                opacity: 1,
-                top: 0
-            },
-            o: { duration: 200 }
-        }), 'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme || !n || l(), 0 < e.length ? (e[e.length - 1].o.complete = function () {
-            t.next();
-        }, Velocity.RunSequence(e)) : t.next(), CONFIG.motion.async && t.next();
-    },
-    menu: function (t) {
-        Velocity(document.querySelectorAll('.menu-item'), 'transition.slideDownIn', {
-            display: null,
-            duration: 200,
-            complete: function () {
-                t.next();
-            }
-        }), CONFIG.motion.async && t.next();
-    },
-    subMenu: function (t) {
-        var e = document.querySelectorAll('.sub-menu .menu-item');
-        0 < e.length && e.forEach(function (t) {
-            t.style.opacity = 1;
-        }), t.next();
-    },
-    postList: function (t) {
-        var e = document.querySelectorAll('.post-block, .pagination, .comments'), o = CONFIG.motion.transition.post_block, n = document.querySelectorAll('.post-header'), i = CONFIG.motion.transition.post_header, r = document.querySelectorAll('.post-body'), c = CONFIG.motion.transition.post_body, u = document.querySelectorAll('.collection-header'), s = CONFIG.motion.transition.coll_header;
-        if (0 < e.length) {
-            var l = window.postMotionOptions || {
-                stagger: 100,
-                drag: !0,
-                complete: function () {
-                    t.next();
-                }
-            };
-            CONFIG.motion.transition.post_block && Velocity(e, 'transition.' + o, l), CONFIG.motion.transition.post_header && Velocity(n, 'transition.' + i, l), CONFIG.motion.transition.post_body && Velocity(r, 'transition.' + c, l), CONFIG.motion.transition.coll_header && Velocity(u, 'transition.' + s, l);
-        }
-        'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme || t.next();
-    },
-    sidebar: function (t) {
-        var e = document.querySelector('.sidebar-inner'), o = CONFIG.motion.transition.sidebar;
-        !o || 'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme || Velocity(e, 'transition.' + o, {
-            display: null,
-            duration: 200,
-            complete: function () {
-                e.style.transform = 'initial';
-            }
-        }), t.next();
-    }
-};

+ 0 - 57
next-boot.js

@@ -1,57 +0,0 @@
-'use strict';
-function _toConsumableArray(e) {
-    if (Array.isArray(e)) {
-        for (var t = 0, i = Array(e.length); t < e.length; t++)
-            i[t] = e[t];
-        return i;
-    }
-    return Array.from(e);
-}
-NexT.boot = {}, NexT.boot.registerEvents = function () {
-    NexT.utils.registerScrollPercent(), NexT.utils.registerCanIUseTag(), document.querySelector('.site-nav-toggle .toggle').addEventListener('click', function () {
-        event.currentTarget.classList.toggle('toggle-close');
-        var e = document.querySelector('.site-nav'), t = e.classList.contains('site-nav-on') ? 'slideUp' : 'slideDown';
-        'function' == typeof Velocity ? Velocity(e, t, {
-            duration: 200,
-            complete: function () {
-                e.classList.toggle('site-nav-on');
-            }
-        }) : e.classList.toggle('site-nav-on');
-    });
-    document.querySelectorAll('.sidebar-nav li').forEach(function (e, s) {
-        e.addEventListener('click', function (e) {
-            var t = e.currentTarget, i = 'sidebar-nav-active', o = 'sidebar-panel-active';
-            if (!t.classList.contains(i)) {
-                var n = document.querySelectorAll('.sidebar-panel'), a = n[s], r = n[1 - s];
-                window.anime({
-                    targets: r,
-                    duration: 200,
-                    easing: 'linear',
-                    opacity: 0,
-                    complete: function () {
-                        r.classList.remove(o), a.style.opacity = 0, a.classList.add(o), window.anime({
-                            targets: a,
-                            duration: 200,
-                            easing: 'linear',
-                            opacity: 1
-                        });
-                    }
-                }), [].concat(_toConsumableArray(t.parentNode.children)).forEach(function (e) {
-                    e.classList.remove(i);
-                }), t.classList.add(i);
-            }
-        });
-    }), window.addEventListener('resize', NexT.utils.initSidebarDimension), window.addEventListener('hashchange', function () {
-        var e = location.hash;
-        if ('' !== e && !e.match(/%\S{2}/)) {
-            var t = document.querySelector('.tabs ul.nav-tabs li a[href="' + e + '"]');
-            t && t.click();
-        }
-    });
-}, NexT.boot.refresh = function () {
-    CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox(), CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img'), CONFIG.lazyload && window.lozad('.post-body img').observe(), CONFIG.pangu && window.pangu.spacingPage(), CONFIG.exturl && NexT.utils.registerExtURL(), CONFIG.copycode.enable && NexT.utils.registerCopyCode(), NexT.utils.registerTabsTag(), NexT.utils.registerActiveMenuItem(), NexT.utils.registerLangSelect(), NexT.utils.registerSidebarTOC(), NexT.utils.wrapTableWithBox(), NexT.utils.registerVideoIframe();
-}, NexT.boot.motion = function () {
-    CONFIG.motion.enable && NexT.motion.integrator.add(NexT.motion.middleWares.logo).add(NexT.motion.middleWares.menu).add(NexT.motion.middleWares.postList).add(NexT.motion.middleWares.sidebar).bootstrap(), NexT.utils.updateSidebarPosition();
-}, window.addEventListener('DOMContentLoaded', function () {
-    NexT.boot.registerEvents(), NexT.boot.refresh(), NexT.boot.motion();
-});

+ 0 - 52
trail.js

@@ -1,52 +0,0 @@
-'use strict';
-var canvas, context, particles, SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight, RADIUS = 60, RADIUS_SCALE = 1, RADIUS_SCALE_MIN = 1, RADIUS_SCALE_MAX = 1.5, QUANTITY = 25, mouseX = 0.5 * SCREEN_WIDTH, mouseY = 0.5 * SCREEN_HEIGHT, mouseIsDown = !1;
-function init() {
-    (canvas = document.getElementById('world')) && canvas.getContext && (context = canvas.getContext('2d'), document.addEventListener('mousemove', documentMouseMoveHandler, !1), document.addEventListener('mousedown', documentMouseDownHandler, !1), document.addEventListener('mouseup', documentMouseUpHandler, !1), document.addEventListener('touchstart', documentTouchStartHandler, !1), document.addEventListener('touchmove', documentTouchMoveHandler, !1), window.addEventListener('resize', windowResizeHandler, !1), createParticles(), windowResizeHandler(), setInterval(loop, 1000 / 60));
-}
-function createParticles() {
-    particles = [];
-    for (var e = 0; e < QUANTITY; e++) {
-        var t = {
-            position: {
-                x: mouseX,
-                y: mouseY
-            },
-            shift: {
-                x: mouseX,
-                y: mouseY
-            },
-            size: 1,
-            angle: 0,
-            speed: 0.01 + 0.04 * Math.random(),
-            targetSize: 1,
-            fillColor: '#' + (4210752 * Math.random() + 11184810 | 0).toString(16),
-            orbit: 0.5 * RADIUS + 0.5 * RADIUS * Math.random()
-        };
-        particles.push(t);
-    }
-}
-function documentMouseMoveHandler(e) {
-    mouseX = e.clientX, mouseY = e.clientY;
-}
-function documentMouseDownHandler(e) {
-    mouseIsDown = !0;
-}
-function documentMouseUpHandler(e) {
-    mouseIsDown = !1;
-}
-function documentTouchStartHandler(e) {
-    1 == e.touches.length && (e.preventDefault(), mouseX = e.touches[0].pageX - 0.5 * (window.innerWidth - SCREEN_WIDTH), mouseY = e.touches[0].pageY - 0.5 * (window.innerHeight - SCREEN_HEIGHT));
-}
-function documentTouchMoveHandler(e) {
-    1 == e.touches.length && (e.preventDefault(), mouseX = e.touches[0].pageX - 0.5 * (window.innerWidth - SCREEN_WIDTH), mouseY = e.touches[0].pageY - 0.5 * (window.innerHeight - SCREEN_HEIGHT));
-}
-function windowResizeHandler() {
-    SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight, canvas.width = SCREEN_WIDTH, canvas.height = SCREEN_HEIGHT;
-}
-function loop() {
-    for (context.shadowBlur = 3, mouseIsDown ? RADIUS_SCALE += 0.02 * (RADIUS_SCALE_MAX - RADIUS_SCALE) : RADIUS_SCALE -= 0.02 * (RADIUS_SCALE - RADIUS_SCALE_MIN), RADIUS_SCALE = Math.min(RADIUS_SCALE, RADIUS_SCALE_MAX), i = 0, len = particles.length; i < len; i++) {
-        var e = particles[i];
-        e.angle += e.speed, e.shift.x += (mouseX - e.shift.x) * e.speed, e.shift.y += (mouseY - e.shift.y) * e.speed, e.position.x = e.shift.x + Math.cos(i + e.angle) * (e.orbit * RADIUS_SCALE), e.position.y = e.shift.y + Math.sin(i + e.angle) * (e.orbit * RADIUS_SCALE), e.position.x = Math.max(Math.min(e.position.x, SCREEN_WIDTH), 0), e.position.y = Math.max(Math.min(e.position.y, SCREEN_HEIGHT), 0), e.size += 0.05 * (e.targetSize - e.size), Math.round(e.size) == Math.round(e.targetSize) && (e.targetSize = 1 + 7 * Math.random()), context.beginPath(), context.fillStyle = e.fillColor, context.moveTo(e.position.x, e.position.y), context.arc(e.position.x, e.position.y, e.size, 0, 2 * Math.PI, !0), context.fill();
-    }
-}
-init();

+ 0 - 235
utils.js

@@ -1,235 +0,0 @@
-'use strict';
-function _toConsumableArray(e) {
-    if (Array.isArray(e)) {
-        for (var t = 0, n = Array(e.length); t < e.length; t++)
-            n[t] = e[t];
-        return n;
-    }
-    return Array.from(e);
-}
-HTMLElement.prototype.wrap = function (e) {
-    this.parentNode.insertBefore(e, this), this.parentNode.removeChild(this), e.appendChild(this);
-}, NexT.utils = {
-    wrapImageWithFancyBox: function () {
-        document.querySelectorAll('.post-body :not(a) > img, .post-body > img').forEach(function (e) {
-            var t = $(e), n = t.attr('data-src') || t.attr('src'), a = t.wrap('<a class="fancybox fancybox.image" href="' + n + '" itemscope itemtype="http://schema.org/ImageObject" itemprop="url"></a>').parent('a');
-            t.is('.post-gallery img') ? a.attr('data-fancybox', 'gallery').attr('rel', 'gallery') : t.is('.group-picture img') ? a.attr('data-fancybox', 'group').attr('rel', 'group') : a.attr('data-fancybox', 'default').attr('rel', 'default');
-            var r = t.attr('title') || t.attr('alt');
-            r && (a.append('<p class="image-caption">' + r + '</p>'), a.attr('title', r).attr('data-caption', r));
-        }), $.fancybox.defaults.hash = !1, $('.fancybox').fancybox({
-            loop: !0,
-            helpers: { overlay: { locked: !1 } }
-        });
-    },
-    registerExtURL: function () {
-        document.querySelectorAll('span.exturl').forEach(function (e) {
-            var t = document.createElement('a');
-            t.href = decodeURIComponent(atob(e.dataset.url).split('').map(function (e) {
-                return '%' + ('00' + e.charCodeAt(0).toString(16)).slice(-2);
-            }).join('')), t.rel = 'noopener external nofollow noreferrer', t.target = '_blank', t.className = e.className, t.innerHTML = e.innerHTML, e.parentNode.replaceChild(t, e);
-        });
-    },
-    registerCopyCode: function () {
-        document.querySelectorAll('figure.highlight').forEach(function (e) {
-            var t = document.createElement('div');
-            e.wrap(t), t.classList.add('highlight-container'), t.insertAdjacentHTML('beforeend', '<div class="copy-btn"><i class="fa fa-clipboard"></i></div>');
-            var n = e.parentNode.querySelector('.copy-btn');
-            n.addEventListener('click', function (e) {
-                var t = e.currentTarget, n = [].concat(_toConsumableArray(t.parentNode.querySelectorAll('.code .line'))).map(function (e) {
-                        return e.innerText;
-                    }).join('\n'), a = document.createElement('textarea');
-                a.style.top = window.scrollY + 'px', a.style.position = 'absolute', a.style.opacity = '0', a.readOnly = !0, a.value = n, document.body.append(a);
-                var r = document.getSelection(), o = 0 < r.rangeCount && r.getRangeAt(0);
-                a.select(), a.setSelectionRange(0, n.length), a.readOnly = !1;
-                var i = document.execCommand('copy');
-                CONFIG.copycode.show_result && (t.querySelector('i').className = i ? 'fa fa-check' : 'fa fa-times'), a.blur(), t.blur(), o && (r.removeAllRanges(), r.addRange(o)), document.body.removeChild(a);
-            }), n.addEventListener('mouseleave', function (e) {
-                setTimeout(function () {
-                    e.target.querySelector('i').className = 'fa fa-clipboard';
-                }, 300);
-            });
-        });
-    },
-    wrapTableWithBox: function () {
-        document.querySelectorAll('table').forEach(function (e) {
-            var t = document.createElement('div');
-            t.className = 'table-container', e.wrap(t);
-        });
-    },
-    registerVideoIframe: function () {
-        document.querySelectorAll('iframe').forEach(function (t) {
-            if (["www.youtube.com","player.vimeo.com","player.youku.com","player.bilibili.com","www.tudou.com"].some(function (e) {
-                    return t.src.includes(e);
-                }) && !t.parentNode.matches('.video-container')) {
-                var e = document.createElement('div');
-                e.className = 'video-container', t.wrap(e);
-                var n = Number(t.width), a = Number(t.height);
-                n && a && (t.parentNode.style.paddingTop = a / n * 100 + '%');
-            }
-        });
-    },
-    registerScrollPercent: function () {
-        var r = document.querySelector('.back-to-top'), o = document.querySelector('.reading-progress-bar');
-        window.addEventListener('scroll', function () {
-            if (r || o) {
-                var e = document.querySelector('.container').offsetHeight, t = window.innerHeight, n = t < e ? e - t : document.body.scrollHeight - t, a = Math.min(100 * window.scrollY / n, 100);
-                r && (r.classList.toggle('back-to-top-on', 50 < window.scrollY), r.querySelector('span').innerText = Math.round(a) + '%'), o && (o.style.width = a.toFixed(2) + '%');
-            }
-        }), r && r.addEventListener('click', function () {
-            window.anime({
-                targets: document.scrollingElement,
-                duration: 500,
-                easing: 'linear',
-                scrollTop: 0
-            });
-        });
-    },
-    registerTabsTag: function () {
-        document.querySelectorAll('.tabs ul.nav-tabs .tab').forEach(function (e) {
-            e.addEventListener('click', function (e) {
-                e.preventDefault();
-                var t = e.currentTarget;
-                if (!t.classList.contains('active')) {
-                    [].concat(_toConsumableArray(t.parentNode.children)).forEach(function (e) {
-                        e.classList.remove('active');
-                    }), t.classList.add('active');
-                    var n = document.getElementById(t.querySelector('a').getAttribute('href').replace('#', ''));
-                    [].concat(_toConsumableArray(n.parentNode.children)).forEach(function (e) {
-                        e.classList.remove('active');
-                    }), n.classList.add('active'), n.dispatchEvent(new Event('tabs:click', { bubbles: !0 }));
-                }
-            });
-        }), window.dispatchEvent(new Event('tabs:register'));
-    },
-    registerCanIUseTag: function () {
-        window.addEventListener('message', function (e) {
-            var t = e.data;
-            if ('string' == typeof t && t.includes('ciu_embed')) {
-                var n = t.split(':')[1], a = t.split(':')[2];
-                document.querySelector('iframe[data-feature=' + n + ']').style.height = parseInt(a, 10) + 5 + 'px';
-            }
-        }, !1);
-    },
-    registerActiveMenuItem: function () {
-        document.querySelectorAll('.menu-item').forEach(function (e) {
-            var t = e.querySelector('a[href]');
-            if (t) {
-                var n = t.pathname === location.pathname || t.pathname === location.pathname.replace('index.html', ''), a = !CONFIG.root.startsWith(t.pathname) && location.pathname.startsWith(t.pathname);
-                e.classList.toggle('menu-item-active', t.hostname === location.hostname && (n || a));
-            }
-        });
-    },
-    registerLangSelect: function () {
-        var n = document.querySelector('.lang-select');
-        n && (n.value = CONFIG.page.lang, n.addEventListener('change', function () {
-            var e = n.options[n.selectedIndex];
-            document.querySelector('.lang-select-label span').innerText = e.text;
-            var t = e.dataset.href;
-            window.pjax ? window.pjax.loadUrl(t) : window.location.href = t;
-        }));
-    },
-    registerSidebarTOC: function () {
-        var i = document.querySelectorAll('.post-toc li'), c = [].concat(_toConsumableArray(i)).map(function (e) {
-                var t = e.querySelector('a.nav-link');
-                return t.addEventListener('click', function (e) {
-                    e.preventDefault();
-                    var t = document.getElementById(e.currentTarget.getAttribute('href').replace('#', '')).getBoundingClientRect().top + window.scrollY;
-                    window.anime({
-                        targets: document.scrollingElement,
-                        duration: 500,
-                        easing: 'linear',
-                        scrollTop: t + 10
-                    });
-                }), document.getElementById(t.getAttribute('href').replace('#', ''));
-            }), l = document.querySelector('.post-toc-wrap');
-        !function r(o) {
-            o = Math.floor(o + 10000);
-            var t = new IntersectionObserver(function (e, t) {
-                var n = document.documentElement.scrollHeight + 100;
-                if (o < n)
-                    return t.disconnect(), void r(n);
-                var a = function (e) {
-                    var t = 0, n = e[t];
-                    if (0 < n.boundingClientRect.top)
-                        return 0 === (t = c.indexOf(n.target)) ? 0 : t - 1;
-                    for (; t < e.length; t++) {
-                        if (!(e[t].boundingClientRect.top <= 0))
-                            return c.indexOf(n.target);
-                        n = e[t];
-                    }
-                    return c.indexOf(n.target);
-                }(e);
-                !function (e) {
-                    if (!e.classList.contains('active-current')) {
-                        document.querySelectorAll('.post-toc .active').forEach(function (e) {
-                            e.classList.remove('active', 'active-current');
-                        }), e.classList.add('active', 'active-current');
-                        for (var t = e.parentNode; !t.matches('.post-toc');)
-                            t.matches('li') && t.classList.add('active'), t = t.parentNode;
-                        window.anime({
-                            targets: l,
-                            duration: 200,
-                            easing: 'linear',
-                            scrollTop: l.scrollTop - l.offsetHeight / 2 + e.getBoundingClientRect().top - l.getBoundingClientRect().top
-                        });
-                    }
-                }(i[a]);
-            }, {
-                rootMargin: o + 'px 0px -100% 0px',
-                threshold: 0
-            });
-            c.forEach(function (e) {
-                e && t.observe(e);
-            });
-        }(document.documentElement.scrollHeight);
-    },
-    hasMobileUA: function () {
-        var e = navigator.userAgent;
-        return /iPad|iPhone|Android|Opera Mini|BlackBerry|webOS|UCWEB|Blazer|PSP|IEMobile|Symbian/g.test(e);
-    },
-    isTablet: function () {
-        return window.screen.width < 992 && 767 < window.screen.width && this.hasMobileUA();
-    },
-    isMobile: function () {
-        return window.screen.width < 767 && this.hasMobileUA();
-    },
-    isDesktop: function () {
-        return !this.isTablet() && !this.isMobile();
-    },
-    supportsPDFs: function () {
-        var e = navigator.userAgent, t = e.includes('irefox') && 18 < parseInt(e.split('rv:')[1].split('.')[0], 10), n = void 0 !== navigator.mimeTypes['application/pdf'], a = /iphone|ipad|ipod/i.test(e.toLowerCase());
-        return t || n && !a;
-    },
-    initSidebarDimension: function () {
-        var e = document.querySelector('.sidebar-nav'), t = 'none' !== e.style.display ? e.offsetHeight : 0, n = CONFIG.sidebar.offset || 12, a = CONFIG.back2top.enable && CONFIG.back2top.sidebar ? document.querySelector('.back-to-top').offsetHeight : 0, r = 2 * CONFIG.sidebar.padding + t + a;
-        'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme || (r += 2 * n - 22);
-        var o = document.body.offsetHeight - r + 'px';
-        document.querySelector('.site-overview-wrap').style.maxHeight = o, document.querySelector('.post-toc-wrap').style.maxHeight = o;
-    },
-    updateSidebarPosition: function () {
-        var e = document.querySelector('.sidebar-nav'), t = document.querySelector('.post-toc');
-        if (t ? (e.style.display = '', e.classList.add('motion-element'), document.querySelector('.sidebar-nav-toc').click()) : (e.style.display = 'none', e.classList.remove('motion-element'), document.querySelector('.sidebar-nav-overview').click()), NexT.utils.initSidebarDimension(), this.isDesktop() && 'Pisces' !== CONFIG.scheme && 'Gemini' !== CONFIG.scheme) {
-            var n = CONFIG.page.sidebar;
-            'boolean' != typeof n && (n = 'always' === CONFIG.sidebar.display || 'post' === CONFIG.sidebar.display && t), n && window.dispatchEvent(new Event('sidebar:show'));
-        }
-    },
-    getScript: function (e, n, t) {
-        if (t)
-            n();
-        else {
-            var a = document.createElement('script');
-            a.onload = a.onreadystatechange = function (e, t) {
-                !t && a.readyState && !/loaded|complete/.test(a.readyState) || (a.onload = a.onreadystatechange = null, a = void 0, !t && n && setTimeout(n, 0));
-            }, a.src = e, document.head.appendChild(a);
-        }
-    },
-    loadComments: function (e, n) {
-        if (CONFIG.comments.lazyload && e) {
-            var t = new IntersectionObserver(function (e, t) {
-                e[0].isIntersecting && (n(), t.disconnect());
-            });
-            return t.observe(e), t;
-        }
-        n();
-    }
-};

Some files were not shown because too many files changed in this diff