Skip to content

Instantly share code, notes, and snippets.

@lunamoth
Last active May 11, 2025 16:37
Show Gist options
  • Save lunamoth/ad31d1534aadc553bb8efa653653d03e to your computer and use it in GitHub Desktop.
Save lunamoth/ad31d1534aadc553bb8efa653653d03e to your computer and use it in GitHub Desktop.
C=chrome,r=C.runtime,C.tabs?(a=C.tabs,r.onMessage.addListener((e,{tab:t})=>[a.create,a.remove,a.goBack,a.goForward][e](e?t.id:{index:++t.index}))):(e=addEventListener,e("mousedown",e=>2&e.button&&(t=1,n=e.x,o=e.y,s=0)),e("mousemove",e=>t&&!s&&99<(e.x-n)**2+(e.y-o)**2&&(s=1)),e("mouseup",e=>t&&(2&e.button?624<(X=e.x-n)*X+(Y=e.y-o)*Y&&r.sendMessage(Y*Y>X*X?Y<0^1:2|X>0):t=s=0)),e("contextmenu",e=>(s&&e.preventDefault(),t=s=0)),e("blur",_=>t=0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment