Hi all,
Realise that this post has been quiet for a while but I thought I'd add my thoughts as I needed to create a Read Only tiddly.
I downloaded the "empty.html" and made a copy, made my changes to remove all the "edit" buttons and then used MELD (
http://meldmerge.org/) to compare the two html files.
From there I wrote a script in Autoit (but any language would do) to do a simple find and replace on the text in the html to reflect the differences I saw in MELD.
To test it you will need to install Autoit -
https://www.autoitscript.com/site/autoit/downloads/And download the tiddlywiki -
http://tiddlywiki.com/#DownloadOnce downloaded then copy and rename the file to "empty_RW.html" as that is what the script looks for (the "_RW" is for Read Write and helps you keep track of what you are up to)
Then copy and paste the script below into Autoit, save it then press F5 to run it, point it at "empty_RW.html" and you will find another file created called "empty_RO.html" which will have all the edit features removed.
I haven't given this the full "hack" test and I am sure that with a little effort a hardcore user would be able to get to the missing system tiddlers but for most purposes this will work.
Enjoy :-)
Dave
Here is the code for Autoit -
;***** CODE STARTS
;Open Tiddly
$File = FileOpenDialog("Please select Tiddlywiki", @DesktopDir & "\", "HTML (*.html;*.htm)", 1 + 2)
If @error Then
MsgBox(4096, "", "No File chosen")
Exit
Else
If StringInStr($File, "_RW.html") Then
$ReadOnly = StringReplace($File, "_RW.html", "_RO.html")
Else
$ReadOnly = StringReplace($File, "_RW.htm", "_RO.htm")
EndIf
$FileCreate = FileOpen($ReadOnly, 2)
$FileRead = FileOpen($File, 0)
While 1
$FileLine = FileReadLine($FileRead)
If @error = -1 Then ExitLoop
;Remove Sidebar - $:/core/ui/SideBarLists
If StringInStr($FileLine, "<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]\" default={{$:/config/DefaultSidebarTab}} state=\"$:/state/tab/sidebar\" />") Then
$FileLine = StringReplace($FileLine, "<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]\" default={{$:/config/DefaultSidebarTab}} state=\"$:/state/tab/sidebar\" />", "<!-- Deleted Sidebar -->")
EndIf
If StringInStr($FileLine, '<div id="storeArea" style="display:none;">') Then
;Hide these buttons
FileWriteLine($FileCreate, $FileLine)
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/EditToolbarButtons/Visibility/$:/core/ui/Buttons/cancel"><pre>hide</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100727113" title="$:/config/EditToolbarButtons/Visibility/$:/core/ui/Buttons/delete"><pre>hide</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/EditToolbarButtons/Visibility/$:/core/ui/Buttons/save"><pre>hide</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/control-panel"><pre>hide</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-tiddler"><pre>hide</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/save-wiki"><pre>hide</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/edit"><pre>hide</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/more-tiddler-actions"><pre>hide</pre></div>')
;Show these buttons
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home"><pre>show</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/close-all"><pre>show</pre></div>')
FileWriteLine($FileCreate, '<div modified="20151005100728309" title="$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/close-others"><pre>show</pre></div>')
$FileLine = FileReadLine($FileRead)
EndIf
FileWriteLine($FileCreate, $FileLine)
WEnd
FileClose($FileCreate)
FileClose($FileRead)
MsgBox(0, "Done", "File - " & $ReadOnly & " Created Successfully")
EndIf
;**** CODE ENDS