-
Notifications
You must be signed in to change notification settings - Fork 45
/
uservoice.js
47 lines (36 loc) · 945 Bytes
/
uservoice.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Initializes UserVoice and it's autoprompts
*/
define(["core/uid"], function(uid) {
var initUV = function() {
var uv = document.createElement("script");
uv.async = true;
uv.type = "text/javascript";
uv.src = "https://widget.uservoice.com/YLT6rl3u3uU75IbSodIBw.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(uv, s);
window.UserVoice.push(["set", {
accent_color: "#448dd6",
trigger_color: "white",
screenshot_enabled: "false",
trigger_background_color: "rgba(46, 49, 51, 0.6)"
}]);
window.UserVoice.push(["identify", {
id: uid
}]);
window.UserVoice.push(["autoprompt", {
position: "toast"
}]);
};
if (Math.random() * 5 < 1) {
window.UserVoice = window.UserVoice || [];
initUV();
}
return function() {
if (!window.UserVoice) {
window.UserVoice = [];
initUV();
}
window.UserVoice.push(Array.prototype.slice.call(arguments));
};
});