mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-05-05 08:54:10 +00:00

* remove blks first try * dprint.json seems to be OK, some forgotten functions * add some more space-after-keyword settings * server remove blks * add **/files to dprint exclude * dprint.js fixes a typo * add boot.js and bootprefix.js to dprint exclude * dprint change dprint.json * add dprint fmt as script * remove jslint comments * fix whitespace * fix whitespace * remove function-wrapper from geospatial plugin * fix whitespace * add function wrapper to dyannotate-startup * remove dpring.json
39 lines
879 B
JavaScript
39 lines
879 B
JavaScript
/*\
|
|
title: $:/core/modules/startup/favicon.js
|
|
type: application/javascript
|
|
module-type: startup
|
|
|
|
Favicon handling
|
|
|
|
\*/
|
|
|
|
"use strict";
|
|
|
|
// Export name and synchronous status
|
|
exports.name = "favicon";
|
|
exports.platforms = ["browser"];
|
|
exports.after = ["startup"];
|
|
exports.synchronous = true;
|
|
|
|
// Favicon tiddler
|
|
var FAVICON_TITLE = "$:/favicon.ico";
|
|
|
|
exports.startup = function() {
|
|
// Set up the favicon
|
|
setFavicon();
|
|
// Reset the favicon when the tiddler changes
|
|
$tw.wiki.addEventListener("change",function(changes) {
|
|
if($tw.utils.hop(changes,FAVICON_TITLE)) {
|
|
setFavicon();
|
|
}
|
|
});
|
|
};
|
|
|
|
function setFavicon() {
|
|
var tiddler = $tw.wiki.getTiddler(FAVICON_TITLE);
|
|
if(tiddler) {
|
|
var faviconLink = document.getElementById("faviconLink");
|
|
faviconLink.setAttribute("href",$tw.utils.makeDataUri(tiddler.fields.text,tiddler.fields.type,tiddler.fields._canonical_uri));
|
|
}
|
|
}
|