Hide right sidebar by default

304 views
Skip to first unread message

MarKubus

unread,
Oct 29, 2007, 6:15:13 PM10/29/07
to TiddlyWiki
Hi there,

have been reading all the discussions with pleasure. One newby
question relating to the togglesidebar macro.

Where exactly can you state that the default should be "hide". I am
unable to get this working and would be thrilled if you can help me
out with this.

gr
Marco

wolfgang

unread,
Oct 29, 2007, 7:10:41 PM10/29/07
to TiddlyWiki
Welcome Markubus,

Though I never used ToggleSideBar, but there I read:


Usage:
<<toggleSideBar>> »
additional options:
where:
label = custom label for the button,
tooltip = custom tooltip for the button,
show/hide = use one or the other, determines whether the sidebar is
shown at first or not.
(default is to show the sidebar)

You can add it to your tiddler toolbar, your MainMenu, or where you
like really.
If you are using a horizontal MainMenu and want the button to be right
aligned, put the following in your StyleSheet:
.HideSideBarButton {float:right;}


So that does means to me, just place the following in whichever
tiddler or menu most convenient (since you aren't concerned with a
label of the button or a popupmenu anyway):

<<toggleSideBar hide>>

Regards,

W.

DenizenOfAsgard

unread,
Oct 30, 2007, 5:45:48 AM10/30/07
to TiddlyWiki
The above described way to use the toggleSideBar forces the user to
click a button, or at the very least presents a button for them to
toggle. This is really not good because you really don't want a casual
reader to see the sidebar in the first place nor do you want them to
see any buttons which lets them make that "confusing stuff on the
right" appear.

Here's what I did to solve the problem. That is, you never see the
right bar. The solution is ugly, but it works.

1. Create a tiddler called SetReaderMode
It contains the following 1 line:
<<toggleSideBar " " " " hide>>

2. Make a core tweak as follows:

In "function main()" directly before the line, "restart();", I added
the following 2 lines:

story.displayTiddler(null,"SetReaderMode");
story.closeTiddler("SetReaderMode");

3. I have another tiddler called SetWorkMode. It contains the
following
<<toggleSideBar "Display Side Bar, for author only" "You Shouldn't be
clicking this">>
This is referenced by an inconspicuous link on a rarely referenced
page so I can get to the side bar when I need it as the author.

Okay, I know, I know, core tweaks are bad. I just couldn't find
another way to activate the macro without human intervention. If
someone could suggest a way to either close a tiddler automatically
after executing it, or to execute a macro without forcing the user to
click a button, then I could remove the core tweek.

Joe

MarKubus

unread,
Oct 30, 2007, 6:32:31 AM10/30/07
to TiddlyWiki
Thanks, got it working! Just didn't understand how to make this:

<<toggleSideBar "" "" hide>>!. So easy, if you know how it works,

gr
marco

Eric Shulman

unread,
Oct 30, 2007, 7:40:03 AM10/30/07
to TiddlyWiki
> someone could suggest a way to either close a tiddler automatically
> after executing it, or to execute a macro without forcing the user to
> click a button, then I could remove the core tweek.

To render yoru [[SetReaderMode]] tiddler during startup, without it
being visible, you can add the following to the [[PageTemplate]]:

<span style="display:none" macro="tiddler SetReaderMode"></span>

Whenever the TW page template is re-drawn, [[SetReaderMode]] is
automatically invoked, triggering the <<toggleSideBar>> macro it
contains. Note that the span that invokes the macro is NOT displayed,
so that it will have no net effect on the page appearance, even though
it is being rendered when the page is drawn.

Also, rather than using an obscurely placed link to trigger
[[SetWorkMode]] you could combine both cases into a single tiddler,
and use InlineJavascriptPlugin to conditionally show/hide the sidebar,
based on programmatic criteria, such as checking the current username,
like this:

[[SetMode]]
<script>
if (config.options.txtUserName="admin")
return '<<toggleSideBar ... show>>';
else
return '<<toggleSideBar ... hide>>';
</script>

[[PageTemplate]]
<span style="display:none" macro="tiddler SetMode"></span>

Then, to use "author mode", just set your username to "admin"... any
other username will default to "reader mode"...

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

DenizenOfAsgard

unread,
Oct 31, 2007, 4:02:12 AM10/31/07
to TiddlyWiki
Thanks for the advice. You are right, I do have to implement your
[[SetMode]] script suggestion, otherwise, then the sidebar always
disappears no matter what, (of course that may not be a bad thing on a
final "published" product).

Continuously learning,
Joe

Reply all
Reply to author
Forward
0 new messages