Jump to content

Recommended Posts

I'm currently making a GreaseMonkey script for a Live Support script that I use on a daily basis.

 

Here's the Live Support's HTML (Client-Side):

<td align="center" nowrap="nowrap"><a href="javascript:void(0)" onclick="window.open('http://*****.com/livesupport/request.php?action=accept&sessionid=***&requestid=***&sid=***&userid=***&l=admin&x=1', '***', 'status=no,scrollbars=no,menubar=no,resizable=no,location=no,width=450,height=635,screenX=50,screenY=100')"><b>ACCEPT</b></a>   |   <a href="javascript:parent.window.do_reject(***)">busy</a></td>

 

And here's what I have so far (I was testing):

var busy = document.getElementsByTagName('tr')[4].getElementsByTagName('td')[0].getElementsByTagName('a')[1];
busy.parentNode.removeChild(busy);

 

My code is working well but it only removes the bolded part in the above quote.

 

Yeah, I know.. That's all the code I posted is supposed to do... But I'm trying to completely remove "   |   <a href="javascript:parent.window.do_reject(***)">busy</a></td>"

 

I looked around regex and I couldn't really understand how to use it or if it would even work for what I'm trying to accomplish.

 

It might be hard to understand what I'm asking for.. I'm just trying to remove this:

   |   [b]<a href="javascript:parent.window.do_reject(***)">busy</a></td>

from the quote at the top of the thread. If you need more explaining, I will gladly do that :)

 

Does anybody have any ideas?

Link to comment
https://forums.phpfreaks.com/topic/214788-help-removing-a-few-things/
Share on other sites

I'm not really sure what you're trying to do here, but you won't be able remove (just) them as a single node. As you said you could use regex, which to match it would require:

 

/   \|   \[b\]<a href\="javascript:parent\.window\.do_reject\(\*\*\*\)">busy<\/a><\/td>/

 

Then you could use the .replace() method to remove the string:

 

var td = document.getElementsByTagName('tr')[4].getElementsByTagName('td')[0].innerHTML;
td.replace(/   \|   \[b\]<a href\="javascript:parent\.window\.do_reject\(\*\*\*\)">busy<\/a><\/td>/, '');

 

Not tested, but you should be able to tweak it to get it working.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.