Retain asynchronous Writer context and explain the five working activities
This commit is contained in:
parent
63fb2d5a75
commit
98bce93ffc
@ -9,7 +9,10 @@ for(const [label,book,project] of [['Populated',w.book,w.project],['Minimal',w.o
|
||||
if(before){console.log('PASS baseline authenticated four-fixture captures');return;}
|
||||
await p.goto(route('Write'));const exportSessions=async()=>await(await p.request.get(base+`/Writer/Work/Export?bookId=${w.book}`)).json();const sessionsBefore=await exportSessions();const form=p.locator('[data-focus-wizard]');if(!await form.isVisible())await p.locator('[data-change-focus]').click();await form.locator('[name=Activity]').selectOption('Revising');await form.locator('[data-focus-next]').click();await form.locator('[name=ChapterID]').selectOption(String(w.chapter));await form.locator('[name=SceneID]').selectOption(String(w.scene));await form.locator('[data-focus-next]').click();await form.locator('[name=Intention]').fill('Clarify the turning point');await form.locator('[data-focus-back]').click();assert.equal(await form.locator('[name=ChapterID]').inputValue(),String(w.chapter));await form.locator('[data-focus-next]').click();assert.equal(await form.locator('[name=Intention]').inputValue(),'Clarify the turning point');let saves=0;p.on('request',r=>{if(r.method()==='POST'&&new URL(r.url()).pathname==='/Writer/SaveObjective')saves++;});await form.evaluate(n=>{n.requestSubmit();n.requestSubmit();});await p.locator('[data-focus-summary]').filter({hasText:'Clarify the turning point'}).waitFor();assert.equal(saves,1);assert.deepEqual(await exportSessions(),sessionsBefore,'focus must not create sessions');await shot('Write-established');await p.goto(route('Plan'));assert((await p.locator('.writer3-main').textContent()).includes('Clarify the turning point'));await p.goto(route('Write'));assert((await p.locator('[data-focus-summary]').textContent()).includes('Clarify the turning point'));await p.locator('[data-change-focus]').click();await form.locator('[data-focus-next]').click();await form.locator('[name=ChapterID]').selectOption('');await form.locator('[data-focus-next]').click();await form.locator('[data-save-focus]').click();await p.locator('[data-focus-summary]').filter({hasText:'Across the book'}).waitFor();assert.deepEqual(await exportSessions(),sessionsBefore);
|
||||
await p.goto(route('Explore'));await p.locator('[data-discovery-tiles] [data-tile]:visible').first().waitFor();const tile=p.locator('[data-discovery-tiles] [data-tile]:visible').first(),id=await tile.getAttribute('data-tile');await tile.locator('[data-dismiss]').click();assert(await p.locator(`[data-tile="${id}"]`).isHidden());await p.reload();assert(await p.locator(`[data-tile="${id}"]`).isHidden());await p.locator('[data-reconsider]').click();assert(await p.locator(`[data-tile="${id}"]`).isVisible());await p.locator(`[data-tile="${id}"] [data-defer]`).click();assert(await p.locator(`[data-tile="${id}"]`).isHidden());await p.locator('[data-reconsider]').click();await p.locator('[data-investigation-opening] input[name=concern]').first().check();await p.locator('[data-investigation-opening] button[type=submit]').click();await p.waitForURL(/Investigate\?bookId=.*id=/);assert(await p.locator('[data-investigation-answer]').isVisible());await p.goto(route('Explore'));await p.locator('[data-my-investigations] article').first().waitFor();const completed=p.locator('[data-my-investigations] article').filter({hasText:'Original results'}).first();await completed.getByRole('button',{name:'Continue',exact:true}).click();await p.locator('.investigation form[data-guidance-navigation]').first().locator('button').click();await p.locator('[data-investigation-companion] #guidance-finding').waitFor();assert.equal(context.pages().length,1);await p.locator('[data-guidance-pin]').click();await p.goto(route('Explore'));await p.locator('[data-discovery-active] form').first().waitFor();await p.evaluate(()=>PlotLineHelpDrawer.open('writer3.explore'));await p.locator('.help-drawer-article').waitFor();await shot('Explore-both-panels');
|
||||
await p.goto(route('Review')+'&chapterId='+w.chapter);await p.locator('[data-review-intentions-slot] [data-review-intentions]').waitFor();assert(await p.locator('.reader-page').isVisible());const paragraph=p.locator('[data-paragraph-id][data-scene-id]').filter({hasText:'recorded first paragraph'}).first();await paragraph.click();await p.locator('[data-review-record]').click();await p.locator('[data-review-cancel]').click();await p.locator('[data-review-intentions-slot]').getByText('Disposable review scene',{exact:true}).waitFor();await shot('Review-context');await p.locator('#reader-focus').click();await p.locator('#reader-next').click();assert.equal(await p.locator('.manuscript-reader').getAttribute('data-focus'),'true');await p.locator('#reader-focus').click();await p.goto(route('Review')+'&reading=true&chapterId='+w.chapter);assert.equal(await p.locator('.manuscript-reader').getAttribute('data-reading'),'true');await shot('Reading-mode');
|
||||
await p.goto(route('Reflect'));await p.locator('.writer-month-grid').waitFor();const month=await p.locator('.writer-section-heading h2').first().textContent();await p.getByRole('link',{name:'Previous month',exact:true}).click();assert(p.url().includes('/Writer/Reflect'));assert.notEqual(await p.locator('.writer-section-heading h2').first().textContent(),month);await p.locator('.writer-month-grid a').first().click();assert(p.url().includes('day='));await shot('Reflect-day');
|
||||
await p.goto(route('Review')+'&chapterId='+w.chapter);await p.locator('[data-review-intentions-slot] [data-review-intentions]').waitFor();assert(await p.locator('.reader-page').isVisible());const paragraph=p.locator('[data-paragraph-id][data-scene-id]').filter({hasText:'recorded first paragraph'}).first();await paragraph.click();await p.locator('[data-review-record]').click();await p.locator('[data-review-cancel]').click();await p.locator('[data-review-intentions-slot]').getByText('Disposable review scene',{exact:true}).waitFor();await shot('Review-context');await p.locator('#reader-focus').click();await p.locator('.reader-controls a[rel=next]').click();assert.equal(await p.locator('.manuscript-reader').getAttribute('data-focus'),'true');await p.locator('#reader-focus').click();await p.goto(route('Review')+'&reading=true&chapterId='+w.chapter);assert.equal(await p.locator('.manuscript-reader').getAttribute('data-reading'),'true');await shot('Reading-mode');
|
||||
// An explicit session is a separate action, never a side effect of choosing focus.
|
||||
await p.goto(route('Write'));const token=await p.locator('input[name=__RequestVerificationToken]').first().inputValue();const session=require('crypto').randomUUID();assert.equal((await p.request.post(base+'/Writer/Work/Start',{form:{bookId:w.book,kind:'Planning',requestId:session,__RequestVerificationToken:token}})).status(),200);assert.equal((await p.request.post(base+'/Writer/Work/End',{form:{bookId:w.book,sessionId:session,note:'Considered the next writing step',__RequestVerificationToken:token}})).status(),200);
|
||||
await p.goto(`${base}/Writer/ScheduleSetup?projectId=${w.project}&bookId=${w.book}`);await p.locator('[name=PlanName]').fill('Disposable Phase 2 writing plan');const today=new Date(),end=new Date(Date.now()+28*86400000);await p.locator('[name=StartDate]').fill(today.toISOString().slice(0,10));await p.locator('[name=DeadlineDate]').fill(end.toISOString().slice(0,10));for(const box of await p.locator('input[type=checkbox][name$=".IsAvailable"]').all())await box.check();await p.getByRole('button',{name:'Review activities',exact:true}).click();await p.waitForURL(/PlanActivities|SchedulePreview/);if(p.url().includes('PlanActivities')){await p.locator('[name=Confirm]').check();await p.getByRole('button',{name:'Commit reviewed schedule'}).click();await p.waitForURL(/SchedulePreview/);}const planId=new URL(p.url()).searchParams.get('writingPlanId');assert(planId);await p.goto(route('Plan'));assert((await p.locator('.writer3-main').textContent()).includes('Scheduled writing activities'));await p.goto(`${base}/Writer/EditWritingPlan?writingPlanId=${planId}`);assert(await p.locator('[name=PlanName]').isVisible());await p.goto(route('Reflect'));await p.locator('.writer-month-grid').waitFor();const month=await p.locator('.writer-section-heading h2').first().textContent();await p.getByRole('link',{name:'Previous month',exact:true}).click();assert(p.url().includes('/Writer/Reflect'));assert.notEqual(await p.locator('.writer-section-heading h2').first().textContent(),month);await p.locator('.writer-month-grid a').first().click();assert(p.url().includes('day='));await shot('Reflect-day');
|
||||
for(const d of ['Write','Explore','Plan','Review','Reflect']){await p.goto(route(d));await p.waitForTimeout(150);await shot('Working-'+d);}
|
||||
for(const width of [1920,1366,800])for(const d of ['Write','Explore','Plan','Review','Reflect']){await p.setViewportSize({width,height:1000});await p.goto(route(d));await p.evaluate(()=>PlotLineHelpDrawer.open('writer3.layout'));await p.locator('.help-drawer-article').waitFor();assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2),d+' '+width);await shot(d+'-'+width+'-panels');const collapse=p.locator('[data-ribbon-collapse]');await collapse.click();assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));if(await p.locator('[data-guidance-collapse]').isVisible())await p.locator('[data-guidance-collapse]').click();await p.locator('[data-help-collapse]').count().then(async n=>{if(n)await p.locator('[data-help-collapse]').click();});await shot(d+'-'+width+'-collapsed');}
|
||||
assert.deepEqual(errors,[]);console.log('PASS Phase 2 authenticated four fixtures, AJAX focus and no sessions, discovery preferences, canonical questionnaire, saved guidance, Review/Reading/Focus scene context, Reflect month/day, three widths and panel/ribbon states');await context.close();}finally{await browser.close();}})().catch(e=>{console.error(e.stack);process.exitCode=1});
|
||||
|
||||
@ -24,3 +24,7 @@ Drag the divider or focus it and use Left/Right arrow keys to resize the context
|
||||
# Authenticated tools
|
||||
|
||||
Develop a chapter or scene opens Write with the selected project/book; Develop your plot and threads opens the existing authenticated plot workspace; Look at your story's shape opens its timeline. These are distinct existing tools, not the public Problem Solver or a new guided ideation engine. Guided exploration remains a later phase. No analysis runs merely by choosing Explore.
|
||||
|
||||
# Discover or investigate
|
||||
|
||||
Explore gives equal space to useful story tools and the real opening concerns of Guided Investigation. Discovery uses recorded book context and your active investigation, not an assessment of what you have planned elsewhere. Not now sets a tile aside; Later defers it for seven days on this browser. Reconsider hidden suggestions restores those choices; the ribbon always remains available. My Investigations resumes existing work without replacing another investigation silently.
|
||||
|
||||
@ -22,3 +22,7 @@ Preview and manage links preserve the book and include project-wide All Books pl
|
||||
# Arrange your workspace
|
||||
|
||||
Drag the divider or focus it and use Left/Right arrow keys to resize the contextual companion. Hide companion gives your main task the full width; Show companion restores it. Each destination remembers its width and desktop visibility on this browser. In narrow windows the companion opens as an overlay; use Back to workspace or Escape to return. Workspace Layout Help beside Show/Hide companion explains keyboard controls, storage and the independent standalone Context/Intent windows.
|
||||
|
||||
# What should I work on next?
|
||||
|
||||
Your next intended work is the same private working focus used in Write. Choose it without dates or a schedule, then Continue when you are ready. Scheduled activities appear separately from that intention. Schedule and completed work opens existing plans, completion controls and availability adjustments. Planned minutes are budgets; saving a focus is neither task completion nor a recorded session.
|
||||
|
||||
@ -20,3 +20,7 @@ No retained evidence does not mean no writing took place. A baseline starts from
|
||||
# Arrange your workspace
|
||||
|
||||
Drag the divider or focus it and use Left/Right arrow keys to resize the contextual companion. Hide companion gives your main task the full width; Show companion restores it. Each destination remembers its width and desktop visibility on this browser. In narrow windows the companion opens as an overlay; use Back to workspace or Escape to return. Workspace Layout Help beside Show/Hide companion explains keyboard controls, storage and the independent standalone Context/Intent windows.
|
||||
|
||||
# Your journey here
|
||||
|
||||
Reflect now opens Writing Journey directly. Move between months and select a date to inspect recorded work. Accepted manuscript changes are observed automatically; sessions are explicitly started and ended. Elapsed session time differs from observed activity. Earlier writing may have no tracking history. Recording details are available on demand, and quiet days are not a judgement of your writing.
|
||||
|
||||
@ -20,3 +20,7 @@ Return to Word uses the existing verified, acknowledged chapter/paragraph handof
|
||||
Reading & Audio Review uses the existing session/media controls and return notes. Observations are separate from session notes, canonical scene revision state and automated findings. Opening Review runs no manuscript analysis.
|
||||
|
||||
Use Show/Hide companion and keyboard/pointer resizing. On narrow screens the companion opens as an overlay. Each pane scrolls only when its content exceeds the available viewport. See Read, Notice and Decide for observation capture, original references and recovery.
|
||||
|
||||
# Intentions beside the manuscript
|
||||
|
||||
Review uses the canonical Reader. Expand or collapse Chapter intentions and verified scene context independently of the observation companion. At wide working widths intentions sit beside the manuscript; at smaller widths they precede it. Selecting accepted text shows scene intentions only where an accepted scene assignment is reliable. Reading reduces editorial controls; Focus Reading retains chapter navigation and a clear exit. Notes, observations and accepted text remain distinct.
|
||||
|
||||
@ -44,3 +44,7 @@ The companion shows concise saved references rather than inferred story facts. F
|
||||
# Word continuity
|
||||
|
||||
Your manuscript in Word distinguishes the selected working focus from the exact verified Word position. Explicit chapter/scene navigation waits for acknowledgement and never starts a session or forces a save. Check saved manuscript uses the existing bounded check; Reader retains accepted prose and may lag later edits. See Word and Your Writing Focus for document selection, disconnected recovery and returning from Companion.
|
||||
|
||||
# Choose your current focus
|
||||
|
||||
Use Change focus for a three-step inline flow: choose an existing activity, choose a chapter/scene or work across the book, then add an optional intention. Back retains your choices. Save focus updates your working summary without starting or changing a recorded session. Continue opens the existing chapter, scene or book tools; manuscript prose is written in Word.
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
<details><summary>@work.Year year overview</summary><div class="writer-year-grid">@for(var date=new DateTime(work.Year,1,1);date.Year==work.Year;date=date.AddDays(1)){days.TryGetValue(date,out var day);<a class="work-level-@Level(day)" asp-action="@(Model.Destination=="Reflect"?"Reflect":"Journey")" asp-route-bookId="@work.BookID" asp-route-year="@date.Year" asp-route-month="@date.Month" asp-route-day="@date.ToString("yyyy-MM-dd")" aria-label="@date.ToString("d MMM yyyy"): @Description(day)" title="@date.ToString("d MMM"): @Description(day)"></a>}</div></details>
|
||||
@if(work.Day is {} selected){days.TryGetValue(selected.Date,out var observed);<h3 class="mt-3">@selected.ToString("d MMMM yyyy")</h3>@if(observed==null){<p>No retained observation for this day. This does not establish that no work took place.</p>}else{<p>@observed.Changes accepted changes · +@observed.Added / −@observed.Removed words · @(observed.Added-observed.Removed) net.</p><p>@Math.Floor(observed.EngagedSeconds/60d) browser-engaged minutes · @Math.Floor(observed.PlaybackSeconds/60) observed playback minutes. These may overlap and are not added.</p>}<a asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@work.BookID" asp-route-day="@selected.ToString("yyyy-MM-dd")">Accepted-change evidence</a>}
|
||||
<h3 class="mt-3">@(work.Day.HasValue?"Sessions on this day":"Recent sessions")</h3>
|
||||
@foreach(var session in work.Sessions.Take(20)){<article class="writer-reminder"><strong>@session.Kind · @(session.ChapterTitle??(session.ChapterID.HasValue?"Chapter no longer available":"Whole book"))</strong><p>@session.StartedUtc.ToString("d MMM HH:mm") UTC · @session.EngagedSeconds browser-engaged seconds · @Math.Round(session.PlaybackSeconds) observed playback seconds · @Math.Round(session.UniqueSeconds) unique audio seconds.</p>@if(session.EndedUtc.HasValue){<span>@Math.Round((session.EndedUtc.Value-session.StartedUtc).TotalMinutes) minutes elapsed (not active time).</span>}@if(session.ChangesDuringSession>0){<p>@session.ChangesDuringSession accepted changes during this interval · +@session.AdditionsDuringSession / −@session.RemovalsDuringSession words across the book · @session.ChangedParagraphs changed paragraph identities associated with this chapter. Overlap in time does not prove that playback caused edits.</p>}@if(session.StartRevision.HasValue){<p>Accepted checkpoint @session.StartRevision → @(session.EndRevision?.ToString()??"session open") · @session.StartParagraphCount → @(session.EndParagraphCount?.ToString()??"—") paragraphs (whole book).</p>}@if(session.Note!=null){<p>@session.Note</p>}</article>}
|
||||
@foreach(var session in work.Sessions.Take(20)){<article class="writer-reminder"><strong>@session.Kind · @(session.ChapterTitle??"Across the book")</strong><p>@session.StartedUtc.ToString("d MMM yyyy HH:mm") · @(session.EndedUtc.HasValue?Math.Round((session.EndedUtc.Value-session.StartedUtc).TotalMinutes)+" minutes elapsed":"Session open")</p>@if(!string.IsNullOrWhiteSpace(session.Note)){<p class="review-recorded">@session.Note</p>}<details><summary>Recording details</summary><p>This session was started explicitly. Elapsed time is not active time. @Math.Floor(session.EngagedSeconds/60d) browser-engaged minutes and @Math.Floor(session.PlaybackSeconds/60) observed playback minutes may overlap and are not added. Dates use UTC.</p>@if(session.ChangesDuringSession>0){<p>@session.ChangesDuringSession accepted manuscript changes were recorded during this interval; this association does not establish what caused them.</p>}</details></article>}
|
||||
|
||||
<a asp-controller="WriterWork" asp-action="Export" asp-route-bookId="@work.BookID" asp-route-day="@work.Day?.ToString("yyyy-MM-dd")">Export recent session evidence (up to 50)</a>
|
||||
</section>
|
||||
@if(Model.WritingSchedule.UpcomingTasks.Count>0||Model.PlannedActivities.Count>0){<section class="writer-card"><h2>Planned work ahead</h2><ul>@foreach(var task in Model.WritingSchedule.UpcomingTasks){<li>@task.ScheduledDate.ToString("d MMM") · <a asp-controller="Scenes" asp-action="Edit" asp-route-id="@task.SceneID">@task.SceneTitle</a> · @task.TaskType</li>}@foreach(var task in Model.PlannedActivities){<li>@task.ScheduledDate.ToString("d MMM") · @if(task.SceneID.HasValue){<a asp-controller="Scenes" asp-action="Edit" asp-route-id="@task.SceneID">@task.Title</a>}else{<a asp-action="Chapter" asp-route-id="@task.ChapterID">@task.Title</a>} · @task.Kind · @task.Minutes planned minutes</li>}</ul></section>}
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
const priorId=current?.id;const stamp=++epoch;request?.abort();request=new AbortController();
|
||||
try{const url=new URL(root.dataset.summaryUrl,location.origin);if(root.dataset.project)url.searchParams.set('projectId',root.dataset.project);if(root.dataset.book)url.searchParams.set('bookId',root.dataset.book);
|
||||
const response=await fetch(url,{cache:'no-store',signal:request.signal});if(response.redirected||response.status===401){throw Error('Sign in again to resume your saved investigation.');}if(!response.ok)throw Error('Saved guidance could not be loaded. Retry when your connection returns.');const data=await response.json();if(stamp!==epoch)return;
|
||||
current=data.active?data.summary:null;hasSnapshot=data.hasSnapshot!==false;resultsUrl=data.resultsUrl;preference=read();render();restorePanel(!hydrated||priorId!==current?.id);hydrated=true;window.dispatchEvent(new CustomEvent("plotdirector:guidance-summary",{detail:data}));
|
||||
current=data.active?data.summary:null;hasSnapshot=data.hasSnapshot!==false;resultsUrl=data.resultsUrl;preference=read();render();restorePanel(!hydrated||priorId!==current?.id);hydrated=true;window.PlotDirectorGuidanceSummary=data;window.dispatchEvent(new CustomEvent("plotdirector:guidance-summary",{detail:data}));
|
||||
}catch(e){if(e.name==='AbortError'||stamp!==epoch)return;current=null;content.replaceChildren(element('p',e.message),btn('Retry',load),startLink());panel.hide();}
|
||||
}
|
||||
async function mutate(operation,extra={}){
|
||||
|
||||
@ -36,7 +36,8 @@
|
||||
}
|
||||
function replaceCard(card,doc){const fresh=doc.querySelector(`[data-key="${CSS.escape(card.dataset.key)}"]`);if(!fresh)throw Error('Saved record is not available');const clone=fresh.cloneNode(true),parent=card.parentElement;card.replaceWith(clone);bind(parent);clone.querySelector('[data-authoring-status]').textContent='Saved.';clone.querySelector('[data-authoring-edit]')?.focus();}
|
||||
async function read(){const response=await fetch(root.dataset.inspectUrl,{cache:'no-store'});if(!response.ok)throw Error('Recorded information is unavailable');const doc=new DOMParser().parseFromString(await response.text(),'text/html');if(!doc.querySelector('[data-authoring-content]'))throw Error('Authorisation or recorded information is unavailable');return doc;}
|
||||
async function load(){if(!root.dataset.inspectUrl){root.replaceChildren();return;}try{const doc=await read();root.replaceChildren(...doc.body.childNodes);bind(root);const references=document.querySelector('[data-authoring-references]'),template=root.querySelector('[data-authoring-companion]');if(references&&template)references.replaceChildren(template.content.cloneNode(true));}
|
||||
let loadEpoch=0;
|
||||
async function load(){const mine=++loadEpoch;if(!root.dataset.inspectUrl){root.replaceChildren();return;}try{const doc=await read();if(mine!==loadEpoch)return;root.replaceChildren(...doc.body.childNodes);bind(root);const references=document.querySelector('[data-authoring-references]'),template=root.querySelector('[data-authoring-companion]');if(references&&template)references.replaceChildren(template.content.cloneNode(true));}
|
||||
catch{root.replaceChildren();const p=document.createElement('p');p.textContent='Recorded information could not load. Your current work and existing editors remain available.';const retry=document.createElement('button');retry.type='button';retry.className='btn btn-outline-secondary';retry.textContent='Try again';retry.addEventListener('click',load);root.append(p,retry);}}
|
||||
window.addEventListener('beforeunload',e=>{if(dirty()&&!allowLeave){e.preventDefault();e.returnValue='';}});
|
||||
function guard(e){if(!dirty())return;const target=e.target.closest('a,form,[data-plan-focus]');if(!target||target.matches('[data-authoring-form],[data-work-start]')||target.target==='_blank'||target.hasAttribute('download'))return;if(target.tagName==='A'&&new URL(target.href,location.href).pathname===location.pathname&&new URL(target.href,location.href).search===location.search&&target.hash)return;if(!confirm(root.querySelector('[data-busy="true"]')?'A save is in progress and may finish after you leave. Leave this page?':'Leave without saving your inline edits?')){e.preventDefault();e.stopImmediatePropagation();}else allowLeave=true;}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
function render(){if(!tiles)return;let shown=0;for(const card of [...tiles.children].sort((a,b)=>Number(b.dataset.rank)-Number(a.dataset.rank)||a.dataset.tile.localeCompare(b.dataset.tile))){tiles.append(card);const value=preferences[card.dataset.tile],hidden=value==='dismissed'||Number(value)>Date.now();card.hidden=hidden||shown>=4;if(!card.hidden)shown++;}if(message)message.textContent=shown?'':'All suggestions are set aside. Reconsider them whenever you like.';}
|
||||
discovery.addEventListener('click',e=>{const card=e.target.closest('[data-tile]');if(card&&(e.target.matches('[data-dismiss]')||e.target.matches('[data-defer]'))){preferences[card.dataset.tile]=e.target.matches('[data-dismiss]')?'dismissed':Date.now()+7*86400000;try{localStorage.setItem(key,JSON.stringify(preferences));}catch{}render();discovery.querySelector('[data-reconsider]')?.focus();}if(e.target.matches('[data-reconsider]')){preferences={};try{localStorage.removeItem(key);}catch{}render();}});render();
|
||||
// Reuse the companion's authorised compact summary and native recommendation forms.
|
||||
window.addEventListener('plotdirector:guidance-summary',e=>{const area=discovery.querySelector('[data-discovery-active]');if(!area)return;area.replaceChildren();if(!e.detail?.active)return;const summary=e.detail.summary;if(String(summary.bookID)!==discovery.dataset.book)return;
|
||||
const guidance=e=>{const area=discovery.querySelector('[data-discovery-active]');if(!area)return;area.replaceChildren();if(!e.detail?.active)return;const summary=e.detail.summary;if(String(summary.bookID)!==discovery.dataset.book)return;
|
||||
for(const finding of summary.findings.slice(0,2)){const available=finding.tools.filter(t=>t.available&&t.progress!=='Skipped'&&t.progress!=='Done').slice(0,2);for(const tool of available){const source=[...document.querySelectorAll('.pd-guidance-tool')].find(x=>x.dataset.capability===tool.id);const native=source?.querySelector('form');if(!native)continue;const article=document.createElement('article');article.className='writer2-tile';const h=document.createElement('h3');h.textContent=tool.name;const p=document.createElement('p');p.textContent='From your active investigation: '+finding.explanation;article.append(h,p,native.cloneNode(true));area.append(article);}}
|
||||
});}
|
||||
};window.addEventListener('plotdirector:guidance-summary',guidance);if(window.PlotDirectorGuidanceSummary)guidance({detail:window.PlotDirectorGuidanceSummary});}
|
||||
})();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user