Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

JavaScript Tables and Two Dimensional Arrays

Ever want an easy way of converting a two dimensional array into an HTML table in JavaScript? Would you like to access items in a two dimensional JavaScript array by aliasing rows and columns? Now you can!

JavaScript object merge

Ever wanted to merge several javascript objects into one object? What about merging JavaScript functions or arrays? Now you can!

JavaScript object walker

Ever wanted to recursively iterate through an object and its properties without writing all that boilerplate code? Now you can!

JavaScript object foreach

Ever wished JavaScript had a forEach function for dealing with objects? Now it does!

HTML Table of Contents Generator

Would you like to automatically add a table of contents to your webpage based on the headings in it? The html-table-of-contents module will do it for you.

HTML5 Audio Tag Injector

Would you like to automatically add html5 audio to your webpage when you create links to audio files? The audio-tag-injector will do it for you.

Integrate Ace Editor in CKEditor Source View

Integrate Ace Editor in CKEditor Source View

Have you ever wanted to have code highlighting and other advanced features in the CKEditor source view? Well, now you can! I've written up a script that will allow you to integrate any web based code editor into CKEditor's source view. It's extremely easy to do using my code. Simply set up a web page running your preferred source code editor in fullscreen mode and then use my script to inject it into the CKEditor. No more screwing around, just awesomeness in your editor!

disable-output-escaping is not supported in Firefox

CDATA concatenation

or: disable-output-escaping is not supported in Firefox

Recently I was working on generating XML documents to contain arbitrary text. Naturally I wanted to make things easy on myself by wrapping said arbitrary text with CDATA sections. It just so happens that the text in question contains CDATA tags and as everyone knows, CDATA sections can not be nested. After searching around the web and running into "answers" that were pure opinion on what XML is, is for, and should do, I still didn't have the simple answer to a common problem so I wrote it myself and posted it here.

Javascript: HTML documentation and Intellisense for Visual Studio

Problem: I want to generate HTML documentation for my JavaScript files and have intellisense support in Visual Studio. I do not want to write massive comment blocks to support this.

Solution: Write javadoc style comments for jsdoc toolkit per standard practice. The rest can be easily automated.

Turn PHP Built in Web Server into a Proxy

PHPMonkey? I wanted to use PHP to alter web pages and http traffic, so I downloaded many scripts that said they were PHP proxy. I didn't find any that really worked, they all just fetched the page, mangled all the links, and puked it back at me. I couldn't log in to any website, and if the site I was visiting used javascript to inject links, scripts, and all sorts of other dynamic content these so called proxies failed horribly. So, I figured I'd try writing one myself, and I've come up with something that works.

Unexpected 'in'. Compare with undefined, or use the hasOwnProperty method instead

Unexpected 'in'. Compare with undefined, or use the hasOwnProperty method instead.

Problem: JsLint Confusion

I don't understand why JsLint is giving me this error message: Unexpected 'in'. Compare with undefined, or use the hasOwnProperty method instead.(see infix_in at http://www.jslint.com/msgs.html). The "in" operator seems to be very clearly defined. There appear to be only three outcomes for 'someProperty' in anObject which is one of: true, false, or a TypeError exception is thrown. When it evaluates to true, then there is definitely 'someProperty' in anObject. When it evaluates to false there is definitely not 'someProperty' in anObject. When a TypeError is thrown there is definitely not 'someProperty' in anObject because anObject is either null or it isn't an object at all. This all seems very clear to me. When I want to know if an object has a property and, I don't care if that property is the object's own property or being inherited and, I don't care what the value of the property is, then I simply look for 'someProperty' in anObject.

Set Default Values for Optional Function Parameters in JavaScript

Set Default Values for Optional Function Parameters in JavaScript

Setting the default value of an optional parameter in a JavaScript function is easy. Since it is perfectly acceptable to call a function in JavaScript with more or less parameters than the function was defined with, you may wish to define every acceptable parameter for your function and set a default value for the truly optional parameters. JavaScript does not have a way of explicitly defining an optional parameter because, it seems, by default all parameters are optional. So how do we find out whether a specific parameter was supplied and, in the case where it was not, set a default value for that specific parameter?

Selenium Extension: RecordMouseDownUp

Selenium Extension: RecordMouseDownUp

Sunday, April 15, 2012

Today I wrote another extension for the Selenium IDE: RecordMouseDownUp. This has been tested with the Selenium IDE 1.7.2 and is known to work on standard devices (my friend said someone's making a sex toy for the iPad; If you happen to try it out and this extension works as expected, keep it a secret you perv! :O )

Selenium Extensions: RecordSpecialKeys, RecordAllClicks

Selenium Extensions: RecordSpecialKeys, RecordAllClicks

Saturday, April 14, 2012

Today I wrote two extensions for the Selenium IDE: RecordSpecialKeys and RecordAllClicks. These have been tested with the Selenium IDE 1.7.2 and are known to work on even the most convoluted web cloud app-ish bullshit, except for the meta key in RecordSpecialKeys.js: that's untested. If someone tries it out and the meta key works like the rest of the keys, let me know. ;)