Created
September 28, 2023 01:45
-
-
Save PhantomOffKanagawa/535fb0d0e5b694ed2d02e86e13d03c16 to your computer and use it in GitHub Desktop.
Bookmarklet for helping beat the password game on https://neal.fun/password-game/, minify and add (or copy minified version) to a bookmarklet to get the first 23 rules completed
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
javascript:const settings={feed:!0,fightFire:!0,captcha:!0,geo:!0,chess:!0,elements:!0};(function(){function l(u,i){var d=document;if(!d.getElementById(i)){var s=d.createElement('script');s.src=u;s.id=i;d.body.appendChild(s);s.addEventListener('load',fireWatch);s.addEventListener('load',feed);s.addEventListener('load',starter);s.addEventListener('load',captcha);s.addEventListener('load',geo);s.addEventListener('load',chess);s.addEventListener('load',elements)}}l('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js','jquery');let previous='';function fireReplacer(match,offset){console.log(previous+' '+previous.charAt(offset));return previous.charAt(offset)}function fireWatch(){let timeout=setTimeout(fireWatch,200);if(settings.fightFire==true&&$('.ProseMirror p:first-child')[0].innerText.match('๐ฅ')!=null){$('.ProseMirror p:first-child')[0].innerText=$('.ProseMirror p:first-child')[0].innerText.replace('๐ฅ',fireReplacer);settings.fightFire=0;clearTimeout(timeout)}previous=$('.ProseMirror p:first-child')[0].innerText}function feed(){if(settings.feed==true&&$('.hatch').length!=0){if(($('.ProseMirror p:first-child')[0].innerText.match(/๐/g)||[]).length<3){$('.ProseMirror p:first-child')[0].insertAdjacentText('afterbegin','๐')}}setTimeout(feed,10000)}function starter(){if(confirm('Enter Static Starter')){$('.ProseMirror p:first-child')[0].innerHTML='<strong>9๐ฅ4@444Imayiamlovedpepsi๐๏ธโโ๏ธ๐๏ธโโ๏ธ๐๏ธโโ๏ธXXXVHe</strong>'}if(confirm('Enter Wordle')){$.get('https://neal.fun/api/password-game/wordle?date='+new Date().toISOString().slice(0,10),function(data){$('.ProseMirror p:first-child')[0].insertAdjacentText('beforeend',data.answer)})}if(confirm('Enter Moon Phase')){const getJulianDate=(date=new Date())=>{const time=date.getTime();const tzoffset=date.getTimezoneOffset();return time/86400000-tzoffset/1440+2440587.5};const LUNAR_MONTH=29.530588853;const getLunarAge=(date=new Date())=>{const percent=getLunarAgePercent(date);const age=percent*LUNAR_MONTH;return age};const getLunarAgePercent=(date=new Date())=>{return normalize((getJulianDate(date)-2451550.1)/LUNAR_MONTH)};const normalize=value=>{value=value-Math.floor(value);if(value<0){value=value+1}return value};const getLunarPhase=(date=new Date())=>{const age=getLunarAge(date);if(age<1.84566){return '๐'}else if(age<5.53699){return '๐'}else if(age<9.22831){return '๐'}else if(age<12.91963){return '๐'}else if(age<16.61096){return '๐'}else if(age<20.30228){return '๐'}else if(age<23.99361){return '๐'}else if(age<27.68493){return '๐'}return '๐'};$('.ProseMirror p:first-child')[0].insertAdjacentText('beforeend',getLunarPhase())}}function captcha(){let timeout=setTimeout(captcha,500);if(settings.captcha==true&&$('.captcha-img').length!=0){if($('.captcha-img').attr('src').match(/(\/captchas\/)(\D{5})/g)==null){$('.captcha-refresh').click();clearTimeout(timeout);timeout=setTimeout(captcha,100)}else{if(settings.captcha==true){$('.ProseMirror p:first-child')[0].insertAdjacentText('beforeend',/(\/captchas\/)(.{5})/g.exec($('.captcha-img').attr('src'))[2])}settings.captcha=false;clearTimeout(timeout)}}}function geo(){let timeout=setTimeout(geo,500);if(settings.geo==true&&$('.geo-wrapper iframe').length!=0){let toEqual=$('.geo-wrapper iframe').attr('src');let awfulString=window.webpackJsonp[0][1]['1145'].toString();let regex=/title:"([^"]*)",link:"([^"]*)",embed:"([^"]*)"/g;let array=[];while((array=regex.exec(awfulString))!==null){if(array[3]==toEqual){break}}$('.ProseMirror p:first-child')[0].insertAdjacentText('beforeend',array[1].toLowerCase());settings.geo=false;clearTimeout(timeout)}}function chess(){let timeout=setTimeout(chess,500);if(settings.chess==true&&$('.chess-img').length!=0){let i=/puzzle((\d)*)/.exec($('.chess-img').attr('src'))[1];let awfulString=window.webpackJsonp[0][1]['1145'].toString();let regex=/,B=(\[{[^\]]*])/;let arrayStr=regex.exec(awfulString)[1];const puzzles=eval(arrayStr);$('.ProseMirror p:first-child')[0].innerText=(9-(puzzles[i].sol.match(/\d/)[0]))+$('.ProseMirror p:first-child')[0].innerText.slice(1);$('.ProseMirror p:first-child')[0].insertAdjacentText('beforeend',puzzles[i].sol);settings.chess=false;clearTimeout(timeout)}}function elements(){let timeout=setTimeout(elements,500);if(settings.elements==true&&$('.atomic-number').length!=0){let awfulString=window.webpackJsonp[0][1]['1145'].toString();let regex=/r\(69\),(\[{[^\]]*])/;let arrayStr=regex.exec(awfulString)[1];const puzzles=eval(arrayStr);const elements=[];for(ele of puzzles){elements[ele.num]=ele.symbol}let array=[];let regex2=/A[cglmrstu]|B[aehikr]?|C[adeflmnorsu]?|D[bsy]|E[rsu]|F[elmr]?|G[ade]|H[efgos]?|I[nr]?|Kr?|L[airuv]|M[dgnot]|N[abdeiop]?|Os?|P[abdmortu]?|R[abefghnu]|S[bcegimnr]?|T[abcehilm]|U(u[opst])?|V|W|Xe|Yb?|Z[nr]/g;let string=$('.ProseMirror p:first-child')[0].innerText;let atomicTotal=0;while((array=regex2.exec(string))!==null){atomicTotal+=elements.indexOf(array[0])}if(atomicTotal>200){console.log('Over 200')}else if(atomicTotal==200){console.log('Already 200')}else{let atomicLeft=200-atomicTotal;while(atomicLeft>0){if(atomicLeft>118){addElement(118,elements);atomicLeft-=118}else if(/I|V|X|L|C|D|M/.test(elements[atomicLeft])){addElement(1,elements);atomicLeft-=1}else{addElement(atomicLeft,elements);atomicLeft-=atomicLeft}}}settings.elements=false;clearTimeout(timeout)}}function addElement(index,elements){$('.ProseMirror p:first-child')[0].insertAdjacentText('beforeend',elements[index])}})(); |
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
javascript: | |
const settings = { feed: !0, fightFire: !0, captcha: !0, geo: !0, chess: !0, elements: !0 } | |
;(function () { | |
function l (u, i) { | |
var d = document | |
if (!d.getElementById(i)) { | |
var s = d.createElement('script') | |
s.src = u | |
s.id = i | |
d.body.appendChild(s) | |
s.addEventListener('load', fireWatch) | |
s.addEventListener('load', feed) | |
s.addEventListener('load', starter) | |
s.addEventListener('load', captcha) | |
s.addEventListener('load', geo) | |
s.addEventListener('load', chess) | |
s.addEventListener('load', elements) | |
} | |
} | |
l('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', 'jquery') | |
// Fire Watch | |
let previous = '' | |
function fireReplacer (match, offset) { | |
console.log(previous + ' ' + previous.charAt(offset)) | |
return previous.charAt(offset) | |
} | |
function fireWatch () { | |
let timeout = setTimeout(fireWatch, 200) | |
if ( | |
settings.fightFire == true && | |
$('.ProseMirror p:first-child')[0].innerText.match('๐ฅ') != null | |
) { | |
$('.ProseMirror p:first-child')[0].innerText = $( | |
'.ProseMirror p:first-child' | |
)[0].innerText.replace('๐ฅ', fireReplacer) | |
settings.fightFire = 0 | |
clearTimeout(timeout) | |
} | |
previous = $('.ProseMirror p:first-child')[0].innerText | |
} | |
// Feed | |
function feed () { | |
if (settings.feed == true && $('.hatch').length != 0) { | |
if (($('.ProseMirror p:first-child')[0].innerText.match(/๐/g) || []).length < 3) { | |
$('.ProseMirror p:first-child')[0].insertAdjacentText('afterbegin', '๐') | |
} | |
} | |
setTimeout(feed, 10000) | |
} | |
// Starter | |
function starter () { | |
if (confirm('Enter Static Starter')) { | |
$('.ProseMirror p:first-child')[0].innerHTML = '<strong>9๐ฅ4@444Imayiamlovedpepsi๐๏ธโโ๏ธ๐๏ธโโ๏ธ๐๏ธโโ๏ธXXXVHe</strong>' | |
} | |
if (confirm('Enter Wordle')) { | |
$.get( | |
'https://neal.fun/api/password-game/wordle?date=' + | |
new Date().toISOString().slice(0, 10), | |
function (data) { | |
$('.ProseMirror p:first-child')[0].insertAdjacentText( | |
'beforeend', | |
data.answer | |
) | |
} | |
) | |
} | |
if (confirm('Enter Moon Phase')) { | |
// Thanks https://jasonsturges.medium.com/moons-lunar-phase-in-javascript-a5219acbfe6e | |
const getJulianDate = (date = new Date()) => { | |
const time = date.getTime() | |
const tzoffset = date.getTimezoneOffset() | |
return time / 86400000 - tzoffset / 1440 + 2440587.5 | |
}; | |
const LUNAR_MONTH = 29.530588853; | |
const getLunarAge = (date = new Date()) => { | |
const percent = getLunarAgePercent(date) | |
const age = percent * LUNAR_MONTH | |
return age | |
}; | |
const getLunarAgePercent = (date = new Date()) => { | |
return normalize((getJulianDate(date) - 2451550.1) / LUNAR_MONTH) | |
}; | |
const normalize = value => { | |
value = value - Math.floor(value) | |
if (value < 0) value = value + 1 | |
return value | |
}; | |
const getLunarPhase = (date = new Date()) => { | |
const age = getLunarAge(date) | |
if (age < 1.84566) return '๐' | |
else if (age < 5.53699) return '๐' | |
else if (age < 9.22831) return '๐' | |
else if (age < 12.91963) return '๐' | |
else if (age < 16.61096) return '๐' | |
else if (age < 20.30228) return '๐' | |
else if (age < 23.99361) return '๐' | |
else if (age < 27.68493) return '๐' | |
return '๐' | |
}; | |
$('.ProseMirror p:first-child')[0].insertAdjacentText( | |
'beforeend', | |
getLunarPhase() | |
) | |
} | |
} | |
// Captcha | |
function captcha () { | |
let timeout = setTimeout(captcha, 500) | |
if (settings.captcha == true && $('.captcha-img').length != 0) { | |
if ( | |
$('.captcha-img') | |
.attr('src') | |
.match(/(\/captchas\/)(\D{5})/g) == null | |
) { | |
$('.captcha-refresh').click() | |
clearTimeout(timeout) | |
timeout = setTimeout(captcha, 100) | |
} else { | |
if (settings.captcha == true) | |
$('.ProseMirror p:first-child')[0].insertAdjacentText( | |
'beforeend', | |
/(\/captchas\/)(.{5})/g.exec($('.captcha-img').attr('src'))[2] | |
) | |
settings.captcha = false | |
clearTimeout(timeout) | |
} | |
} | |
} | |
// Geo | |
function geo () { | |
let timeout = setTimeout(geo, 500) | |
if (settings.geo == true && $('.geo-wrapper iframe').length != 0) { | |
let toEqual = $('.geo-wrapper iframe').attr('src') | |
let awfulString = window.webpackJsonp[0][1]['1145'].toString() | |
let regex = /title:"([^"]*)",link:"([^"]*)",embed:"([^"]*)"/g | |
let array = [] | |
while ((array = regex.exec(awfulString)) !== null) { | |
if (array[3] == toEqual) break | |
} | |
$('.ProseMirror p:first-child')[0].insertAdjacentText( | |
'beforeend', | |
array[1].toLowerCase() | |
) | |
settings.geo = false | |
clearTimeout(timeout) | |
} | |
} | |
// Chess | |
function chess () { | |
let timeout = setTimeout(chess, 500) | |
if (settings.chess == true && $('.chess-img').length != 0) { | |
let i = /puzzle((\d)*)/.exec($('.chess-img').attr('src'))[1] | |
let awfulString = window.webpackJsonp[0][1]['1145'].toString() | |
let regex = /,B=(\[{[^\]]*])/ | |
let arrayStr = regex.exec(awfulString)[1] | |
const puzzles = eval(arrayStr) | |
//* TODO SUPPORT NOT STARTING STRING NUMBER ADD UP TO | |
$('.ProseMirror p:first-child')[0].innerText = (9 - (puzzles[i].sol.match(/\d/)[0])) + $('.ProseMirror p:first-child')[0].innerText.slice(1) | |
$('.ProseMirror p:first-child')[0].insertAdjacentText( | |
'beforeend', | |
puzzles[i].sol | |
) | |
settings.chess = false | |
clearTimeout(timeout) | |
} | |
} | |
// Elements | |
function elements () { | |
let timeout = setTimeout(elements, 500) | |
if (settings.elements == true && $('.atomic-number').length != 0) { | |
let awfulString = window.webpackJsonp[0][1]['1145'].toString() | |
let regex = /r\(69\),(\[{[^\]]*])/ | |
let arrayStr = regex.exec(awfulString)[1]; | |
const puzzles = eval(arrayStr); | |
const elements = []; | |
for (ele of puzzles) { | |
elements[ele.num] = ele.symbol | |
} | |
let array = [] | |
let regex2 = | |
/A[cglmrstu]|B[aehikr]?|C[adeflmnorsu]?|D[bsy]|E[rsu]|F[elmr]?|G[ade]|H[efgos]?|I[nr]?|Kr?|L[airuv]|M[dgnot]|N[abdeiop]?|Os?|P[abdmortu]?|R[abefghnu]|S[bcegimnr]?|T[abcehilm]|U(u[opst])?|V|W|Xe|Yb?|Z[nr]/g | |
let string = $('.ProseMirror p:first-child')[0].innerText | |
let atomicTotal = 0 | |
while ((array = regex2.exec(string)) !== null) { | |
atomicTotal += elements.indexOf(array[0]) | |
} | |
if (atomicTotal > 200) { | |
console.log('Over 200') | |
} else if (atomicTotal == 200) { | |
console.log('Already 200') | |
} else { | |
let atomicLeft = 200 - atomicTotal; | |
while (atomicLeft > 0) { | |
if (atomicLeft > 118) { | |
addElement(118, elements); | |
atomicLeft -= 118; | |
} else if (/I|V|X|L|C|D|M/.test(elements[atomicLeft])) { | |
addElement(1, elements); | |
atomicLeft -= 1; | |
} else { | |
addElement(atomicLeft, elements); | |
atomicLeft -= atomicLeft; | |
} | |
} | |
} | |
settings.elements = false | |
clearTimeout(timeout) | |
} | |
} | |
function addElement(index, elements) { | |
$('.ProseMirror p:first-child')[0].insertAdjacentText( | |
'beforeend', | |
elements[index] | |
) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment