Browse Source

Added disqus comments on articles

Virgile Bello 5 years ago
parent
commit
fca8ccc539
3 changed files with 33 additions and 14 deletions
  1. 19 0
      en/template/conceptual.html.primary.tmpl
  2. 4 0
      en/template/styles/main.css
  3. 10 14
      en/template/styles/main.js

+ 19 - 0
en/template/conceptual.html.primary.tmpl

@@ -48,6 +48,25 @@
               {{{rawTitle}}}
               {{{rawTitle}}}
               {{{conceptual}}}
               {{{conceptual}}}
             </article>
             </article>
+
+            <div class="comment-section">
+              <h1>Comments</h1>
+              <div id="disqus_thread"></div>
+              <script>
+
+              var disqus_config = function () {
+              this.page.url = 'https://doc.stride3d.net/latest/en/{{{ _path }}}';  // Replace PAGE_URL with your page's canonical URL variable
+              //this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
+              };
+              (function() { // DON'T EDIT BELOW THIS LINE
+              var d = document, s = d.createElement('script');
+              s.src = 'https://stride3d.disqus.com/embed.js';
+              s.setAttribute('data-timestamp', +new Date());
+              (d.head || d.body).appendChild(s);
+              })();
+              </script>
+              <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+            </div>
           </div>
           </div>
           {{^_disableAffix}}
           {{^_disableAffix}}
           {{>partials/affix}}
           {{>partials/affix}}

+ 4 - 0
en/template/styles/main.css

@@ -54,6 +54,10 @@ ol li img {
 
 
 /********************************************/
 /********************************************/
 
 
+.comment-section {
+    margin-top: 60px;
+}
+
 .sidefilter {
 .sidefilter {
     position: inherit;
     position: inherit;
 }
 }

+ 10 - 14
en/template/styles/main.js

@@ -26,18 +26,22 @@ $(function () {
   function apiDocSizeControl() {
   function apiDocSizeControl() {
     "use srtict"
     "use srtict"
     function resizableTOC() {
     function resizableTOC() {
-      // If object "sizes" saved already
+      // Get started space parameters
+      var startSidebarWidth = $('#sidetoggle').width();
+      var contentMargin = + $($('.article.grid-right')[0]).css('marginLeft').split('px')[0];
+
       if (localStorage.getItem('sizes') != null) {
       if (localStorage.getItem('sizes') != null) {
         // Get the sizes from local storage
         // Get the sizes from local storage
         var sizes = JSON.parse(localStorage.getItem('sizes'));
         var sizes = JSON.parse(localStorage.getItem('sizes'));
+
+        sidebarSizeDivide = sizes.sidebarWidth - startSidebarWidth;
         // Set width to sidebar
         // Set width to sidebar
         $('#sidetoggle').css('width', sizes.sidebarWidth);
         $('#sidetoggle').css('width', sizes.sidebarWidth);
-        // Set width and margin to content part
+        // Set sizes for content part
         $($('.article.grid-right')[0]).css({
         $($('.article.grid-right')[0]).css({
-          'width': sizes.contentWidth,
-          'marginLeft': sizes.contentMargin
+          'marginLeft': contentMargin + sidebarSizeDivide
         });
         });
-        // Wait, while filter is aviable
+        // Wait, while filter is availiable
         var filterTimer = setInterval(function () {
         var filterTimer = setInterval(function () {
           if ($($('.sidefilter')[0]).length > 0) {
           if ($($('.sidefilter')[0]).length > 0) {
             var filter = $($('.sidefilter')[0]);
             var filter = $($('.sidefilter')[0]);
@@ -54,10 +58,6 @@ $(function () {
       } else {
       } else {
         $('.container.body-content.hide-when-search').show();
         $('.container.body-content.hide-when-search').show();
       }
       }
-      // Get started space parameters
-      var startSidebarWidth = $('#sidetoggle').width();
-      var contentWidth = $($('.article.grid-right')[0]).width();
-      var contentMargin = + $($('.article.grid-right')[0]).css('marginLeft').split('px')[0];
       // Start resizable function
       // Start resizable function
       $('#sidetoggle').resizable({
       $('#sidetoggle').resizable({
         containment: ".container.body-content.hide-when-search",
         containment: ".container.body-content.hide-when-search",
@@ -70,15 +70,11 @@ $(function () {
           // Create "Sizes" object
           // Create "Sizes" object
           var sizes = {
           var sizes = {
             sidebarWidth: ui.size.width,
             sidebarWidth: ui.size.width,
-            contentWidth: contentWidth - sidebarSizeDivide,
-            contentMargin: contentMargin + sidebarSizeDivide
           }
           }
           // Set sizes for content part
           // Set sizes for content part
           $($('.article.grid-right')[0]).css({
           $($('.article.grid-right')[0]).css({
-            'width': sizes.contentWidth,
-            'marginLeft': sizes.contentMargin
+            'marginLeft': contentMargin + sidebarSizeDivide
           });
           });
-          // Set sizes for filter
           $($('.sidefilter')[0]).css('width', sizes.sidebarWidth);
           $($('.sidefilter')[0]).css('width', sizes.sidebarWidth);
           localStorage.setItem('sizes', JSON.stringify(sizes))
           localStorage.setItem('sizes', JSON.stringify(sizes))
         }
         }