Mercurial > hg > Blog
comparison themes/tuxlite_tbs/templates/juvia.html @ 9:6e2bcaecf3ec
include the theme locally to avoid any dependency on the pelican-themes git repo. Those guys don't incorporate the fixes as quickly as I need plus, I already changed the theme to incorporate the juvia comments.
| author | Dirk Olmes <dirk@xanthippe.ping.de> |
|---|---|
| date | Mon, 01 Jul 2013 04:09:23 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 8:587302b65fb6 | 9:6e2bcaecf3ec |
|---|---|
| 1 {% if JUVIA_SITE_KEY %} | |
| 2 <div id="juvia_comments"></div> | |
| 3 <script type="text/javascript" class="juvia"> | |
| 4 (function() { | |
| 5 var options = { | |
| 6 container : '#juvia_comments', | |
| 7 site_key : '{{ JUVIA_SITE_KEY }}', | |
| 8 topic_key : location.pathname, | |
| 9 topic_url : location.href, | |
| 10 topic_title : document.title || location.href, | |
| 11 include_base: !window.Juvia, | |
| 12 include_css : !window.Juvia | |
| 13 }; | |
| 14 | |
| 15 function makeQueryString(options) { | |
| 16 var key, params = []; | |
| 17 for (key in options) { | |
| 18 params.push( | |
| 19 encodeURIComponent(key) + | |
| 20 '=' + | |
| 21 encodeURIComponent(options[key])); | |
| 22 } | |
| 23 return params.join('&'); | |
| 24 } | |
| 25 | |
| 26 function makeApiUrl(options) { | |
| 27 // Makes sure that each call generates a unique URL, otherwise | |
| 28 // the browser may not actually perform the request. | |
| 29 if (!('_juviaRequestCounter' in window)) { | |
| 30 window._juviaRequestCounter = 0; | |
| 31 } | |
| 32 | |
| 33 var result = | |
| 34 '{{ JUVIA_URL }}/api/show_topic.js' + | |
| 35 '?_c=' + window._juviaRequestCounter + | |
| 36 '&' + makeQueryString(options); | |
| 37 window._juviaRequestCounter++; | |
| 38 return result; | |
| 39 } | |
| 40 | |
| 41 var s = document.createElement('script'); | |
| 42 s.async = true; | |
| 43 s.type = 'text/javascript'; | |
| 44 s.className = 'juvia'; | |
| 45 s.src = makeApiUrl(options); | |
| 46 (document.getElementsByTagName('head')[0] || | |
| 47 document.getElementsByTagName('body')[0]).appendChild(s); | |
| 48 })(); | |
| 49 </script> | |
| 50 {% endif %} |
