geke hand
E Z B O A R D
Alphabetize Emoticons on Post Screens

<< updated: 4/15/2003

Summary: Sort the emoticons into alphabetical order on the posting screen.

Details:

The list of emoticons is kept in an array called "eList" which is defined before the custom HEAD section. If we want to sort the list, we can do so by rearranging the array with a script in the custom HEAD section.

Be aware that emoticons are written left-to-write, so alphabetizing them leads to a list like this:

A B C D E F
G H I J K L

Not like this:

A C E G I K
B D F H J L

HEAD: (box #1)

<script type="text/javascript">
/* ALPHABETIZE EMOTICONS */
function sortEmote() {
aTag = new Array(eList.length / 2);
newE = new Array(eList.length);
for (el = 0; el < (eList.length / 2); el++) {
aTag[el] = eList[(el*2)+1];
newE[(el*2)] = eList[(el*2)];
newE[(el*2)+1] = eList[(el*2)+1];
}
aTag.sort();
for (et = 0; et < aTag.length; et++) {
for (el = 0; el < eList.length; el++) {
if (aTag[et] == newE[el]) {
eList[(et*2)+1] = aTag[et];
eList[(et*2)] = newE[el-1];
}
}
}
aTag = null;
newE = null;
}
try {
if (eList) { sortEmote(); }
}
catch (e) {}
/* END ALPHABETIZE EMOTICONS */
</script>

HEAD Notes:

Because both the emoticon image URL and the emoticon "tag" are kept in the same array, sorting the list is a little tricky. We can't just sort the eList array, we have to separate the tags out from the images, sort them, and then reconstruct the combined array.

In order to reconstruct the combined array, we create a duplicate of the original array in the variable "newE" and later match entries in newE with entries in our tag array to rewrite eList.

We see if the eList is present and throw away the error if it isn't. If it is, we sort the array with our function.

History:

4/15/2003 - written by phalen180

Credits:

Requested by Toggle Off

E Z B O A R D

design by G E K E . N E T
best viewed in 1024x768 screen resolution using a standards compliant browser
logo based on a public domain drawing of a hand making the sign of the cross, no disrespect is intended
all other contents and code copyright © 2002-2005 jonathan cook

Valid HTML 4.01! Valid CSS!