Skip to content

jeremy46231/qrqr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QRQR

A QR code that can generate QR codes

QRQR
data:text/html,<script>d=new%20DecompressionStream('deflate-raw');w=d.writable.getWriter();w.write(new%20Uint8Array([...[...location.hash.slice(1).matchAll('.{16}')].map(s=>(+s[0]).toString(2).padStart(53,0)).join``.matchAll`.{8}`].map(s=>parseInt(s[0],2)).slice(0,2550)));w.close();d.readable.getReader().read().then(v=>eval(new%20TextDecoder().decode(v.value)))</script>#4410266470807234730992868952275246841639565580320691446019841315335811183591427665032091039463875444021094202372580125721880936281276205442554005892152297401979508984953587838881365424647522328122878334757369362881856356159779374109601733777793159837000068101723713235062271548704136959747626827838910566425753219562241035385405455463567605979865657952790541658595595687392542818816994275955309847161494031274287727871756548774591697337535401244591198334173612695654708307056918282845852568849865814201951988024967989434021146054617728001296128259471115829833179366760690437806542739935044814237537594855917352550632695898258226284368787178193012266193294850679983551741328093321145563156134054961238051487725027058844197565895028744345217039710838347274898921226431563426869448197100467833762729600032950220017954127705700612704675056356431853725649684924300733095775755628222304789122556100878446610497978377555508667911859202306303561635377513595047819214961786742275975497798358159142355952838036281653572128651286400542550170720754158120944843425728450075181215200579579693723086536774612368198623376398781240027041039504847643327001648099686712965010700270633729355802691796287157920352087216087927974075686330668829155410700260649389159589887230718648273690711193463281597473298236107565858735357041615881688891395124393034525945920124928731646616752109407175704228620930772556232451712109169193813045246065980247711440938923325908372116783727151667755219468983565831702052177679108077435640390091503562756938119258590946763289858894403275506868312092269543608307019574526626825241402740962916317675925954200575263904525400087670167901187084851380668547303770436280602567085247628946475481249015639360188874255419018743664946880588568723866835473660559972838011896778201843404809263204127188119610067682108937081946036698213562952276722487146149109554986235240208942581084659032215782544708888875817561763216585857090062969464700477665202748753482862637046564806420218523878021309320694039917072455146068866221847969281057747780011735008065312280056799920347983661034128402521322220856939713969731555035498848968606551154214013450704818724267124537799544120844062773423100998076066232620257313209120326233841113205539171703886214588912521175903185395244956763320220126276839569515366042428556459138048730926896200705811954294188114274024323228462729011586610598330206650052909133912247683359822914933589671206684674399455071557261254882231693387388380007130836568305089537147173612076387772461075705126048631328538925187023456893003558416353200502105810093848243591488470010976954791352500507241649863633620465235309541181972340656145296057427481139593174105537271260827758891324550244991382654297316691416838571719687923197463897945695167002014020376134800812705739546351318380291003850324856371749051552200072175595453873034672711622081609185458770062089987716353068566012621320911808487663329087849263240165868363807402051705052893571681724361943410101215336553687852684452310529216440435979244276918159417419673152264728189561809136416675975810978143497040538715403225013981735267007899198940524740917721998310597349883845399379109667892978033942985609695338076709282829862868799586701870629632586302917436678629642649816641086390809274189907676653801384314236430356572598798259491259660423506002051261634502332567461678151436668068908197397780753610305127762949578897011301715293060863323710141927024002148280837765361522689479552143245608418441781007561459143400945767076577770216769754833370979645157051802573748096968951614271529334944048550462727511343559982426125754915642717045600458099032845345222517461497356039786943630795872636583131345917039245562565065142282399081779491938965238192779434615211689192133731996256330309997878805451808641669689841960845681353354116277346191673268473090608616209734573861403021315984135243173597252279612217269072629159085706390055186886404547571695740509141564245965681186207976598444196508297137836916468059645485827030369113234137469185753056328687344349830272781371488286113633943104002691020655050368903344519299044763334423249339801265299560977736472341154476029806111844814373973418614928693438041488973312456859174185469465655120686685838940045209902797297814770839921736121404618833716334505640645051579910383266505925898120210595634386340365822159062477987858612881114788590925266331846283001116366037690282720765787532133431674878791635129538880545644640372298629672417253368514876865614441284881277217774115837724104234211383296170420551599726691698212156282410460185432957897568046707812201463137765530699042353527893051122848882399697023986927314423792428234379404619067506832165079865621884523004448606268796243300806810012449419775333728053533952738447841460873126419690752532674617324596193783644013864416477436606387752657533202577296700680873282667860590803769666286990289804439383469548663835190285508025975215463988091007569129057272170457812632554893137432719187039325797972095419386268605474340467174226806648497016405146408990288471211994668392120607884482507863339840798657387599617072086793610584514241361623395341915149850522780063575609674595582401754815847936243277200477354411702301285792592936362350722187787996473891740070710160688469025406834963368988675444219247695128645745637783462897691960460704519795525255765806534078987856458392277208920592758477595579022938638093779569505604831723050500356463413445834939193314464189099923443725646126094443452015490688889205550176359526919523274880621992697206290995670044435513465949735835889639695672866268371673624971834587699858958987695109301357517427912085349062035293732356149651857281565019637083356425970781765843665331140552665328893285898552682115802140964557030754084491844987372838649689922147580496157278413217417647985289711010342405762775527659731493466351856627570469167600503120579180509847927442379246030037488368416734831709802027203091730624584945030455771605350677822003004970794151575050484435761080407583016036059595285193007081822024662551607493955359162165927505806611303742948302049838383071811945312105800765147031265292383706830842543658465961399995886510307135239767920875473168499458590149759537120

Made for Hack Club's Say Cheese YSWS :D

Note: If you're using an iPhone, point the camera at the QR code, click the QR icon in the bottom right, and copy the URL to your browser. Other QR scanners may need similar steps, they don't recognize data: URLs as URLs. You can also copy the URL above and paste it into a new tab to try it out without needing to scan the QR code.

How it works

The source code is in src/. The JavaScript files are compiled with Google's incredible Closure Compiler, then ran through Terser for good measure. The resulting bundle is then compressed with raw Deflate, converted to a string of decimal numbers, and appended to the end of prefix.html to create the final data: URL. The QR code uses byte mode and numeric mode, letting much more data fit in the QR code.

The prefix, golfed by hand, has a script tag which decodes, decompresses, and executes the bundle from the URL. The JS then writes a UI to the page, accepting text and generating QR codes, which are rendered to many <div>s in a CSS Grid. If no URL is inputted, it defaults to the current page's location, making the page a sort of quine, generating a QR code of itself.

Compiling

To compile the QR code, install the dependencies and run the compile.ts script:

# imagemagick is optional, used for converting the SVG to PNG
winget install ImageMagick # windows
brew install imagemagick # mac
sudo apt install imagemagick # debian/ubuntu

bun i
bun compile.ts

This will generate a dist/qr.svg file with the QR code, as well as a dist/url.txt file with the URL to the page. It will also update the README.md with the new URL.

Credits

QR code generator adapted from alexeyten/qr-image (MIT licensed) and significantly trimmed down and golfed by hand.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published