前言:我美化的没那么好看,如果不喜欢的话,你可以在css中根据自己的需要调整。本页面用到的所有css均在一个文件。持续更新到我不知道更新什么为止。2.0版本已解决验证问题。

项目初期版本迭代更新较快,请着重参考文档中的介绍。
活前往查看最新教程:https://cndrew.cn/2020/05/11/artitalk/

文档地址:https://artitalk.js.org/
如果有问题或者建议,欢迎进群交流,群号:1104585229

Artitalk交流群

一开始我想说的话

本文可能不会实时更新,推荐前往GitHub。
本篇文章中涉及到的js和css都已上传到GitHub: Hexo-shuoshuo
之前弄了一个简单的说说页面,没想到效果挺好。挺多小伙伴都表示了很有用,最近突然意识到既然评论数据可以存储在leancloud然后展示出来,那说说肯定也可以啊!说干就干。
之前那篇文章的链接: 为你的hexo博客添加说说页面
视频教程:Hexo-shuoshuo bilibili
目前最新版本:V2.1.1

特性:

  • Hexo中显示一个说说页面,并且支持站长实时发布,可移步leancloud后台进行修改。
  • 可直接使用html语法插入歌曲或者图片视频等。理论上支持除了<li><ui>的其他任何html语法。
  • 通过leancloud的用户直接调用保证仅站长可以发布说说,且被破解的概率理论上为0.

Demo: Hexo-说说

具体食用方法

关于Leancloud

这里我们要求使用leancloud国际版注册,因为国际版不需要绑定备案的域名
注册结束后首先找到账号设置,绑定邮箱和手机号。这一步是必须的,否则无法创建应用。邮箱和手机号都有临时的,所以也不难。

绑定成功之后,点击创建应用,并将应用名字设置为shuoshuo


创建之后点击应用跳转到控制台

在设置中找到应用keys中的appIdappKey记下来,或者页面一直开着。

leancloud的存储中添加class,命名为shuoshuo

然后在你新建的应用中找到结构化数据下的用户

然后点击添加用户,输入你想使用的用户名以及密码

接着回到结构化数据->shuoshuo->权限,在Class访问权限中将add_fields以及create权限设置为指定用户,输入你刚才输入的用户名会自动匹配。为了安全起见,将deleteupdate也设置为跟它们一样的权限。


最后将_User中的权限全部调为指定用户,或者数据创建者,为了保证不被篡改用户数据。

到这里leancloud的设置就告一段落了。

关于js和css

GitHub下载:Hexo-shuoshuo
引用jquery

<script src="https://cdn.jsdelivr.net/gh/drew233/cdn/js/jquery-3.3.1.min.js"></script>
<!-- 如果之前引用过就不需要重复引用了 -->

然后在根目录的source文件夹下新建一个shuoshuo文件夹,并在文件夹中新建index.md

index.md中除了font-matter之外写上以下内容

<script>
var img="";
var appID="";
var appKEY="";
var per="";
var username="";
</script>
<link rel="stylesheet" href="/src/shuoshuov1.1.css" media="all">
<script src="https://cdn.jsdelivr.net/npm/leancloud-storage@4.5.3/dist/av-min.js"></script>
<script type="text/javascript" src="/src/os.js"></script>
<script type="text/javascript" src="/src/shuoshuov2.1.1.js"></script>
<body>
  <div id="lazy">
    <div class="preloader" style="opacity: 1; ">
  <svg version="1.1" id="sun" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="10px" height="10px" viewBox="0 0 10 10" enable-background="new 0 0 10 10" xml:space="preserve" style="opacity: 1; margin-left: 0px; margin-top: 0px;">
    <g>
      <path fill="none" d="M6.942,3.876c-0.4-0.692-1.146-1.123-1.946-1.123c-0.392,0-0.779,0.104-1.121,0.301c-1.072,0.619-1.44,1.994-0.821,3.067C3.454,6.815,4.2,7.245,5,7.245c0.392,0,0.779-0.104,1.121-0.301C6.64,6.644,7.013,6.159,7.167,5.581C7.321,5,7.243,4.396,6.942,3.876z M6.88,5.505C6.745,6.007,6.423,6.427,5.973,6.688C5.676,6.858,5.34,6.948,5,6.948c-0.695,0-1.343-0.373-1.69-0.975C2.774,5.043,3.093,3.849,4.024,3.312C4.32,3.14,4.656,3.05,4.996,3.05c0.695,0,1.342,0.374,1.69,0.975C6.946,4.476,7.015,5,6.88,5.505z"></path>
      <path fill="none" d="M8.759,2.828C8.718,2.757,8.626,2.732,8.556,2.774L7.345,3.473c-0.07,0.041-0.094,0.132-0.053,0.202C7.319,3.723,7.368,3.75,7.419,3.75c0.025,0,0.053-0.007,0.074-0.02l1.211-0.699C8.774,2.989,8.8,2.899,8.759,2.828z"></path>
      <path fill="none" d="M1.238,7.171c0.027,0.047,0.077,0.074,0.128,0.074c0.025,0,0.051-0.008,0.074-0.02l1.211-0.699c0.071-0.041,0.095-0.133,0.054-0.203S2.574,6.228,2.503,6.269l-1.21,0.699C1.221,7.009,1.197,7.101,1.238,7.171z"></path>
      <path fill="none" d="M6.396,2.726c0.052,0,0.102-0.026,0.13-0.075l0.349-0.605C6.915,1.976,6.89,1.885,6.819,1.844c-0.07-0.042-0.162-0.017-0.202,0.054L6.269,2.503C6.228,2.574,6.251,2.666,6.322,2.706C6.346,2.719,6.371,2.726,6.396,2.726z"></path>
          <path fill="none" d="M3.472,7.347L3.123,7.952c-0.041,0.07-0.017,0.162,0.054,0.203C3.2,8.169,3.226,8.175,3.25,8.175c0.052,0,0.102-0.027,0.129-0.074l0.349-0.605c0.041-0.07,0.017-0.16-0.054-0.203C3.603,7.251,3.513,7.276,3.472,7.347z"></path>
          <path fill="none" d="M3.601,2.726c0.025,0,0.051-0.007,0.074-0.02C3.746,2.666,3.77,2.574,3.729,2.503l-0.35-0.604C3.338,1.828,3.248,1.804,3.177,1.844C3.106,1.886,3.082,1.976,3.123,2.047l0.35,0.604C3.5,2.7,3.549,2.726,3.601,2.726z"></path>
          <path fill="none" d="M6.321,7.292c-0.07,0.043-0.094,0.133-0.054,0.203l0.351,0.605c0.026,0.047,0.076,0.074,0.127,0.074c0.025,0,0.051-0.006,0.074-0.02c0.072-0.041,0.096-0.133,0.055-0.203l-0.35-0.605C6.483,7.276,6.393,7.253,6.321,7.292z"></path>
          <path fill="none" d="M2.202,5.146c0.082,0,0.149-0.065,0.149-0.147S2.284,4.851,2.202,4.851H1.503c-0.082,0-0.148,0.066-0.148,0.148s0.066,0.147,0.148,0.147H2.202z"></path>
          <path fill="none" d="M8.493,4.851H7.794c-0.082,0-0.148,0.066-0.148,0.148s0.066,0.147,0.148,0.147l0,0h0.699c0.082,0,0.148-0.065,0.148-0.147S8.575,4.851,8.493,4.851L8.493,4.851z"></path>
          <path fill="none" d="M5.146,2.203V0.805c0-0.082-0.066-0.148-0.148-0.148c-0.082,0-0.148,0.066-0.148,0.148v1.398c0,0.082,0.066,0.149,0.148,0.149C5.08,2.352,5.146,2.285,5.146,2.203z"></path>
          <path fill="none" d="M4.85,7.796v1.396c0,0.082,0.066,0.15,0.148,0.15c0.082,0,0.148-0.068,0.148-0.15V7.796c0-0.082-0.066-0.148-0.148-0.148C4.917,7.647,4.85,7.714,4.85,7.796z"></path>
          <path fill="none" d="M2.651,3.473L1.44,2.774C1.369,2.732,1.279,2.757,1.238,2.828C1.197,2.899,1.221,2.989,1.292,3.031l1.21,0.699c0.023,0.013,0.049,0.02,0.074,0.02c0.051,0,0.101-0.026,0.129-0.075C2.747,3.604,2.722,3.514,2.651,3.473z"></path>
          <path fill="none" d="M8.704,6.968L7.493,6.269c-0.07-0.041-0.162-0.016-0.201,0.055c-0.041,0.07-0.018,0.162,0.053,0.203l1.211,0.699c0.023,0.012,0.049,0.02,0.074,0.02c0.051,0,0.102-0.027,0.129-0.074C8.8,7.101,8.776,7.009,8.704,6.968z"></path>
      </g>
  </svg>

  <svg version="1.1" id="cloud" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="10px" height="10px" viewBox="0 0 10 10" enable-background="new 0 0 10 10" xml:space="preserve">
    <path fill="none" d="M8.528,5.624H8.247c-0.085,0-0.156-0.068-0.156-0.154c0-0.694-0.563-1.257-1.257-1.257c-0.098,0-0.197,0.013-0.3,0.038C6.493,4.259,6.45,4.252,6.415,4.229C6.38,4.208,6.356,4.172,6.348,4.131C6.117,3.032,5.135,2.235,4.01,2.235c-1.252,0-2.297,0.979-2.379,2.23c-0.004,0.056-0.039,0.108-0.093,0.13C1.076,4.793,0.776,5.249,0.776,5.752c0,0.693,0.564,1.257,1.257,1.257h6.495c0.383,0,0.695-0.31,0.695-0.692S8.911,5.624,8.528,5.624z"></path>
  </svg>

  <div class="rain">
    <span class="drop"></span>
    <span class="drop"></span>
    <span class="drop"></span>
    <span class="drop"></span>
    <span class="drop"></span>
    <span class="drop"></span>
    <span class="drop"></span>
    <span class="drop"></span>
    <span class="drop"></span>
    <span class="drop"></span>
  </div>
  <div class="text">
    LOOKING OUTSIDE FOR YOU... ONE SEC
  </div>
</div>
  </div>
  <div id="primary" class="content-area" style="">
    <main id="main" class="site-main" role="main">
        <div id="shuoshuo_content">
            <div id="ccontent">
        </div>
<div id="sa"></div>
<div id="saa"></div>
<textarea id="neirong" placeholder="本页面仅支持站长发表说说,由于特殊原因关闭本页面评论功能" style="width:100%;height:150px;background-image: url(https://cdn.jsdelivr.net/gh/drew233/cdn/20200409110727.webp);background-size: contain;background-repeat: no-repeat;background-position: right;"></textarea>
<button onclick="savecontent()" style="float :right;">biu~</button>
<button onclick="preview()" style="float :right;">预览</button>
<input type="password" id="key" value="" class="mytxt" placeholder="是时候验证你的身份了!" autocomplete="off"/>

<div id="preview"></div>
</div>
</body>
  • 变量含义及作用
  • img: 头像url链接
  • appID: leancloud的应用appId
  • appKEY: leancloud的应用appKey
  • per: 每一部分想展示的说说数以及每次点击查看更多的时候显示的说说数
  • username: 你在leancloud中添加的作为可发布说说的用户的用户名
  • 每个参数均必须填写(若未自己修改js)

至此就添加完毕了。访问yoursite.com/shuoshuo就能看到你的动态说说界面了。
每次发说说填上你在leancloud中设置的密码,再也不会有人可能冒充你发说说了呢。
效果图

与valine的一些冲突

说说页面无法开启valine评论
如果不可以,请联系我或者在GitHub提交issues

结语

本教程使用hexo默认主题做的示范,理论上任何主题均支持。
我只是一个小白,大家轻喷。