Last active
February 19, 2019 02:47
-
-
Save allex/94ce5362059940e9a9f24369eba8e512 to your computer and use it in GitHub Desktop.
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
// GistID: 94ce5362059940e9a9f24369eba8e512 (https://git.io/fhdGF) | |
var isP2PEnable = (function(scaleName, scale) { | |
var setc = function(e, t, i, o) { | |
var a = e + "=" + escape(t), n = new Date(); | |
n.setTime(n.getTime() + 60 * i * 60 * 1e3), o && (a += ";path=/ ; domain=" + (o || '')), | |
document.cookie = a + "; expires=" + n.toGMTString(); | |
}; | |
var getc = function(e) { | |
var o = new RegExp("(?:^|;+|\\s+)" + e + "=([^;]*)"), c = document.cookie.match(o); | |
return c ? c[1] : ""; | |
}; | |
var __random_seed = getc(scaleName) || Math.random(); | |
var flg = __random_seed < scale; | |
setc(scaleName, __random_seed, 24 * 365 * 3, '.' + document.domain.split('.').slice(-2).join('.')); | |
return flg | |
})('__random_seed_p2p_v2', 0.2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment