Turn Bookmarklet Into Greasemonkey Script

May 6, 2007

javascript:(function(){var k,x,t,i,j,p; for(k=0;x=document.links[k];k+
+){t=x.href.replace(/[%]3A/ig,':').replace(/[%]2f/
ig,'/');i=t.lastIndexOf('http');if(i>0){ t=t.substring(i);
j=t.indexOf('&'); if(j>0)t=t.substring(0,j); p=/https?://[^
s]*[^.,;'%22>s)]]/.exec(unescape(t)); if(p) x.href=p[0]; } else if
(x.onmouseover&&x.onmouseout){x.onmouseover(); if (window.status &&
window.status.indexOf('://')!=-1)x.href=window.status;
x.onmouseout(); } x. x. }})();

View 1 Replies


ADVERTISEMENT

AppendChild In Greasemonkey

Jul 23, 2005

I'm using the following code in a Greasemonkey script.

var start, newElement;
start = document.body;
newElement = document.createElement('b');
newText = document.createTextNode("The Greasemonkey salutes you!");
newElement.appendChild(newText);
start.appendChild(newElement);

Can anyone tell me: 1) why my string appears twice; 2) how to make it
appear just once?

I'm trying to insert code at the top of every viewed page. Obviously,
document.body appends the string to the closing body tag which is not
what I want. What could I use to insert my code as the first childnode
under 'body'?

View 3 Replies View Related

Greasemonkey 'Component Is Not Available'

Dec 27, 2006

I'm new to Greasemonkey, and have no idea how to fix this. I would post elsewhere, but I couldn't find a forum for user script development help....

View 4 Replies View Related

Greasemonkey Seems To Fail With Too Many Gm_xmhttprequests?

Mar 22, 2006

I'm trying to write a script (my first) that loops through some table
rows and gets some data from another page using gm_xmlhttprequests. It
works if I keep the loop to one, but if I try and loop through all the
rows, and therefore have say 10-20 gm_xmlhttprequests, the script just
seems to fail. But if I put an alert inside each gm_xmlhttprequest, and
wait a bit before dismissing the alert, the gm_xmlhttprequest will
succeed and the data gets updated as planned. It seems as if the
gm_xmlhttprequests don't block, or the script keeps executing without
waiting for the requests to finish. I don't have any listeners on the
script, I just want it all to load when the page loads. Also, I looked
at the javascript console and it doesn't have any errors about the
gm_xmlhttprequests.

View 1 Replies View Related

Disable Greasemonkey On My Page?

Mar 4, 2009

Without getting into whether I should or shouldn't do this, I'm hoping someone can help me disable greasemonkey on my site.

I've tried the two methods I could find via Google, but neither worked code...

Is there actually a way to prevent Greasemonkey from loading on your page?

View 2 Replies View Related

Replace Url Greasemonkey Script?

Feb 12, 2010

I am trying to learn some javascript at the moment and thought a simple greasemonkey script might be a good way to start.What I want the script to do is to replace an existing url on a website with a different url from another location within the website.

E.G. replace "/mailbox.php?inbox" with "/account.php?action=mybookmarks"

There are a lot of examples of replacing existing urls with different ones on the web but they all use id's to locate and replace urls.

This script is for a site I visit often and since I dont own it I dont have the ability to add id tags to the appropriate a tags, this makes writing this script a lot more difficult.This is the code I have so far;

Code:

// ==UserScript==
// @name NZBmatrix mailbox url replace
// @include http://nzbmatrix.com/

[code]....

View 3 Replies View Related

Tool To Tell Where Is The Error - Greasemonkey

May 7, 2010

would like to know a tool that could give me a clue on where is the error in a greasemonkey script that i'm working on. I'm using notepad, what tool could "run" the script and tell me where is the error?

View 4 Replies View Related

Watching A Countdown Timer With Greasemonkey?

Mar 21, 2009

What I would like to do is watch a countdown timer on a page, like the ones on swoopo.co.uk and then perfom an action depending on what time is left on the timer.

I've installed DOM inspector on Firefox and poked around with javascript shell and I think I've figured out how to read the timer and assign that to a variable, something like this -

var timer=document.getElementById('counter_index_page_162980').innerHTML;

Now I need to watch that so I guessed this would do -

while (timer!=="00:00:01")
{
var timer=document.getElementById('counter_index_page_162980').innerHTML;
}
alert('timer at 1 sec!');

But that just brings up an "unresponsive script" error in my browser.

Am I even close to the mark? I know I'm not going to win any auctions with this but I've already paid for the bids so I may as well use them now.

View 1 Replies View Related

Greasemonkey Script Not Showing Checkboxes?

May 8, 2010

I'm using this script:

[URL]

source code:

[URL]

but it's showing no checkboxes. Here's the code related to that:

Code:

function rp_villageSelector() { //adds Village checkboxes
FM_log(3,"rp_villageSelector() called");
//get Travian Version

[code]....

View 1 Replies View Related

Greasemonkey: Insert An Element Using Regular Expression

Nov 27, 2006

I'm a newbie to JavaScript and Greasemonkey and just started learning
with 'Dive Into Greasemonkey'. I looked for an example on the web, but
unfortunately I'm still missing something...

I have a text file which is a simple database:

Key01 Text01 Url01
Key02 Text02 Url02
....

I'd like to insert after

<a href="anUrl" class="thisClass">Key01<a>

the element

<a href="Url01">Text01<a>

I tried to reuse the "Dumb Quotes" from 'Dive Into Greasemonkey' by
replacing

replacement = {
"Key01":"Key01</a><a href="Url01">Text01",
"Key02":"Key02</a><a href="Url01">Text02"
};

Unfortunately, this doesn't work, since </a><a href...is not
interpreted as a HTML tag.

So I tried this:

nodes = document.evaluate(
"//text()",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < nodes.snapshotLength; i++) {
node = nodes.snapshotItem(i);
text = node.data;
for (key in replacements) {
if(s==key)
helpkey=key;
}
newLink = document.createElement('a');
// newLink.href = 'Url0x' ????
// newLink.appendChild(document.createTextNode(Text0x )); ???
newLink.parentNode.insertBefore(newLink, node.nextSibling);
}

I'm really lost.

View 2 Replies View Related

Greasemonkey - Display Number Of Clicks Since Last Refresh?

Jan 14, 2010

I've just started some JavaScript development, but have run into a bit of a problem with a Greasemonkey script I'm working on. This script is for personal use. I'm doing a variety of things on a page, including auto-refreshing it. I want to display the number of clicks (preferably just on links) since the last refresh.

View 1 Replies View Related

Bookmarklet

Jan 21, 2007

I have a bookmarklet which copies a marked set of characters into a searchpage in our dictionary. If nothing is copied, a window opens where you can type a word.

BTW, it is for firefox 2.0.

javascript:s=window.getSelection();if(s=='')for(i= 0;i<frames.length;i++){s=frames[i].document.getSelection();if(s)break;}if(!s)void(s= prompt('some
text.',''));if(s){test=open('URL/search.pl?searchphrase='+escape(s));test.focus();}
This works well.

We have another search /command which needs to be finished with &search= after the searchphrase

searchphrase="here comes the markedtyped set of characters"&search=

Can anyone of you help me changing the bookmarklet or point me to a site where I can read more about this?

View 1 Replies View Related

Interactive Bookmarklet?

Jun 22, 2007

Is there a way to create a bookmarklet that discerns the shift (or
ctrl) key state at the time the javascipt is launched?????

View 1 Replies View Related

Bookmarklet For Random Url

Jul 20, 2005

I've found examples of bookmarklets that select a URL from a page at
random, but I'd like one that generates part of the URL at random.

If you have a bunch of images that are named:
mydomain.com/images/abcd.jpg where abcd is can be any combination of 4
lowercase letters - is there a way of having the bookmarklet generate
the letters randomly when clicked?

I'm able to do it using AppleScript & Safari but would like it to work
from within Safari - which is missing the "Scripts" menu that most Apple
apps have :(

It looks as if bookmarklets are the only option, but I've only ever used
javascript to select randomly from existing arrays of images and don't
fancy typing in the names of a couple of thousand images...

View 5 Replies View Related

Reader Bookmarklet...

May 6, 2003

Download the attached file, rename it read.html and open it. Drag the "read" link onto your Favorites|Links toolbar, and acknowlege the warning dialog. Then, from anyone's page, click the "read" bookmarklet and read along with it.

My basic premise is that vowels and digits make for a place to pause momentarily (90ms) during reading. If it reads too fast or slow, you can adust the delay factor accordingly.

I haven't tested this on other browsers yet.

View 4 Replies View Related

Escaping Bookmarklet Code

Nov 13, 2006

When publishing bookmarklets, we put the bookmarklet code in anchor tag
like this:

<a href="javascript: alert('test');"name </a>

Some characters of the code need to be escaped. For example, double
quotes need to be escaped as %22 like in this example:
<a href="javascript: var doubleQuote = '%22' alert(doubleQuote);">
name </a>

Question: Is double quotes the only thing that need to be escaped?

I have seen examples of escaping spaces as %20, but it seems
unnecessary in most browsers i have used.

View 1 Replies View Related

Javascript Bookmarklet For Del.icio.us

Mar 3, 2007

I'm using the following javascript bookmarklet for creating del.icio.us posts, and it works fine, but i've been trying to augment it with "document.getSelection" and have not gotten it to work.

the code is:
javascript:q=location.href;p=document.title;void(open('http://del.icio.us/fogboy?v=3&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'delicious%20',%20'toolbar=no,width=740,height=700'))

and it works fine (to test of course you'd have to change the del.icio.us username in there), except it doesn't have the "document.getSelection" syntax which would make it so highlighted text on a page was put in the "notes" field. i've tried about 5 different ways of writing that, based on other versions i've seen around. i would love to know exactly the right syntax to use to get this working.

View 1 Replies View Related

View-Source Bookmarklet

Apr 15, 2003

I didn't know about this until a few hours ago. I thought it was cool, so I thought I'd share it.

I got the code from brothercake, although I did add a few tweaks to it.

Just save this as a bookmark, and you can view the source of any site with just a click (even "protected" sites :rolleyes: )


javascript:var newWin=window.open(); newWin.document.body.innerHTML=('<b style="font-family:Verdana; font-size:9pt;">Source of '+location.href+'</b><br><br><br><xmp style="font-family:Verdana; font-size:8pt; color:#000080;"><html>'+document.getElementsByTagName('html')[0].innerHTML+'</html></xmp>'); newWin.select(); newWin.focus(); void(0);


Just remember to remove the space in "javascript:"

View 13 Replies View Related

Open Bookmarklet In New Window?

Oct 6, 2010

I found this bookmarklet which I'm using in Firefox Would anyone here be willing to modify it to display its results in a new tab, instead of using the current tab?

Code:
javascript:q = "" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (!q) q = prompt("You didn't select any text. Enter a search phrase:", ""); if (q!=null) location=("http://www.google.com/search?num=100&q=site:" + escape(location.hostname) + " "" + escape(q.replace(/"/g,"")) + """).replace(/ /g, "+"); void 0

View 1 Replies View Related

Document.body.outerHTML Via Bookmarklet

Aug 11, 2006

I'm trying to create a bookmarklet on IE6, that passes the outerHTML of the body element as a GET param my site.

The problem is that for some page (ie mail.yahoo.com) the bookmarklet does not work while for other pages (simpler ones) it does work....

View 2 Replies View Related

Bookmarklet With Safari (windows Version)

Jun 12, 2007

I have bookmarklets with a # in their urls but safari changes the
# to %23. And unfortunately, the bookmarklet does not work with %23.
You need to change it back manually to #.

View 3 Replies View Related

Make Bookmarklet Open In New Window?

May 21, 2009

I need this bookmarklet (below) to open in a new window and display the info there. It needs to work in both FF and IE. It would be in one line in the bookmarklet but I expanded it for readability. It should work against our site: [URL]

[Code]...

View 2 Replies View Related

Dictionary Bookmarklet To Open In New Window

Aug 6, 2010

How could I make this useful dictionary bookmarklet open in a new window?

javascript:var%20t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset||document.characterSet);if(t!=''){ location.href='http://translate.google.com/translate_t?text='+t+'&hl=en&langpair=auto|en&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+escape(location.href)+'&hl=en&langpair=auto|en&tbb=1&ie='+e;};

Its the "To English" bookmarklet as featured on lifehacker (http://lifehacker.com/5168984/to-english-bookmarklet-quickly-easily-translates-any-text-with-one-click).

View 1 Replies View Related

Writing To A Text File By Using Bookmarklet In Firefox?

Jul 13, 2010

I am trying to write a bookmarklet that extract a citation information from a web page in a new text file for the client by using javascript.

but I could not find any solution where writing to a text file is allowed with firefox by using javascript.

the application suppose to be run on the client side only.

View 2 Replies View Related

JS Bookmarklet Opens New Window Instead Of Working In The Current One

Jul 28, 2011

I have found a script for opening all linked images of one page in a new window and displaying all images in full size inline. It works so far, however:

I want the images to be displays in the current window i am in instead of opening a new window.

Here is the code:

Code:
javascript:(function(){function%20I(u){var%20t=u.split('.'),e=t[t.length-1].toLowerCase();return%20{gif:1,jpg:1,jpeg:1,png:1,mng:1}[e]}function%20hE(s){return%20s.replace(/&/g,'&').replace(/>/g,'>').replace(/</g,'<').replace(/"

[Code]....

View 3 Replies View Related

Twitter Bookmarklet That Will Tweet Current Page

Nov 1, 2009

I am trying to make a twitter bookmarklet that will tweet the current page, I currently have this code:
Javascript:window.open('[URL]'+self.location)
But when I try it, it changes the page its tweeting to just show [object Window].

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved