ascend
Jul 06, 2026

PART 2 - The Doctor Who Saw Through the Lie - 13!001

PART 2 - The Doctor Who Saw Through the Lie - 1

Part 2

For three years, I had imagined the moment when Grant Mercer would finally be afraid of me.

In my imagination, he shouted. He demanded lawyers. He slammed doors and barked orders the way he did when waiters forgot his preferred table or assistants mispronounced a donor's name. But reality was quieter.

Grant simply stared.

His face went pale beneath the warm emergency-room lights as I lifted the small black recorder from beneath the blanket. It was no larger than a lipstick tube, taped to the inside seam of my sleeve with medical tape I had hidden months earlier in the lining of my purse.

Dr. Reed saw it first.

His expression changed, not with shock, but with understanding. Something settled in his eyes, a calm, professional focus that made me feel, for the first time that night, as if the floor had stopped tilting beneath me.

One of the officers stepped closer. “Ma'am, what is that?”

“My insurance,” I whispered.

Grant found his voice. “Emily is confused. She's injured. She doesn't know what she's saying.”

I wanted to laugh, but my ribs punished the thought. Instead, I looked at the officer, a woman with silver-threaded hair pulled into a tight bun and a face built for patience.

“My name is Emily Mercer,” I said, each word scraped raw. “My husband did this to me. And that's not all.”

Grant moved then, not toward me, but toward the recorder.

Security reached him before the police had to. The guard's hand landed firmly against his chest, stopping him with an authority Grant wasn't used to meeting.

“Sir,” the guard said, “step back.”

“You have no idea who I am,” Grant snapped.

The officer with the bun answered without blinking. “Then you can explain it downtown.”

Grant turned to me, and in that brief second, the mask cracked completely. Not because he felt guilt. Not because he regretted what he'd done. Because he finally understood that I had not been silent from weakness.

I had been silent because I was listening.

The recorder was sealed in an evidence bag. So was my old tablet when a second officer retrieved it from the locker where I had convinced a nurse to place my belongings. On that tablet was a cloud folder organized with the clean precision of my old profession.

Dates. Times. Photos. Audio files. Bank transfers. Grant's own videos. Copies of documents from the Mercer Foundation. A spreadsheet titled simply: THREAD.

The officer introduced herself as Detective Mara Sullivan.

She didn't ask me to tell everything at once. That was the first mercy. She asked for the beginning, and when I couldn't give it, she accepted the middle. She let me pause. She let the nurses come and go. She let Dr. Reed check my pupils, my breathing, the swelling along my cheek.

Grant was taken away before sunrise.

I did not watch him leave.

I had dreamed for years of seeing him in handcuffs. When the moment came, I found myself staring instead at the small window above the sink, where dawn had begun pressing pale blue light against the glass.

“You're safe here,” Dr. Reed said softly.

Safe.

The word sounded foreign, like a language I had studied long ago but never learned to speak.

I turned my head toward him. He looked exhausted. There was a faint crease between his eyebrows, and his white coat had a coffee stain near the pocket. He was not heroic in the way movies liked doctors to be. He was simply present. Careful. Human.

“Why did you believe me?” I asked.

He glanced toward the hallway, where nurses moved in quiet currents. “Because injuries tell stories. Yours didn't match his.”

“He's good at making people believe him.”

“I know men like Grant Mercer.”

Something in the way he said it made me look at him more closely. Before I could ask what he meant, Detective Sullivan returned with a paper cup of water and a legal pad.

“We're going to take this one step at a time,” she said.

That became the rhythm of the next twelve hours.

One step at a time.

A nurse named Lila helped me sit up enough to sip broth. A social worker with kind eyes brought clothes from a donation closet: gray sweatpants, a navy sweatshirt, socks with little yellow moons printed across them. Detective Sullivan asked questions in short, careful sections.

Had Grant hurt me before?

Yes.

Had he isolated me from friends or family?

Yes.

Had he monitored my communications?

Yes.

Had I collected the financial records myself?

Yes.

And then came the question that tightened every muscle in my body.

“Why didn't you leave earlier?”

Detective Sullivan didn't ask it cruelly. She asked it like a woman who already knew the answer had many rooms.

I stared down at my hands. My wedding ring had been removed for scans and placed inside a plastic bag on the tray table. It looked harmless there, just a bright circle under fluorescent light.

“Because leaving wasn't enough,” I said. “Because he had friends everywhere. Judges at galas. Officers at fundraisers. Reporters who called him generous. If I ran without proof, he would find me, and everyone would say I was unstable.”

The detective wrote nothing for a moment.

Then she said, “You were building a case.”

“I was building a door.”

Her eyes softened.

By evening, the hospital had moved me to a private room under a different name in the system. Detective Sullivan told me it was temporary but necessary. Grant's attorney had already called twice. His mother had called seven times. A man from the Mercer Foundation had appeared at the front desk demanding information and left when hospital security refused him access.

I slept in pieces.

When I woke, snow was falling outside the window. Chicago looked gentler under snow, all its sharp edges blurred. For one strange minute, I forgot where I was. Then pain returned, memory following close behind.

There was a chair beside my bed.

My sister was in it.

Claire.

She had one leg tucked beneath her, her dark hair loose around her face, her coat still buttoned as if she had arrived in a rush and forgotten how to take it off. We had not spoken in nineteen months.

Grant had made sure of that.

At first, he had only criticized her. Too opinionated. Too protective. Too suspicious. Then he began answering my phone when she called. Then he convinced me that seeing her would create “unnecessary drama.” Finally, after one terrible argument during which Claire begged me to come home with her, Grant told me she wanted to ruin my marriage because she was lonely.

I had believed none of it.

But I had obeyed anyway.

Claire opened her eyes as if she had felt me watching.

For a second, neither of us spoke. Then her face crumpled.

“Em,” she whispered.

The childhood nickname broke something open in me.

She came to the bed carefully, as though approaching a frightened animal. When I reached for her, she held my hand between both of hers and began to cry without sound.

“I tried,” she said. “I tried so many times.”

“I know.”

“I should have tried harder.”

“No.” My voice shook. “You couldn't have pulled me out while I was still pretending I wasn't trapped.”

Claire pressed her forehead to our joined hands.

We stayed like that until a nurse came in and pretended not to notice we were crying.

Later, Claire helped me eat applesauce from a plastic cup. It was absurd and tender, and for some reason that hurt more than the bruises. I was thirty-four years old, a former investigator, a woman who had tracked shell companies through six countries, and my little sister was feeding me applesauce because I couldn't lift my arm without wincing.

“Where will you go?” she asked.

“I don't know.”

“With me,” she said immediately. “Obviously.”

I looked at her.

She lifted her chin. “Don't argue. My guest room is currently occupied by laundry and a judgmental cat, but both can be moved.”

A laugh surprised me. It came out small and broken, but it was mine.

Claire smiled through tears. “There you are.”

Dr. Reed came in during visiting hours with updated scan results. No internal bleeding. A concussion that required monitoring. Two cracked ribs. Severe bruising. He explained everything clearly, checking often to make sure I understood.

Claire watched him with the fierce suspicion of a sister who had missed too much and trusted no one.

“Are the police really taking this seriously?” she asked.

“They are,” he said. “Detective Sullivan is thorough.”

“People like Grant usually find loopholes.”

Dr. Reed looked at me before answering. “Sometimes. But evidence has a way of making rooms smaller for people who think they own every exit.”

That sentence stayed with me.

The following afternoon, Detective Sullivan returned with news. Grant had been charged in connection with the assault. More charges could follow, depending on what the financial crimes unit found in my files. A protective order was being prepared. The Mercer Foundation's accounts were being reviewed.

“And Grant?” I asked.

“He made bail.”

The room went very still.

Claire stood so quickly her chair scraped the floor.

Detective Sullivan raised a hand. “He is not allowed to contact you or come near you. We're coordinating with hospital security and your discharge plan.”

I nodded, but my fingers curled around the blanket.

Grant out in the world was not the same as Grant contained in a cell. I could picture him stepping into the cold air outside the precinct, straightening his coat, already deciding which version of the truth to purchase.

Detective Sullivan seemed to read my thoughts.

“He can hire attorneys,” she said. “He can make statements. He can call in favors. But he cannot undo what you documented.”

“What if someone helps him?”

“Then we document that too.”

I wanted to believe her.

That evening, a hospital administrator visited to discuss privacy forms. A victim advocate explained options in a calm voice. Claire made calls to arrange a locksmith, a new phone, and a ride home when I was released. The world became a clipboard of necessary steps.

Yet beneath all of it, another current moved.

Something was wrong with my evidence.

I felt it before I knew it.

The clue came from Detective Sullivan's copy of my THREAD spreadsheet. She had printed several pages and left them on the rolling table while taking a phone call in the hall. I wasn't supposed to touch them, probably, but old habits rose stronger than pain.

My eyes found the column of foundation transfers.

Grant had used the Mercer Foundation as a showroom for his virtue. Scholarships. Housing grants. Hospital donations. Public photographs with oversized checks. But behind the polished reports were payments to consulting firms that did not exist, invoices with identical formatting, and offshore accounts routed through charities with names designed to sound compassionate and vague.

One line caught my attention.

ASTRID CONSULTING - COMMUNITY OUTREACH REVIEW - $48,000.

I had seen it before. Many times. But now the date made my stomach tighten.

March 14.

The day after my father died.

I stared until the numbers blurred.

My father, Daniel Hart, had passed away after a long illness in a hospice outside Albany. Grant had refused to come with me for the final visit, saying he had an important donor dinner. He had sent flowers so large the nurses had to move them into the hallway.

On March 14, while I sat in my father's empty apartment choosing which books to keep, Grant had authorized a foundation payment to Astrid Consulting.

Why would that date matter?

Detective Sullivan returned and saw my face.

“What is it?”

“This transfer,” I said. “I need the backup file.”

She hesitated. “Emily, you need rest.”

“I rested for three years whenever he told me to. Please.”

Maybe it was the steadiness in my voice. Maybe she understood that thinking was the only part of me that didn't hurt. She opened her laptop and pulled up the scanned invoice from the evidence drive.

ASTRID CONSULTING, LLC.

Below it was a service description. Outreach review. Strategic partnership audit. Words built to say nothing.

Then I saw the signature approving payment.

Not Grant's.

Mine.

My name sat at the bottom of the invoice in smooth blue script.

Emily Mercer.

For a moment, the room disappeared.

“I didn't sign that,” I said.

Detective Sullivan leaned closer. “You're sure?”

“Yes.”

Grant had forged my name before, on household documents, membership forms, social invitations. But this was different. This placed me inside the foundation's financial activity. If prosecutors looked quickly, carelessly, they might see me not as the person who exposed the accounts, but as part of them.

A cold, familiar understanding spread through me.

Grant had not merely controlled me.

He had prepared to blame me.

Claire arrived with coffee and found me sitting rigidly upright, shaking with fury so quiet it frightened even me.

“What happened?”

“He made me his exit plan,” I said.

Detective Sullivan closed the laptop slowly. “Maybe. Or maybe someone else did.”

I looked at her. “What does that mean?”

“There are three signatures on the Mercer Foundation banking authorization. Grant's. Yours. And the executive director's.”

“Peter Vale,” I said.

Peter had been at every gala, always smiling from the edges of photographs. Thin, polished, unfailingly polite. He sent handwritten thank-you notes after dinners and remembered donors' children's names. Grant trusted him because Peter knew how to disappear inside a room until needed.

Detective Sullivan nodded. “He's the man who came to the front desk yesterday.”

Claire set the coffee down untouched.

“Why would he come here?” she asked.

“To see whether Emily was speaking,” the detective said.

The next day, I was discharged through a side entrance.

Snow had turned to gray slush along the curb. Claire's car smelled like peppermint gum and old library books, exactly as it had when we were teenagers. She drove with both hands clamped to the wheel, checking the mirrors every few seconds.

“You're allowed to breathe,” I said.

“You first.”

We did not go to my house. Detective Sullivan had arranged for officers to accompany Claire later to collect essentials. Instead, we drove to Claire's apartment in Oak Park, a second-floor walk-up with ivy around the windows and a radiator that hissed like an irritated dragon.

Her cat, Mr. Bennet, regarded me from the hallway with solemn disappointment.

“He judges everyone,” Claire said. “Don't take it personally.”

The guest room was small and crowded with boxes, but Claire had cleared the bed. On the nightstand sat a glass of water, a bottle of prescribed medication, and a framed photograph of us at sixteen and fourteen, sunburned and laughing on a beach our parents had barely been able to afford.

I touched the frame.

“I thought you threw this away,” I said.

“I kept everything.”

The words undid me.

Healing did not arrive like sunrise. It came in uneven fragments. A shower taken with the bathroom door unlocked. A phone that did not light up with demands. The ability to decide whether the lamp stayed on or off.

At night, I woke expecting Grant's footsteps.

Claire would call from the other room, “It's just the radiator,” or “It's Mr. Bennet being dramatic,” or once, “It's me eating cereal at two in the morning because adulthood is a myth.”

Little by little, my body learned the apartment's sounds.

Meanwhile, the case widened.

Detective Sullivan visited often. Sometimes she brought updates; sometimes she brought questions. Financial crimes investigators had confirmed several shell companies. Peter Vale had not appeared for a scheduled interview. Grant's attorneys claimed I had access to all foundation accounts and had manufactured evidence to protect myself.

There it was.

The story Grant had planted long before the hospital.

The ungrateful wife. The unstable former accountant. The woman with enough knowledge to create a crime and enough resentment to accuse an innocent man.

“He always said I was too smart for my own good,” I told Claire one afternoon.

She was folding towels with unnecessary aggression. “Then let's make sure he's right.”

I began working again from Claire's kitchen table.

Not officially. Detective Sullivan warned me not to interfere. But she also understood that no one knew Grant's patterns better than I did. She gave me copies of documents my own evidence had generated and asked me to mark anything unfamiliar.

The forged signatures were good.

Too good.

That bothered me.

Grant was arrogant, not meticulous. He could imitate charm, not handwriting. Peter Vale had access to documents, but I had seen Peter's writing on thank-you notes for years. His loops were narrow, his pressure light. The forged signatures had heavier downstrokes. Confident. Practiced.

Someone else had written my name.

On the fifth day at Claire's, I found the second clue.

It was buried in metadata from a scanned invoice. Most people forget documents carry fingerprints of a different kind: creation dates, printer IDs, usernames. The file had been created on a computer registered to M.NOVAK.

“Do you know that name?” Detective Sullivan asked over the phone.

“No.”

“Think foundation staff. Vendors. Donors.”

I closed my eyes, searching through years of forced dinners and polished smiles.

Novak.

The name surfaced with the scent of lilies and hospital disinfectant.

“Marian Novak,” I said. “Grant's mother.”

Claire, standing at the sink, went still.

Marian Mercer had remarried when Grant was in college, briefly becoming Marian Novak before the second husband died and she returned to the Mercer name as if correcting a clerical error. She was elegant, controlled, and colder than any room she entered.

She had never liked me.

Not because she saw through Grant. Because she saw too much of herself in him and too little obedience in me.

Detective Sullivan was quiet for a beat. “Are you telling me Grant's mother may have prepared the forged documents?”

“I'm telling you she had the patience.”

That night, sleep refused me.

I sat by Claire's living room window wrapped in a quilt, watching headlights pass over the ceiling. Somewhere across the city, Grant was free enough to breathe the same winter air. Marian was likely in her townhouse, arranging flowers, calling attorneys, deciding how best to turn me into a liability.

My phone buzzed.

Only three people had the new number: Claire, Detective Sullivan, and the victim advocate.

The screen showed UNKNOWN.

I should have ignored it.

Instead, I answered without speaking.

For several seconds, there was only static. Then a woman's voice, low and familiar, said, “You always were better with numbers than with people.”

Marian.

My grip tightened.

“You shouldn't be calling me.”

“I am not calling to threaten you, Emily.”

“No. You'd consider that vulgar.”

A small pause. Then, unexpectedly, she laughed.

“I told Grant you would become a problem. He mistook silence for surrender. Men often do.”

I glanced toward Claire's bedroom door. It was closed.

“What do you want?”

“To offer clarity.”

“Then call Detective Sullivan.”

“I prefer not to perform for civil servants.”

There she was. Every syllable polished into contempt.

I reached for the small notebook on the coffee table and wrote: MARIAN CALLING. KEEP HER TALKING.

“What clarity?” I asked.

“The foundation was never Grant's idea. He inherited a machine he barely understood. Your files are impressive, but incomplete.”

My pulse changed.

“What machine?”

“The kind families build when money must look cleaner than it is.”

“Why tell me this?”

“Because Grant has become inconvenient.”

The words chilled me more than any threat could have.

Marian continued, “He is emotional. Careless. He confuses cruelty with strength. I warned him that leaving marks was foolish.”

I closed my eyes.

“Did you forge my signatures?”

“Some of them.”

The admission landed softly, almost politely.

I wrote it down with a shaking hand.

“Why?”

“Because one should always know where the exits are.”

“You were going to frame me.”

“I was going to preserve the family.”

“Those are not the same thing.”

“To you, perhaps.”

A floorboard creaked behind me. Claire stood in the hallway, eyes wide. I pointed to the phone, then the notebook.

Marian's voice lowered. “Listen carefully. Peter Vale has disappeared because he knows enough to bargain. Grant believes Peter has betrayed him. Peter believes you have something that belongs to him.”

“What?”

“Your father left you a key.”

I stopped breathing.

“My father left me books and medical bills.”

“He left you more than he understood.”

The line crackled.

“Where is Peter?” I asked.

“If I knew, I would not be calling.”

That was the first thing she said that sounded almost true.

“Why should I believe you?”

“Because tomorrow morning, Grant's attorneys will file a motion claiming your father was paid by Astrid Consulting before his death. They will say you used his accounts to move foundation money.”

The room tilted.

“My father was a retired school principal.”

“Yes,” Marian said. “A useful kind of innocent.”

Claire covered her mouth.

Anger rose in me, clean and bright. Not explosive. Sharpening.

“You leave him out of this.”

“My dear, he was never out of it. That's what I'm trying to tell you.”

Then the call ended.

Detective Sullivan arrived within twenty minutes. Claire had recorded the last half of the conversation on her phone after realizing what was happening. It wasn't perfect, but it was something.

When Sullivan listened, her expression gave little away. But when Marian mentioned my father, she paused the recording.

“Emily,” she said, “did your father ever know Grant before you met him?”

“No.”

“Are you certain?”

I wanted to answer quickly. Instead, I remembered my father's face the first time I brought Grant home. He had smiled, welcomed him, asked about his work. But later, while Grant helped my mother carry dishes, Dad had touched my elbow and said, very quietly, “Be careful with men who need every room to admire them.”

At the time, I thought he was being protective.

Now I wondered.

Claire went to the guest room and returned with the box of my father's things she had brought from storage months earlier, unable to make herself sort through it alone. Inside were old photographs, a fountain pen, a cracked leather Bible, and stacks of letters tied with string.

At the bottom was a small brass key taped inside an envelope.

My name was written across it in my father's handwriting.

Emily.

My hands trembled as I opened the envelope.

There was no letter, only a receipt from a private storage facility in Albany and a note written on the back.

For when the polished people start telling polished lies.

Below that was a number.

Unit 317.

No one spoke.

Snow tapped softly against the window, delicate as fingertips.

Detective Sullivan leaned forward. “Did you know about this?”

I shook my head.

Claire picked up the key, holding it as if it weighed more than metal.

“My father knew,” I whispered.

The detective's phone rang before anyone could answer. She stepped into the kitchen, speaking low. I watched her through the doorway. Her posture changed. Her shoulders tightened.

When she returned, her face had gone carefully blank.

“That was Albany police,” she said. “They went to check the storage facility.”

“And?” Claire asked.

“Unit 317 was opened two hours ago.”

My fingers went cold around the envelope.

Detective Sullivan looked directly at me.

“Whoever opened it used a key.”

END OF PART 2 - LIKE, SHARE AND COMMENT "THE ENTIRE STORY" IF YOU WANT TO READ THE FULL STORY

Report this article

Select a reason for reporting:

Inaccurate information Copyright violation Spam / advertisement Offensive content Other '; footer.hidden = true; overlay.hidden = false; document.body.style.overflow = 'hidden'; } function hideSection() { if (section) section.hidden = true; } function openModal() { if (alreadyReported) { showSuccess(); return; } overlay.hidden = false; document.body.style.overflow = 'hidden'; } function closeModal() { overlay.hidden = true; document.body.style.overflow = ''; footer.hidden = false; overlay.querySelectorAll('input[name="report_reason"]').forEach(function(r) { r.checked = false; }); document.getElementById('reportMessage').value = ''; errorBox.hidden = true; submitBtn.disabled = false; submitBtn.textContent = 'Submit report'; imageItems = []; imgGrid.innerHTML = ''; updateAttachBtn(); } btn.addEventListener('click', openModal); closeBtn.addEventListener('click', closeModal); cancelBtn.addEventListener('click', closeModal); overlay.addEventListener('click', function(e) { if (e.target === overlay) closeModal(); }); document.addEventListener('keydown', function(e) { if (!overlay.hidden && e.key === 'Escape') closeModal(); }); // --- Error helper --- function showError(msg) { errorBox.textContent = msg; errorBox.hidden = false; } // --- Submit --- submitBtn.addEventListener('click', function() { var selected = overlay.querySelector('input[name="report_reason"]:checked'); if (!selected) { showError('Please select a reason.'); return; } errorBox.hidden = true; submitBtn.disabled = true; var itemsToUpload = imageItems.filter(function(it) { return !it.uploadedUrl; }); if (itemsToUpload.length === 0) { doSubmit(selected.value); return; } submitBtn.textContent = 'Uploading…'; var done = 0, failed = 0; itemsToUpload.forEach(function(entry) { entry.statusEl.textContent = '…'; entry.statusEl.className = 'report-img-item__status'; entry.statusEl.hidden = false; resizeImage(entry.file, MAX_LONG_PX, function(resized) { uploadFile(resized, currentSlug, function(err, url) { done++; if (err) { failed++; entry.statusEl.textContent = 'Failed'; entry.statusEl.className = 'report-img-item__status err'; } else { entry.uploadedUrl = url; entry.statusEl.textContent = '✓'; entry.statusEl.className = 'report-img-item__status done'; } if (done === itemsToUpload.length) { if (failed > 0) { showError('Could not upload ' + failed + ' image(s). Remove the failed ones (red) or submit without them.' ); submitBtn.disabled = false; submitBtn.textContent = 'Submit report'; } else { doSubmit(selected.value); } } }); }); }); }); function doSubmit(reason) { submitBtn.textContent = 'Sending…'; var uploadedUrls = imageItems .map(function(it) { return it.uploadedUrl; }) .filter(Boolean); var payload = { reason: reason, message: document.getElementById('reportMessage').value.trim(), post_slug: currentSlug, post_url: window.location.href }; if (uploadedUrls.length) payload.image_urls = uploadedUrls; fetch('/api/post-report', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest' }, body: JSON.stringify(payload) }) .then(function(r) { return r.json(); }) .then(function(data) { if (data && data.ok) { markReported(currentSlug); alreadyReported = true; bodyEl.innerHTML = '✓ Thank you for your report.'; footer.hidden = true; setTimeout(function() { closeModal(); footer.hidden = false; hideSection(); }, 2000); } else { showError((data && data.message) ? data.message : 'Something went wrong. Please try again.'); submitBtn.disabled = false; submitBtn.textContent = 'Submit report'; } }) .catch(function() { showError('Connection failed. Please try again.'); submitBtn.disabled = false; submitBtn.textContent = 'Submit report'; }); } })();

Comments 0

Posting as Guest '; } return; } var normalizedItems = items.slice().reverse(); var html = normalizedItems.map(function(comment) { var replies = Array.isArray(comment.replies) ? comment.replies : []; var repliesHtml = replies.map(function(reply) { return '' + '' + '' + '' + '' + escapeHtml(reply.author_name) + '' + escapeHtml(reply.time) + '' + '

' + escapeHtml(reply.content) + '

' + '' + '' + '' + ''; }).join(''); return '' + '' + '' + '' + '' + escapeHtml(comment.author_name) + '' + escapeHtml(comment.time) + '' + '

May you like

' + escapeHtml(comment.content) + '

' + '' + '' + '' + '' + (repliesHtml ? '' + repliesHtml + '' : '') + ''; }).join(''); if (mode === 'prepend') { listEl.insertAdjacentHTML('afterbegin', html); return; } listEl.insertAdjacentHTML('beforeend', html); } async function loadComments(page, mode) { var query = new URLSearchParams({ post_slug: postSlug, page: String(page), per_page: String(perPage), }); var response = await fetch('/api/post-comments?' + query.toString(), { method: 'GET', headers: { 'Accept': 'application/json' } }); var data = await response.json().catch(function() { return {}; }); if (!response.ok || data.ok === false) { throw new Error((data && data.message) || 'Cannot load comments.'); } var pagination = data.pagination || {}; currentPage = Number(pagination.current_page || 1); lastPage = Number(pagination.last_page || 1); totalCountEl.textContent = String((data.post && data.post.comment_count) || pagination.total || 0); loadMoreBtn.classList.toggle('comment-box__hidden', currentPage >= lastPage); renderComments(data.comments || [], mode); } async function postComment(content, parentId, feedbackTarget, submitTarget) { var authorName = ensureName(false); if (!authorName) { var forced = ensureName(true); if (!forced) { throw new Error('Please enter your name first.'); } authorName = forced; } var payload = { post_slug: postSlug, post_url: window.location.href, author_name: authorName, content: content, }; if (parentId > 0) { payload.parent_id = parentId; } if (submitTarget) submitTarget.disabled = true; if (feedbackTarget) { feedbackTarget.textContent = 'Submitting...'; feedbackTarget.style.color = ''; } try { var response = await fetch('/api/post-comments', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify(payload) }); var data = await response.json().catch(function() { return {}; }); if (!response.ok || data.ok === false) { throw new Error((data && data.message) || 'Cannot submit comment.'); } await loadComments(1, 'replace'); return true; } finally { if (submitTarget) submitTarget.disabled = false; } } form.addEventListener('submit', async function(event) { event.preventDefault(); var content = String(contentEl.value || '').trim(); if (!content) { setFeedback('Please enter comment content.', true); return; } submitBtn.disabled = true; setFeedback('Submitting...'); try { await postComment(content, 0); contentEl.value = ''; setFeedback('Comment submitted.'); } catch (error) { setFeedback(error.message || 'Cannot submit comment.', true); } finally { submitBtn.disabled = false; } }); listEl.addEventListener('click', function(event) { var replyBtn = event.target.closest('.comment-item__reply-btn'); if (replyBtn) { var row = replyBtn.closest('.comment-item'); if (!row) return; var formEl = row.querySelector('.comment-item__reply-form'); if (!formEl) return; listEl.querySelectorAll('.comment-item__reply-form').forEach(function(f) { if (f !== formEl) f.classList.add('comment-box__hidden'); }); formEl.classList.remove('comment-box__hidden'); var input = formEl.querySelector('textarea'); if (input) input.focus(); return; } var cancelBtn = event.target.closest('.comment-item__reply-cancel'); if (cancelBtn) { var rf = cancelBtn.closest('.comment-item__reply-form'); if (!rf) return; rf.classList.add('comment-box__hidden'); var rInput = rf.querySelector('textarea'); var rFeedback = rf.querySelector('.comment-item__reply-feedback'); if (rInput) rInput.value = ''; if (rFeedback) rFeedback.textContent = ''; } }); listEl.addEventListener('submit', async function(event) { var replyForm = event.target.closest('.comment-item__reply-form'); if (!replyForm) return; event.preventDefault(); var row = replyForm.closest('.comment-item'); if (!row) return; var parentId = Number(row.getAttribute('data-comment-id') || 0); var input = replyForm.querySelector('textarea'); var submit = replyForm.querySelector('.comment-item__reply-submit'); var feedback = replyForm.querySelector('.comment-item__reply-feedback'); var replyText = String((input && input.value) || '').trim(); if (!replyText) { if (feedback) { feedback.textContent = 'Please enter reply content.'; feedback.style.color = '#dc2626'; } return; } try { await postComment(replyText, parentId, feedback, submit); // setFeedback('Reply submitted.'); } catch (error) { if (feedback) { feedback.textContent = error.message || 'Cannot submit reply.'; feedback.style.color = '#dc2626'; } } }); changeNameBtn.addEventListener('click', function() { ensureName(true); }); loadMoreBtn.addEventListener('click', async function() { if (currentPage >= lastPage) return; loadMoreBtn.disabled = true; try { await loadComments(currentPage + 1, 'prepend'); } catch (error) { setFeedback(error.message || 'Cannot load more comments.', true); } finally { loadMoreBtn.disabled = false; } }); ensureName(false); loadComments(1, 'replace').catch(function(error) { setFeedback(error.message || 'Cannot load comments.', true); }); })();

Other posts