This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // DLasMD-console.save.js -- Download your JavaScript objects from your web browser's F12 Dev Tools console! (also Bookmarklet click defaults to saving prompt text data or body.innerText as `DL-[date].md`) [as of 15Jan2025 started using DLasMD-console.save.js] | |
| // this GIST url: https://gist.github.com/DarrenSem/444cc1c0539226a4902e7f265f23820f | |
| // DOWNLOAD contents as MarkDown.js, plus adds console.save() function | |
| // javascript:void function(){"use strict";let a=document,b=a._,c="",d="\n\n",e="innerText",f="application/octet-stream",g=URL,h=Date.now,i=Object.assign,j=b=>a.createElement(b),k=(c,f="onselectstart")=>{if(c=a=>a,a[f]&&a[f]!=c)return a[f]=c,alert("Text selecting was disabled!"+d+"Try again, it is now enabled...");let g=a.getSelection(),h=g&&"Range"===g.type&&g.getRangeAt(0),i=h&&j("div");return i&&(i.appendChild(h.cloneContents()),i[e])||b},l=(a,b,d,e)=>{e=g.createObjectURL(a=new Blob([a],{type:d||a?.type||f})),b??="DL-"+h()+".md";i(j("a"),{href:e},!0===b?{target:"_blank"}:{download:b||c}).clic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // width.js - Bookmarklet for OpenAI playground to fix maxWidth of "Configure" panel (due to latest layout update); add as browser Favorite then click to toggle visibility | |
| // https://gist.github.com/DarrenSem/0d9da09fc5a7b95abcc0df95d65b02c7 | |
| //// 13Jul2026 723am: start over from scratch, making it the simplest possible ONE-LINER... | |
| // 740am: 287 char javascript:(a=>{"0px"==getComputedStyle(a).maxWidth?a.style.removeProperty("max-width"):a.style.setProperty("max-width","0px","important");document.querySelector("button[aria-label=\"Close panel\"]")?.click()})([...document.querySelectorAll("[data-config-sidebar-side=\"left\"]")].pop()) | |
| // [FINAL ANSWER] 803am: 287 char javascript:((a,b,c="max-width")=>{(b=[...a.querySelectorAll("[data-config-sidebar-side=\"left\"]")].pop())&&("0px"==getComputedStyle(b).maxWidth?b.style.removeProperty(c):b.style.setProperty(c,"0px","important"));a.querySelector("button[aria-label=\"Close panel\"]")?.click()})(document) | |
| ( (doc, configurePane, MW = "max-width") => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ytSubs.js (SEE DISCLAIMER) - via @DarrenSem https://gist.github.com/DarrenSem (22Mar2024) | |
| // YouTube subtitles - English (auto-generated) CC (closed captions) | |
| // Usage: node ytSubs.js videoIdOrUrl | |
| // or Web browser BOOKMARKLET (contents open in a new window) | |
| // ES6 clickable Bookmarklet = 3923 chars: | |
| //javascript:void function(){"use strict";var e=String.fromCharCode;const n=!1,d=globalThis,{process:i}=d,t=console,u=async(e,n,d="text")=>fetch(e,n).then(e=>e[d]()),a=e=>{try{e=(e||"")+"";const n=e.match(/"captionTracks":.*"isTranslatable"\:.*?}]/),d=JSON.parse(`{${(n||[""])[0]}}`).captionTracks||[],i=d.map(e=>{const n=e.name;return[l(n.simpleText||n.runs&&n.runs[0].text),e.baseUrl+"&fmt=json3"]});return i}catch(n){}},r=e=>{e=new Date(e);let n=e.getDate();return isNaN(n)?null:`${(n+"").padStart(2,"0")}${e.toLocaleString("default",{month:"short"})}${e.getFullYear()}`},f=e=>{e="string"!=typeof e&&e?new URL(e):{href:e||""};const n=e&&e.href.trim()||"",d=n.replace(/(https?:\/\/)?\/*(.+?)\/?$/,"https://$2"),i=d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // stringify.js (handles virtually all types unlike the normal JSON.stringify -- intended for inspecting/displaying object values, NOT for serializing/exporting) | |
| //// 14Feb2023 748am: the previous (last known good?) version of 'stringify.js" WAY BEFORE my COMPLETELY NEW way (April/May of 2026)... | |
| /* | |
| this function's result is far more flexible, human-friendly, and USEFUL than JSON.stringify, because... | |
| ( Infinity ) => 'Infinity' and ( NaN ) => 'NaN' , instead of 'null' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //// Update: Go here instead, works as a Bookmarklet or as an included file via <script src="...">. (I also added a printButton.js) | |
| //// https://github.com/DarrenSem/markdown/blob/master/static/resizer.js | |
| // MarkDownLivePreview.com-resizer.js -- bookmarklet to add 'Toggle Editor' (and also width-resizer) - instead of waiting for repo update that might use something like this <script src="./static/resizer.js"></script> | |
| // (09Sep2025 938am) 2209 char javascript:void function(){"use strict";const e="minedit",t="extra-button",i="mouse",n="width",r=document,o=e=>r.getElementById(e),s=(e,t)=>Object.assign(r.createElement(e||"div"),t),d=(e,...t)=>e.addEventListener(...t),l=(e,...t)=>e.removeEventListener(...t),a=e=>e.preventDefault(),c=setTimeout,g=40,m=window,f=(e="resizer-css")=>{if(o(e))return;const i=["\nbody {\n margin: 0;\n height: 100vh;\n overflow: hidden;\n}\n#container {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n#resizer {\n width: 4px;\n background-color: green;\n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // consoleRestore.js -- Bookmarklet to bring back [something close to] the native console.log() etc. that have been replaced with a custom override (e.g. by Microsoft Teams April 2025) | |
| // https://gist.github.com/DarrenSem/48f853b2bca6d8334320affde48e225e | |
| // also adds `console.tableEach(...args)` = args.forEach( arg => console.table(arg) ) + `console.dirEach(...args)` | |
| // ^ purpose and examples here: https://gist.github.com/DarrenSem/a0109f95056c0c2512fe2abeb930bab2 | |
| // Silent: 398 char javascript:void function(){(()=>{const a="table",b=console,c=/\bnative code|^\(\.\.\.\w+\)=>\w+\.(forEach\(\w+=>\w+(\[\w+\])|\.assert)\(/;if(!c.test(b.log)){const d=c.test(b[a])?(...c)=>c.forEach(c=>b[a](c)):(...a)=>b.assert(!1,"\n",...a);["debug","error","info","log","warn"].forEach(a=>b[a]=d)}return b.tableEach=(...a)=>a.forEach(a=>b.table(a)),b.dirEach=(...a)=>a.forEach(a=>b.dir(a)),b})()}(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // above.js (PARENT element, levels = #) + next.js (SIBLING element, levels = #) helper functions instead of foo.parentElement.parentElement.parentElement etc. | |
| // https://gist.github.com/DarrenSem/4d37711fb71a484b6ed2356c60e3c94a | |
| // PARENT element: ... | |
| const above = (startingElement, levels = 1) => { | |
| let el = startingElement; | |
| while ( levels-- && (el = el?.parentElement) ); | |
| return el || null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // console.tableEach() - and also console.dirEach().js | |
| ///////////////////// | |
| console.tableEach = (...args) => args.forEach( arg => console.table(arg) ); | |
| // comparing native log() and table() functions vs. new custom function tableEach()... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SwapBranches(GitHub compare).js -- Bookmarklet for toggling/reversing order of [base: targetBranch] <-- [compare: sourceBranch] | |
| // 287 char: javascript:void function(){const a=a=>{const b=a?.href??a??"",c=/(\/compare\/)([^.\/]+)\.\.\.([^.\/]+)/;return c.test(b)?b.replace(c,(a,b,c,d)=>`${b}${d}...${c}`):b},b=(b=location)=>{const c=b?.href??b??"",d=a(c);return c!=d&&((b?.href?b:{}).href=d)};console.clear(),console.log(b())}(); | |
| const getSwappedGitHubBranches = (url) => { | |
| const href = url?.href ?? url ?? ""; | |
| const pattern = /(\/compare\/)([^.\/]+)\.\.\.([^.\/]+)/; | |
| const replacer = (_, prefix, branch1, branch2) => `${prefix}${branch2}...${branch1}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // innerText.js bookmarklet for mobile (to show webpage text contents OR html) (including PARTIAL source of SELECTION) | |
| // https://gist.github.com/DarrenSem/7e1216bda80e6269ad53b43d90603158 | |
| // 26Jan2025 BUGFIX: now missing ONLY the "System instructions" section (one extra div layer was added SIGH) | |
| // 4784 char javascript:void function(){"use strict";const e="main div[data-collapsed",n="engine-select",t=`div.model-select>button>span`,d=[]._,i=((e,t,i,a,n,l,d,r)=>(t=new Date(e||Date()),[i,a,,n]=t.toLocaleTimeString().replace(/(a|p)\.(m)\./i,"$1$2").split(/\W/),[,,l,d]=t.toString().split(" "),r=t.toLocaleString().replace(/(\d+)-(\d+)-(\d+)/,"$2/$1/$3").split("/")[0].padStart(2,0),`${i}${a}${(n||"").toLowerCase()} ${d}-${r}-${l}`))(),a=`${""} ${i}`,l=top.document,r=location,u=(e,n)=>(n||l).querySelectorAll(e||null),o=(e,n)=>{const t=e?.[n?"value":x],i=t==d?d:n?t:t.replace(/\n{3,}/g,"\n\n\n").replace(/\n\n/g,"\n");return i},f=e=>e.trim(),s=e=>(e??"").replace(/\nSYNC$/i,"").replace(/ INSTRUCTIONS$/i,""),c=e=>(e?? |
NewerOlder