ToggleRightSidebar - hide sidebar by default

1,420 views
Skip to first unread message

Eric Shulman

unread,
Mar 30, 2008, 7:29:35 AM3/30/08
to TiddlyWiki
dev wrote: (copied from another thread)
> how can I make the sidebar hidden by default ?
> I have a toggleSideBar macro , but that doesn't make it hidden by
default.

Try this inline script:
http://www.TiddlyTools.com/#ToggleRightSidebar
(requires http://www.TiddlyTools.com/#InlineJavascriptPlugin)

Then, in [[MainMenu]] add:
<<tiddler ToggleRightSidebar>>

This adds an 'arrow' into the main menu display. Initially, the
sidebar is displayed by default. Clicking the arrow will toggle the
sidebar display state (i.e., hide the sidebar) and save that setting
as a cookie (chkShowRightSidebar), so that the next time you load the
document, the sidebar will be hidden (or shown) as soon as the
document is rendered.

If you want to *always* start with the sidebar hidden, you can 'hard-
code' the option setting by using a tiddler (e.g., [[ConfigTweaks]] or
[[CookieJar]]), tagged with 'systemConfig', containing:
config.options.chkShowRightSidebar=false;

Note: Because the arrow in the MainMenu is created using
InlineJavascriptPlugin, you can also drag-and-drop the arrow directly
onto the browser's toolbar, creating a stand-alone 'instant
bookmarklet' that can be applied to *any* TiddlyWiki document, even if
[[ToggleRightSidebar]] and [[InlineJavascriptPlugin]] are not
installed in that document!

To try this, visit TiddlyTools.com and drag the ToggleRightSidebar
'arrow' that is displayed in the upper right corner of the story
column and drop it directly onto your browser's toolbar. Then, open
your own document, and click the 'instant bookmarklet' from the
browser's toolbar. The sidebar in *your* document will appear/
disappear, even though nothing new has been installed into your
document!

Note: see also
http://www.TiddlyTools.com/#InstantBookmarklets
for several other convenient bookmarklets, including:
ToggleRightSidebar
ToggleLeftSidebar
ToggleTitles
ToggleFullscreen (does all three of the above in one click!)
and several others...

enjoy,
-e

koyut

unread,
Apr 3, 2008, 1:29:37 PM4/3/08
to TiddlyWiki
Ive tried placing config.options.chkShowRightSidebar=false; in the my
zconfig tiddler but the sidebar keeps showing up when I reload the
page tried to clear cache and cookies but still no effect.

Eric Shulman

unread,
Apr 3, 2008, 1:48:41 PM4/3/08
to TiddlyWiki
> Ive tried placing config.options.chkShowRightSidebar=false; in the my
> zconfig tiddler but the sidebar keeps showing up when I reload the
> page tried to clear cache and cookies but still no effect.

Because [[ToggleRightSidebar]] is not a plugin, it is not
automatically invoked upon startup. Instead, the script must be
*rendered* somewhere on the page in order to apply the
config.options.chkShowRightSidebar setting.

The simplest method of ensuring that the script gets rendered is to
add the following in your [[MainMenu]]:
<<tiddler ToggleRightSidebar>>

... and, if you don't want the 'toggle' arrow to appear in your menu,
you can surround the above line with a little inline CSS:

@@display:none;<<tiddler ToggleRightSidebar>>@@

HTH,
-e


koyut

unread,
Apr 3, 2008, 3:37:57 PM4/3/08
to TiddlyWiki
That did the trick... Thanks

wolfgang

unread,
Apr 9, 2008, 5:01:47 PM4/9/08
to TiddlyWiki
Hi Eric,

for making best use of screen space I want to put the right Sidebar to
the left:
_____

<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></
div>
<div id='sidebarTabs' refresh='content' force='true'
tiddler='SideBarTabs'></div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
</div>
_____

and switch them from the header with 3 adapted toggle sidebar
bookmarklets - as example for the SideBarTabs:
_____

<script label="Content" title="Switch SideBarTabs on or off">
if (window.version && window.version.title=='TiddlyWiki') {
var sbt=document.getElementById('sidebarTabs');
var show=sbt.style.display=='none';
if (!show) { sbt.style.display='none'; var margin='1em'; }
else { sbt.style.display='block'; var
margin=config.options.txtDisplayAreaTopMargin||''; }
document.getElementById('displayArea').style.marginTop=margin;
config.options.chkSideBarTabs=show;
saveOptionCookie('chkSideBarTabs');
var sm=document.getElementById('storyMenu'); if (sm)
config.refreshers.content(sm);
return false;
}
</script>
_____

How would this bookmarklet have to be written, for example, to have it
not only toggle the respective menu in my left sidebar on - but at the
same time switch the sidebarOptions and mainMenu parts off at the same
time?

Regards,

W.

On 3 Apr., 21:37, koyut <koyut.c...@gmail.com> wrote:
> That did the trick... Thanks
>
> On Apr 4, 1:48 am, Eric Shulman <elsdes...@gmail.com> wrote:
>
> > > Ive tried placing config.options.chkShowRightSidebar=false; in the my
> > > zconfig tiddler but thesidebarkeeps showing up when I reload the

wolfgang

unread,
Apr 11, 2008, 5:07:25 PM4/11/08
to TiddlyWiki
Of course - the easiest way would be to add the SideBarOptions tiddler
as a tab to the SideBarTabs tiddler. ;-)

Regards,

W.
Reply all
Reply to author
Forward
0 new messages