Skip to content

Instantly share code, notes, and snippets.

View swnck's full-sized avatar
🐒

Nick Schweizer swnck

🐒
View GitHub Profile
@swnck
swnck / 3DPageViewer.js
Created March 29, 2024 03:13
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
//Credits: https://gist.github.com/OrionReed/4c3778ebc2b5026d2354359ca49077ca
(() => {
const THICKNESS = 5;
const MAX_ROTATION = 180;
const DISTANCE = 10000;
const getDOMDepth = element => [...element.children].reduce((max, child) => Math.max(max, getDOMDepth(child)), 0) + 1;
const body = document.body;