mirror of
https://github.com/mbirth/wiki.git
synced 2024-12-25 23:04:06 +00:00
Load comment scripts on first click.
This commit is contained in:
parent
f7a0ca6069
commit
60f10bbdc6
@ -1,29 +1,20 @@
|
|||||||
<ul id="comments-tabs">
|
<ul id="comments-tabs">
|
||||||
<li class="static">Comments:</li>
|
<li class="static">Comments:</li>
|
||||||
<li class="current" data-div="comments_disqus">Disqus</li>
|
<li data-service="disqus" data-div="comments_disqus">Disqus</li>
|
||||||
<li data-div="comments_google">Google+</li>
|
<li data-service="google" data-div="comments_google">Google+</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div id="comments_disqus" class="comments-tab current">
|
<div id="comments_disqus" class="comments-tab">
|
||||||
<div id="disqus_thread"></div>
|
<div id="disqus_thread">Loading <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus</a>…</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* * * CONFIGURATION VARIABLES * * */
|
/* * * CONFIGURATION VARIABLES * * */
|
||||||
var disqus_shortname = 'mb-wiki';
|
var disqus_shortname = 'mb-wiki';
|
||||||
var disqus_identifier = '{% if page.id %}{{ page.id }}{% else %}/index{% endif %}';
|
var disqus_identifier = '{% if page.id %}{{ page.id }}{% else %}/index{% endif %}';
|
||||||
var disqus_title = '{{ page.title }}';
|
var disqus_title = '{{ page.title }}';
|
||||||
var disqus_url = '{{ site.url }}{{ page.url }}';
|
var disqus_url = '{{ site.url }}{{ page.url }}';
|
||||||
|
|
||||||
/* * * DON'T EDIT BELOW THIS LINE * * */
|
|
||||||
(function() {
|
|
||||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
|
||||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
|
||||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
|
||||||
})();
|
|
||||||
</script>
|
</script>
|
||||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="comments_google" class="comments-tab">
|
<div id="comments_google" class="comments-tab">
|
||||||
<script src="//apis.google.com/js/plusone.js" type="text/javascript"></script>
|
|
||||||
<div class="g-comments" data-href="{{ site.url }}{{ page.url }}" data-width="868" data-first_party_property="BLOGGER" data-view_type="FILTERED_POSTMOD">Loading Google+ comments…</div>
|
<div class="g-comments" data-href="{{ site.url }}{{ page.url }}" data-width="868" data-first_party_property="BLOGGER" data-view_type="FILTERED_POSTMOD">Loading Google+ comments…</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,6 +3,26 @@
|
|||||||
$(document).ready ->
|
$(document).ready ->
|
||||||
$('ul#comments-tabs li').not('.static').click ->
|
$('ul#comments-tabs li').not('.static').click ->
|
||||||
tab_id = $(this).attr 'data-div'
|
tab_id = $(this).attr 'data-div'
|
||||||
|
service = $(this).attr 'data-service'
|
||||||
|
|
||||||
|
switch service
|
||||||
|
when 'disqus'
|
||||||
|
# load Disqus
|
||||||
|
dsq = document.createElement 'script'
|
||||||
|
dsq.type = 'text/javascript'
|
||||||
|
dsq.async = true
|
||||||
|
dsq.src = "//#{disqus_shortname}.disqus.com/embed.js"
|
||||||
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild dsq
|
||||||
|
$(this).removeAttr 'data-service'
|
||||||
|
|
||||||
|
when 'google'
|
||||||
|
# load Google+
|
||||||
|
gog = document.createElement 'script'
|
||||||
|
gog.type = 'text/javascript'
|
||||||
|
gog.async = true
|
||||||
|
gog.src = '//apis.google.com/js/plusone.js'
|
||||||
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild gog
|
||||||
|
$(this).removeAttr 'data-service'
|
||||||
|
|
||||||
$('ul#comments-tabs li').removeClass 'current'
|
$('ul#comments-tabs li').removeClass 'current'
|
||||||
$('.comments-tab').removeClass 'current'
|
$('.comments-tab').removeClass 'current'
|
||||||
|
Loading…
Reference in New Issue
Block a user