tm-open-window: list of child windows?

66 views
Skip to first unread message

E Browns

unread,
Aug 10, 2020, 10:03:00 PM8/10/20
to TiddlyWikiDev
Hi dev people,

I was wondering if the main browser window tracks its children windows? I have this scenario:

Different drafts opened in multiple children windows through tm-open-window, but are not opened in the story river of the parent browser = cluttered draft tabs in the bottom of the parent browser.

I experimented with populating a list tiddler (WindowList) with the title of children windows as they are being called. In this way, I was able to target the red draft tabs and style the specific tab so it isn't displayed in the parent window.

The problem now is, when I close the child window, it is still listed in (WindowList) and thus its red draft tab in the parent window is still hidden.


Is there any workaround to this or am I missing something?


Thanks for the help!

-jd

Jeremy Ruston

unread,
Aug 11, 2020, 2:50:08 PM8/11/20
to TiddlyWikiDev
Hi JD

> I was wondering if the main browser window tracks its children windows? I have this scenario:

No, at the moment there’s no tracking of the open child windows.

> Different drafts opened in multiple children windows through tm-open-window, but are not opened in the story river of the parent browser = cluttered draft tabs in the bottom of the parent browser.
>
> I experimented with populating a list tiddler (WindowList) with the title of children windows as they are being called. In this way, I was able to target the red draft tabs and style the specific tab so it isn't displayed in the parent window.
>
> The problem now is, when I close the child window, it is still listed in (WindowList) and thus its red draft tab in the parent window is still hidden.
>
>
> Is there any workaround to this or am I missing something?

I’m not aware of any workaround, I think this is something that would need fixing in the core. The simplest implementation would be to track the open windows and then expose the details via a filter operator. We might also add a message to close a specific child window.

Best wishes

Jeremy

jd

unread,
Aug 12, 2020, 1:27:01 AM8/12/20
to TiddlyWikiDev
Hi Jeremy

I’m not aware of any workaround, I think this is something that would need fixing in the core. The simplest implementation would be to track the open windows and then expose the details via a filter operator. We might also add a message to close a specific child window. 

Oh! That'll be grand! Can that be included by the next release? I should probably add this to github as a feature request.

-jd

TonyM

unread,
Aug 12, 2020, 11:59:53 PM8/12/20
to TiddlyWikiDev
Folks,

The close function is documented here, and the windows opened need a name, 

However I just though I would add, content in the tiddlywiki affects what is displayed in the window, and visa versa. So I see that if we had a way to trigger the window to close according to a condition of a particular tiddler, there should be a way to make a window able to react and close itself.

Careful consideration may allow a series of windows to be opened, with navigation to the next closing the last.

Regards
Tones

Eric Shulman

unread,
Aug 13, 2020, 1:07:31 AM8/13/20
to TiddlyWikiDev
On Wednesday, August 12, 2020 at 8:59:53 PM UTC-7, TonyM wrote:
The close function is documented here, and the windows opened need a name, 

On that page, it says this about closing the current window:

Closing the current window

In the past, when you called the window object's close() method directly, rather than calling close() on a window instance, the browser closed the frontmost window, whether your script created that window or not. This is no longer the case; for security reasons, scripts are no longer allowed to close windows they didn't open. (Firefox 46.0.1: scripts can not close windows, they had not opened)

function closeCurrentWindow() {
  window.close();
}

Thus, it is not possible to *programmatically* close the current window from javascript.  You can only close a window from it's parent, and then only if you have the window's handle (returned when the window.open(...) was called)

However... it turns out there *is* a way to close the current window... but only from a user-initiated click interaction:
<a href="javascript:window.close()"> close this window </a>

Thus, you can do the following using a TiddlyWiki $button widget
<$button>
   
<a href="javascript:window.close()"> {{$:/core/images/close-button}} </a>
</$button>
Note that the click action has to be on the actual *content* (in this example, the close-button image), so clicking near the edge of the button, but not on the content itself, does nothing.

-e

Reply all
Reply to author
Forward
0 new messages