Last active
December 19, 2015 15:28
-
-
Save adautoneto/5976437 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$("[data-plan]").each(function(i, item) { | |
var $item = $(item), | |
table = $item.parents("table"), | |
tableRows = table.find("tr"), | |
templateRow = tableRows.last().clone(), | |
columnIndex = $item.siblings().andSelf().index($item), | |
currentRowIndex = tableRows.index($item.parents("tr")) + 1; | |
var produtos = conteudo[ $item.data("plan") ]; | |
for(var produto in produtos) { | |
if (currentRowIndex >= tableRows.length - 1) { | |
table.append(templateRow.clone()); | |
tableRows = table.find("tr"); | |
} | |
tableRows.eq(currentRowIndex).find("td:eq(" + columnIndex + ")").html(produtos[produto]); | |
currentRowIndex++; | |
} | |
}); | |
$("table:has([data-plan])").each(function(i, item) { | |
$(item).find("tr").last().remove(); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> </p> | |
<br /> | |
<h2 class="headingA01">SHOP MUSIC TEO</h2> | |
<p>AV SINDONIO OTONI, 640 - MG<br /> TEOFILO OTONI</p> | |
<p> </p> | |
<table border="1" cellspacing="0" cellpadding="10" width="100%"> | |
<tbody> | |
<tr> | |
<td colspan="4">Instrumentos Musicais</td> | |
</tr> | |
<tr> | |
<td width="25%" bgcolor="#CCCCCC" data-plan="teclado"><strong>Teclado e Piano Portátil</strong></td> | |
<td width="25%" bgcolor="#CCCCCC"><strong>Guitarra, Contrabaixo e Amplificador</strong></td> | |
<td width="25%" bgcolor="#CCCCCC"><strong>Bateria Eletrônica DTX</strong></td> | |
<td width="25%" bgcolor="#CCCCCC" data-plan="sopro"><strong>Sopros</strong></td> | |
</tr> | |
<tr> | |
<td width="25%"></td> | |
<td width="25%"></td> | |
<td width="25%"></td> | |
<td width="25%"></td> | |
</tr> | |
</tbody> | |
</table> | |
<p> </p> | |
<table border="1" cellspacing="0" cellpadding="10" width="50%"> | |
<tbody> | |
<tr> | |
<td colspan="2">Standard Áudio</td> | |
</tr> | |
<tr> | |
<td width="25%" bgcolor="#CCCCCC"><strong>Digital Mixer</strong></td> | |
<td width="25%" bgcolor="#CCCCCC" data-plan="mixer"><strong>MG/MGP Mixer</strong></td> | |
</tr> | |
<tr> | |
<td width="25%"></td> | |
<td width="25%"></td> | |
</tr> | |
</tbody> | |
</table> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
<script src="plans.js"></script> | |
<script src="contentLoader.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var conteudo = { | |
teclado: [ "PSR-E243", "PSR-E423" ], | |
sopro: [ "YSL-354", "YSL-3335", "YTR-2330", "YFL-211" ], | |
mixer: [ "MG82CX", "MG102C / C-R", "MG124CX-R", "MG166C / USB", "MG166CX / USB", "MG206C / USB", "MG24/14FX", "MG32/14FX", "MGP12X", "MGP16X", "MGP24X", "MGP32X", "Serie EMX", "Serie STAGEPAS"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment