mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-02 08:46:56 +00:00
Added support for dynamic favicons
Now it’s possible to edit $:/favicon.ico with the image editor, and see the changes instantly reflected in the browser.
This commit is contained in:
parent
ad6bf4f9c5
commit
eef32e70e3
@ -112,6 +112,21 @@ exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
|
||||
$tw.crypto.setPassword(null);
|
||||
});
|
||||
// Set up the favicon
|
||||
var faviconTitle = "$:/favicon.ico",
|
||||
faviconLink = document.getElementById("faviconLink"),
|
||||
setFavicon = function() {
|
||||
var tiddler = $tw.wiki.getTiddler(faviconTitle);
|
||||
if(tiddler) {
|
||||
faviconLink.setAttribute("href","data:" + tiddler.fields.type + ";base64," + tiddler.fields.text);
|
||||
}
|
||||
};
|
||||
setFavicon();
|
||||
$tw.wiki.addEventListener("change",function(changes) {
|
||||
if($tw.utils.hop(changes,faviconTitle)) {
|
||||
setFavicon();
|
||||
}
|
||||
});
|
||||
// Set up the styles
|
||||
var styleTemplateTitle = "$:/core/ui/PageStylesheet",
|
||||
styleParser = $tw.wiki.parseTiddler(styleTemplateTitle);
|
||||
|
@ -14,7 +14,7 @@ title: $:/core/templates/tiddlywiki5.html
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="copyright" content="{{$:/core/copyright.txt}}" />
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
|
||||
<title>{{$:/core/wiki/title}}</title>
|
||||
<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~-->
|
||||
|
||||
|
@ -8,7 +8,7 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
!! Improvements
|
||||
|
||||
*
|
||||
* Added support for [[Setting a favicon]]
|
||||
|
||||
!! Bug Fixes
|
||||
|
||||
|
17
editions/tw5.com/tiddlers/howtos/Setting a favicon.tid
Normal file
17
editions/tw5.com/tiddlers/howtos/Setting a favicon.tid
Normal file
@ -0,0 +1,17 @@
|
||||
created: 20131224074240979
|
||||
modified: 20131224075348329
|
||||
tags: howto
|
||||
title: Setting a favicon
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
"favicons" are small icons that most browsers display to help users identify websites.
|
||||
|
||||
! favicons in the Browser
|
||||
|
||||
When TiddlyWiki starts up in the browser it looks for a tiddler called [[$:/favicon.ico]] and dynamically uses it as the favicon for the page. If you modify the image then the favicon changes instantly to reflect it.
|
||||
|
||||
! favicons on the Server
|
||||
|
||||
On the server, the ServerCommand will serve the tiddler [[$:/favicon.ico]] at the path `/favicon.ico`.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user