String.prototype.camelToProper = function () { if (this == null || this == "") { return this; } var newText = ""; var characters = this.split(""); for (var i = 0; i < characters.length; i++) { if (characters[i] == characters[i].toUpperCase() && i != 0 && !(characters[i + 1] == characters[i + 1].toUpperCase()) && characters[i - 1] != " ") { newText += " "; } newText += characters[i]; }
return newText;}Friday, October 21, 2011
JavaScript CamelCase string conversion to Proper Case
Monday, October 17, 2011
Speed Test: Document-Relative vs. Root-Relative
Today I got curious if there was a speed difference for loading using Document-Relative paths or Root-Relative paths.
I created a sample test on one of my sites which loads up 583 thumbnails and put in a trigger to change the type of relative pathing utilized.
I did a series of load time measurements and based on these tests it appears that the difference insignificant. Therefore, use whichever method you like best.
Document-Relative Paths: http://aiwl.us/test/?relativity=document
| Load Time | First Byte | Start Render | DOM Elements | Result (error code) |
|---|---|---|---|---|
| 20.844s | 0.516s | 0.890s | 586 | 0 |
| Document Complete | ||||
| Time | Requests | Bytes In | ||
| 20.844s | 583 | 3,050 KB | ||
| Fully Loaded | ||||
| Time | Requests | Bytes In | ||
| 20.844s | 583 | 3,050 KB | ||
Root-Relative Paths: http://aiwl.us/test/?relativity=root
| Load Time | First Byte | Start Render | DOM Elements | Result (error code) |
|---|---|---|---|---|
| 20.606s | 0.430s | 0.832s | 586 | 0 |
| Document Complete | ||||
| Time | Requests | Bytes In | ||
| 20.606s | 583 | 3,070 KB | ||
| Fully Loaded | ||||
| Time | Requests | Bytes In | ||
| 20.606s | 583 | 3,070 KB | ||
Wednesday, June 15, 2011
How to get the value of a FCKeditor based using jQuery
Today I ran into the need to use jQuery AJAX on an FCKeditor box generated by
For my cftextarea I have it wrapped in a div that we will identify with a class of "fckEditorBox".
For the jQuery you can use:
var fck_iFrame = $(".fckEditorBox iframe").contents().find("#xEditingArea iframe");
var fckEditorVal = fck_iFrame.contents().find("body").html();
Now the html contents of the fckEditor are now stored in the fckEditorVal.
Enjoy.
