17 lines
836 B
JavaScript
17 lines
836 B
JavaScript
// Launching is independent of live follow. Only a Context window owns Context notifications.
|
|
(() => {
|
|
'use strict';
|
|
function openContext(scope={}) {
|
|
const url=new URL('/Writing/Context',location.origin);
|
|
for(const key of ['projectId','bookId','chapterId','sceneId','instanceId','sessionId','documentGuid']) {
|
|
const value=scope[key]??scope[key.replace('Id','ID')];if(value)url.searchParams.set(key,value);
|
|
}
|
|
if(scope.pinned)url.searchParams.set('pinned','true');
|
|
url.searchParams.set('contextWindow',crypto.randomUUID());
|
|
const opened=window.open(url.href,'_blank','popup,width=1100,height=760,resizable=yes,scrollbars=yes');
|
|
if(!opened)window.PlotDirector?.toast?.warning('Allow popups to open a Context window.');
|
|
return opened;
|
|
}
|
|
window.PlotDirectorWritingWorkspace={openContext};
|
|
})();
|