I found that once I removed one item for web viewing, i wanted to
remove more. This is what I did:
ConfigTweaks
-------------------
config.options.chkHttpReadOnly = true;
readOnly = (document.location.protocol!='file:');
The 'location' in document.location is called the javascript location property
Its saying "If the document location protocol, the part of a URL that
is "http:" or "file:" , is UNTURE ("!=" means untrue in Javascript)
then set the variable readOnly to TRUE.
In other words you want you TW to be editable when the adress in the
broswser starts with "file:". All other cases, like when the addesss
in the browser starts with "http:" it will be not be editable. Eric
wrote this code and posted it to the group [1]
However you need to do something with readOnly
Plugins
---------
Simon Baird's HideWhenPlugin
URL: http://mptw.tiddlyspot.com/#HideWhenPlugin
Use the plugin to take the value of readOnly (which will be either
TRUE or FALSE) and give it to the plugin to do its business.
Edits
------
ViewTemplate
*Remove toolbar from normal edit view by cutting
*paste code for toolbar. Wrap toolbar in a div and in this div add;
macro="hideWhen readOnly">
This makes the plugin take readOnly and do its business. Any div with
this macro in it when readOnly is TRUE will be hidden. Therefore you
can use it in many parts of a TW, the pageTemplate for example, to
hide the sidebar or mainmenu for example.
ViewTemplate
------------------
<div macro="hideWhen readOnly">
<!-- toolbar for offline viewing only -->
<div class='toolbar' macro='toolbar closeTiddler closeOthers
+editTiddler deleteTiddler
permalink references jump'></div>
</div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span
macro='view modified date'></span> (<span macro='message
views.wikified.createdPrompt'></span> <span macro='view created
date'></span>)</div>
<div class='viewer' macro='view text wikified'></div>
[1]
http://groups.google.com/group/TiddlyWiki/browse_thread/thread/9c00e06adebae96e/3fe7a4523c9ca528?lnk=gst&q=readOnly+%3D+(document.location.protocol!%3D%27file%3A%27)%3B+#3fe7a4523c9ca528
( http://tinyurl.com/dn93b2 )
2009/4/20 FND <[email protected]>:
>
>> I have seen things like "Authoring-mode" and other heavy
>> plugins like "ThemeSwitching" that i.m.o. go far beyond what I need.
>
> Just for the record, you don't always need a plugin; you could create a
> simple read-only mode theme* with a customized ViewTemplate:
> |ViewTemplateReadOnly|##ViewTemplate|
> !ViewTemplate
> <!--{{{-->
> <div class='toolbar' macro='toolbar
> [[ToolbarCommands::ReadOnlyViewToolbar]]'></div>
> <div class='title' macro='view title'></div>
> <div class='viewer' macro='view text wikified'></div>
> <!--}}}-->
>
> This now points to a custom toolbar slice in [[ToolbarCommands]]:
> |~ReadOnlyViewToolbar|closeTiddler closeOthers|
>
>
> -- F.
>
>
> * http://tiddlywiki.org/wiki/Themes
>
> >
>
--
t: 0161 442 2202
m: 0781 372 50 17
skype: alexhough
delicious: alexhough
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---