Bookmarklet: [🍪]("javascript:(function(){window.biscuit=(()=>({getCookie: cookieName => document.cookie.split(';').map(item=>item.split('=').map(name=>name.trim())).map(item=>({name: item[0], value: item[1]})).find(item => item.name === cookieName), setCookie: (cookieName, cookieValue) => document.cookie = ${cookieName}=${cookieValue}
}))(); })();")
Last active
August 7, 2018 15:38
-
-
Save ultim8k/56f95f54a0c96ee8b80196660fcfd147 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Long | |
const Oreo = (function Biscuit () { | |
const readRawCookies = () => document.cookie; | |
const writeRawCookies = cookie => document.cookie = cookie; | |
const parseRawCookie = rawCookie => { | |
const [key, val] = rawCookie.split('=').map(item=>item.trim()); | |
return { | |
name: key, | |
value: val | |
} | |
}; | |
const createCookie = (name, value) => `${name}=${value}`; | |
const nameMatches = item => item.name === name; | |
const parseCookies = rawCookies => rawCookies.split(';').map(parseRawCookie); | |
const getCookie = name => parseCookies(readRawCookies()).find(nameMatches); | |
const setCookie = (name, value) => writeRawCookies(createCookie(name, value)); | |
return { | |
getCookie, | |
setCookie | |
}; | |
})(); | |
// Oreo Mini | |
const OreoMini = (()=>({ | |
getCookie: cookieName => document.cookie.split(';').map(item=>item.split('=').map(name=>name.trim())).map(item=>({name: item[0], value: item[1]})).find(item => item.name === cookieName), | |
setCookie: (cookieName, cookieValue) => document.cookie = `${cookieName}=${cookieValue}` | |
}))(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment