+var supports_html5_storage = function() {
+ try {
+ return 'localStorage' in window && window['localStorage'] !== null;
+ } catch (e) {
+ return false;
+ }
+}
+
+// Make the unique token persistent so people refreshing the page won't count twice.
+// Of course, you can never fully protect against people deliberately wanting to spam.
+var get_unique = function() {
+ var use_local_storage = supports_html5_storage();
+ if (use_local_storage && localStorage['unique']) {
+ return localStorage['unique'];
+ }
+ var unique = Math.random();
+ if (use_local_storage) {
+ localStorage['unique'] = unique;
+ }
+ return unique;
+}
+