48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
// -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
|
// correction de quelques méthodes qui ont des bugs
|
|
|
|
TiddlyWiki.prototype.tiddlerExists = function(title)
|
|
{
|
|
// reconnaire les shadowTiddlers qui ont des string literal
|
|
var t = this.tiddlers[title];
|
|
var s = config.shadowTiddlers[title];
|
|
return (t != undefined && t instanceof Tiddler) || (s != undefined && (s instanceof String || typeof(s) == "string"));
|
|
}
|
|
|
|
TiddlyWiki.prototype.getTiddlerSubtitle = function(title)
|
|
{
|
|
// une fonction pour retourner la valeur de subtitle pour un tiddler qui est peut-être dans shadowTiddlers
|
|
if (!title) return config.messages.subtitleUnknown;
|
|
var tiddler = this.tiddlers[title];
|
|
if(tiddler) return tiddler.getSubtitle();
|
|
else return config.messages.subtitleUnknown;
|
|
}
|
|
|
|
function createTiddlerTitle(title,highlightText,highlightCaseSensitive) {
|
|
// fonctions qui utilisent getTiddlerSubtitle()
|
|
var theTitle = document.getElementById("title" + title);
|
|
if(theTitle) {
|
|
removeChildren(theTitle);
|
|
createTiddlyText(theTitle,title);
|
|
if (store.tiddlerExists(title)) {
|
|
theTitle.title = store.getTiddlerSubtitle(title);
|
|
}
|
|
}
|
|
}
|
|
|
|
function createTiddlyLink(place,title,includeText) {
|
|
// fonctions qui utilisent getTiddlerSubtitle()
|
|
var text = includeText ? title : null;
|
|
var subTitle, theClass;
|
|
if(store.tiddlerExists(title)) {
|
|
subTitle = store.getTiddlerSubtitle(title);
|
|
theClass = "tiddlyLinkExisting tiddlyLink";
|
|
} else {
|
|
subTitle = config.messages.undefinedTiddlerToolTip.format([title]);
|
|
theClass = "tiddlyLinkNonExisting tiddlyLink";
|
|
}
|
|
var btn = createTiddlyButton(place,text,subTitle,onClickTiddlerLink,theClass);
|
|
btn.setAttribute("tiddlyLink",title);
|
|
return(btn);
|
|
}
|