Skip to content

Instantly share code, notes, and snippets.

@keevie
Last active May 31, 2022 19:25
Show Gist options
  • Save keevie/41cd43089e4b67d5ed90d7f9772edafe to your computer and use it in GitHub Desktop.
Save keevie/41cd43089e4b67d5ed90d7f9772edafe to your computer and use it in GitHub Desktop.
fakepeople

Table friends

in a lounge layout, join a table with camera on and mic off, then run this bookmarklet

javascript: (function() { fetch('https://gist.githubusercontent.com/keevie/fc059dfe3f56e1cd908f4a57f2d0af82/raw/87fc0d0346819cb7caf17e8f8456b630cb740157/fake-people.json').then(res => res.json()) .then(friendImageArray => { function shuffle(array) { let currentIndex = array.length, randomIndex; while (currentIndex != 0) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex--; [array[currentIndex], array[randomIndex]] = [ array[randomIndex], array[currentIndex]]; } return array; } friendImageUrls = shuffle(friendImageArray).slice(-5); friendNames = [ 'Zachary Simms', 'Claire Gibson', 'Jasmine Ginnish', 'Vilho Rintala', 'Martin Isdahl', ]; streamContainer = document.querySelector('vk-call').shadowRoot.querySelector('.VideoCall_Streams'); for (const i of Array(4).keys()) { streamContainer.appendChild(streamContainer.children[0].cloneNode(true)); } let streamWidth = streamContainer.children[0].getBoundingClientRect().width / 2; streamContainer.style = `--video-stream-min-size: ${streamWidth}px`; for (const v of streamContainer.querySelectorAll('video')) { friendImageUrls.push(v.src = friendImageUrls.shift()); v.outerHTML = v.outerHTML.replace('video', 'img'); } for (const el of streamContainer.querySelectorAll('.StreamProfile_Name')) { el.innerText = friendNames.shift(); } let myTable = [...document.querySelectorAll('.table')] .find(t => t.innerHTML.match(/(you)/)); for (const p of myTable.querySelectorAll('.participant')) { p.style.backgroundImage = `url(${friendImageUrls.shift()})`; p.style.backgroundSize = 'cover'; p.style.backgroundPosition = 'center'; p.innerHTML = ''; }; }); })()

@keevie
Copy link
Author

keevie commented Jan 26, 2022

###put people in the tables of a hybrid layout

bookmarklet
javascript:function fill(name) { let rooms = document.querySelectorAll('.tables-container .table'); if (name) { var room = [...rooms].find(r => r.innerHTML.match(name)); } else { var room = rooms[Math.random() * rooms.length | 0]; } let seat = room.querySelector('.participant.is-empty'); if (!seat) { const oldSeat = room.querySelector('.participant'); seat = oldSeat.cloneNode(oldSeat); seat.removeChild(seat.querySelector(".avatar")); oldSeat.parentNode.appendChild(seat); } seat.style.backgroundImage = `url(https://randomuser.me/api/portraits/${Math.random() > 0.5 ? 'men' : 'women'}/${Math.random() * 100 | 0}.jpg)`; seat.classList.remove('is-empty'); seat.style.backgroundSize = 'cover'; } for (const i of Array(10).keys()) { fill(); };void(0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment