PageSourceSearch

https://booru-tags-gallery.netlify.app/assets/PostBadgeTooltip-D6ciVQ01.js

js booru-tags-gallery.netlify.app collected 2026-10-03 10:31:37 UTC 4,746 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/danbooruApi-B6hvBjo7.js","assets/utils-BUmlVoVe.js","assets/dtextFormatter-Cfnol0nw.js","assets/index-CezxM2Rd.js","assets/vendor-CbBVmkB7.js","assets/i18n-B7Ntd71b.js","assets/index-CxEI5hhA.css","assets/legacyStorageMigration-DPnr2_a0.js"])))=>i.map(i=>d[i]);
2import{j as e,_ as t}from"./index-CezxM2Rd.js";import{c as n}from"./vendor-CbBVmkB7.js";import{u as s}from"./useNSFWFilter-CGbllJPm.js";import"./i18n-B7Ntd71b.js";const o="postBadgeHover",r="postBadgeLeave",i=e=>{const t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top}},d=()=>{const[d,a]=n.useState({postId:0,x:0,y:0,visible:!1,loading:!1,direction:"above"}),l=n.useRef(null),c=n.useRef(null);let u,m=!1;try{const e=s();m=e.isNSFWFilterEnabled,u=e.getRatingParams().allowedRatings}catch{m=!1}if(n.useEffect(()=>{const e=async e=>{const n=e.detail,{postId:s,element:o}=n;if(!s||!o)return;l.current&&(clearTimeout(l.current),l.current=null);const{x:r,y:d}=i(o),c=d<120?"below":"above";a(e=>({...e,postId:s,x:r,y:d,visible:!0,loading:!0,post:void 0,direction:c}));try{const{default:e}=await t(async()=>{const{default:e}=await import("./danbooruApi-B6hvBjo7.js");return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])),n=await e.getPostsByIds([s]),r=n&&n.length>0?n[0]:null;if(r&&o)try{o.setAttribute("data-rating",r.rating||"")}catch{}a(e=>({...e,loading:!1,post:r}))}catch{a(e=>({...e,loading:!1,post:null}))}},n=()=>{l.current&&clearTimeout(l.current),l.current=window.setTimeout(()=>{a(e=>({...e,visible:!1}))},120)};document.addEventListener(o,e),document.addEventListener(r,n);const s=e=>{"Escape"===e.key&&a(e=>({...e,visible:!1}))};return document.addEventListener("keydown",s,!0),()=>{document.removeEventListener(o,e),document.removeEventListener(r,n),document.removeEventListener("keydown",s,!0),l.current&&clearTimeout(l.current)}},[]),n.useEffect(()=>{const e=()=>{if(!d.visible)return;
2const e=document.querySelector(`[data-post-badge][data-post-id='${d.postId}']`);if(e){const{x:t,y:n}=i(e),s=n<120?"below":"above";a(e=>({...e,x:t,y:n,direction:s}))}else a(e=>({...e,visible:!1}))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[d.visible,d.postId]),n.useEffect(()=>{if(!d.visible||!d.postId)return;if(!document.querySelector(`[data-post-badge][data-post-id='${d.postId}']`))return;const e=new MutationObserver(()=>{document.querySelector(`[data-post-badge][data-post-id='${d.postId}']`)||a(e=>({...e,visible:!1}))});return e.observe(document.body,{childList:!0,subtree:!0}),()=>e.disconnect()},[d.visible,d.postId]),!d.visible)return null;const{x:v,y:f,loading:p,post:x,direction:b}=d,g=(null==x?void 0:x.preview_file_url)||(null==x?void 0:x.large_file_url)||(null==x?void 0:x.file_url),h=null==x?void 0:x.rating,w=!(!(m&&h&&u)||u.includes(h)),y="above"===b?Math.max(4,f-8):f+8,j="above"===b?"-translate-y-full":"translate-y-0";return e.jsx("div",{ref:c,className:`pointer-events-none fixed z-[4000] -translate-x-1/2 ${j} transform transition-opacity duration-75`,style:{top:y,left:v},children:e.jsxs("div",{className:"relative w-48 rounded-[10px] border border-border bg-popover p-2 text-popover-foreground shadow-md sm:w-56",children:[p&&e.jsx("div",{className:"h-24 animate-pulse rounded-lg bg-muted",children:"Cargando…"}),!p&&null===x&&e.jsx("div",{className:"flex items-center justify-center h-24 text-xs text-muted-foreground",children:"Sin datos"}),!p&&x&&g&&!w&&e.jsx("img",{src:g,alt:`Post #${x.id}`,className:"w-full h-auto max-h-48 object-contain rounded-lg",draggable:!1}),!p&&x&&w&&e.jsx("div",{className:"relative w-full h-24 image-container",children:e.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center p-2",children:[e.jsx("svg",{className:"w-6 h-6 mx-auto mb-1 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Content blocked by NSFW filter"})]})})}),!p&&x&&e.jsxs("div",{className:"mt-1.5 flex justify-between gap-2 font-mono text-xs tabular-nums text-muted-foreground",children:[e.jsxs("span",{children:["#",x.id]}),e.jsx("span",{className:"truncate max-w-[60%]",children:w?"—":`Score ${x.score}`})]})]})},`${d.postId}-${p?"loading":"loaded"}`)};export{d as PostBadgeTooltip,d as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.