PageSourceSearch

https://faptap.net/assets/Rating.vue_vue_type_script_setup_true_lang.3ad4ff04.js

js faptap.net collected 2026-09-25 22:12:31 UTC 1,461 bytes, 1 lines download raw bytes

1import{d as _,a6 as y,a7 as x,u as w,b as n,L as T,w as d,v as B,g as L,n as b,j as C,p as S,x as z,i as D,t as I,_ as M,aB as R,a as v}from"./index.16ba4ea0.js";const V=_({__name:"Rating",props:{thingId:{},thingType:{},liked:{type:Boolean},likes:{}},emits:["update"],setup(k,{emit:p}){const{authDialog:h}=y(x()),g=w(),t=k,u=n(!1),o=n(!1),e=n(!1),a=n(0);T(()=>{e.value=t.liked,a.value=t.likes});const r=p,m=async()=>{if(o.value)return;if(!g.isAuthorized){h.value=!0;return}const l=e.value,i=a.value;e.value=!e.value;const f=a.value+(e.value?1:-1);a.value=Math.max(0,f),r("update",{liked:e.value,likes:a.value});try{u.value=!0;let s;if(t.thingType===R.Playlist)s=await v.playlists.toggleLike(t.thingId);else{const c=await v.rating.setRating(t.thingId,t.thingType);s={liked:c,likes:c?i+1:i-1}}e.value=s.liked,a.value=Math.max(0,s.likes),r("update",{liked:e.value,likes:a.value})}catch(s){e.value=l,a.value=i,r("update",{liked:l,likes:i}),console.error("Failed to update rating:",s)}finally{u.value=!1}o.value=!0,setTimeout(()=>{o.value=!1},1e3)};return d(()=>t.liked,l=>{e.value=l}),d(()=>t.likes,l=>{a.value=l}),(l,i)=>(B(),L(M,{disabled:u.value,onClick:m,theme:e.value?"blue":void 0,class:"flex gap-2 items-center"},{default:b(()=>[C(z,{name:e.value?"heart":"heart-outline",class:S([{"!text-white":e.value},"h-5 w-5 text-zinc-400 group-hover:text-white"])},null,8,["name","class"]),D("span",null,I(a.value),1)]),_:1},8,["disabled","theme"]))}});export{V as _};

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.