Alphabetization of tiddlers on right sidebar "all" tab.

4 views
Skip to first unread message

Naamah

unread,
Feb 7, 2010, 7:25:26 AM2/7/10
to TiddlyWiki
My sidebar menu alphabetizes from A-Z and then from a-z.

In other words, I am looking at something like this:

Albion
Cimmeria
Thuringia
Zenda
dragon
manticore
vampire
werewolf

I should be seeing this:

Albion
Cimmeria
dragon
manticore
Thuringia
vampire
werewolf
Zenda

This is incredibly annoying and not okay at all. Is there a plugin
that will fix this?

Keep in mind, I am completely new to this, and am not what one would
call code or tech savvy -- which is why I went with what seems to be
an easily editable wiki program.

Naamah

unread,
Feb 8, 2010, 2:21:50 PM2/8/10
to TiddlyWiki
In the interests of furthering community knowledge, a friend solved
this problem for me and I include the fix here. She just had me go
into the raw code in Notepad++ to edit it.

Search for this snip of text:

TiddlyWiki.prototype.reverseLookup

There's only one like it in the file.

You should see this block of code shortly beneath that line::

if(!sortField)
sortField = "title";
results.sort(function(a,b) {return a[sortField] <
b[sortField] ? -1 :
(a[sortField] == b[sortField] ? 0 : +1);});
return results;


Replace it with this block of text:

if(!sortField)
sortField = "title";
results.sort(function(a,b) {var x =
String(a[sortField]).toLowerCase(); var y =
String(b[sortField]).toLowerCase(); if (x > y) { return 1; } if (x <
y)
{ return -1; } return 0; });
return results;


And voila, fixed.

-- Naamah

Mike

unread,
Feb 8, 2010, 2:45:56 PM2/8/10
to TiddlyWiki
could also patch as a plugin (otherwise known as Hijacking). . .
(instead of editing code)

In a tiddler tagged as systemconfig

**beware google wrapping**

// Return an array of the tiddlers that do or do not have a specified
entry in the specified storage array (ie, "links" or "tags")
// lookupMatch == true to match tiddlers, false to exclude tiddlers
TiddlyWiki.prototype.reverseLookup =
function(lookupField,lookupValue,lookupMatch,sortField)
{
var results = [];
this.forEachTiddler(function(title,tiddler) {
var f = !lookupMatch;
for(var lookup=0; lookup<tiddler[lookupField].length; lookup++) {
if(tiddler[lookupField][lookup] == lookupValue)
f = lookupMatch;
}
if(f)
results.push(tiddler);
});


if(!sortField)
sortField = "title";
results.sort(function(a,b) {var x =
String(a[sortField]).toLowerCase(); var y =
String(b[sortField]).toLowerCase(); if (x > y) { return 1; } if (x
<y)
{ return -1; } return 0; });
return results;

};

Haven't tested but should have the same results

:P Mike

Reply all
Reply to author
Forward
0 new messages