Created
October 1, 2024 18:00
-
-
Save pingyen/5fc3ddb3729a3d8852f66fe4b1db29d0 to your computer and use it in GitHub Desktop.
PTT over 18 cookie detection
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
(() => { | |
const set = new Set(['gossiping', 'sex']); | |
const pathname = location.pathname; | |
const tokens = pathname.split('/'); | |
if (tokens.length < 3) { | |
return; | |
} | |
const kind = tokens[1]; | |
if (kind !== 'bbs' && kind !== 'man') { | |
return; | |
} | |
const board = tokens[2].toLocaleLowerCase(); | |
if (set.has(board) === false) { | |
return; | |
} | |
if (document.cookie.indexOf('over18=1') !== -1) { | |
return; | |
} | |
location.replace('/ask/over18?from=' + encodeURIComponent(pathname)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment