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


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

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

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 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

Use String.replace That Is Not Case Sensitive And Replace Every String Found?

Jul 27, 2010

Here is my code:

<script type="text/javascript">
var str="Welcome to Microsoft! Microsoft Microsoft";
var stringToBeFound = 'Microsoft'
var ReplaceString = 'site'
document.write(str.replace(stringToBeFound , ReplaceString ));
</script>

My problem is im trying to use string.replace that is not case sensitive and replace every string found. I could use regular expression with it but my stringToBeFound is a dynamic variable im getting it from my database

View 9 Replies View Related

String.replace(/.../,str) Won't Replace?

Dec 20, 2009

i am trying to make an online graphing calculator with javascript. dont ask how because i dont know. but there is an annoying error in a do...while loop. although it should break out of the loop when the |'s (absolute value signs) are replaced with Math.abs( and ). here is the code.

var initec = function(){
var rg = {
}

[code]....

View 9 Replies View Related

Replace A String With Another String, The Replace Lines Look Like This?

Aug 19, 2010

I ran into a problem that I could not fix myself, I am trying to replace a string with another string, the replace lines look like this:

Code:
var word = document.getElementById("word").innerHTML; document.getElementById("word").innerHTML = wordd.replace(/B/g, '<span class="style106">B</span><span class="style107"> </span>'); It works just perfectly if left alone, but I need to replace every letter inside this string, adding those style and span tags around each and every letter. So if I add another line to this code, like this:

[Code]...

View 5 Replies View Related

How To Replace <br> With </p><p>

Jun 30, 2010

Is is possible to strip out some legacy <br> tags and replace them with </p><p>? A line break after the closing para would also be nice. And, can I target the asterisk and following space (see below) and delete it?

I've had a look at jQuery and managed to replace the br with p tags but they're the wrong way round i.e. open then close as it just manipulates the DOM not my string.

The current code/text is supplied from a database I don't have access to and the client doesn't have the time (nor the inclination I would suspect) to amend it.

Old existing code:

<p>blah blah blah<br>* blah blah blah<br>* blah blah blah<br>* blah blah blah</p>

New code wanted:

<p>blah blah blah</p>
<p>blah blah blah</p>
<p>blah blah blah</p>
<p>blah blah blah</p>

View 4 Replies View Related

Replace One Div With Another

Aug 6, 2010

I'm looking for a very simple script to replace one div with another. I've found a few but they seem overly complicated with features I don't need. I simply want to be able to click on a div and for it to be replaced with another div previously hidden.

View 12 Replies View Related

Replace

Nov 14, 2007

I'm trying to convert comma's with dots.

For example if: IS_Attr_OMZETINTERN.value="250,00";
then the result should be:
IS_Attr_OMZETINTERN.value="250.00";

However my code seems to fail on the second line of my code :S

var str = IS_Attr_OMZETINTERN.value;
var str2 = str.replace(',','.');
IS_Attr_OMZETINTERN.value=str2;

View 2 Replies View Related

Replace The With \

May 27, 2009

How to replace the with \ for e.g:MEG20070500025612;

View 7 Replies View Related

Location.replace In FF

Jul 23, 2005

I've got a simple navigation system set up in a framed site:
navigation/top frame and a main body frame. Whenever you click on a
navigation button it passes the new location to this function:

gotoNewPage = function(loc) {
main.location.replace(loc);
// alert(loc);
}

which changes the page loaded in the main frame. This seems to work well
until I put a link in the page in the main frame, say:

<a href="#" onclick="top.gotoNewPage(&#391;_7.htm')">Click me</a>

In IE the page changes to &#391;.7.htm'.
In FF (and MZ) the page "flashes" but doesn't change.
If I uncomment the alert the page changes.
If I put the link in the nav frame the page changes in FF.

How can I get FF to behave in this instance?

View 1 Replies View Related

Simple Replace

Feb 20, 2006

I want to replace all occurences of this ),( in my string with a comma .....

statement=statement.replace("),(",",");

This only does the first. I've been reading about adding "/g", but haven't
got it to work. I've messed about with no luck. Any quick pointers?

View 2 Replies View Related

Javascript Replace?

Apr 13, 2006

I see the use of Javascript replace all over the web. What are all the
character sequences? (sorry I am a bit of a newbie at this).

i.value.replace(/[^d]+/g, '');

I understand that /g is global and /i is case sensitive, but what are
the rest? I am asking because I am trying to write a function that
takes an input and replaces everything but numbers and a . (for decimal
numbers).

View 3 Replies View Related

Location.replace

Oct 16, 2006

I am creating a "Please wait..." page to show a friendly message to my
site users while the data is being loaded. I am using
location.replace() javascript function to do this.

The problem that I am facing is displaying the records that the
application has already processed on the wait page. Does anybody know
what can I do to pass data field value from the end page where the data
processing is going in background on to the wait page.

View 5 Replies View Related

Syntax -0 At End Of Replace()

Nov 13, 2006

I found this in one of my old scripts but I can't remember what the -0 was used for. I remember it was a shortcut method but I can't remember for what. Does this ring a bell with anyone?

var Pattern = /px/;
var T = paddingArry[0].replace(Pattern, "")-0;

View 5 Replies View Related

Replace One DOM Node With Two?

Dec 18, 2006

I have a question about manipulating a document. Suppose for example
that I had a table like this:

<table>
<tr id="row1">
<td>R1C1</td>
</tr>
<tr>
<td>R2C1</td>
</tr>
</table>

What I want to do is add an onclick event handler to row1 to insert a
row after row1. I can't seem to find a way to do it though. After
creating the new row node, I could try something like
document.getElementById("row1").parentNode.appendChild(newNode) but
that would add the new row to the bottom of the table. The
insertBefore() method is the right idea but I want to insert the new
row AFTER row1 and there doesn't seem to be an insertAfter() method.

I thought about navigating through the DOM tree to get the row after
row1 and then using insertBefore() but the table is generated
dynamically and there won't necessarily be a next row.

View 18 Replies View Related

String.replace

Apr 4, 2007

I was tring to write a function to make that took the letters that a
user is searching for and making the first occurrence of it bold in
the results (ignoring the case).

>From reading javascript books and looking at posts in this group, I

thought this would work. Perhaps I misunderstood what $1 is. But in
the results, I am getting a bold $1 with IE6.

How can I determine what the occurrence of the phrase is in the
correct case?

I realize I can write this parsing the string without regular
expressions but I thought this would be cleaner.

var match = new RegExp( escapeCharsForRegExp(typedLetters), "i");
if (match.test(text))
{
text = text.replace(match, '<b>' + '$1' + '</b>' );
}

View 2 Replies View Related

String.replace(/</g,'&lt;');

Jul 20, 2005

Three questions

1)

I have a string function that works perfectly but according to W3C.org
web site is syntactically flawed because it contains the characters </
in sequence. So how am I supposed to write this function?

String.replace(/</g,'&lt;');

2)

While I'm on the subject, anyone know why they implemented replace using
a slash delimiter instead of quotes? I know it's how it's done in Perl
but why is it done that way?

3)

One last regexp question:
is it possible to do something like this:
String.replace(/<(.*?)>(.*?)</$1>/ig,'&lt;$1&gt;$2&lt;/$1&gt;');
This is just an example where a sub-match used in a regular expression
must sub-match again exactly as it did the first time later in the same
string. But I don't know how to do that in a regexp although it seems
like it should be possible.

View 4 Replies View Related







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