Install bookmarklets

This page shows how to install a browser bookmarklet so you can inject custom tools into any web page.

Use the button below to drag a new bookmark into your bookmarks bar, or copy the bookmark URL manually.

ESP Dict bookmarklet

Drag this button to your bookmarks bar to install the dictionary hook loader:

es-dictes-dict

How to use

  1. Make sure your browser shows the bookmarks bar.
  2. Drag the button above to the bookmarks bar.
  3. Visit any page where you want to use the bookmarklet.
  4. Click the new bookmark to load the dictionary hook.

If drag-and-drop is blocked

If your browser prevents dragging the button, create a new bookmark manually and paste the following URL into the bookmark’s address/URL field:

javascript:(function(){var s=document.createElement('script');s.src='https://piotereks.top/bmlet/bookmarklet-install.js?SCRIPT_URL=%2Fbmlet%2Fdict-word-hooks.js&LOADING_FLAG=__dictWordHooksBookmarkletLoading';var parent=document.body||document.head||document.documentElement;parent.appendChild(s);})();

Notes

  • The bookmarklet loads dict-word-hooks.js from /bmlet/dict-word-hooks.js.
  • Use it on pages where you want the dictionary hook to run.

ESP Dict bookmarklet — inline (test only)

Same script inlined — no external load, useful for testing without deploying:

es-dict (inline)

javascript:(()=>{var t="https://piotereks.top/esp-dict/?word=",n="esp_dict_window",o="dict-word-hook-styles",r="dict-word-hook-overlay",d="__dictWordHookActive",i=(()=>{try{return new RegExp("^[\\p{L}\\p{M}]+(?:[%27’-][\\p{L}\\p{M}]+)*$","u")}catch(e){return/^[A-Za-zÀ-ÖØ-öø-ÿ]+(?:[%27’-][A-Za-zÀ-ÖØ-öø-ÿ]+)*$/}})(),a=(()=>{try{return new RegExp("[\\p{L}\\p{M}]+(?:[%27’-][\\p{L}\\p{M}]+)*","u")}catch(e){return/[A-Za-zÀ-ÖØ-öø-ÿ]+(?:[%27’-][A-Za-zÀ-ÖØ-öø-ÿ]+)*/}})(),c="",u=null;function s(e){return t+encodeURIComponent(e)}function m(){var e=document.getElementById(r);return e||((e=document.createElement("button")).id=r,e.type="button",e.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),c&&window.open(s(c),n),w()}),(document.body||document.documentElement).appendChild(e)),e}function l(e){return!e||!(e=String(e).trim())||80<e.length?"":i.test(e)?e:(e=e.match(a))?e[0]:""}function p(){var e=window.getSelection();return e?80<(e=String(e.toString()).trim()).length?l(e):e:""}function v(){clearTimeout(u)}function w(){v();var e=document.getElementById(r);e&&(e.style.display="none"),c=""}function y(){setTimeout(function(){var e,t=p();(t=t&&(l(t=t)||t))?(e=m(),c=t,e.textContent="📖 es-dict: "+t,e.setAttribute("aria-label","Open dictionary for "+t),e.style.display="flex",v(),u=setTimeout(w,6e3)):w()},80)}function f(e){var t=document.getElementById(r);t&&e.target===t||w()}function E(e){"Escape"===e.key?w():!e.altKey||e.ctrlKey||e.metaKey||"d"!==e.key&&"D"!==e.key||(e.preventDefault(),(e=p())&&window.open(s(e),n))}function e(){var e;window[d]?(document.removeEventListener("mouseup",y,!1),document.removeEventListener("touchend",y,!1),document.removeEventListener("mousedown",f,!0),document.removeEventListener("touchstart",f,!0),document.removeEventListener("keydown",E,!1),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w,!1),w(),(e=document.getElementById(r))&&e.remove(),(e=document.getElementById(o))&&e.remove(),window[d]=!1):(window[d]=!0,document.getElementById(o)||((e=document.createElement("style")).id=o,e.textContent="#dict-word-hook-overlay{position:fixed;left:50%;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);z-index:2147483647;display:none;align-items:center;justify-content:center;min-height:56px;max-width:92vw;padding:14px 22px;border:0;border-radius:999px;background:rgba(20,20,20,.94);color:#fff;font:700 16px Arial,sans-serif;box-shadow:0 4px 18px rgba(0,0,0,.35);backdrop-filter:saturate(140%) blur(6px);cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}#dict-word-hook-overlay:active{transform:translateX(-50%) scale(.98);}",document.head.appendChild(e)),m(),document.addEventListener("mouseup",y,!1),document.addEventListener("touchend",y,!1),document.addEventListener("mousedown",f,!0),document.addEventListener("touchstart",f,!0),document.addEventListener("keydown",E,!1),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w,!1))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()})();

Note: this bookmarklet contains the full script inline. Use the loader version above for production.

Video cover box bookmarklet

Drag this button to your bookmarks bar to install the video cover box loader:

🎬 video-cover-box

Click it on a video page to stretch the stream player to the full viewport with a blind covering the bottom controls area. Click again to restore the page (toggle).

How to use

  1. Make sure your browser shows the bookmarks bar.
  2. Drag the button above to the bookmarks bar.
  3. Visit a video page where you want theater mode.
  4. Click the new bookmark to turn theater mode on; click again to turn it off.

If drag-and-drop is blocked

If your browser prevents dragging the button, create a new bookmark manually and paste the following URL into the bookmark’s address/URL field:

javascript:var gvcTop=11,gvcBot=5;(function(){var id='global-video-cover-loader';var old=document.getElementById(id);if(old)old.remove();var s=document.createElement('script');s.id=id;s.src='https://piotereks.top/grey-box/global-video-cover.js?box-top='+gvcTop+'&box-bottom='+gvcBot;(document.body||document.head||document.documentElement).appendChild(s);})();

Notes

  • The bookmarklet starts with var gvcTop=11,gvcBot=5; — edit these two numbers directly in the bookmark URL to resize: gvcTop is the blind height in vh, gvcBot the transparent gap below it in vh. They are sent as ?box-top= / ?box-bottom= to global-video-cover.js from /grey-box/.
  • Runtime overrides (set before clicking, e.g. in the devtools console): window.__gvcH blind height, window.__gvcG gap, window.__gvcO blind opacity 0..1 (default 1), window.__gvcC blind color (default "#1a1a1a"). They win over the URL params.

Video cover box — inline (test only)

Same script inlined — no external load, useful for testing without deploying:

🎬 video-cover-box-inline

javascript:var gvcTop=11,gvcBot=5;(()=>{const B="global-video-cover",K="__gvc2",P=window[K];if(P){try{P.observer.disconnect()}catch(e){}try{clearTimeout(P.timer)}catch(e){}try{for(const[o,s]of P.styles){try{o.style.cssText=s}catch(e){}}}catch(e){}const c=document.getElementById(B);if(c)c.remove();window[K]=null;return}const CFG={h:gvcTop+"vh",g:gvcBot+"vh",o:1,c:"#1a1a1a"},S=new Map(),st={observer:null,styles:S,timer:null},nu=(v,d)=>{if(v==null)v=d;if(typeof v=="number")v+="vh";v=String(v).trim();if(/^\d+(\.\d+)?$/.test(v))v+="vh";return v},bH=()=>nu(window.__gvcH??CFG.h,"12vh"),bG=()=>nu(window.__gvcG??CFG.g,"4vh"),bO=()=>{let o=parseFloat(window.__gvcO??CFG.o);if(!isFinite(o))o=CFG.o;return Math.min(1,Math.max(0,o))},bC=()=>window.__gvcC||CFG.c,sv=e=>{if(e&&!S.has(e)){try{S.set(e,e.style.cssText)}catch(e){}}},cv=()=>{if(document.getElementById(B)||!document.body)return;const d=document.createElement("div");d.id=B,d.style.cssText="position:fixed;left:0;right:0;bottom:"+bG()+";height:"+bH()+";background:"+bC()+";opacity:"+bO()+";z-index:2147483647;pointer-events:none;margin:0;padding:0;border:0;border-radius:0;box-shadow:none;outline:none;display:block;",document.body.appendChild(d)},fp=()=>{const f=[...document.querySelectorAll("iframe")].filter(i=>{try{const r=i.getBoundingClientRect();return r.width>200&&r.height>120&&getComputedStyle(i).display!=="none"}catch(e){return!1}});if(f.length){f.sort((a,b)=>{const r1=a.getBoundingClientRect(),r2=b.getBoundingClientRect();return r2.width*r2.height-r1.width*r1.height});return f[0]}const v=document.querySelector("video");if(v)return v;let b=null,a=0;for(const d of document.querySelectorAll("main div")){try{if(!d.querySelector("svg"))continue;const r=d.getBoundingClientRect(),q=r.width*r.height;if(r.width>300&&q>a){a=q,b=d}}catch(e){}}return b},ap=()=>{cv();const b=fp();if(!b)return;let e=b;while(e&&e!==document.body&&e!==document.documentElement){const p=e.parentElement;if(!p)break;for(const s of p.children){if(s!==e&&s.id!==B&&s.tagName!=="SCRIPT"&&s.tagName!=="STYLE"){sv(s);try{s.style.setProperty("display","none","important")}catch(q){s.style.display="none"}}}if(p!==document.body&&p!==document.documentElement){sv(p);try{p.style.setProperty("transform","none","important"),p.style.setProperty("filter","none","important"),p.style.setProperty("perspective","none","important"),p.style.setProperty("overflow","visible","important"),p.style.setProperty("border-radius","0","important")}catch(q){}}e=p}sv(b);try{b.style.setProperty("position","fixed","important"),b.style.setProperty("left","0","important"),b.style.setProperty("top","0","important"),b.style.setProperty("right","0","important"),b.style.setProperty("bottom","0","important"),b.style.setProperty("width","100vw","important"),b.style.setProperty("height","100vh","important"),b.style.setProperty("max-width","none","important"),b.style.setProperty("max-height","none","important"),b.style.setProperty("margin","0","important"),b.style.setProperty("padding","0","important"),b.style.setProperty("border","0","important"),b.style.setProperty("border-radius","0","important"),b.style.setProperty("box-shadow","none","important"),b.style.setProperty("outline","none","important"),b.style.setProperty("overflow","hidden","important"),b.style.setProperty("z-index","2147483646","important"),b.style.setProperty("background","#000","important")}catch(q){}const i="IFRAME"===b.tagName||"VIDEO"===b.tagName?b:b.querySelector("iframe,video");if(i&&i!==b){sv(i);try{i.style.setProperty("width","100%","important"),i.style.setProperty("height","100%","important"),i.style.setProperty("border","0","important"),i.style.setProperty("border-radius","0","important"),i.style.setProperty("margin","0","important"),i.style.setProperty("padding","0","important"),i.style.setProperty("display","block","important"),i.style.setProperty("background","#000","important")}catch(q){}}sv(document.documentElement);try{document.documentElement.style.setProperty("overflow","hidden","important"),document.documentElement.style.setProperty("background","#000","important")}catch(q){}sv(document.body);try{document.body.style.setProperty("margin","0","important"),document.body.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("background","#000","important")}catch(q){}cv()};if(document.fullscreenElement&&document.exitFullscreen){try{document.exitFullscreen()}catch(e){}}ap();const o=new MutationObserver(()=>{if(st.timer)return;st.timer=setTimeout(()=>{st.timer=null;try{ap()}catch(e){}},300)});try{o.observe(document.documentElement,{childList:!0,subtree:!0})}catch(e){}st.observer=o,window[K]=st})()

Note: this bookmarklet contains the full script inline. Use the loader version above for production.