[jQuery] Re: listnav letter question?

2009-07-24 Thread Jack Killpatrick


Hi Keith,

Glad you like the plugin. I missed your original post, but just spotted 
this one. Your change looks good, that's where I would have done it, 
too. I'm having a little trouble picturing your use case, though. Do you 
have an example anywhere or could you explain it a little bit more? I 
might considering adding an option for this kind of thing to the plugin.


Thanks,
Jack

keith.westb...@gmail.com wrote:
Ok... I think I got it. I tweaked the addClasses function to eval a 
list items attribute instead of the text value. I'm using the attrib 
LANG for now. I populate this server side with either the first 
character of the persons firstname or lastname depending on what order 
was selected on the page. So now I can generate a dynamic list of 
anything I like without needing to ensure the first char matches the 
navigation line selected character. I'm sure there is allot wrong with 
this approach, and I apologize in advance. My enviornment is strictly 
Intranet with mandated browser and version, so I can normally get away 
with much less test overhead than the will wild west... =)


Cheers,
Keith


///
function addClasses() {
var str, firstChar;
var temp;

$($list).children().each(function() {

// ORIGINAL
// $(this).text().replace(/\s+/g, ''); //.toLowerCase();
// strip all white space (including tabs and linebreaks that might 
have been in the HTML)

// thanks to Liam Byrne, l...@onsight.ie

// NEW
str = $(this).attr("lang");

if (str != '') {

// ORIGINAL
// firstChar = str.slice(0, 1).toLowerCase();

// NEW
firstChar = str.toLowerCase();

if (!isNaN(firstChar)) firstChar = '_'; // use '_' if the first char 
is a number

$(this).addClass('ln-' + firstChar);

if (counts[firstChar] == undefined) counts[firstChar] = 0;
counts[firstChar]++;
allCount++;
}
});
}




On Jul 20, 2009 11:33pm, keith  wrote:
> Great solution to managing large lists... 3 thumbs up!  =)
>
>
>
>
>
> After playing with it this evening, I found myself wondering what it
>
>
> would take to possibly target another attribute to determine its
>
>
> placement?  For instance if I were to use an image instead of a link
>
>
> or some other type of content without any text, how would I tweak the
>
>
> plugin to eval this area instead of its text.   Do you believe this
>
>
> would be a simple endeavor?
>
>
>
>
>
> Before I really dig in, I thought I would first ask yourselves and see
>
>
> if this was even possible without a huge rewrite.
>
>
>
>
>
> Thank you again for a really great tool... I look forward to using it
>
>
> in future projects.
>
>
>
>
>
> Respectfully,
>
>
> Keith
>
>
> 





[jQuery] Re: listnav letter question?

2009-07-24 Thread keith . westberg
Ok... I think I got it. I tweaked the addClasses function to eval a list  
items attribute instead of the text value. I'm using the attrib LANG for  
now. I populate this server side with either the first character of the  
persons firstname or lastname depending on what order was selected on the  
page. So now I can generate a dynamic list of anything I like without  
needing to ensure the first char matches the navigation line selected  
character. I'm sure there is allot wrong with this approach, and I  
apologize in advance. My enviornment is strictly Intranet with mandated  
browser and version, so I can normally get away with much less test  
overhead than the will wild west... =)


Cheers,
Keith


///
function addClasses() {
var str, firstChar;
var temp;

$($list).children().each(function() {

// ORIGINAL
// $(this).text().replace(/\s+/g, ''); //.toLowerCase();
// strip all white space (including tabs and linebreaks that might have  
been in the HTML)

// thanks to Liam Byrne, l...@onsight.ie

// NEW
str = $(this).attr("lang");

if (str != '') {

// ORIGINAL
// firstChar = str.slice(0, 1).toLowerCase();

// NEW
firstChar = str.toLowerCase();

if (!isNaN(firstChar)) firstChar = '_'; // use '_' if the first char is a  
number

$(this).addClass('ln-' + firstChar);

if (counts[firstChar] == undefined) counts[firstChar] = 0;
counts[firstChar]++;
allCount++;
}
});
}




On Jul 20, 2009 11:33pm, keith  wrote:

Great solution to managing large lists... 3 thumbs up! =)







After playing with it this evening, I found myself wondering what it




would take to possibly target another attribute to determine its




placement? For instance if I were to use an image instead of a link




or some other type of content without any text, how would I tweak the




plugin to eval this area instead of its text. Do you believe this




would be a simple endeavor?







Before I really dig in, I thought I would first ask yourselves and see




if this was even possible without a huge rewrite.







Thank you again for a really great tool... I look forward to using it




in future projects.







Respectfully,




Keith