PageSourceSearch

https://www.royalroad.com/dist/fiction-pageTw-HJGGQ3XK.modern.js

js royalroad.com collected 2026-10-01 10:12:12 UTC 37,122 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="843a63fc-2a01-530d-8e05-bae0aed4f542")}catch(e){}}();
3import{a as D}from"/dist/chunk-SJOFY4FT.modern.js";import{a as j}from"/dist/chunk-GO6BGFDQ.modern.js";import{a as we}from"/dist/chunk-YIJUPZ7O.modern.js";import"/dist/chunk-B6DKOGOG.modern.js";import{a as q}from"/dist/chunk-KYJTOSVH.modern.js";import{c as ne,i as V}from"/dist/chunk-LXK3K7Q2.modern.js";import{a as ae}from"/dist/chunk-5D2LWOWN.modern.js";import"/dist/chunk-7VOBDG6O.modern.js";import{a as P}from"/dist/chunk-H6RT7CK2.modern.js";import"/dist/chunk-3VCALG5Y.modern.js";import"/dist/chunk-DLQYCW67.modern.js";import"/dist/chunk-G3D6DRPP.modern.js";import"/dist/chunk-MZMH5DFL.modern.js";import"/dist/chunk-HWQAGBKC.modern.js";import"/dist/chunk-RLANYOVG.modern.js";import"/dist/chunk-RNH53NA7.modern.js";import{d as te}from"/dist/chunk-GVQ63BL2.modern.js";import{a as ve}from"/dist/chunk-GZ6MMC44.modern.js";import"/dist/chunk-H6NBHFA7.modern.js";import{a as O}from"/dist/chunk-API445M3.modern.js";import{a as oe}from"/dist/chunk-DRHYE5CL.modern.js";import{a as re}from"/dist/chunk-AW7PTGAA.modern.js";import{a as ee}from"/dist/chunk-IO4KYIVT.modern.js";import{b as C}from"/dist/chunk-G64MVQY7.modern.js";import"/dist/chunk-URZVXJM5.modern.js";import"/dist/chunk-ET4STBUF.modern.js";import{a as y}from"/dist/chunk-BFBIXWHF.modern.js";import{b as K}from"/dist/chunk-NALJTZ37.modern.js";import"/dist/chunk-Y6WZIIK2.modern.js";import"/dist/chunk-VXLO4RCE.modern.js";import{f as Q,m as Z}from"/dist/chunk-LAYA2F3I.modern.js";import{a as J}from"/dist/chunk-VTLEDJJK.modern.js";import"/dist/chunk-N5CHCEKF.modern.js";import{a as F,b as M,g as I,k as E}from"/dist/chunk-XSELNDBU.modern.js";E();E();var o=I(O());var se=I(we());E();var b=I(O());function ie(g){let{currentPage:e,totalItems:t,totalPages:n,itemsPerPage:a,volumes:l,currentVolume:u,onPageChange:d,onPreviousVolume:s,onNextVolume:i}=g,c=n!==void 0?n:Math.ceil(t/a),m=[],h=Math.max(2,e-2);e<6?h=2:e>=c-4&&(h=Math.max(2,c-6));let v=5;if(e>5&&e<c-4&&(v=4),e===5&&c===9&&(v=6),c>1)for(let w=h;w<Math.min(c,h+v+1);w++)m.push(w);function f(){return l.indexOf(u)>0?e===1:!1}function N(){let w=l.indexOf(u);return w>=0&&w<l.length-1?e===c:!1}let k="cursor-pointer inline-flex items-center justify-center min-w-[2rem] h-8 px-2 mx-1 rounded text-on-surface hover:bg-surface-hover transition-colors duration-150",R="inline-flex cursor-pointer items-center justify-center min-w-[2rem] h-8 px-2 mx-1 rounded bg-primary text-on-primary",A="inline-flex items-center justify-center w-8 h-8 rounded text-on-surface hover:bg-surface-hover transition-colors duration-150 disabled:opacity-35 cursor-pointer disabled:cursor-not-allowed",T="inline-flex cursor-pointer  items-center justify-center h-8 px-3 rounded text-primary hover:bg-surface-hover transition-colors duration-150";return b.default.createElement("div",{className:"flex flex-wrap items-center justify-end gap-2"},f()&&b.default.createElement("button",{className:T,onClick:()=>s(),type:"button"},"Previous Volume"),b.default.createElement("button",{className:A,disabled:e===1,onClick:()=>d(e-1),type:"button"},b.default.createElement("i",{className:"fas fa-chevron-left"})),b.default.createElement("button",{className:e===1?R:k,onClick:()=>d(1),type:"button"},"1"),h>2&&b.default.createElement("span",{className:"mx-1 text-on-surface-variant"},"..."),m.map(w=>b.default.createElement("button",{key:w,className:e===w?R:k,onClick:()=>d(w),type:"button"},w)),m[m.length-1]<c-1&&b.default.createElement("span",{className:"mx-1 text-on-surface-variant"},"..."),c>1&&b.default.createElement("button",{className:e===c?R:k,onClick:()=>d(c),type:"button"},c),b.default.createElement("button",{className:A,disabled:e===c,onClick:()=>d(e+1),type:"button"},b.default.createElement("i",{className:"fas fa-chevron-right"})),N()&&b.default.createElement("button",{className:T,onClick:()=>i(),type:"button"},"Next Volume"))}function le(g){let[e,t]=(0,o.useState)(-1),[n,a]=(0,o.useState)(1),[l,u]=(0,o.useState)(window.innerWidth>728?20:10),[d,s]=(0,o.useState)(""),[i,c]=(0,o.useState)("releaseDate"),[m,h]=(0,o.useState)("asc"),v=te.isGpuAccelerated(),f=v&&window.displaySettings.roundedCorners?"rounded-md":"rounded-none",N=v?"group-hover:scale-105 group-hover:shadow-xl":"",k=v?"transition-all duration-300":"",R=v?"bg-gradient-to-t from-black/80 via-black/20 to-transparent":"bg-black/65 h-[15%] top-[85%]",A=v?"":"contain-layout";(0,o.useEffect)(()=>{$(".popovers").popover()});function T(){var r;return(r=g.fictionCover)!=null?r:q.defaultImageConst}function w(r,p){var x;if(e===p){let S=(x=g.volumes.find(L=>L.id===p))==null?void 0:x.cover;p===-1&&(S=T()),B.coverDialog(S)}else t(p),a(1)}function U(r){return e===r?"text-center volume-selector selected ".concat(v?"drop-shadow-glow-sm drop-shadow-primary":"outline-3 outline-offset-2 outline-solid outline-primary"):"text-center volume-selector"}function me(){let r=g.volumes.findIndex(p=>p.id===e);r<g.volumes.length-1&&(t(g.volumes[r+1].id),a(1))}function fe(){let r=g.volumes.findIndex(p=>p.id===e);r>0&&(t(g.volumes[r-1].id),a(1))}function he(r,p){window.innerWidth>480&&(r.preventDefault(),r.ctrlKey||r.metaKey?window.open(p.url,"_blank"):window.location.href=p.url)}function ge(r,p){return i==="title"?m==="desc"?p.title.localeCompare(r.title):r.title.localeCompare(p.title):m==="desc"?p.order-r.order:r.order-p.order}function G(r){h(r===i&&m==="asc"?"desc":"asc"),c(r)}function _(r){u(r),a(1)}
3let X=(0,o.useMemo)(()=>()=>g.chapters.sort(ge).filter(r=>e===-1||r.volumeId===null&&e===null||r.volumeId===e).filter(r=>r.title.toLowerCase().includes(d.toLowerCase())),[g.chapters,i,m,e,d]);return o.default.createElement("div",null,g.volumes!=null&&g.volumes.length>0&&o.default.createElement(se.default,M(F({},be),{className:"slick-dotted volumes-carousel mt-2.5 mb-2 ".concat(A)}),o.default.createElement("div",{className:U(-1),onClick:r=>w(r.target,-1)},o.default.createElement("div",{className:"relative w-[160px] h-[240px] md:w-[200px] md:h-[300px] mx-auto mb-2 group"},o.default.createElement(q,{className:"w-full h-full object-cover ".concat(f),cover:T()}),o.default.createElement("div",{className:"absolute inset-0 ".concat(R," ").concat(f)}),o.default.createElement("h6",{className:"absolute bottom-2 left-0 right-0 text-white text-sm font-semibold px-2 text-center transition-transform duration-300 group-hover:-translate-y-2"},"All Chapters"),o.default.createElement("div",{className:"absolute inset-0 ".concat(f," ").concat(k," ").concat(N)}))),g.volumes.map((r,p)=>{var x;return o.default.createElement("div",{className:U(r.id),onClick:S=>w(S.target,r.id),key:p,"aria-selected":"false","aria-labelledby":"volume-".concat(r.id,"-label"),role:"button"},o.default.createElement("div",{className:"relative w-[160px] h-[240px] md:w-[200px] md:h-[300px] mx-auto mb-2 group"},o.default.createElement(q,{className:"w-full h-full object-cover ".concat(f),cover:(x=r.cover)!=null?x:p<10?"/dist/img/volumes/volume".concat(p+1,".png"):T()}),o.default.createElement("div",{className:"absolute inset-0 ".concat(R," ").concat(f)}),o.default.createElement("h6",{id:"volume-".concat(r.id,"-label"),className:"absolute bottom-2 left-0 right-0 text-white text-sm font-semibold px-2 text-center transition-transform duration-300 group-hover:-translate-y-2"},r.title),o.default.createElement("div",{className:"absolute inset-0 ".concat(f," ").concat(k," ").concat(N)}),e===r.id&&r.cover&&o.default.createElement("div",{className:"volume-lightbox-icon"})))}),g.chapters.filter(r=>r.volumeId===null).length>0&&o.default.createElement("div",{className:U(null),onClick:r=>w(r.target,null)},o.default.createElement("div",{className:"relative w-[160px] h-[240px] md:w-[200px] md:h-[300px] md:w-[200px] md:h-[300px] mx-auto mb-2 group"},o.default.createElement(q,{className:"w-full h-full object-cover ".concat(f)}),o.default.createElement("div",{className:"absolute inset-0 ".concat(R," ").concat(f)}),o.default.createElement("h6",{className:"absolute bottom-2 left-0 right-0 text-white text-sm font-semibold px-2 text-center transition-transform duration-300 group-hover:-translate-y-2"},"Other Chapters"),o.default.createElement("div",{className:"absolute inset-0 ".concat(f," ").concat(k," ").concat(N)})))),o.default.createElement("div",null,o.default.createElement("div",{className:"flex flex-row justify-between items-baseline md:items-center mb-4 p-2"},o.default.createElement("div",{className:"md:mb-2 mb-0 flex-col md:flex-row flex items-center"},o.default.createElement("div",{className:"relative inline-block text-left mr-4"},o.default.createElement("button",{type:"button",className:"inline-flex cursor-pointer justify-center w-full rounded-sm border border-surface-variant px-4 py-2 bg-surface text-sm font-medium text-on-surface hover:bg-surface-alt",id:"menu-button","aria-expanded":"true","aria-haspopup":"true",onClick:()=>{let r=document.getElementById("dropdown-menu");r&&r.classList.toggle("hidden")}},l,o.default.createElement("svg",{className:"-mr-1 ml-2 h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},o.default.createElement("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}))),o.default.createElement("div",{className:"hidden origin-top-left absolute left-0 mt-2 w-24 rounded-sm shadow-lg bg-surface ring-1 ring-on-surface ring-opacity-5 divide-y divide-surface-variant z-10",id:"dropdown-menu"},o.default.createElement("div",{className:"py-1 "},o.default.createElement("a",{onClick:()=>{var r;_(10),(r=document.getElementById("dropdown-menu"))==null||r.classList.add("hidden")},className:"cursor-pointer block px-4 py-2 text-sm text-on-surface hover:bg-surface-alt"},"10"),o.default.createElement("a",{onClick:()=>{var r;_(20),(r=document.getElementById("dropdown-menu"))==null||r.classList.add("hidden")},className:"cursor-pointer block px-4 py-2 text-sm text-on-surface hover:bg-surface-alt"},"20"),o.default.createElement("a",{onClick:()=>{var r;_(50),(r=document.getElementById("dropdown-menu"))==null||r.classList.add("hidden")},className:"cursor-pointer block px-4 py-2 text-sm text-on-surface hover:bg-surface-alt"},"50"),o.default.createElement("a",{onClick:()=>{var r;_(100),(r=document.getElementById("dropdown-menu"))==null||r.classList.add("hidden")},className:"cursor-pointer block px-4 py-2 text-sm text-on-surface hover:bg-surface-alt"},"100")))),o.default.createElement("span",{className:"text-on-surface-muted text-sm"},"\xA0entries per page")),o.default.createElement("div",null,o.default.createElement("input",{type:"text",className:"px-4 py-2 rounded-sm border border-surface-variant bg-surface text-on-surface focus:outline-none focus:ring-2 focus:ring-primary",placeholder:"Search...",value:d,onChange:r=>s(r.target.value)}))),o.default.createElement("div",{className:"overflow-x-auto w-full ".concat(A),id:"chapters"},o.default.createElement("table",{className:"w-full"},o.default.createElement("thead",null,o.default.createElement("tr",{className:"border-b border-surface"},o.default.createElement("th",{className:"cursor-pointer text-left py-3 px-4 font-semibold text-on-surface text-sm tracking-wider",onClick:()=>G("title")},o.default.createElement("div",{className:"flex items-center"},o.default.createElement("span",null,"Chapter Name"),i==="title"&&o.default.createElement("span",{className:"ml-1"},o.default.createElement("i",{className:"fas fa-sort-alpha-".concat(m==="asc"?"down":"up")})))),o.default.createElement("th",{className:"cursor-pointer text-right py-3 px-4 font-semibold text-on-surface text-sm tracking-wider sm:table-cell",onClick:()=>G("releaseDate")},o.default.createElement("div",{className:"flex items-center justify-end cursor-pointer"},o.default.createElement("span",null,"Release Date"),i==="releaseDate"&&o.default.createElement("span",{className:"ml-1"},o.default.createElement("i",{className:"fas fa-sort-amount-".concat(m==="asc"?"down":"up","-alt")})))))),o.default.createElement("tbody",{className:"chapter-rows"},X().slice((n-1)*l,n*l).map((r,p)=>{var x,S,L;return o.default.createElement("tr",{className:"hover:bg-surface cursor-pointer transition-colors leading-[1.125rem] border-b border-surface/60",key:r.id,onClick:pe=>he(pe,r)},o.default.createElement("td",{className:"py-[0.1rem] px-3"},o.default.createElement("div",{className:"flex items-center gap-2"},((x=r.subscriptionTiers)==null?void 0:x.length)>0&&r.isUnlocked&&o.default.createElement(D,{position:"top",content:"You have access to this bonus chapter"},o.default.createElement("i",{className:"fas fa-lock-open text-success"}))||((S=r.subscriptionTiers)==null?void 0:S.length)>0&&r.doesNotRollOver&&o.default.createElement(D,{position:"top",content:"This is a bonus chapter exclusive for subscribers"},o.default.createElement("i",{className:"fas fa-lock text-accent"}
3))||((L=r.subscriptionTiers)==null?void 0:L.length)>0&&!r.doesNotRollOver&&o.default.createElement(D,{position:"top",content:"Subscribe today to get access to this chapter sooner!"},o.default.createElement("i",{className:"fa fa-clock text-accent"})),!r.visible&&o.default.createElement(D,{position:"top",content:"This chapter has been deleted"},o.default.createElement("i",{className:"fa fa-trash text-danger"}))||g.readingProgress===r.id&&o.default.createElement(D,{position:"top",content:"This is the last chapter you've opened"},o.default.createElement("i",{className:"fa fa-caret-right text-primary"})),o.default.createElement("a",{href:r.url,className:"text-primary hover:text-primary-hover"},r.title))),o.default.createElement("td",{className:"py-3 px-4 text-right hidden sm:table-cell"},o.default.createElement("a",{href:r.url,className:"text-primary hover:text-primary-hover"},o.default.createElement(j,{dateTime:r.date,format:"agoshort"})," ago")),o.default.createElement("td",{className:"py-3 pr-4 text-right text-xs text-on-surface-variant sm:hidden"},o.default.createElement("a",{href:r.url,className:"text-primary hover:text-primary-hover"},o.default.createElement(j,{dateTime:r.date,format:"agoshort"})," ago")))})))),o.default.createElement("div",{className:"mt-4 flex justify-end"},o.default.createElement(ie,{volumes:g.volumes,currentVolume:g.volumes.find(r=>r.id===e),onNextVolume:me,onPreviousVolume:fe,currentPage:n,totalItems:Math.ceil(X().length),itemsPerPage:l,onPageChange:r=>a(r)}))))}var be={infinite:!1,slidesToShow:4,slidesToScroll:4,dots:!0,autoplay:!1,initialSlide:0,responsive:[{breakpoint:1200,settings:{slidesToShow:4,slidesToScroll:4,infinite:!1,dots:!0}},{breakpoint:1025,settings:{slidesToShow:3,slidesToScroll:3,infinite:!1,dots:!0}},{breakpoint:800,settings:{slidesToShow:3,slidesToScroll:3,infinite:!1,dots:!0}},{breakpoint:700,settings:{arrows:!1,slidesToShow:3,slidesToScroll:3,infinite:!1,dots:!0}},{breakpoint:600,settings:{arrows:!1,slidesToShow:3,slidesToScroll:3,infinite:!1,dots:!1}},{breakpoint:480,settings:{dots:!1,slidesToShow:2,slidesToScroll:2,infinite:!1}},{breakpoint:320,settings:{dots:!1,slidesToShow:1,slidesToScroll:1,infinite:!1}}]};var Y=I(O()),W=I(ve());E();var ce=I(ae());var ye=K(["fiction","rating"]),z=class g{constructor(e){var t,n;this.nonInteractiveUserRatingInstance=null,this.interactiveUserRatingInstance=null,this.tooltipInstance=null,this.element=e,this.data=this.extractDataFromElement(),this.nonInteractiveUserRatingInstance=(t=document.getElementById("fiction-user-rating"))==null?void 0:t.__rrRatingInstance,this.interactiveUserRatingInstance=this.element.__rrRatingInstance,this.tooltipInstance=(n=document.getElementById("fiction-rating-tooltip"))==null?void 0:n.__rrTooltipInstance,this.setupEventListeners()}extractDataFromElement(){return{fictionId:Number.parseInt(this.element.getAttribute("data-rr-rating-fiction-id")||"0"),authorId:Number.parseInt(this.element.getAttribute("data-rr-rating-author-id")||"0"),userAuthenticated:this.element.getAttribute("data-rr-rating-user-authenticated")==="true",userActivated:this.element.getAttribute("data-rr-rating-user-activated")==="true",userId:this.element.getAttribute("data-rr-rating-user-id")||"",hasRead:this.element.getAttribute("data-rr-rating-has-read")==="true",blockRatings:this.element.getAttribute("data-rr-rating-block-ratings")==="true",disableAnonymous:this.element.getAttribute("data-rr-rating-disable-anonymous")==="true",submitUrl:this.element.getAttribute("data-rr-rating-submit-url")||"",activationUrl:this.element.getAttribute("data-rr-rating-activation-url")||"",userRating:Number.parseFloat(this.element.getAttribute("data-rr-rating-user-rating")||"0")}}setupEventListeners(){if(!this.element)return;let e=(0,ce.default)(t=>{let n=t;this.handleRatingChange(n.detail.value)},150);this.element.addEventListener("rating-changed",e)}handleRatingChange(e){var n;let t=this.canUserRate();if(!t.allowed){this.showRatingBlockedToast(t.reason),(n=this.interactiveUserRatingInstance)==null||n.resetToInitial();return}this.submitRating(e)}canUserRate(){return this.data.userId&&Number.parseInt(this.data.userId)===this.data.authorId?{allowed:!1,reason:"own-fiction"}:this.data.blockRatings?{allowed:!1,reason:"ratings-blocked"}:this.data.disableAnonymous&&!this.data.userAuthenticated?{allowed:!1,reason:"anonymous-disabled"}:this.data.userAuthenticated?this.data.userActivated?this.data.hasRead?{allowed:!0}:{allowed:!1,reason:"not-read"}:{allowed:!1,reason:"not-activated"}:{allowed:!1,reason:"not-authenticated"}}showRatingBlockedToast(e){let t="",n="warning",a=null;switch(e){case"own-fiction":t="You can't rate your own fiction!",n="warning";break;case"ratings-blocked":t="Ratings are currently blocked for this fiction.",n="warning";break;case"anonymous-disabled":t="Please log in to rate this fiction.",n="info",a={label:"Log In",href:"/account/login?returnUrl="+encodeURIComponent(window.location.pathname+window.location.search),target:"_self"};break;case"not-authenticated":t="Please log in to rate fictions.",n="info",a={label:"Log In",href:"/account/login?returnUrl="+encodeURIComponent(window.location.pathname+window.location.search),target:"_self"};break;case"not-activated":t="Your account must be activated to rate fictions",n="warning",a={label:"Activate Account",href:this.data.activationUrl,target:"_blank"};break;case"not-read":t="Please read the fiction before rating it! Use the 'Not Interested' button if you don't want to read it.",n="info";break;default:t="You can't rate this fiction right now.",n="warning"}y.show({message:t,variant:n,action:a,duration:5e3,allowHtml:e==="not-activated"})}async submitRating(e){var a,l,u,d,s,i,c;let t=(a=this.nonInteractiveUserRatingInstance)==null?void 0:a.getRating(),n=((l=this.tooltipInstance)==null?void 0:l.getContent())||"";console.log("Submitting rating: ".concat(e," (initial: ").concat(t,")"));try{if((u=this.nonInteractiveUserRatingInstance)==null||u.setRating(e),(d=this.interactiveUserRatingInstance)==null||d.resetToInitial(),this.tooltipInstance&&n){let f=this.updateTooltipUserRating(n,e);this.tooltipInstance.updateContent(f)}let m=new FormData;m.append("id",this.data.fictionId.toString()),m.append("rating",(e*2).toString());let h=document.querySelector('input[name="__RequestVerificationToken"]');if(h&&m.append("__RequestVerificationToken",h.value),(await fetch(this.data.submitUrl,{method:"POST",body:m,headers:{"X-Requested-With":"XMLHttpRequest"}})).ok)(i=(s=document.getElementById("overall-score"))==null?void 0:s.__rrRatingInstance)==null||i.setRating(e),y.show({title:"Rating Submitted",message:"Please consider giving more feedback so the author and other readers may know why you gave the rating!",variant:"success",action:{label:"Write a Review",onClick:()=>{console.log("Review button clicked");let f=document.getElementById("write-a-review-accordion");f&&(console.log("Trying to open review accordion"),f.__rrAccordionInstance.openAll()),setTimeout(()=>{f==null||f.scrollIntoView({behavior:"smooth"})},300)}},duration:6e3}),this.data.userRating=e;else throw new Error("Failed to submit rating")}catch(m){ye.error("Error submitting rating: ".concat(m)),(c=this.nonInteractiveUserRatingInstance)==null||c.setRating(t),this.tooltipInstance&&this.tooltipInstance.updateContent(n),y.show({message:"Failed to submit rating. Please try again.",variant:"danger",duration:5e3})}}updateTooltipUserRating(e,t){let n=t.toFixed(2),a=/Your Rating:\s*<span[^>]*>[\d.]+<\/span>\s*\/\s*5/;if(a.test(e))return e.replace(a,'Your Rating: <span class="font-semibold">'.concat(n,"</span> / 5"));let l=/(Overall Rating:\s*<span[^>]*>[\d.]+<\/span>\s*\/\s*5)/;return l.test(e)?e.replace(l,'$1\n                        <div>\n                            Your Rating: <span class="font-semibold">'.concat(n,"</span> / 5\n                        </div>")):e}static initialize(){let e=document.getElementById("fiction-rating");if(!e)return null;if(e.dataset.rrFictionRatingInitialized==="true")return e.__rrFictionRating;let t=new g(e);return e.dataset.rrFictionRatingInitialized="true",e.__rrFictionRating=t,t}},de=z;var ue=I(ae());var B=class g{constructor(){this.scrollListener=null,this.isUserScrolling=!0,this.accordionElements=new Map,this.accordionInstances=new Map}init(e){isNaN(e.fictionId)||(this.loadEditor(),ee.handleReviewVote(),de.initialize(),this.initCoverLightbox(),this.initVolumes(),this.generateRecommendations(e),this.setupBlazorComponentInstances(),this.setupScrollToRadioSync(),this.initDeleteReviewHandlers(),this.initTailwindReviewVote(),this.coupleSortDropDownToReviewPagination(),this.ajaxFollowButton(),document.evaluate('//span[text()="Admin Dashboard"]',document).iterateNext()&&(window.initCannedResponses=this.initCannedMessages),this.deferredHashScroll())}deferredHashScroll(){if(!window.location.hash||window.location.hash.length<2)return;window.scrollTo(0,0);let e=window.location.hash.slice(1),t=Date.now()+5e3,n=!1,a=()=>{n=!0};window.addEventListener("wheel",a,{once:!0,passive:!0}),window.addEventListener("touchmove",a,{once:!0,passive:!0}),window.addEventListener("keydown",a,{once:!0});let l=d=>{for(let s=d;s!==null;s=s.parentElement)if(window.getComputedStyle(s).display==="none")return!1;return!0},u=()=>{var s;if(n||Date.now()>t)return;let d=(s=document.getElementById(e))!=null?s:document.getElementsByName(e)[0];
3if(!d||!l(d)){window.setTimeout(u,250);return}d.scrollIntoView({behavior:"smooth",block:"start"})};window.setTimeout(u,1e3)}setupBlazorComponentInstances(){this.sortingDropdown=document.querySelector("#review-sort-dropdown"),this.reviewPaginate=document.querySelector("#reviews-pagination"),this.accordionElements.set("stats",document.querySelector("#stats-accordion")),this.accordionElements.set("chapters",document.querySelector("#chapters-accordion")),this.accordionElements.set("reviews",document.querySelector("#reviews-accordion")),this.accordionElements.set("recommendations",document.querySelector("#recommendations-accordion")),this.accordionElements.set("write-a-review-accordion",document.querySelector("#write-a-review-accordion"));let e=document.getElementById("deleteReviewModal");e?this.deleteReviewModal=e==null?void 0:e.__rrDialogInstance:console.warn("No delete review modal found.");for(let[t,n]of Array.from(this.accordionElements)){if(!n)continue;let a=n.__rrAccordionInstance;a&&this.accordionInstances.set(t,a)}if(this.sortingDropdown?this.rrDropdown=this.sortingDropdown.__rrDropdownInstance:console.warn("No sorting dropdown found."),this.reviewPaginate?this.rrPagination=this.reviewPaginate.__rrPaginateInstance:console.warn("No review pagination found."),this.sortingDropdown&&!this.rrDropdown)console.warn("No RRDropdown instance found on sorting dropdown");else if(this.reviewPaginate&&!this.rrPagination){console.warn("No RRPagination instance found on review pagination");return}this.rrPagination&&this.rrPagination.addPostPageChangeHook(()=>{V.initializeTooltip(),V.initializeDialog(),ne.initialize(),C.spoilers.configureNewSpoilers(".reviews .reviews-container"),C.convertTime(".reviews time"),this.initDeleteReviewHandlers(),this.initTailwindReviewVote()})}initDeleteReviewHandlers(){document.querySelectorAll("[data-rr-delete-review-button]:not([data-rr-delete-review-button-initialized])").forEach(t=>{t.setAttribute("data-rr-delete-review-button-initialized","true"),t.addEventListener("click",async n=>{n.preventDefault();let a=t.getAttribute("data-rr-review-id");if(!a){console.error("No review ID found on delete button");return}await this.openDeleteReviewModal(a)})})}async openDeleteReviewModal(e){if(!this.deleteReviewModal){console.error("Delete review modal instance not found");return}let t=document.getElementById("deleteReviewModal");if(!t){console.error("Delete review modal element not found");return}let n=t.querySelector('input[name="id"]');n&&(n.value=e);let a=t.querySelector("#delete-report-reason-error"),l=t.querySelector("#delete-report-other-error");a&&(a.style.display="none"),l&&(l.style.display="none");let u=t.querySelector('textarea[name="reason"]');u&&(u.value="");let d=document.querySelector("#review-content-".concat(e)),s=t.querySelector('input[name="content"]');d&&s&&(s.value=d.textContent||d.innerText||"");let i=document.querySelector("#review-".concat(e)),c=i==null?void 0:i.querySelector(".review-title"),m=t.querySelector("#deleted-review-title");c&&m&&(m.textContent=c.textContent||"");try{await this.initCannedMessages(Number.parseInt(e))}catch(h){console.error("Error initializing canned responses:",h)}this.deleteReviewModal.open(),this.setupDeleteReviewFormHandler()}setupDeleteReviewFormHandler(){let e=document.querySelector("#deleteReviewModal form");e&&(e.removeEventListener("submit",this.handleDeleteReviewSubmit),e.addEventListener("submit",this.handleDeleteReviewSubmit.bind(this)))}async handleDeleteReviewSubmit(e){var s;e.preventDefault();let t=e.target,n=t.querySelector('button[type="submit"]'),a=new FormData(t),l=a.get("reason");if(!l||l.length===0){let i=document.querySelector("#delete-report-reason-error");i&&(i.style.display="block");return}let u=a.get("id"),d=(s=n==null?void 0:n.innerHTML)!=null?s:"";n&&(n.disabled=!0,n.innerHTML='<span class="inline-flex items-center gap-2"><span class="inline-block animate-spin rounded-full h-4 w-4 border-b-2 border-current" aria-hidden="true"></span><span>Submitting...</span></span>');try{let i=await fetch("/reviews/delete/",{method:"POST",body:a,credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"}});if(i.ok){this.deleteReviewModal.close();let c=document.getElementById("review-".concat(u));c&&c.remove(),y.show({message:"Review successfully deleted.\n".concat(l),variant:"success",duration:-1,action:{label:"Copy reason",onClick:()=>{g.copyTextToClipboard(l)}}})}else throw new Error("HTTP ".concat(i.status))}catch(i){console.error("Error deleting review:",i),this.deleteReviewModal.close();let c=document.querySelector("#delete-report-other-error");c&&(c.style.display="block",c.textContent=(i instanceof Error?i.message:String(i))||"An error occurred while deleting the review"),y.show({message:"Failed to delete review. Please try again.",variant:"danger",duration:1e4})}finally{n&&(n.disabled=!1,n.innerHTML=d)}}static async copyTextToClipboard(e){var t;if((t=navigator.clipboard)!=null&&t.writeText)try{await navigator.clipboard.writeText(e);return}catch(n){}}handleNavigationTabStrip(){this.navigationTabStrip&&this.navigationTabStrip.addEventListener("rr-radio-group-changed",e=>{var t,n;e.detail.value==="read"?(this.isUserScrolling=!1,(t=document.querySelector("#fiction-hero"))==null||t.scrollIntoView({behavior:"smooth"}),setTimeout(()=>this.isUserScrolling=!0,1e3)):(this.isUserScrolling=!1,(n=this.accordionInstances.get(e.detail.value))==null||n.openAll(),setTimeout(()=>{var a;(a=this.accordionElements.get(e.detail.value))==null||a.scrollIntoView({behavior:"smooth"}),setTimeout(()=>this.isUserScrolling=!0,1e3)},300))})}setupScrollToRadioSync(){if(!this.navigationTabStrip)return;let e=this.navigationTabStrip.__rrRadioGroupInstance;if(!e)return;let t=[{key:"read",element:document.querySelector("#fiction-hero")},{key:"stats",element:this.accordionElements.get("stats")},{key:"chapters",element:this.accordionElements.get("chapters")},{key:"reviews",element:this.accordionElements.get("reviews")}].filter(l=>l.element);if(t.length===0)return;let n=!1,a=(0,ue.default)(()=>{let l=window.scrollY||document.documentElement.scrollTop,u=window.innerHeight,d=l+u*.3,s=t[0].key;for(let i of t)if(i.element.getBoundingClientRect().top+l<=d)s=i.key;else break;e.getValue()!==s&&e.setValue(s,!1)},100);this.scrollListener=()=>{!this.isUserScrolling||n||(n=!0,requestAnimationFrame(()=>{a(),n=!1}))},window.addEventListener("scroll",this.scrollListener,{passive:!0})}coupleSortDropDownToReviewPagination(){!this.rrDropdown||!this.rrPagination||this.sortingDropdown.addEventListener("rr-dropdown-change",async e=>{let t=e;await this.rrPagination.fetchUpdateUrlAndHook("/fictions/reviews/".concat(window.fictionId,"?sorting=").concat(t.detail.value))})}async loadEditor(){let e=(await import("/dist/tinymce.defaults-JFERGTJF.modern.js")).tinymce,t={skin_url:"/lib/tinymce5/skins/ui/"+(C.isDarkTheme()?"tw_dark":"tw_light"),selector:"#review-content",skin:C.isDarkTheme()?"tw_dark":"tw_light",content_css:"/lib/tinymce5/skins/content/"+(C.isDarkTheme()?"tw_dark":"tw_light")+"/content.min.css",plugins:Q,toolbar:[Z],emoticons_database_url:"/misc/emoticons",contextmenu:!1,menubar:!1,branding:!1,browser_spellcheck:!0,cache_suffix:"?v=4.20210216.1",placeholder:"FOLLOW THE RULES! They are linked under the text box\n\nFor a basic review, please provide a brief overview of your opinion of the story, as well as justification for the rating you gave.\n\nFor an advanced review, make sure to add your opinion regarding the four subcategories...",setup:n=>{let a=document.getElementById("fiction-hero"),l=[],u=()=>{l.length=0;let s=n.getContainer().parentElement;for(;s&&s!==document.documentElement;){let i=getComputedStyle(s),c=i.backdropFilter,m=i.webkitBackdropFilter,h=i.filter;c&&c!=="none"&&(l.push({el:s,prop:"backdropFilter",value:s.style.backdropFilter}),s.style.backdropFilter="none"),m&&m!=="none"&&(l.push({el:s,prop:"webkitBackdropFilter",value:s.style.webkitBackdropFilter||""}),s.style.webkitBackdropFilter="none"),h&&h!=="none"&&(l.push({el:s,prop:"filter",value:s.style.filter}),s.style.filter="none"),s=s.parentElement}a&&(a.style.zIndex="0")},d=()=>{for(let{el:s,prop:i,value:c}of l)i==="webkitBackdropFilter"?s.style.webkitBackdropFilter=c:s.style[i]=c;l.length=0,a&&(a.style.zIndex="2")};n.on("FullscreenStateChanged",s=>{s.state?u():d()})}};oe.registerInstance("review-content",t),await e.init(t)}initTailwindReviewVote(){P.initialize(),document.querySelectorAll(".tailwind-review-vote-form .vote-button:not([data-vote-handler-attached])").forEach(e
3=>{e.setAttribute("data-vote-handler-attached","true"),e.addEventListener("click",async t=>{await this.tailwindReviewVoteCallback(t,e)})})}async tailwindReviewVoteCallback(e,t){e.preventDefault();let n=t.form;if(!n)return;if(C.userId===0){let i=n.action.split("/").pop();window.location="/Account/Login?returnUrl=".concat(encodeURIComponent("".concat(window.location.pathname,"?review-").concat(i,"#review-").concat(i)));return}let a=P.getInstance(t);if(!a)return;let l=Array.from(n.querySelectorAll(".vote-button")).filter(i=>i!==t),u=new Map(l.map(i=>[i,i.disabled]));l.forEach(i=>i.disabled=!0);let d=!a.isOutline,s=new FormData(n);s.append("up",t.value),await a.runRequest({form:n,formData:s,transitions:{success:{outline:d}},onSuccess:()=>{let i=n.querySelector('.vote-button[value="true"]'),c=n.querySelector('.vote-button[value="false"]'),m=t===i?c:i,h=m?P.getInstance(m):null;if(d){n.querySelectorAll('input[name="remove"]').forEach(f=>f.remove()),h&&this.setReviewVoteOutline(h,!0),this.updateReviewVoteCount(t,-1);return}if(!n.querySelector('input[name="remove"]')){let f=document.createElement("input");f.type="hidden",f.name="remove",f.value="true",n.appendChild(f)}let v=h?!h.isOutline:!1;h&&this.setReviewVoteOutline(h,!0),this.updateReviewVoteCount(t,1),v&&m&&this.updateReviewVoteCount(m,-1)},onFailure:async(i,c)=>{var h,v;let m="Unknown error";try{let f=await(c==null?void 0:c.json());m=(v=(h=f==null?void 0:f.message)!=null?h:f==null?void 0:f.title)!=null?v:m}catch(f){}y.show({message:"Failed to submit vote. Error: ".concat(m),variant:"danger",duration:3e3})},onFinally:()=>{u.forEach((i,c)=>c.disabled=i)}})}setReviewVoteOutline(e,t){e.transition({outline:t})}updateReviewVoteCount(e,t){let n=e.querySelector("[data-rr-review-vote-count]");if(!n)return;let a=Number.parseInt(n.textContent||"0",10);n.textContent=Math.max(0,a+t).toString()}ajaxFollowButton(){document.querySelectorAll('form[action*="/fictions/setbookmark"]').forEach(t=>{let n=t.querySelector('button[type="submit"]');n&&(n.hasAttribute("data-bookmark-handler-attached")||(n.setAttribute("data-bookmark-handler-attached","true"),n.addEventListener("click",async a=>{a.preventDefault(),await this.handleBookmarkAction(t,n)})))})}async handleBookmarkAction(e,t){let n=P.getInstance(t);if(!n)return;let a=t.querySelector("span"),l=e.querySelector('input[name="type"]'),u=e.querySelector('input[name="mark"]'),d=l==null?void 0:l.value,s=n.getState()==="active";await n.runRequest({form:e,onSuccess:()=>{let i=!s;n.setActive(i),n.setState(i?"active":"inactive"),u&&(u.value=String(!i)),typeof window.gtag<"u"&&a&&window.gtag("event",a.innerText,{event_category:"Fiction"}),y.show({message:this.getBookmarkToastMessage(d,i),variant:"success",duration:3e3})},onFailure:(i,c)=>{if((c==null?void 0:c.status)===401){window.location="/account/login?returnUrl="+encodeURIComponent(window.location.pathname);return}y.show({message:"Failed to update bookmark. Please try again.",variant:"danger",duration:3e3})}})}getBookmarkToastMessage(e,t){let a={follow:{activate:"You are now following this fiction",deactivate:"You have unfollowed this fiction"},favorite:{activate:"Added to favorites",deactivate:"Removed from favorites"},ril:{activate:"Added to Read Later",deactivate:"Removed from Read Later"},hide:{activate:"Marked as Not Interested",deactivate:"Removed from Not Interested"}}[e||""];return a?t?a.activate:a.deactivate:"Bookmark updated"}updateBookmarkIcon(e,t,n){var d;let l={follow:{inactive:"far fa-plus",active:"fa fa-check"},favorite:{inactive:"far fa-heart",active:"fa fa-heart"},ril:{inactive:"far fa-clock",active:"fa fa-clock"},hide:{inactive:"far fa-eye-slash",active:"fas fa-eye-slash"}}[t||""];if(!l)return;let u=((d=e.className.match(/h-\d+/))==null?void 0:d[0])||"h-3";e.className="".concat(n?l.active:l.inactive," ").concat(u)}initCoverLightbox(){document.querySelectorAll(".cover-art-container").forEach(t=>{t.onclick=()=>{let n=t.querySelector("img"),a=n==null?void 0:n.src;a&&g.coverDialog(a)}})}static coverDialog(e){let t=document.getElementById("cover-lightbox-img");t.src=e.replace("covers-full","covers-large"),t.onerror=()=>{t.src=e,t.onerror=()=>{t.src="/dist/img/nocover-new-min.png"}},document.getElementById("cover-dialog").__rrDialogInstance.open()}async generateRecommendations(e){if(document.querySelector("#recommendations")===null){console.log("No recommendations container found, skipping recommendations load");return}let t=document.querySelector("#recommendations-accordion"),n=(t==null?void 0:t.getAttribute("data-themed-overlays"))==="true",a=await import("/dist/FictionRecommendationsTw-72IM6OX4.modern.js"),l=document.querySelector("#recommendations");W.default.createRoot(l).render(Y.default.createElement(a.FictionRecommendations,M(F({},e),{themedOverlays:n})))}initVolumes(){let{fictionCover:e,chapters:t,volumes:n,readingProgress:a}=window,l=document.querySelector("#chapters").parentElement;W.default.createRoot(l).render(Y.default.createElement(le,{fictionCover:e,chapters:t,volumes:n,readingProgress:a}))}async initCannedMessages(e,t){let n=document.querySelector("#cannedResponse");if(n){let a=new re(n,{placeholder:"Select a canned response",valueField:"id",labelField:"name",searchField:["name"],closeAfterSelect:!0,plugins:["remove_button"],preload:!0,items:[],create:!1,maxItems:null,load:async(u,d)=>{try{let i=await(await fetch("/fictions/cannedMessages?reviewId=".concat(e!=null?e:0),J)).json();this.cannedResponses=i,d(i)}catch(s){console.error("Error loading canned responses:",s),d()}},onLoad:()=>
3{l()},onItemAdd:u=>{l()},onItemRemove:u=>{l()}}),l=()=>{let u=document.querySelector("#reason");if(u){let d=a.getValue(),s=this.cannedResponses.filter(i=>d.includes(i.id.toString()));s.length===0?u.value="":s.length===1?u.value=s[0].content:s.length>1&&(u.value=s.map((i,c)=>"Reason #".concat(c+1,": ").concat(i.content)).join("\n"))}}}}destroy(){this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener),this.scrollListener=null)}},xe=new B,Ke=xe;export{B as FictionPage,Ke as default};
4
5//# debugId=843a63fc-2a01-530d-8e05-bae0aed4f542

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.