Archive for Category ‘Javascript‘

Generic clomiphene clomid

I like to use “simple” text editors rather then generic clomiphene clomid word processors to write, I use TextMate on OSX and TextPad on Windows, adopting the generic clomiphene clomid OPML editor when i need to support and track structure. But when generic clomiphene clomid I saw Writeroom generic nexium nexpro about a generic clomiphene clomid month ago I was struck with its beautiful design and generic clomiphene clomid essential feature set, I thought that it would have been generic clomiphene clomid great if such a kind of editor existed on the generic clomiphene clomid web (I was constantly using gmail drafts to generic clomiphene clomid jot down notes while not in my office). I have generic clomiphene clomid seen that many other around me are doing pretty much the generic clomiphene clomid same so having some time this month I did go on and generic clomiphene clomid build it myself.

I was planning to start development after I completed Tiber (a web feed reader I’m working on) but then the spreading of the “no frills editor” meme around the blogsphere (see here, here generic plavix sale and here) made me change my plans and generic clomiphene clomid I suspended Tiber, while working on this writer tool.

Two weeks after The Typer was ready (have a look at the screencast!).

I have generic clomiphene clomid put it online with the hope to to show the work and generic clomiphene clomid to receive some feedback. If anyone wants to test it, just register your generic clomiphene clomid email on the site and i’ll send you an invitation (I’m doing this generic clomiphene clomid just to be able to handle the load gradually on the generic clomiphene clomid server, I’ll open up the service in september).

Generic clomiphene clomid

I needed to load and parse some opml in a javascript: any recent browser (aka Mozilla, Firefox or IE6) has the abilty to asyncronously load a resource from the net (all the AJAX stuff is based on this), moreover of this generic clomiphene clomid is an xml file it is possible to have it parsed into a generic clomiphene clomid DOM object.
But the browsers i tested don’t parse correctly the generic clomiphene clomid content returned from the server if it cannot be identified as xml from generic clomiphene clomid the MIME type (or the extension). This can generic clomiphene clomid be a problem if you cannot set the mime type returned form the generic clomiphene clomid server (e.g. is someone elses’ server) and the extension is not .xml (in my case it is .opml).
A search on google didn’t come up with a solution, so here it is how i did it:

function parse(text) {
	var doc;
	if (typeof DOMParser != 'undefined') {
		var parser = new DOMParser();
		doc = parser.parseFromString(text, "text/xml");
	}
	else if (typeof ActiveXObject != 'undefined') {
		doc=new ActiveXObject("Microsoft.XMLDOM");
		doc.async="false";
		doc.loadXML(text);
	}
	return doc;
}
function load (url, callback) {
	var httpRequest;
	if (typeof XMLHttpRequest != 'undefined') {
		httpRequest = new XMLHttpRequest();
	}
	else if (typeof ActiveXObject != 'undefined') {
		httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
	}
	if (httpRequest) {
		httpRequest.open('GET', url, true);
		httpRequest.onreadystatechange = function () {
			if (httpRequest.readyState == 4 &&
				httpRequest.status == 200) {
				callback(httpRequest.responseText);

			}
		};
		httpRequest.send(null);
	}
}

I did separate the generic clomiphene clomid loading and parsing phases, and using DOMParser for Mozilla/Firefox and generic clomiphene clomid XMLDOM for IE, passing them the xmlText. This has been tested with Firefox and generic clomiphene clomid InternetExplorer 6