Closed felixhayashi closed 5 years ago
Hi @twMat
I agree, the "progress" element would serve well here.
Only css animation for reasons mentioned below
There are some CSS only spinners: IMO they would be simple to implement and modify: http://blog.pexels.com/css-only-loaders/
SVGCircus has some nice animations, but it uses script tags inside SVG, which won't work with TW. So some more work would be needed. ... But imo the animations are very nice. see: http://svgcircus.com/
@pmario I am much in favour or css-only solutions. @twMat the problem with the progress element would be that it needs to be updated and what to use as "max" value? An endless spinner is better.
:+1: for css-only solutions
:+1: css only
I like this one... http://codepen.io/brunjo/pen/vELmaP hinting at how TiddlyWiki also does some zooming when opening tiddlers.
Hopefully it's fairly obvious that figuring out how the display progress bar is the trivial part of the problem. The hard part is figuring out how to interrupt the loading process so that our JavaScript can run and update the progress bar. For plenty of the delay that the user perceives the browser is doing stuff that doesn't give us an opportunity to run any JavaScript.
I think to tackle this we need to instrument the startup process sufficiently so that we know where the majority of the time is spent, and to the degree that any of them are JS tasks done by TW, we need to figure out which of them could be made asynchronous.
A simple loading indicator is a different matter, of course, it's just an actual progress bar that's difficult.
A simple loading indicator is a different matter, of course, it's just an actual progress bar that's difficult.
Hi @Jermolene, yes, its not about updating a loading bar, it is about a css spinner that signals the user that something is happening (in contrast to a white screen).
I updated the OP
We do this trick on one of our EmberJS apps:
index.html
has a <style>
tag which includes CSS (data: images only) that defines a animated spinner.<body>
and the above CSS has a more specific rule for the spinner class which has display: hidden;
,It look s like this:
I guess one question to answer is: do we really need an algorhithm to assess the loading progress and what would be the actual benefit? I don't think we do. For me it's really more of a simple visual bridge to fill the gap.
Looks simple enough: http://www.gradient-animator.com/ More impressive: http://webdesign.tutsplus.com/articles/15-inspiring-examples-of-css-animation-on-codepen--cms-23937 (...is that second thing a Subtiddler? )
I guess one question to answer is: do we really need an algorhithm to assess the loading progress and what would be the actual benefit. I don't think we do. For me it's really more of a simple visual bridge to fill the gap.
@tobibeer Yes, I think we all agree on that.
@sukima, you don't need to go that far to add elements. Just make use of css pseudo elements and once the core has booted, add a flag (e.g. a class) that disables the css style (as in your example).
@felixhayashi correct, In our case though we needed elements for our boot loading messages. In the simpler case a pseudo element would be better.
[OP]
Currently, a big wiki leaves a blank screen for a few seconds at startup
Come to think of it, this is really an opportunity that we shouldn't miss! - How can we make those, presumably unavoidable, screen seconds of animation be of value? - of value for the TW project or the users site.
Three approaches come to mind. Use those seconds of animation for either of
It should be an overwritable tiddler so people can modify it to their own needs.
Actually, I think this should be implemented via some $:/SplashScreen tiddler (or named differently) that is rendered on startup... assuming that's possible. Then users can define / override the default loading message any way they'd like.
Here is what I suggest:
$:/core/wiki/rawmarkup
is created that contains a style tag with css instructions.
content
attribute. So we have an all-css solution.$:/tags/RawMarkup
(which is placed below markup generade by $:/core/wiki/rawmarkup
)tc-wiki-ready
is added to the <body>
element which makes the css style rule invalid and removes the animation.As @twMat suggested, we could do a little advertisement for tw here. However The boot process varies between 1 and 3 seconds. If you place a text message for the user to read, it will certainly often not be enough time to read it, which is frustrating/irritating ("wait I couldn't read that, was it important? it looked like an error?"). Moreover, I am certain, nobody wants to have a big picture in the core just to show a splash screen.
Therefore I suggest the following default: A small movotun jack svg (which is included in any wiki per default) displayed e.g. in changing colors (css) or pulsating (css) and a very short text below as default: "TiddlyWiki is loading"
Feedback?
@tobibeer Ha! For some reason we thought the same thing ;)
;-)
I think I remember that in TW2 some SplashScreenPlugin actually inserted html into the wiki html, so you possibly even needed to save and reload twice for changes to take effect.
Therefore I suggest the following default: A small movotun jack svg (which is included in any wiki per default) displayed e.g. in changing colors (css) or pulsating (css) and a very short text below as default: "TiddlyWiki is loading"
Now that sounds quite neat indeed... and possibly not all that hard to achieve.
As @twMat suggested, we could do a little advertisement for tw here. However The boot process varies between 1 and 3 seconds. If you place a text message for the user to read, it will certainly often not be enough time to read it, which is frustrating/irritating ("wait I couldn't read that, was it important? it looked like an error?").
You're probably right... Maybe the color aspect for subtly communicating a "feeling" is the only thing that can be used... but probably not the default background gray...
A small movotun jack svg...
Sure. Would .svg be better than converting it to css?
BTW, how is this content fetched before the TW is loaded? Does it add to the loading time?
Hi @twMat
sorry for my unprecise language in my previous post: First, there is no such thing as a css format. What I meant is that a bitmap image needs to be converted into base64 to be embedded into css.
That said, movutun jack is svg ($:/core/icon
) and svg doesn't need to be converted into base64. Anyway, tw's utils methods do the job here automatically as far as I remember.
BTW, how is this content fetched before the TW is loaded? Does it add to the loading time?
The content is not fetched, it is statically persisted as html. Because $:/core/icon
is super small it should be loaded in an instant.
I'm confused. I thought the problem was that there was a delay in rendering as the boot system loads. If that is the case how can a $:/SplashScreen
or what ever work. Tiddlers are in div
s that don't render till the boot system loads. The point of this is before any JavaScript runs.
The only option I could see is when a $:/SplashScreen
changes modify the raw HTML. This obviously would lead to syncing problems.
The only option I could see is when a
$:/SplashScreen
changes modify the raw HTML. This obviously would lead to syncing problems.
That's what I was trying to hint at how it was done in TW2.
On tbGTD all the code that is needed is actually in my zzConfig plugin:
//shortened splashscreen code
var tbRestart=window.restart;
window.restart = function(){
var splash=document.getElementById('SplashScreen');
if (splash) splash.style.display = "none";
document.getElementById('contentWrapper').style.display = "block";
tbRestart();
}
The SplashScreen in that TW2 being defined in MarkupPreHead.
PS: Yes I know the above looks hacky. ;-)
Hi @sukima
I'm confused. I thought the problem was that there was a delay in rendering as the boot system loads. If that is the case how can a $:/SplashScreen or what ever work. Tiddlers are in divs that don't render till the boot system loads. The point of this is before any JavaScript runs.
I am not talking about tiddlers, but about raw static markup here. TiddlyWiki offers us a clean way to inject markup into the html header using the tags I described above. This markup will not be virtual but truly stored in the html header. It all happens when the html wiki is build on the basis of $:/core/templates/tiddlywiki5.html
. That's similar to how the page's title
element makes it into the wiki src file. So this is completely independent of the boot or any tw rendering. Hope it's clearer now.
TW2 used the tiddler MarkupPreHead to inject content in the appropriate spot, before doing any major booting. So there only is some minimal kernel loading (boot) which injects the splash screen before most everything else.
A standalone wiki must be able to define its splash screen. For it to do that needs to be a tiddler that could actually be baked into the wiki's html upon saving ...or upon serving / building it via node ...as opposed to dynamically loaded first on startup.
A standalone wiki must be able to define its splash screen. For it to do that needs to be a tiddler that could actually be baked into the wiki's html upon saving ...or upon serving / building it via node ...as opposed to dynamically loaded first on startup.
You are right, this is the only way it works + this is what is possible with TW5 + what I am proposing.
TW2 used the tiddler MarkupPreHead to inject content in the appropriate spot, before doing any major booting. So there only is some minimal kernel loading (boot) which injects the splash screen before most everything else.
This was not optimal then, because if a crawler doesn't execute the wiki with javascript, then the markup won't be available. TW5 does a better job here.
This was not optimal then, because if a crawler doesn't execute the wiki with javascript, then the markup won't be available. TW5 does a better job here.
Possibly, TW2 actually did write those tiddlers to the actual HTML upon saving. Not sure.
Possibly, TW2 actually did write those tiddlers to the actual HTML upon saving. Not sure.
That would explain why at some point (I believe) it took two saves / refreshes for changes two apply.
That would explain why at some point (I believe) it took two saves / refreshes for changes two apply.
Ahh, I get it. I was wondering why you mentioned that at some point in the discussion.
By the way, it just happened: 1700 stars ;)
Hmm, I had some thoughts about this topic too, but in a different direction: How about using a kind of preload.html page for big wikis, which shows the animation, preloads the wiki page and redirects to wiki.html when finished? I am not sure, how this could be done, but found this in a discussion here at the end:
Prerender is the most powerful option. It tells the browser to request the url and download all the assets.
<link rel="prerender" href="http://example.com/page">.
You should be pretty sure that the person will open the page, otherwise you will just waste his bandwidt
This trick could be used for heavy wikis without increasing the weight of TW for the rest of the users. Just my 5 cents
This is closely related with this commit:
https://github.com/buggyj/TiddlyWiki5/commit/91a2afd2495122a534f9e6066e7e7272e83ca119
And this issue #2159
Hi @danielo515 this topic is quite long and embraces a number of distinct suggestions, which one are you thinking of?
Hello @Jermolene
I'm referring to what @tobibeer said:
I think I remember that in TW2 some SplashScreenPlugin actually inserted html into the wiki html, so you possibly even needed to save and reload twice for changes to take effect.
This happens on TW5 too as it is exposed on issue #2159
After #3417 is resolved, I would suggest to close this issue too. Users can find a spinner anywhere and display it on their splash screen.
Thanks @telmiger
Currently, a big wiki leaves a blank screen for a few seconds at startup. The boot process should trigger a simple loading animation (edit: just animation, no js or progress bar) that informs the user that the page is loaded. This boot display is killed once the wiki is loaded. An option would be to work with CSS pseudo elements for this task.
edit An implementational design suggestion is stated here: https://github.com/Jermolene/TiddlyWiki5/issues/2254#issuecomment-176123061