Last active
December 21, 2015 23:18
-
-
Save davidlbatey/6380807 to your computer and use it in GitHub Desktop.
Uservoice coffeescript with turbolinks support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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