Skip to content

Instantly share code, notes, and snippets.

@davidlbatey
Last active December 21, 2015 23:18
Show Gist options
  • Save davidlbatey/6380807 to your computer and use it in GitHub Desktop.
Save davidlbatey/6380807 to your computer and use it in GitHub Desktop.
Uservoice coffeescript with turbolinks support
# Suggest this goes in it's own file
$.pageLoad = (ready) ->
$(document).ready(ready)
$(document).on('page:load', ready)
# Called on document ready and turbo links page:load
$.pageLoad ->
unless window.UserVoice
loadUserVoice()
else
display()
# Update with your widget url
loadUserVoice = ->
js = $.getScript('//widget.uservoice.com/xxxxxxx.js')
js.then display
# Update the xxxx with the correct value for your site
display = ->
UserVoice = window.UserVoice || []
UserVoice.push ['showTab', 'classic_widget',
mode: 'full',
primary_color: 'xxxx',
link_color: 'xxxx',
default_mode: 'feedback',
forum_id: xxxx,
tab_label: 'Feedback & Support',
tab_color: 'xxxx',
tab_position: 'xxxx',
tab_inverted: false
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment