2014-10-27 14:45:50 -07:00
|
|
|
|
(function (globalScope, store) {
|
2014-10-26 17:19:52 -07:00
|
|
|
|
|
2014-10-27 14:45:50 -07:00
|
|
|
|
if (!globalScope.MediaBrowser) {
|
|
|
|
|
globalScope.MediaBrowser = {};
|
|
|
|
|
}
|
2014-10-26 20:06:01 -07:00
|
|
|
|
|
2014-10-27 14:45:50 -07:00
|
|
|
|
globalScope.MediaBrowser.generateDeviceId = function () {
|
2014-10-26 17:19:52 -07:00
|
|
|
|
|
|
|
|
|
var keys = [];
|
|
|
|
|
|
|
|
|
|
keys.push(navigator.userAgent);
|
|
|
|
|
keys.push((navigator.cpuClass || ""));
|
|
|
|
|
|
|
|
|
|
var randomId = '';
|
|
|
|
|
|
|
|
|
|
// Since the above is not guaranteed to be unique per device, add a little more
|
|
|
|
|
randomId = store.getItem('randomId');
|
|
|
|
|
|
|
|
|
|
if (!randomId) {
|
|
|
|
|
|
|
|
|
|
randomId = new Date().getTime();
|
|
|
|
|
|
|
|
|
|
store.setItem('randomId', randomId.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keys.push(randomId);
|
2014-11-05 12:28:41 -07:00
|
|
|
|
return CryptoJS.SHA1(keys.join('|')).toString();
|
2014-10-26 17:19:52 -07:00
|
|
|
|
};
|
|
|
|
|
|
2014-10-27 14:45:50 -07:00
|
|
|
|
})(window, store);
|