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-dictes-dict (inline)

javascript:(()=>{if(window.__dictWordHookActive){document.removeEventListener("mouseup",window.__dwhSel,!1);document.removeEventListener("touchend",window.__dwhSel,!1);document.removeEventListener("click",window.__dwhClk,!0);document.removeEventListener("keydown",window.__dwhKey,!1);window.removeEventListener("scroll",window.__dwhHide,!0);window.removeEventListener("resize",window.__dwhHide,!1);let b=document.getElementById("dict-word-hook-overlay");b&&b.remove();let s=document.getElementById("dict-word-hook-styles");s&&s.remove();window.__dictWordHookActive=!1;return}window.__dictWordHookActive=!0;const D="https://piotereks.top/esp-dict/?word=",W="esp_dict_window",O="dict-word-hook-overlay",S="dict-word-hook-styles";let a="";const R=/[\p{L}\p{M}'’-]/u,P=/[\p{L}\p{M}]+(?:['’-][\p{L}\p{M}]+)*/u;function x(t){return(t||"").trim().match(P)?.[0]||""}function u(w){window.open(D+encodeURIComponent(w),W)}function h(){let b=document.getElementById(O);b&&(b.style.display="none"),a=""}function y(w,r){if(!w||!r)return h();let b=document.getElementById(O);b.style.display="inline-block";b.style.left=Math.max(8,Math.min(r.left,innerWidth-b.offsetWidth-8))+"px";b.style.top=Math.max(8,Math.min(r.bottom+8,innerHeight-b.offsetHeight-8))+"px";a=w}function g(x,y){let r=document.caretRangeFromPoint?.(x,y);if(!r||r.startContainer.nodeType!==3)return"";let t=r.startContainer.nodeValue||"",o=r.startOffset;o>=t.length&&(o=t.length-1);if(o<0||!R.test(t[o])){if(o>0&&R.test(t[o-1]))o--;else return""}let s=o,e=o+1;for(;s>0&&R.test(t[s-1]);)s--;for(;e<t.length&&R.test(t[e]);)e++;return x=t.slice(s,e).trim()}if(!document.getElementById(S)){let s=document.createElement("style");s.id=S;s.textContent="#dict-word-hook-overlay{position:fixed;z-index:2147483647;display:none;padding:4px 8px;border:0;border-radius:999px;font:600 12px Arial;color:#fff;background:rgba(20,20,20,.88);cursor:pointer;min-width:44px;min-height:44px}";document.head.appendChild(s)}let b=document.createElement("button");b.id=O;b.textContent="es-dict";b.onclick=e=>{e.preventDefault(),a&&u(a),h()};document.body.appendChild(b);window.__dwhSel=()=>setTimeout(()=>{let s=getSelection(),w=x(s+"");if(!w)return h();let r=s.rangeCount?s.getRangeAt(0).getBoundingClientRect():null;r&&y(w,r)},50);window.__dwhClk=e=>{if(e.target===b)return;if(e.altKey){let w=g(e.clientX,e.clientY);w&&(e.preventDefault(),e.stopPropagation(),u(w))}h()};window.__dwhKey=e=>{"Escape"===e.key?h():e.altKey&&("d"===e.key.toLowerCase())&&(e.preventDefault(),a&&u(a))};window.__dwhHide=h;document.addEventListener("mouseup",window.__dwhSel,!1);document.addEventListener("touchend",window.__dwhSel,!1);document.addEventListener("click",window.__dwhClk,!0);document.addEventListener("keydown",window.__dwhKey,!1);window.addEventListener("scroll",h,!0);window.addEventListener("resize",h,!1)})();

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