mirror of
https://github.com/mbirth/wiki.git
synced 2024-11-09 13:16:45 +00:00
Add spot.im. Improved comment's javascript loading.
This commit is contained in:
parent
26ab5aa439
commit
7efc8e549c
@ -2,6 +2,7 @@
|
||||
<li class="static"><strong>Comments:</strong></li>
|
||||
<li data-service="disqus" data-div="comments_disqus">Disqus</li>
|
||||
<li data-service="google" data-div="comments_google">Google+</li>
|
||||
<li data-service="spotim" data-div="comments_spotim">spot.im</li>
|
||||
<li class="hint static">(Click to enable.)</li>
|
||||
</ul>
|
||||
|
||||
@ -19,3 +20,13 @@
|
||||
<div id="comments_google" class="comments-tab">
|
||||
<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 id="comments_spotim" class="comments-tab">
|
||||
<div id="spot-im-frame-inpage" data-post-id="{% if page.id %}{{ page.id }}{% else %}/index{% endif %}"></div>
|
||||
<script type="text/javascript">
|
||||
/* * * CONFIGURATION VARIABLES * * */
|
||||
window.SPOTIM = {
|
||||
spotId: 'sp_cNwZLN9Q'
|
||||
};
|
||||
</script>
|
||||
</div>
|
@ -2,26 +2,30 @@
|
||||
---
|
||||
$(document).ready ->
|
||||
$('ul#comments-tabs li').not('.static').click ->
|
||||
addScript = (script) ->
|
||||
scr = document.createElement 'script'
|
||||
scr.type = 'text/javascript'
|
||||
scr.async = true
|
||||
scr.src = script
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild scr
|
||||
|
||||
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
|
||||
addScript("//#{disqus_shortname}.disqus.com/embed.js")
|
||||
$(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
|
||||
addScript('//apis.google.com/js/plusone.js')
|
||||
$(this).removeAttr 'data-service'
|
||||
|
||||
when 'spotim'
|
||||
# load spot.im
|
||||
addScript('//www.spot.im/launcher/bundle.js')
|
||||
$(this).removeAttr 'data-service'
|
||||
|
||||
$('ul#comments-tabs li.hint').remove()
|
||||
|
Loading…
Reference in New Issue
Block a user