diff --git a/content/book.json b/content/book.json index 2caf53233..0e59f5f33 100644 --- a/content/book.json +++ b/content/book.json @@ -8,7 +8,7 @@ "sitemap" ], "styles": { - "website": "style-website-v3.css" + "website": "style-website-v4.css" }, "pdf": { "margin": { diff --git a/content/script-gitbook-plugin-disqus.js b/content/script-gitbook-plugin-disqus.js index 47b541007..ff4b0e8f3 100644 --- a/content/script-gitbook-plugin-disqus.js +++ b/content/script-gitbook-plugin-disqus.js @@ -5,19 +5,26 @@ require([ var useIdentifier = false; var disqusConfig = null; - function prepareDisqusThreadDOM() { - var id = "disqus_thread"; - if ($("#" + id).children().length > 0) { + function prepareDisqusPollDOM() { + if ($("#disqus_poll").children().length > 0) { return; } - $("#" + id).remove() + $("#disqus_poll").remove() + $(".book-body .page-inner").append(`
`); + } - var $disqusDiv = $("
", { "id": id }); - $(".book-body .page-inner").append($disqusDiv); + function prepareDisqusThreadDOM() { + if ($("#disqus_thread").children().length > 0) { + return; + } + + $("#disqus_thread").remove() + $(".book-body .page-inner").append(`
`); } function resetDisqus() { + prepareDisqusPollDOM() prepareDisqusThreadDOM() if (typeof DISQUS !== "undefined") { DISQUS.reset({ @@ -77,6 +84,17 @@ require([ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); + (function() { + if (document.getElementById('disqus_polls_script')) { + // polls.js script already loaded, don't load a second time + return; + } + var d = document, s = d.createElement('script'); + s.id = 'disqus_polls_script'; + s.src = 'https://dasarpemrogramangolang.disqus.com/polls.js'; + (d.head || d.body).appendChild(s); + })() + resetDisqus(); } diff --git a/content/style-website-v3.css b/content/style-website-v4.css similarity index 98% rename from content/style-website-v3.css rename to content/style-website-v4.css index de77d4c27..b263a4f6f 100644 --- a/content/style-website-v3.css +++ b/content/style-website-v4.css @@ -190,6 +190,10 @@ ins.adsbygoogle { } /* disquss block */ +#disqus_poll { + margin: 40px auto 5px; + max-width: 800px; +} #disqus_thread { margin: 40px auto 5px; max-width: 800px;