lobste.rs has a js-error: here is a mitigation
5 points by refp
5 points by refp
https://lobste.rs – at the time of writing – has a javascript error on load for logged in users:
Uncaught ReferenceError: qS is not defined
at new _LobstersFunction (user-c27ac03d.js:144:34)
at user-c27ac03d.js:665:17
This error is causing much of the site functionality to not work, an easy way to check is to try and [preview] a comment, if that does not work – most likely you have an error in the js-console.
If you provide the missing definition for qS and qSA site functionality is restored in full-effect.
Known to fix:
$things_you_have_spammed_click_wondering_why_it_doesnt_workFor those with webdev experience it is easy to fix the error yourself by simply patching the faulty script with the below:
const qS = (a, b) => b === undefined ? document.querySelector(a) : a.querySelector(b);
const qSA = (a,b) => b === undefined ? [...document.querySelectorAll(a)] : [...a.querySelectorAll(b)];
If the above is ran before the faulty line (665 in this case), all is well and things start working again.
An easier alternative is to use TamperMonkey to automatically run custom javascript for the site, below is what I use:
// ==UserScript==
// @name lobste.rs undefined qS/qSA fix
// @namespace http://tampermonkey.net/
// @version 2026-07-27
// @description try to take over the world!
// @author You
// @match https://lobste.rs/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=lobste.rs
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.qS = (a, b) => b === undefined ? document.querySelector(a) : a.querySelector(b);
window.qSA = (a,b) => b === undefined ? [...document.querySelectorAll(a)] : [...a.querySelectorAll(b)];
})();
Personally I used the override approach after discovering this, but I assume there are more than me who want to use our beloved features while waiting for a redeploy of lobste.rs
(\_/)_00_(\_/)
^- me previewing my own comments like crazy with the mitigation
Happy browsing!
.
.
Note: tampermonkey requires "enable user scripts" in your browser's extension settings, ViolentMonkey has no such requirement.
This works consistently for me now.
// ==UserScript==
// @name lobste.rs qS/qSA repair
// @match https://lobste.rs/*
// @run-at document-end
// @grant none
// ==/UserScript==
let nonce = null;
for (const s of document.scripts) if (s.nonce) { nonce = s.nonce; break; }
if (!nonce) throw new Error('no nonce found');
const el = document.createElement('script');
el.nonce = nonce;
el.type = 'module';
el.textContent = `
window.qS = (a, b) => b === undefined ? document.querySelector(a) : a.querySelector(b);
window.qSA = (a, b) => b === undefined ? [...document.querySelectorAll(a)] : [...a.querySelectorAll(b)];
const map = JSON.parse(document.querySelector('script[type="importmap"]').textContent);
const mod = await import(map.imports.user + '?retry=' + Date.now());
window._LobstersFunction = mod._LobstersFunction;
document.dispatchEvent(new Event('DOMContentLoaded'));
`;
document.documentElement.appendChild(el);
el.remove();
@lalitm see above, this should work (TM)
It works! Thanks so much!
⚠️ ⚠️ ⚠️ ⚠️
The originally posted snippet is faulty, please see this:⚠️ ⚠️ ⚠️ ⚠️
I assume this has been reported to the public repo?
There is the following issue:
There has been heavy activity regarding this in ´#lobsters` (IRC), so at least it is known/discussed there.
Do you mind trying the approach and perhaps upvote this story as a sign of success?
I hope it is as easy for others to fix as it was for me, but with that I don't really know what is considered "easy" given that I assume most do not have web dev experience.
I just tried the TamperMonkey approach and sadly does not seem to have done anything: I'm still seeing the error in console and upvoting doesn't work either.
Ok, so there is a race between the tamperscript being invoked vs the lobster's javascritp is executing. If you have the dev-console open the load slows down enough to always inject our script, so.. browsing with dev-tools open seems to make it more stable!
I have never written anything for tampermonkey before so there might something which isn't ideal in the proposed snippet, but it seems to be working for me.
Edit: Seems to go back to b0rked on some page transitions, working on a fix!