1 madrona.ui = {}; 2 3 madrona.ui.table = (function(){ 4 5 6 return function(element){ 7 var element = $(element); 8 9 if(element.hasClass('madrona-table')){ 10 if(element.hasClass('processed')){ 11 return; 12 } 13 14 element.addClass('processed'); 15 16 if(element.hasClass('madrona-table-zebra')){ 17 var odd = false; 18 element.find('tbody tr').each(function(){ 19 if(odd){ 20 $(this).addClass('zebra'); 21 } 22 odd = !odd; 23 }); 24 } 25 if(element.find('span.hover').length > 0){ 26 element.addClass('madrona-table-hover'); 27 } 28 if(element.find('span.popup').length > 0){ 29 element.addClass('madrona-table-popup'); 30 } 31 32 }else{ 33 throw('element does not have class madrona-table'); 34 } 35 } 36 })();