javascript

Greasemonkey script for inserting math in gmail

I wish an easy way to communicate mathematical equations with gmail. There's a javascript script called AsciiMath, which should translate Tex-like equations into standard mathML. I thought that it would be nice to use this script with GM. I thought that before sending the email, this script would convert all the TeX-like equations in y...

Greasemonkey and Gmail - parsing message contents

I want to read the contents of Gmail messages and add some fancyness on links. Here's some code: unsafeWindow.gmonkey.load("1.0", function(gmail){ gmail.registerViewChangeCallback(function(){ if (gmail.getActiveViewType && gmail.getActiveViewType() == "cv") { var viewElement = gmail.getActiveViewElement() // Do things ...

How do you copy an inline style element in IE?

IE does not allow writing to the innerHTML property of style or head elements. So how do you copy a style element from the head of one document to another? ...

Getting json on Ajax response callback

Hey! I am trying to create a little ajax chat system (just for the heck of it) and I am using prototype.js to handle the ajax part. One thing I have read in the help is that if you return json data, the callback function will fill that json data in the second parameter. So in my php file that gets called I have: header('Content-type...

Why does IE open form submission in a new window and not dynamically inserted iframe.

I am trying to get post a form to a hidden, dynamically inserted iframe, but in Internet Explorer the form submission opens in a new window. var iframe = document.createElement('iframe'); iframe.name = 'hidden_iframe'; iframe.className = 'NotVisible'; iframe.id = 'hidden_iframe'; document.body.appendChild(iframe); var my_form = documen...

Google Maps API - Slow loading javascript

Hello. I am using Google Maps API to display a map on a certain page. Problem is that the file http://maps.google.com/maps?file=api..... sometimes happens to load very slow - decreasing the page's performance, because the rest of the JavaScript is first loaded on document ready, which its rarely reaches - because the browser locks up w...

Facebook Connect Dialog Popup

Hello, When using the "Connect" facebook connect button, when I click it, it opens up a new popup window outside of the current window. This is quite annoying, how am I able to use the inline modal dialog that is found on most sites? I've attached a sample site to see if you can make anything out of it. http://bit.ly/c9Emi Thank you....

prototype.js Ajax.PeriodicalUpdater call own function to update

Hey! Anyone know if it is possible to make the PeriodicalUpdater pass the data it received to a function I assign to update the desired field? I want to process the data I receive and then have the PeriodicalUpdater function update the field. ...

passing value to eventListener functions

for ( var i=0; i<thumbs.length; i++) { var num = i; Core.addEventListener(thumbs[i], "click", Slide.thumbClick); } in the above code, i want to pass the value of var num to the thumbClick eventlistener. but i am unable to. if i try to display that value, it gives an undefined value. pls help ...

ASP.NET Forms autosave

We have an internal asp.net forms app where one page is essentially a WYSIWYG editor that users enter 3-5 paragraph reports into. What are the best options for an autosave feature with the minimum amount of user-interrupt? I don't want to force a postback every five minutes or so unless I have to, but rather maybe some type of client-s...

Having an issue with GetElementbyId silverlight and encoding

I am stumped here. I have a project in which I call the following StringBuilder StringBuilder = new StringBuilder(); StringBuilder.Append("<script type='text/javascript' id='VideoSelection'> "); StringBuilder.Append("function SilverlightChangeVideo(videoID) "); StringBuilder.Append("{ "); StringBui...

How can I determine if a div is scrolled to the bottom?

How do I determine, without using jQuery or any other JavaScript library, if a div with a vertical scrollbar is scrolled all the way to the bottom? My question is not how to scroll to the bottom. I know how to do that. I want to determine if the the div is scrolled to the bottom already. This does not work: if (objDiv.scrollTop == obj...

Is there a way to detect a DOM-node change in Javascript?

I am looking for a way to detect if anything changes within a given DOM node. Is there an event or other technique that would do this? Thanks! ...

linking to options drop down

I don't know if this is possible so bare with me on this one. Can you link to a specific value in an options drop down box from another page? In other words, let's say that I'm on page 1 and I want to anchor link to page 2 that has an options drop down box with 3 different values in it. Let say by default when you go to page 2, the drop ...

Changing the property name dynamically on click of a button : Javascript

Hi, Iam ading rows in a table on click of add button. Each row contains name,class,year text boxes. For the 1st row : property name will be...... name_1,class_1,year_1 For the 2nd row : property name will be...... name_2,class_2,year_2 If suppose, i delete the 1st row (name_1,class_1,year_1) then the second row's property name sho...

JavaScript and jQuery scrolling issue in all browsers

Hi, I just launched http://tweetmp.org.au/ with a stack of new features, including the MP Spotlight you can see on the Homepage Every few seconds, the following code is run, // get the next it var nextId = ids[Math.floor(Math.random() * ids.length)]; $.get('/GetSummary?id=' + nextId, function(result) { if (result) { ...

Reliable cross browser way of setting Status bar text

I've heard of window.status and that it can be used to control the browser's status bar text, but I would like to know if there are better or newer methods that can do the same, with most modern browsers. Also, is it possible to change the status text multiple times after the page has loaded? ...

window.opener.focus() fails in IE, and works in FireFox

Hi, i have the problem that IE cant bring up opener window when i call opener.focus() method window.opener.focus(); // After that, child window stay in front. html1.htm file: <script type="text/javascript" language="JavaScript"><!-- function toCompare() { wCompare = window.open("html2.htm", "wCompare", "width=800,height=600,res...

When serving JavaScript files, is it better to use the application/javascript or application/x-javascript

The whole question fits in the title. And to add some context: I'm not asking what is the best according to what the specs are saying, but rather what works the best given the mix of browsers deployed nowadays. Some data points: Google uses text/javascript for the JS used on their home page. Google uses text/javascript on Google Docs....

When serving JavaScript files, is it safe to gzip it by default

The question fits in the title. I am not interested in what the spec recommend but what the mix of browsers currently deployed support the best. Google Docs gzips their JS. The Google AJAX Libraries API CDN gzips JS. Yahoo gzips the JS for their YUI files. The Yahoo home page gzips their JS. So I think that the answer to my question ...