Skip to content

Commit

Permalink
Incremented version and changed UV due to limits
Browse files Browse the repository at this point in the history
iChrome has been exceeding UserVoice's free plan limits (1,000,000
requests/month).  This change makes the auto-prompt code only load for
20% of page views.

This commit also increments the version, and moves the homepage override
up in the manifest so merges don't have to be handled manually.
  • Loading branch information
Avi Kohn committed May 22, 2015
1 parent 43bda21 commit f9fa9d7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
50 changes: 31 additions & 19 deletions app/js/core/uservoice.js
Expand Up @@ -2,34 +2,46 @@
* Initializes UserVoice and it's autoprompts
*/
define(["core/uid"], function(uid) {
window.UserVoice = window.UserVoice || [];
var initUV = function() {
var uv = document.createElement("script");

var uv = document.createElement("script");
uv.async = true;
uv.type = "text/javascript";
uv.src = "https://widget.uservoice.com/YLT6rl3u3uU75IbSodIBw.js";

uv.async = true;
uv.type = "text/javascript";
uv.src = "https://widget.uservoice.com/YLT6rl3u3uU75IbSodIBw.js";
var s = document.getElementsByTagName("script")[0];

var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(uv, s);

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(["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(["identify", {
id: uid
}]);
window.UserVoice.push(["autoprompt", {
position: "toast"
}]);
};

if (Math.random() * 5 < 1) {
window.UserVoice = window.UserVoice || [];

window.UserVoice.push(["autoprompt", {
position: "toast"
}]);
initUV();
}

return function() {
if (!window.UserVoice) {
window.UserVoice = [];

initUV();
}

window.UserVoice.push(Array.prototype.slice.call(arguments));
};
});
8 changes: 4 additions & 4 deletions app/manifest.json
Expand Up @@ -40,6 +40,9 @@
"48": "icon/48.png",
"128": "icon/128.png"
},
"chrome_settings_overrides": {
"homepage": "http://ichro.me/redirect"
},
"permissions": [
"storage",
"topSites",
Expand All @@ -56,10 +59,7 @@
"bookmarks",
"management"
],
"chrome_settings_overrides": {
"homepage": "http://ichro.me/redirect"
},
"version": "2.1.17",
"version": "2.1.18",
"manifest_version": 2,
"default_locale": "en",
"short_name": "iChrome",
Expand Down

0 comments on commit f9fa9d7

Please sign in to comment.