OSDN Git Service

fix: fix comments
authorIr1d <sirius.caffrey@gmail.com>
Wed, 22 Aug 2018 03:22:33 +0000 (11:22 +0800)
committerIr1d <sirius.caffrey@gmail.com>
Wed, 22 Aug 2018 03:22:33 +0000 (11:22 +0800)
closes https://github.com/Ir1d/gitment/issues/20

static/disqus.html

index ac974b2..6f94df4 100644 (file)
@@ -7,11 +7,35 @@
 {% set pageID = page.title | default("404", true) %}
 <h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
 <div id="gitment_container">
-    <link rel="stylesheet" href="https://aimingoo.github.io/gitmint/style/default.css">
-    <script src="https://aimingoo.github.io/gitmint/dist/gitmint.browser.js"></script>
+    <link rel="stylesheet" href="https://24oi.cf/gitment.css">
+    <script src="https://24oi.cf/gitment.js"></script>
     <script>
-      const gitment = new Gitmint({
+      const myTheme = {
+        render(state, instance) {
+          const container = document.createElement('div')
+          container.lang = "zh-CN"
+          container.className = 'gitment-container gitment-root-container'
+          const divv = document.createElement('form')
+          // container.appendChild(instance.renderSomething(state, instance))
+          container.appendChild(instance.renderHeader(state, instance))
+          divv.appendChild(instance.renderEditor(state, instance))
+          container.appendChild(divv)
+          container.appendChild(instance.renderComments(state, instance))
+          container.appendChild(instance.renderFooter(state, instance))
+          return container
+        },
+        renderSomething(state, instance) {
+          const container = document.createElement('div')
+          container.lang = "zh-CN"
+          if (state.user.login) {
+            container.innerText = `Hello, ${state.user.login}, 来说点什么吧?`
+          }
+          return container
+        }
+      }
+      const gitment = new Gitment({
         id: '{{ page.title | default("404", true)  }}',
+        theme: myTheme,
         owner: 'Ir1d',
         repo: 'gitment',
         oauth: {