No popup on running v0.9
I'm running Firefox 142 with a variety of extensions (I'm not on my desktop right now so can't get the list).
V0.4 of the script gets on and prints Claude chats fine. V0.9 doesn't issue the initial popup for me.
I'm guessing it's hitting some blocker.
I'll get the list of extensions tomorrow.
Here's my extensions:
- Stylus
- Tab Auto Refresh
- uBlock Origin
- Ultimate QR-code Generator
- Video DownloadHelper
- AdGuard AdBlocker
- cookies.txt
- DjVu.js Viewer
- EPUBReader
- Firefox Relay
- Greasemonkey
- JSON-handle
- JSONovich
- Markdown Viewer
When I access claude.ai, my browser console gets lots of CORS errors:
ERROR [Statsig] A networking error occurred during POST request to https://statsig.anthropic.com/v1/rgstr?k=client-U9UUxwLKFe7SJXyDnolyBR2xZtEP8m1pN2uptqkJ5qP&st=javascript-client-react&sv=3.12.1&*****&ec=101. TypeError: NetworkError when attempting to fetch resource. (statsig.anthropic.com) TypeError: NetworkError when attempting to fetch resource. (statsig.anthropic.com) 4490-c515a5ce2e203242.js:18:5741
Not sure if they'll be relevant but I'll mention them in case.
The console shows this when I run the bookmarklet:
Uncaught SyntaxError: expected expression, got '*' elements.push(document.querySelector('div:1:2688
Just to check I've copy/pasted okay, here's what's in the bookmarklet:
javascript:(function () { /* v. 0.9, github.com/give-me/bookmarklets */ let elements = [], csp = false; /* Get elements with a dialog and others */ switch (location.hostname) { case 'claude.ai': /* Dialog */ elements.push(document.querySelector('div[data-test-render-count]').parentElement); /* Open artifacts */ elements.push(document.querySelector('div.ease-out.w-full[class*="overflow-"]')); break; case 'chatgpt.com': /* Dialog */ elements.push(document.querySelector('article').parentElement); /* Open canvas */ elements.push(document.querySelector('section.popover>section')); /* CSP is strict */ csp = true; break; case 'grok.com': /* Dialog */ elements.push(document.querySelector('div#last-reply-container').parentElement);%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20Open%20thoughts%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20elements.push(document.querySelector('aside'));%20%20%20%20%20%20%20%20%20%20%20%20%20break;%20%20%20%20%20%20%20%20%20case%20'gemini.google.com':%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20Dialog%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20elements.push(document.querySelector('#chat-history'));%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20Open%20panels%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20elements.push(document.querySelector('extended-response-panel%20response-container'));%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20Open%20reports%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20elements.push(document.querySelector('deep-research-immersive-panel>div.container'));%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20CSP%20is%20strict%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20csp%20=%20true;%20%20%20%20%20%20%20%20%20%20%20%20%20break;%20%20%20%20%20%20%20%20%20default:%20%20%20%20%20%20%20%20%20%20%20%20%20return%20alert(location.hostname%20+%20'%20is%20not%20supported');%20%20%20%20%20}%20%20%20%20%20console.debug(`Found%20elements%20at%20${location.hostname}:`,%20elements);%20%20%20%20%20elements%20=%20elements.filter(n%20=>%20n);%20%20%20%20%20if%20(csp%20||%20confirm('Confirm%20if%20a%20PDF%20should%20be%20searchable'))%20{%20%20%20%20%20%20%20%20%20/*%20Clone%20elements%20to%20a%20temporary%20element%20*/%20%20%20%20%20%20%20%20%20let%20temp%20=%20document.createElement('div');%20%20%20%20%20%20%20%20%20temp.id%20=%20'id-'%20+%20Math.random().toString(36).slice(2,%209);%20%20%20%20%20%20%20%20%20elements.forEach(el%20=>%20el%20&&%20temp.appendChild(el.cloneNode(true)));%20%20%20%20%20%20%20%20%20/*%20Print%20the%20temporary%20element%20*/%20%20%20%20%20%20%20%20%20let%20style%20=%20document.createElement('style');%20%20%20%20%20%20%20%20%20style.textContent%20=%20`@media%20print{body>*{display:none!important}#${temp.id}{display:flex!important;flex-direction:column}}`;%20%20%20%20%20%20%20%20%20document.head.appendChild(style);%20%20%20%20%20%20%20%20%20document.body.appendChild(temp);%20%20%20%20%20%20%20%20%20print();%20%20%20%20%20%20%20%20%20/*%20Clean%20up%20after%20printing%20*/%20%20%20%20%20%20%20%20%20setTimeout(()%20=>%20{%20%20%20%20%20%20%20%20%20%20%20%20%20document.head.removeChild(style);%20%20%20%20%20%20%20%20%20%20%20%20%20document.body.removeChild(temp);%20%20%20%20%20%20%20%20%20},%201000);%20%20%20%20%20}%20else%20{%20%20%20%20%20%20%20%20%20let%20script%20=%20document.createElement('script');%20%20%20%20%20%20%20%20%20script.src%20=%20'https:/*cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.3/html2pdf.bundle.min.js';%20*/%20%20%20%20%20%20%20%20%20script.onload%20=%20function%20()%20{%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20Get%20a%20timestamp%20and%20elements%20with%20a%20dialog%20and%20artifacts%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20let%20ts%20=%20new%20Date().toISOString().replace(/[-:T.]/g,%20'').slice(0,%2014);%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20Create%20a%20PDF%20from%20the%20first%20element%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20let%20pdf%20=%20html2pdf().set({%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20margin:%205,%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20filename:%20`${ts}.pdf`,%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20html2canvas:%20{scale:%202,%20logging:%20false}%20%20%20%20%20%20%20%20%20%20%20%20%20}).from(elements.shift());%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20Add%20rest%20elements%20to%20the%20PDF%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20elements.forEach(el%20=>%20pdf%20=%20pdf.toPdf().get('pdf').then(pdfObj%20=>%20pdfObj.addPage()).from(el).toContainer().toCanvas().toPdf());%20%20%20%20%20%20%20%20%20%20%20%20%20/*%20Render%20the%20PDF%20*/%20%20%20%20%20%20%20%20%20%20%20%20%20pdf.save();%20%20%20%20%20%20%20%20%20};%20%20%20%20%20%20%20%20%20document.body.appendChild(script);%20%20%20%20%20}%20})();
Ugh. So something went wrong there. I didn't notice until I pasted here - I was only looking at the tiny window in Firefox.
OK, sorted by copying/pasting again.
Sorry for wasting any time!