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'?
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.
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;
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?
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.
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
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.
can anyone please tell me how can i disable or remove the X button(i.e. close button) on the browser. i just want to apply this only to the one web page of my application.
Is there a way to use inline javascript that will prevent any javascript after it (in the same page) from executing? So, for instance I could have something like:
-Content- -JS A- -Content- -JS B- -JS C-
'JS A' would execute, 'JS B' would be the code I'm asking about and it would cause 'JS C' to not do anything. Sorry if this is an off-the-wall question. I good with C/C++, VB, Ruby, Lua, HTML, etc, but I haven't gotten to Javascript (or Java) yet so I have no idea what the capabilities or environment setup are like.
When browsing a web page a user has the ability to highlight content on a page (by holding down the left mouse button and dragging the mouse over the desired content). Is there a way to disable this option?
i have a series of pages that i only want view once and then ended ...is the a way to disable a page after a single view with jquery? or something to delay the next view to give me time to kill link.
theres pages are running off a random page selector
Simple question. How can I disable a textarea when a page is loaded(and re-enable it on a button click). I have tried several things with no luck. What I have tried is at the bottom. Here is mycode snippets: Code to generate the text area <%=Html.TextAreaFor(Function(model) model.NewestComment.Comment, 2, 60, New With {.id = "comment"})%> JQuery Code I have tried to disable it.... <script type="text/javascript"> $(document).ready(function() { $( "NewestComment.Comment").attr("disabled", "disabled"); I also tried.... $( "comment").attr("disabled", "disabled"); Neither of which worked.
I'm wondering if it's possible for a script to enable/disable all input elements on the page with some sort of toggle button. I googled it but didn't find anything too useful except for this: [URL] but I'm not sure how to edit it for the toggle.
We use a variety of plugins on a wordpress site we're developping. But two of them seem to be conflicting, causing one not to load/work properly. One uses jQuery and the other one uses scriptaculous/prototype. It seems those two have some issues running together.
As jQuery is the default library loaded, is there a way (without modifying the $-function) to exclude jQuery from loading from this one page where Scriptaculous is needed?
I have written the following script which enables/disables checkboxes on my page when a radio button is selected.[code] What I would like to do is create another function called checkval() like below, which will check the value of my radio button (id: email_alerts). If the value is equal to "on" then it will run enableCheckboxes().