hey guys im using greasmonkey with jquery and i want to find the remaining time on a page then display it in my infomation bar in game but what im having trouble with is the regxp trying to get the text then get the 1,2 or 3 didgit number between the text here is my current function which gets the numbers on the page but returns a HUGE number because its returning every number
now oviously this get function WILL NOT work for you because you will need to log in so if you just store the following html into the temp var then it will function the same
would it be possible to only strip the following text Time until Revial (number 1,2 or 3 didgits long) minutes and then once it has found that match remove anything that isnt a number
Code:
function getFallen() { hellGate = ""; $.get('http://kong.playmage.com/dream/fallen?board', function(data) { temp = data; if(temp.search("Time until revival:") != -1 || temp.search("minutes") != -1) { numb = temp.match(/\d/g);//format of text needed "Time until Revial (number 1,2 or 3 didgits long) minutes" numb = numb.join("");//with the current match i have it returns huge number //debugScript("Found the number :" + numb, "debug"); //el2 = $inc1("test"); function outside this function just for finding classes/ids //if (el2) el2.textContent = numb; // for setting the content of the id class above not needed in this function but just for debug purposes } }); }
now oviously this get function WILL NOT work for you because you will need to log in so if you just store the following html into the temp var then it will function the same
Code:
<input type="hidden" id="cfix" value=""/> <center><span style="padding-top: 4px; display: inline-block; font-size: 16px; color: #00ddbb; font-family: lucida grande, verdana, arial;">Fallen Defenders</span> <br /> <table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td> <div style="text-align: center;">Last Fallen</div> <div class="trainlbox" style="height: 346px; overflow-x: hidden; margin: 5px 4px 5px 12px; display: inline-block;"> <table style="width: 332px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr style="vertical-align: middle; background-color: rgb(0, 36, 36);"> <td class="healheadertd" style="width: 50px;"> Rank</td> <td class="healheadertd" style="width: 120px;">Player</td> <td class="healheadertd" style="text-align: center;">Damage </td> </tr> <tr style="vertical-align: middle;"> <td> 1</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf110743'); return false;">Authority[aik]</a> </td> <td style="text-align: center;">1,479,141,013 </td> </tr> <tr style="vertical-align: middle;"> <td> 2</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf483977'); return false;">Ultima[HOT]</a> </td> <td style="text-align: center;">603,063,918 </td> </tr> <tr style="vertical-align: middle;"> <td> 3</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf402815'); return false;">wozza[AGA]</a> </td> <td style="text-align: center;">287,130,506 </td> </tr> <tr style="vertical-align: middle;"> <td> 4</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf404165'); return false;">larry1977[AGA]</a> </td> <td style="text-align: center;">277,033,578 </td> </tr> <tr style="vertical-align: middle;"> <td> 5</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf455510'); return false;">Ehanida[ToF]</a> </td> <td style="text-align: center;">276,799,331 </td> </tr> <tr style="vertical-align: middle;"> <td> 6</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf173542'); return false;">dudemanly[DNA]</a> </td> <td style="text-align: center;">191,656,885 </td> </tr> <tr style="vertical-align: middle;"> <td> 7</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf191162'); return false;">krashkill0069[G4B]</a> </td> <td style="text-align: center;">47,831,724 </td> </tr> <tr style="vertical-align: middle;"> <td> 8</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf486185'); return false;">ben_avatar[HOT]</a> </td> <td style="text-align: center;">33,264,175 </td> </tr> <tr style="vertical-align: middle;"> <td> 9</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf312560'); return false;">Niv[PWN]</a> </td> <td style="text-align: center;">31,520,972 </td> </tr> <tr style="vertical-align: middle;"> <td> 10</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf528295'); return false;">leandroaod[DJE]</a> </td> <td style="text-align: center;">26,510,757 </td> </tr> <tr style="vertical-align: middle;"> <td> 11</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf187015'); return false;">Graveyard[PWN]</a> </td> <td style="text-align: center;">10,379,144 </td> </tr> <tr style="vertical-align: middle;"> <td> 12</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf25358'); return false;">Maynard[PWN]</a> </td> <td style="text-align: center;">7,116,618 </td> </tr> <tr style="vertical-align: middle;"> <td> 13</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf229143'); return false;">Barry McCociner[XXX]</a> </td> <td style="text-align: center;">6,123,612 </td> </tr> <tr style="vertical-align: middle;"> <td> 14</td> <td> <a href="#" onclick="showDiv('/dream/profile?id=nf79006'); return false;">DumMetlHed[PWN]</a> </td> <td style="text-align: center;">4,736,449 </td> </tr> </tbody> </table> </div> </td> <td> <div style="text-align: center;">Current Fallen </div> <div class="trainlbox" style="height: 346px; overflow-x: hidden; margin: 5px 8px; display: inline-block;"> <table style="width: 332px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr style="vertical-align: middle; background-color: rgb(0, 36, 36);"> <td class="healheadertd" style="width: 50px;"> Rank</td> <td class="healheadertd" style="width: 120px;">Player</td> <td class="healheadertd" style="text-align: center;">Damage </td> </tr> <tr><td colspan="3" style="text-align: center;"> <br/> <br/> <br/> <br/> Time until revival: 147 minutes </td></tr> </tbody> </table> </div> </td> </tr></tbody> </table> <div style="padding-top: 10px;"><span class="btn100" onclick="closeFloat();">Close</span></div> </center>
Comment