Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-17-2007, 02:08 PM   PM User | #1
Torment
New to the CF scene

 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Torment is an unknown quantity at this point
Firefox extension: click link

Hi all, quick question.

I'm rather new to coding an such so I can't figure out on how I would go about making this plugin. I've googled till I had dead pixels on my screen, but to no avail - so I figured I'd ask it in a place where they'd probably know.

What I'm -trying- to make is a firefox plugin that automatically clicks a specific link when the browser is pointed to a specific page.

Example:

I'm on site.com/bunnies.php?name=randomstring&B=randomstring

On that page are 2 more links.

° Kick the bunny.
Code:
site.com/bunnies.php?name=randomstring&animal=&B=randomstring
° Leave the bunny alone.
Code:
site.com
The random strings gets changed every few minutes, so I would need to use a wildcard.. but I can't figure it out.

Is there any way to have the browser click links named "Kick the bunny" automatically?

Thanks in advance

note: the bunnies are just an example lol
Torment is offline   Reply With Quote
Old 04-17-2007, 03:52 PM   PM User | #2
david_kw
Senior Coder

 
Join Date: Nov 2006
Posts: 1,000
Thanks: 0
Thanked 0 Times in 0 Posts
david_kw will become famous soon enough
I don't know any way to get the browser to do that automatically without it being your page and running javascript on it that does what you need (altering the link).

Code:
for (int i = 0; i < document.links.length; i++) {
  if (isABunnyLink(document.links[i].src)) {
    kickTheBunnyLink(document.links[i].src);
  }
}
Something like that. Obviously you'd have to write the two bunny functions based on your needs.

As for the extension, I've never written one but there are tons of tutorials. Just search for "firefox extension tutorial" on google. Plus you can go to the mozilla page about extensions that has lots of info.

http://developer.mozilla.org/en/docs/Extensions

david_kw
__________________

www.eXfer.net
david_kw is offline   Reply With Quote
Old 04-17-2007, 07:55 PM   PM User | #3
Torment
New to the CF scene

 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Torment is an unknown quantity at this point
Extensions are basically little tools that do stuff for you, like adding more options to your right click menu, auto fill forms etc. They mainly consist of java, some ajax for the advanced features and very rarely C++.

I'm trying to make one that clicks links I want it to click as I would with my mouse, but automatically so I don't need to click or move my mouse.

I know it is possible, so I'm not trying to reinvent the wheel. Just don't know on how I would go about doing it as honestly, the only coding I am able to do is XHTML/CSS/TPL and a little bit of PHP.

Your example does clarify some for me, but I don't see how I could use it. Honestly 0.0% knowledge of java.

What I basically want my extension to do is;
if on site.com/bunnies.php?name=*&B=* > look for 'attack the bunny' >
if found > kick bunny.
if missing > return to bunnies.php
Torment is offline   Reply With Quote
Old 04-17-2007, 08:17 PM   PM User | #4
david_kw
Senior Coder

 
Join Date: Nov 2006
Posts: 1,000
Thanks: 0
Thanked 0 Times in 0 Posts
david_kw will become famous soon enough
Ah, I see. Well extensions are something I've thought about looking into but have yet to find the time/motivation. I wish you luck.

david_kw
__________________

www.eXfer.net
david_kw is offline   Reply With Quote
Old 04-17-2007, 10:23 PM   PM User | #5
carlitos_way
New Coder

 
Join Date: Mar 2007
Location: italy
Posts: 94
Thanks: 1
Thanked 1 Time in 1 Post
carlitos_way is an unknown quantity at this point
Quote:
Originally Posted by Torment View Post
What I'm -trying- to make is a firefox plugin that automatically clicks a specific link when the browser is pointed to a specific page.
if i understood you, you want that, when you go to a page, you're redirected to another one taking the link from the page in which you are.

and you want to do it as a FF extension.

so i suggest you to:
1-read this tutorial about XUL, the language used by FF extensions.
Code:
XUL was designed for creating the user interface of the Mozilla application including the web browser, mail client and page editor. XUL may be used to create these types of applications. However, it may also be used any place you would currently use a web application, for instance, when you need to be able to retrieve resources from the network and require a sophisticated user interface. Like HTML, in XUL you can create an interface using a markup language, use CSS style sheets to define appearance and use JavaScript for behavior.
2-use javascript to read the url you want to redirect to and doing it.

it's quite easy to create an extension for FF, but only if you have any knowledge about DOM and JS...
carlitos_way is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:08 PM.


Advertisement
Log in to turn off these ads.