Hi Finn,
I appreciate your enthusiasm. … BUT … The implementation of this plugin is a hack from front to center. You use .innerHTML to change the DOM that has been created by tiddlywiki, with a timer that runs every second. Not only is .innerHTML a potential security risk, it ruins the TW refresh mechanism and adds a lot of unnecessary CPU load to the browser.
Everytime we click a button. TW redraws and restyles the different elements that are changed. ONLY those elements are changed, to make the mechanism fast. The browser has to do that, using the existing TW CSS and apply the styles.
Every second your plugin comes along and replaces the whole CSS with a 400kByte CSS form a CDN. Hardcore replaces DOM elements the TW core has drawn and restyles the complete page. (That’s where the blinking of the whole UI comes from. )
The most problematic thing is, that the whole thing completely breaks down in offline mode, or if you have a bad internet connection.
There is an easy test:
-
Go to the dev-console on your page F12
-
Select the Network tab
-
Search for the “No throttling” dropdown
-
Select “slow 3G”
-
Select Disable cache which is directly next to it.
-
Then reload your page.
It will need at least 10 seconds to load the page. … Now guess, how long it takes if you use the wiki offline
The core developers do everything to make the user experience fast. There is a lot of internal caching going on, to keep the page redraw as fast as possible.
The way it’s done in the plugin won’t work. It may be ok for empty.html, but once the wiki gets bigger there will be a lot of problems.
Try to download the whole wiki from tiddlywiki.com and drag & drop import it into your wiki. … See what happens.
Sorry but theming TW has to be done in the TiddlyWiki way.
I’m probably too harsh with my critiques, but please go to google and search for “.innerHTML security” and read some of the articles that come up.
Also have a closer look at the “” element, how it works and what it means for browser performance when a complete redraw is forced.
-mario