2015-06-28 02:47:46 +01:00
|
|
|
---
|
|
|
|
---
|
|
|
|
$(document).ready ->
|
2015-06-28 16:37:34 +01:00
|
|
|
$('ul#comments-tabs li').not('.static').click ->
|
2020-01-21 17:01:54 +00:00
|
|
|
addScript = (script, data = {} ) ->
|
2015-12-02 10:49:28 +00:00
|
|
|
scr = document.createElement 'script'
|
|
|
|
scr.type = 'text/javascript'
|
|
|
|
scr.async = true
|
|
|
|
scr.src = script
|
2020-01-21 17:01:54 +00:00
|
|
|
for key, value of data
|
|
|
|
scr.setAttribute "data-#{key}", value
|
2015-12-02 10:49:28 +00:00
|
|
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild scr
|
|
|
|
|
2015-06-28 02:47:46 +01:00
|
|
|
tab_id = $(this).attr 'data-div'
|
2015-06-28 22:15:28 +01:00
|
|
|
service = $(this).attr 'data-service'
|
|
|
|
|
|
|
|
switch service
|
|
|
|
when 'disqus'
|
|
|
|
# load Disqus
|
2015-12-02 10:49:28 +00:00
|
|
|
addScript("//#{disqus_shortname}.disqus.com/embed.js")
|
2015-06-28 22:15:28 +01:00
|
|
|
$(this).removeAttr 'data-service'
|
|
|
|
|
2015-12-02 10:49:28 +00:00
|
|
|
when 'spotim'
|
|
|
|
# load spot.im
|
2020-01-21 17:01:54 +00:00
|
|
|
addScript('//recirculation.spot.im/spot/sp_cNwZLN9Q')
|
|
|
|
addScript('//launcher.spot.im/spot/sp_cNwZLN9Q', { "post-id": window.spotim_postid, "spotim-module": "spotim-launcher" } )
|
2015-06-28 22:15:28 +01:00
|
|
|
$(this).removeAttr 'data-service'
|
2015-06-28 02:47:46 +01:00
|
|
|
|
2015-06-28 23:09:06 +01:00
|
|
|
$('ul#comments-tabs li.hint').remove()
|
2015-06-28 23:07:45 +01:00
|
|
|
|
2015-06-28 02:47:46 +01:00
|
|
|
$('ul#comments-tabs li').removeClass 'current'
|
|
|
|
$('.comments-tab').removeClass 'current'
|
|
|
|
|
|
|
|
$(this).addClass 'current'
|
|
|
|
$("##{tab_id}").addClass 'current'
|