Tags: javascript

chud – GreaseMonkey script for Urban Dead

I’ve finished putting together my first GreaseMonkey script! It’s called “chud”—the Caddy Healer for Urban Dead. It’s been built to plug-in to my favorite web-based zombie apocalypse, Urban Dead. It will bring up a list of anyone in your map cell who can be healed with a first-aid kit, and allow you to click directly on their name in that list to automagically heal them. I uploaded it to userscripts.org, the GreaseMonkey user scripts repository. Click here to check it out.

Browser-independent XSLT with Javascript

To piggy-back on the Javascript function to load an XML document: what can be done to load an XSL stylesheet and apply it to the XML? For the most part, loading it is a snap… but, as is often the case, Internet Explorer is the exception to the rule. So, we write a function that tells every browser except for IE to use our previously-defined loadXML() function, and an exception for Internet Explorer to load the XSL as a “free-threaded document.” Read More →

Browser-independent XML load with Javascript

XML data is, in a word, awesome. It’s standardized, it’s well-formatted, and there are XML parsing methods in nearly every major programming language–including Javascript. However, when using Javascript, the nasty problem of “browser agnosticism” comes into play: a method that works in Firefox may not (read: won’t) work in Internet Explorer; and both methods may fail for WebKit (Safari, Chrome, etc.). Read More →

Wipe all elements in a form with Javascript

Javascript has a nifty method associated with the form DOM object called reset(). Using this method will revert all values of the form’s associated input controls to the values they contained when the page was last sent to the user’s browser. That’s great… but if you want to revert the values to nothing, then some scripting is required: Read More →