How to open tiddler by $tw. ?

93 views
Skip to first unread message

sini-Kit

unread,
Nov 25, 2016, 8:40:41 AM11/25/16
to TiddlyWiki
Hi! I always use in my plugins $tw.notifier.display("MyTiddler");  to make notify and   $tw.modal.display("Mytiddler"); to make modal
But t don't know how to open tiddler in standard way  something like "$tw.Tiddler.display..... "
May be somebody know $tw. function which  open tiddler?

PMario

unread,
Nov 25, 2016, 10:22:19 AM11/25/16
to TiddlyWiki
Hi sini-Kit,

There are actually 2 addToStory() functions. One in navigator.js and one in story.js. ... IMO that's a bug, because the are slightly different, which shouldn't be!

The story function looks like this: Story.prototype.addToStory = function(navigateTo,navigateFromTitle,options)

var story = new $tw.Story();
story.addToStory("HelloThere");

You'll need to have a look, at the source code to see, what's going on.

hope that helps
have fun!
mario

Jeremy Ruston

unread,
Nov 25, 2016, 10:32:21 AM11/25/16
to tiddl...@googlegroups.com
Hi Mario, Sini-Kit,

There are actually 2 addToStory() functions. One in navigator.js and one in story.js. ... IMO that's a bug, because the are slightly different, which shouldn't be!

I did intend to do some refactoring there :)

The support for multiple story rivers with their own navigation means that the story logic primary lives in the navigator widget. However, it's not very easy for external code to get hold of the story information maintained by the navigator widget. That’s why the global story object was added.

The story function looks like this: Story.prototype.addToStory = function(navigateTo,navigateFromTitle,options)

var story = new $tw.Story();
story.addToStory("HelloThere");

You'll need to have a look, at the source code to see, what's going on.

That looks right. You probably want to call story.navigateTiddler(“HelloThere”) so that the history list gets updated alongside the story list.

Best wishes

Jeremy


hope that helps
have fun!
mario


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/24d8cd8e-559e-45fc-bb3a-440d4c8f1f01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PMario

unread,
Nov 25, 2016, 11:07:00 AM11/25/16
to TiddlyWiki
On Friday, November 25, 2016 at 4:32:21 PM UTC+1, Jeremy Ruston wrote:
The support for multiple story rivers with their own navigation means that the story logic primary lives in the navigator widget. However, it's not very easy for external code to get hold of the story information maintained by the navigator widget. That’s why the global story object was added.

I see. navigator code starts Oct. 2013 and story Aug. 2015
 
That looks right. You probably want to call story.navigateTiddler(“HelloThere”) so that the history list gets updated alongside the story list.

Yea. story.navigateTiddler() is the better option.

-m

sini-Kit

unread,
Nov 25, 2016, 11:56:18 AM11/25/16
to TiddlyWiki
Thank you Mario! I found my old plugin and I use there js function window.location.hash="HelloThere"

I try to write a little code to use ENTER button in search field. I have put this code to my $:/boot/bootprefix.js and it works if my search field is on screen when tw5 start.


if (document.querySelector('[type="search"]')){
document.querySelector('[type="search"]').addEventListener('keypress', function (e) {
    var key = e.which || e.keyCode;
    if (key === 13) { 
window.location.hash="%24%3A%2FAdvancedSearch";
    }
});

}




пятница, 25 ноября 2016 г., 18:32:21 UTC+3 пользователь Jeremy Ruston написал:
Reply all
Reply to author
Forward
0 new messages