Innei / innei.github.io

1 stars 0 forks source link

Here are two problems in your front end. #1

Closed i-forgot-my-name closed 6 years ago

i-forgot-my-name commented 6 years ago

I saw your discussion in ojc's group.

Console returns two errors:

live2d.js: Uncaught SyntaxError: Unexpected token this
message.js:78 Uncaught SyntaxError: Unexpected token =

Let's see message.js first.

At Line 78, here is obviously an error.

if (now > 23 || now <= 5)="" {="" text="你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?" ;="" }="" else="" if="" (now=""> 5 && now <= 7)="" {="" text="早上好!一日之计在于晨,美好的一天就要开始了!" ;="" }="" else="" if="" (now=""> 7 && now <= 11)="" {="" text="上午好!工作顺利嘛,不要久坐,多起来走动走动哦!" ;="" }="" else="" if="" (now=""> 11 && now <= 14)="" {="" text="中午了,工作了一个上午,现在是午餐时间!" ;="" }="" else="" if="" (now=""> 14 && now <= 17)="" {="" text="午后很容易犯困呢,今天的运动目标完成了吗?" ;="" }="" else="" if="" (now=""> 17 && now <= 19)="" {="" text="傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~~" ;="" }="" else="" if="" (now=""> 19 && now <= 21)="" {="" text="晚上好,今天过得怎么样?" ;="" }="" else="" if="" (now=""> 21 && now <= 23)="" {="" text="已经这么晚了呀,早点休息吧,晚安~~" ;="" }="" else="" }else="" +="" document.title.split('="" -="" ')[0]="" '="" 」<="" span="">';

Here are so many isolate ="" in your code. It's strange!

And my advice is using switch case, it'll make things clearer. Like this:

switch(true){
    case (now>23 || now<=5):
        text='blahblah';
        break;
    case (now>5 || now<=7):
        text='blahblahblah';
        break;
}

And another problem is Live2D.js

I tried the latest dist in galnetwen/Live2D, seems it won't throw any error. You should download it again and commit it.

https://raw.githubusercontent.com/galnetwen/Live2D/master/live2d/js/live2d.js

i-forgot-my-name commented 6 years ago

And ALWAYS USE OFFICIAL DOCS!

Innei commented 6 years ago

Thanks for your advice ,I refer to https://github.com/galnetwen/Live2D, use his demo, but it doesn't seem to work. Yesterday I use too many live2d's api.But they also seem to failed. This is my first build personal blog ,so I do not have much experience. The hexo provides the live2d plugin , I use official docs ,add live2d to theme's _config.yml ,but when I debug,it didn't show live2d. I don't know where the problem is. Here are my code.


live2d:
  enable: true
  scriptFrom: local
  pluginRootPath: live2dw/
  pluginJsPath: lib/
  pluginModelPath: assets/
  tagMode: false
  log: false
  model:
    use: live2d-widget-model-z16
  display:
    position: right
    width: 150
    height: 300
  mobile:
    show: true 
i-forgot-my-name commented 6 years ago

Have you read some tutorials like https://www.jianshu.com/p/832b3706cebe and https://blog.csdn.net/Aoman_Hao/article/details/82049821 ? These all works.

You didn't push your code on GitHub, so I cannot help to find your problem out.

Innei commented 6 years ago

By the way,when I want use npm to install live2d-helper ,I received this warn. image I put this code into /theme/next/_config.yml image It can't show live2d. But if i put code into /_config.yml , i will received errors follow this . image And now I have already upload my code . Thank you very much!

i-forgot-my-name commented 6 years ago
  1. the warn means there are packages with vulnerabilities in your repo. For further info, Google "npm package vulnerability"

  2. JUST READ THE ERROR!!! It says live2d is a duplicated key. Did you remove live2d block in /theme/next/_config.yml?

  3. Upload your code means push your local code in another repo, NOT deploy a new version in THIS repo.

Innei commented 6 years ago

Thanks for your help ,now my blog added live2d successfully.