SplashScreen code for the core

27 views
Skip to first unread message

Saq Imtiaz

unread,
Jul 7, 2006, 4:06:17 PM7/7/06
to TiddlyWikiDev
Hey guys,

Though I doubt my effort will be up to par for inclusion into the core, I thought I'd give it a go at writing some code for the SplashScreen with that intent.
If nothing else, it's been fun. :)

Anyway, I'm not too sure as to what the best way to share this is, so I've uploaded an empty TW file with the changes, and will also list my modifications here.

The file: http://lewcid.googlepages.com/splashscreenempty.html

The modifications:
1) Inserted markers for Splash-Screen-Start and Splash-Screen-End with default SplashScreen content in between, right after markers for PreHead.
2) Added shadow tiddler for SplashScreen, containing default contents of the SplashScreen
3) modified function 'main' to hide contentWrapper
4) added function hideSplashScreen
5) modified function 'restart' to display contentWrapper and hide SplashScreen (by running hideSplashScreen)
6) modified config.macros.view.handler to wrap SplashScreen tiddler content in html tags before wikifying
7) modified function 'saveChanges' to write the SplashScreen tiddler content to file, between the SplashScreen start and end markers.

Step 6 isn't necessary, and could possibly be implemented in a better manner, but it allows the user to preview the appearance of the SplashScreen.

Pro's:
- Easy for user to customize, just edit the SplashScreen tiddler

Cons:
- currently css for SplashScreen is written inline, is there a better solution?
- could the SlashScreen be automatically updated when the SiteTitle was changed?

Cheers,
Saq

Udo Borkowski

unread,
Jul 7, 2006, 5:19:10 PM7/7/06
to Tiddly...@googlegroups.com
Hi Saq,

have you tried the splash screen with Firefox? I don't see one using
Firefox 1.5.0.4, with IE it looks nice.


Udo

Saq Imtiaz

unread,
Jul 7, 2006, 6:50:44 PM7/7/06
to Tiddly...@googlegroups.com
On 7/7/06, Udo Borkowski <Udo.Bo...@gmx.de> wrote:

Hi Saq,

have you tried the splash screen with Firefox? I don't see one using
Firefox 1.5.0.4, with IE it looks nice.

 Hi Udo,

Working fine here using both Firefox 1.5.0.4 and IE. Try forcing a refresh (control + refresh, or shift + refresh, I forget which it is).
With an empty TW file, especially if it's already in the cache, it can sometimes load so fast that you dont see the Splash Screen. Which is actually desirable since we only want the splash screen to be seen if the TW is going to take a while to load.

 Once there is  a decent chunk of content in there though, it always displays, since both the time to load the entire file from the server, and for it to startup, is longer.

Cheers,
Saq

It might also be a good idea to put some browser compatibility information there for people using older browsers.

Udo Borkowski

unread,
Jul 8, 2006, 6:11:22 AM7/8/06
to Tiddly...@googlegroups.com
Hi Saq,

thanks! The shift refresh does it.


This all looks very nice, very professional. I will probably add it to my TiddlyWikis.

I was just wondering if it is possible to avoid modifying the core code and add the feature in some kind of plugin. Obviously it is more simple patching the core code but I here my ideas to make the thing pluggable:

  • Instead of creating a new SPLASH-SCREEN section put the SplashScreen div into (a marked section) inside the PRE-HEAD section (i.e. in the MarkupPreHead tiddler). You may use the same replaceChunk function, but this time on the content of the tiddler for the markup.
  • Also in that section define a <style> tag, with a style definition for the element with id "contentWrapper" as style.display = "none" (this avoids modifying the main code).
  • In your plugin hijack the restart function and call the hideSplashScreen function (when restart is executed all plugins are already initialized).
  • Put your hideSplashScreen function into the plugin.
  • Instead of your special code in config.macros.view.handler I suggest a little change: Let the SplashScreen tiddler be a normal tiddler (with Wiki syntax) that defines the content of the splash screen. This way also people not knowing HTML style may modify their splash screen. The appearance of the splash screen box (size, position etc.) is defined separately. To make this practical here is what you may do:
    • Put your current "SplashScreen" div text into a new (shadowTiddler) "SplashScreenBox", add "<html>...</html>" around it, but remove the div's content ("<b>TiddlyWiki</b> is loading..." etc). The content will later be filled.
    • In your "SplashScreen" div put the content in Wiki syntax. E.g.: ''TiddlyWiki'' is loading... etc.
    • When updating the SplashScreen div in the MarkupPreHead tiddler the text you insert is created like this:
      • Wikify the tiddler "SplashScreenBox" and remember the element in boxElem.
      • Wikify the tiddler "SplashScreen" and append the element as a child to boxElem.
      • Use "boxElem.innerHTML" to extract the content in HTML format, to be put into the SPLASH-SCREEN of the MarkupPreHead tiddler.
  • Define the shadowTiddlers "SplashScreen" and "SplashScreenBox" in the plugin.

This all may sound a little bit complicated but in the end you should have the same functionality as before. And it needs not to go into the core. (Note by Jeremy on core code submission: "It's much more likely be accepted if ... (it is) Impractical to offer as a plugin" (http://trac.tiddlywiki.org/tiddlywiki/wiki/ContributingCode)).

If you have any question, don't hesitate to ask...

Udo

Saq Imtiaz

unread,
Jul 8, 2006, 6:50:06 AM7/8/06
to Tiddly...@googlegroups.com
Hey Udo,
Thanks for the detailed reply.
I did initially implement this as a plugin and posted it to the group: http://groups.google.com/group/TiddlyWikiDev/browse_thread/thread/d48199036c18b622/7a7c392e645bfe7d?q=splashscreen&rnum=3#7a7c392e645bfe7d

That initial version was a little clutsy to install, and not so easy to customise, so I had intended to improve upon it. However, I then noticed that Jeremy had added a ticket for a splash screen for the core: http://trac.tiddlywiki.org/tiddlywiki/ticket/92

Therefore I decided to attempt to write up a splash screen implementation for the core, rather than improving the plugin. I do like some of your suggestions, I guess I'll wait and see what Jeremy has to say about it before deciding whether to implement them in this code for the core, or the plugin version.

I do personally feel that a splash screen in the core would be most useful, even if it's with an entirely different implementation. It's definitely universally useful, and doesn't come at much cost at all.
 

  • Instead of your special code in config.macros.view.handler I suggest a little change: Let the SplashScreen tiddler be a normal tiddler (with Wiki syntax) that defines the content of the splash screen. This way also people not knowing HTML style may modify their splash screen. The appearance of the splash screen box (size, position etc.) is defined separately. To make this practical here is what you may do:
    • Put your current "SplashScreen" div text into a new (shadowTiddler) "SplashScreenBox", add "<html>...</html>" around it, but remove the div's content ("<b>TiddlyWiki</b> is loading..." etc). The content will later be filled.
    • In your "SplashScreen" div put the content in Wiki syntax. E.g.: ''TiddlyWiki'' is loading... etc.
    • When updating the SplashScreen div in the MarkupPreHead tiddler the text you insert is created like this:
      • Wikify the tiddler "SplashScreenBox" and remember the element in boxElem.
      • Wikify the tiddler "SplashScreen" and append the element as a child to boxElem.
      • Use "boxElem.innerHTML" to extract the content in HTML format, to be put into the SPLASH-SCREEN of the MarkupPreHead tiddler.
  • Define the shadowTiddlers "SplashScreen" and "SplashScreenBox" in the plugin.

I definitely like the idea of allowing people to be able to customize the SplashScreen without needing to know html, and will definitely be adopting this. However, I'd still like to be able to offer a preview mechanism, i.e. when a user views the SplashScreen tiddler, he should be able to see the splash screen as it will appear when the TW is loading. I think I have a idea for it, I'll have a think about this once we've figured out whether this is desirable for the core, or will live on as a plugin.

Thanks again Udo!
Cheers,

Saq

 


Reply all
Reply to author
Forward
0 new messages