HighDots Forums  

firefox extension + greasemonkey

Javascript (Italian) Il linguaggio JavaScript (it.comp.lang.javascript)


Discuss firefox extension + greasemonkey in the Javascript (Italian) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
spx2
 
Posts: n/a

Default firefox extension + greasemonkey - 06-06-2008 , 08:05 PM








Problem description:
-------------------

I'm trying to write a toolbar to automate a search engine that does
not allow query strings.

Attempts at a solution
----------------------

One can write a toolbar that uses in some way or the other query
strings like this

location.href="htt://site/search?query_string="+text_to_search
+optional_stuff

The problem is that the site on which I'm trying to do this does not
allow query strings.
So I have to automate it with other methods.

I've found out that trying to run javascript on a domain different
than the one
on which the javascript is hosted is called "Cross domain scripting"
which is prohibited or
not allowed...one or the othear.
Also , I have succeded in writing a script in greasemonkey that can
access the site and fill the
search textbox with a word and then hit search automatically.

The problems remaining are:

1)how to make the toolbar and greasemnokey communicate ?
2)how to package greasemonkey and the toolbar together so that when
installing the toolbar
on firefox it won't be needed to install them separately.

The following is the script that I've wrote in greasemonkey for
automating the page:



document.getElementById('search').value="gifts";

var inputs = document.getElementsByTagName("input");
var idx;
var btn_search;

for(idx=0;idx<inputs.length;idx++) {
if((inputs.item(idx)).getAttribute('name') == 'btn_search') {
btn_search = inputs.item(idx);
break;
}
}

var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,0, 0, 0, 0, 0, false,
false, false, false, 0, null);
btn_search.dispatchEvent(evt);


Any suggestions/ideas/alternatives are much appreciated.

Reply With Quote
  #2  
Old   
Roberto Montaruli
 
Posts: n/a

Default Re: firefox extension + greasemonkey - 06-07-2008 , 07:46 AM






spx2 ha scritto:
Quote:
The problems remaining are:

1)how to make the toolbar and greasemnokey communicate ?
I also used greasemomkey as a facility for some sites.
But i don't know anything about toolbars.
You must re-write your questioni in "how to communicate with your
toolbar using javascript?"

Quote:
2)how to package greasemonkey and the toolbar together so that when
installing the toolbar
on firefox it won't be needed to install them separately.
Zip them together ad write a readme.txt with instructions.

Your target are Firefox users, and they are told to be able to use brain.


Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.