Created
April 3, 2011 02:55
-
-
Save raliste/900131 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
function setCookie(a, b, d, e) { | |
if (d) { | |
var f = new Date(); | |
var c = new Date(); | |
c.setTime(f.getTime() + d); | |
} | |
document.cookie = a + "=" + encodeURIComponent(b) + "; " + (d ? "expires=" + c.toGMTString() + "; " : "") + "path=" + (e || '/') + "; domain=" + window.location.hostname.replace(/^.*(\.facebook\..*)$/i, '$1'); | |
} | |
function clearCookie(a) { | |
document.cookie = a + "=; expires=Sat, 01 Jan 2000 00:00:00 GMT; " + "path=/; domain=" + window.location.hostname.replace(/^.*(\.facebook\..*)$/i, '$1'); | |
} | |
function getCookie(d) { | |
var e = d + "="; | |
var b = document.cookie.split(';'); | |
for (var c = 0; c < b.length; c++) { | |
var a = b[c]; | |
while (a.charAt(0) == ' ') a = a.substring(1, a.length); | |
if (a.indexOf(e) == 0) return decodeURIComponent(a.substring(e.length, a.length)); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment