jeudi 27 avril 2017

How to hide a according to multiple parameters compared within it unless the contents of it's 2nd contains anyone of a list of strings

<tr id="fcp20429" role="row" class="odd">
          <td class="cl" data-sort="20429"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> ASAFE</td>
          <td class="cl">1000.00000000</td>
          <td class="cl"><span class="countdown grey" exp="-1" fcp="20429">paid once</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(20429,769,&quot;ASAFE&quot;,&quot;Allsafe&quot;,&quot;1000.00000000&quot;,&quot;0&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp6809" role="row" class="even">
          <td class="cl" data-sort="6809"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> LSK</td>
          <td class="cl">0.01000000</td>
          <td class="cl"><span class="countdown grey" exp="-1" fcp="6809">paid once</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(6809,40005,&quot;LSK&quot;,&quot;Lisk&quot;,&quot;0.01000000&quot;,&quot;0&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp13007" role="row" class="odd">
          <td class="cl" data-sort="13007"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> PAC</td>
          <td class="cl">100.00000000</td>
          <td class="cl"><span class="countdown green" exp="00:00:00" fcp="13007">ready</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" onclick="popupFCW();" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(13007,477,&quot;PAC&quot;,&quot;PacCoin&quot;,&quot;100.00000000&quot;,&quot;3600&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp23343" role="row" class="even">
          <td class="cl" data-sort="23343"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> GLC</td>
          <td class="cl">0.10000000</td>
          <td class="cl"><span class="countdown" exp="05:04:15" fcp="23343">05:04:15</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(23343,624,&quot;GLC&quot;,&quot;Globalcoin&quot;,&quot;0.10000000&quot;,&quot;86400&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp1824" role="row" class="odd">
          <td class="cl" data-sort="1824"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> ICASH</td>
          <td class="cl">0.14881488</td>
          <td class="cl"><span class="countdown grey" exp="-1" fcp="1824">paid once</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(1824,125,&quot;ICASH&quot;,&quot;iCash&quot;,&quot;0.14881488&quot;,&quot;0&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp7488" role="row" class="even">
          <td class="cl" data-sort="7488"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> TWERK</td>
          <td class="cl">10.00000000</td>
          <td class="cl"><span class="countdown" exp="05:04:16" fcp="7488">05:04:16</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(7488,200,&quot;TWERK&quot;,&quot;TWERK&quot;,&quot;10.00000000&quot;,&quot;86400&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp18754" role="row" class="odd">
          <td class="cl" data-sort="18754"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> CTL</td>
          <td class="cl">10.00000000</td>
          <td class="cl"><span class="countdown grey" exp="-1" fcp="18754">paid once</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(18754,677,&quot;CTL&quot;,&quot;CTLcoin&quot;,&quot;10.00000000&quot;,&quot;0&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp2940" role="row" class="even">
          <td class="cl" data-sort="2940"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> HIFUN</td>
          <td class="cl">10.00000000</td>
          <td class="cl"><span class="countdown green" exp="00:00:00" fcp="2940">ready</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(2940,291,&quot;HIFUN&quot;,&quot;SatoshiFun&quot;,&quot;10.00000000&quot;,&quot;3600&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp342" role="row" class="odd">
          <td class="cl" data-sort="342"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> SLFI</td>
          <td class="cl">5.00000000</td>
          <td class="cl"><span class="countdown" exp="05:04:17" fcp="342">05:04:17</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(342,107,&quot;SLFI&quot;,&quot;SelfieCoin&quot;,&quot;5.00000000&quot;,&quot;86400&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp26" role="row" class="even">
          <td class="cl" data-sort="26"><img src="http://ift.tt/2poDGo8" width="18px" height="18px"> DASH</td>
          <td class="cl">0.00000100</td>
          <td class="cl"><span class="countdown" exp="05:52:53" fcp="26">05:52:53</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(26,10,&quot;DASH&quot;,&quot;DASH&quot;,&quot;0.00000100&quot;,&quot;86400&quot;)" origin="Donate" value="Donate">
          </td>
      </tr><tr id="fcp24694" role="row" class="odd">
          <td class="cl" data-sort="24694"><img src="http://ift.tt/2qhPkhL" width="18px" height="18px"> BDC</td>
          <td class="cl">5.00000000</td>
          <td class="cl"><span class="countdown green" exp="00:00:00" fcp="24694">ready</span></td>
          <td class="cl">
            <input type="button" class="clGetFreeCoins" origin="Get free coins" value="Get free coins">
            <input type="button" class="clFreecoinsDonate" onclick="popupFreecoinsDonate(24694,426,&quot;BDC&quot;,&quot;BlackDiamondCoin&quot;,&quot;5.00000000&quot;,&quot;10800&quot;)" origin="Donate" value="Donate">
          </td>
      </tr>

Above is an excerpt of the HTML code at http://ift.tt/1Qw6lMz which I've been trying to modify by doing some if statements, but I can't seem to figure out the proper order, or how to compare the second TD that contains an image and " NAMEOFCOIN"</img> with a list of coins that should keep their <td> shown regardless of the conditions of the other if statements.

I've managed to get it to hide all of the coins that are either not ready to click ready != 'ready' or have a value that is less than 0.0001 amount<=0.0001.

My code to only show the coins of value and that are ready to be clicked is as follows, and it works:

$('#freecoins_table > tbody > tr').each(function(tr_index)
{ var ready = ($(this).children(":nth-child(3)").text());
var amount = parseFloat($(this).children(":nth-child(2)").text());
var coinName = ($(this).children(":nth-child(1)").text());

if (ready != ('ready') || amount<=0.0001)
{ $(this).hide();
console.log('Filtering out that which isn\'t ready...');
}
else
{
console.log('Found one that's ready and of value.');
}
});

Now there are several coins that I would like their whole <td> to remain showing even if they aren't >=0.0001 or even 'ready' for that matter.

I've tried:

$('#freecoins_table > tbody > tr').each(function(tr_index)
{ var ready = ($(this).children(":nth-child(3)").text());
var amount = parseFloat($(this).children(":nth-child(2)").text());
var coinName = ($(this).children(":nth-child(1)").text());

if (ready != ('ready') || amount<=0.0001)
{ $(this).hide();
console.log('Filtering out that which isn\'t ready...');
}
else if (coinName == ('*BTC*' || '*DASH*' || '*DOGE*' || '*LTC*' || '*ETH*' || '*POSW*' || '*TWERK*' || '*VTL*' || '*INSANE*' || '*ICASH*' || '*XBY*' || '*TAM*' || '*XVE*' || '*BLRY*' || '*BUB*' || '*LEPEN*' || '*FRWC*' || '*DGCS*' || '*GDOGE*' || '*KRAK*' || '*MONETA*' || '*2BACCO*'));
{
$(this).show();
console.log('Bringing back the popular altcoins!');
} });

and:

$('#freecoins_table > tbody > tr').each(function(tr_index) 
{ var ready = ($(this).children(":nth-child(3)").text());
var amount = parseFloat($(this).children(":nth-child(2)").text());
var coinName = ($(this).children(":nth-child(1)").text());
var coinsAray = coinName.split('\"');
coinName = coinsArray[7];
coinName.replace(("\>"|"\<\/td>"),"");
if (ready != ('ready') || amount<=0.0001)
{ $(this).hide();
console.log('Filtering out that which isn\'t ready...');
}
else if (coinName == (' DASH' || ' DOGE' || ' BTC' || ' MONETA' || ' POSW' || ' ETH' || ' XBY' || ' LTC' || ' ICASH' || ' INSANE' || ' POSW' || ' PVY' || ' LEPEN' || ' HCC' || ' FRN' || ' PHR' || ' VTN' || ' GLC' || ' 2BACCO' || ' DGCS' || ' GDOGE' || ' KRAK' || ' FRWC' || ' LEPEN' || ' BUB' || ' VTL' || ' TWERK' || ' XVE' || ' TAM'))
{
$(this).show();
console.log('Bringing back the popular altcoins!');
}
else 
{
console.log('Ready and Valuable but not Popular...');
}
});

I must be doing something wrong trying to get the name of the coin out of the 2nd <td> as a string to be compared to coinName, or I'm doing my comparisons all wrong, or perhaps I'm going about this whole thing wrong, please help!

Aucun commentaire:

Enregistrer un commentaire