Skip to content

Instantly share code, notes, and snippets.

@nickdunn
Created January 5, 2010 15:35
Show Gist options
  • Save nickdunn/269441 to your computer and use it in GitHub Desktop.
Save nickdunn/269441 to your computer and use it in GitHub Desktop.
// Store templates:
object.find(settings.templates).each(function(position) {
var template = jQuery(this).remove();
var header = template.find(settings.headers).addClass('header');
var option = widgets.selector.append('<option />')
.find('option:last');
var header_children = header.children();
if (header_children.length) {
header_text = header.get(0).childNodes[0].nodeValue + ' (' + header_children.filter(':eq(0)').text() + ')';
} else {
header_text = header.text();
}
option.text(header_text).val(position);
templates.push(template.removeClass('template'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment