EYHN / hexo-helper-live2d

Add the Sseexxyyy live2d to your hexo!
GNU General Public License v2.0
3.86k stars 469 forks source link

怎么修改脚本 #10

Closed Allen-LPL closed 7 years ago

Allen-LPL commented 7 years ago

不知道怎么修改脚本, 自己做了一些尝试: 修改: \blog\themes\next\node_modules\hexo-helper-live2d\index.js

修改了71行的"right" 修改了72行的"z-index"

修改为:

 hexo.extend.helper.register('live2d', function (config) {
  var config = Object.assign(
    {
      model:"z16",
      width: 150,
      height: 300,
      className: "live2d",
      id: "live2dcanvas",
      bottom: -20
    },
    config, 
    hexo.config.live2d
  );
  return `
    <script type="text/javascript" src="/live2d/script.js"></script>
    <canvas id="${config.id}" width="${config.width}" height="${config.height}" class="${config.className}"></canvas>
    <style>
      #${config.id} {
        position: fixed;
        right: 10px;
        z-index: 9999;
        pointer-events: none;
        bottom: ${config.bottom}px;
      }
    </style>
    <script>loadlive2d(${JSON.stringify(config.id)} ,${JSON.stringify(url.resolve("/live2d/assets/",models[config.model]))})</script>
  `
});

但是在渲染的时候, 没有变化, 这是为什么呢?

Allen-LPL commented 7 years ago

sorry, 修改错地方了, 应该修改根目录下 \blog\node_modules\hexo-helper-live2d\index.js

修改过以后就解决了

我修改这个是为了Next主体侧边栏将live2d覆盖的问题

EYHN commented 7 years ago

嗯 我下个更新 会把这个加入配置项