Skip to content

Instantly share code, notes, and snippets.

@vdeemann
Created June 18, 2026 23:06
Show Gist options
  • Select an option

  • Save vdeemann/5d18e4232ff2df35cde490aa8d0c7421 to your computer and use it in GitHub Desktop.

Select an option

Save vdeemann/5d18e4232ff2df35cde490aa8d0c7421 to your computer and use it in GitHub Desktop.
On joining any room on 70s.neader.com, auto-injects the Screen-In-Center and turnStyles scripts — identical to clicking the two bookmarklets.
// ==UserScript==
// @name 70s.neader Auto Center-Screen + turnStyles
// @namespace https://github.com/vdeemann
// @version 2.0.0
// @description On joining any room on 70s.neader.com, auto-injects the Screen-In-Center and turnStyles scripts — identical to clicking the two bookmarklets.
// @match https://70s.neader.com/*
// @run-at document-idle
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Flip to true to show a small "auto-enable fired" toast + console logs.
const DEBUG = false;
function log(...a) { if (DEBUG) console.log('[auto-enable]', ...a); }
// --- The two features. Each = the bookmarklet's action (inject a script once). ---
function enableScreenInCenter() {
if (document.getElementById('screenthingScript')) return; // already injected
const s = document.createElement('script');
s.id = 'screenthingScript';
s.type = 'text/javascript';
s.src = 'https://thompsn.com/turntable/centerscreen/screenthing.js?v=1.1';
document.body.appendChild(s);
log('injected Screen In Center');
}
function enableTurnstyles() {
if (document.getElementById('turnstylesScript')) return; // already injected
const s = document.createElement('script');
s.id = 'turnstylesScript';
s.type = 'text/javascript';
s.src = 'https://ts.pixelcrisis.co/browser.js?' + Math.random();
document.body.appendChild(s);
log('injected turnStyles');
}
// --- Are we inside a room yet? (room canvas or the chat input both prove it) ---
function isInRoom() {
return !!(
document.querySelector('canvas.room-renderer') ||
document.querySelector('input[placeholder*="message" i]')
);
}
// --- Wait for the room, inject both once, then stop. Cheap 1s poll, no observers. ---
let done = false;
function tryEnable() {
if (done || !isInRoom()) return;
done = true;
clearInterval(poll);
// brief settle so screenthing acts on a fully-rendered room (like a manual click)
setTimeout(() => {
enableScreenInCenter();
enableTurnstyles();
toast();
log('done');
}, 600);
}
const poll = setInterval(tryEnable, 1000);
tryEnable();
// --- Optional confirmation toast (only when DEBUG) ---
function toast() {
if (!DEBUG) return;
const t = document.createElement('div');
t.textContent = 'auto-enable fired';
t.style.cssText =
'position:fixed;top:12px;left:62%;transform:translateX(-50%);z-index:999999;' +
'background:#1db954;color:#fff;font:13px/1.4 system-ui,sans-serif;' +
'padding:8px 14px;border-radius:6px;box-shadow:0 2px 8px rgba(0,0,0,.4);' +
'pointer-events:none;';
document.body.appendChild(t);
setTimeout(() => t.remove(), 2500);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment