<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marilyn Burgess &#187; Javascript</title>
	<atom:link href="http://marilynburgess.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://marilynburgess.com</link>
	<description></description>
	<lastBuildDate>Mon, 29 Aug 2011 16:33:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Put a handle on mooTools Drag.Move</title>
		<link>http://marilynburgess.com/2010/01/put-a-handle-on-mootools-drag-move/</link>
		<comments>http://marilynburgess.com/2010/01/put-a-handle-on-mootools-drag-move/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 17:54:45 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Drag.Move]]></category>
		<category><![CDATA[Handle]]></category>
		<category><![CDATA[mooTools]]></category>
		<category><![CDATA[not clickable inputs]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=543</guid>
		<description><![CDATA[In the next version of List Central the little popup form that enables the user to edit list items will be dragable so that the list maker can move it to where ever they would prefer to have it. It is a great little feature that really adds to the usability of List Central. When [...]]]></description>
			<content:encoded><![CDATA[<p>In the next version of List Central the little popup form that enables the user to edit list items will be dragable so that the list maker can move it to where ever they would prefer to have it. It is a great little feature that really adds to the usability of List Central.</p>
<p>When I was implementing the dragable popup form feature I was pleased at how easy it was to use <a href="http://mootools.net/docs/more/Drag/Drag.Move">mooTool&#8217;s Drag.Move</a>. My little form was easily moved to anywhere in the browser window, just as I intended. A problem arose when I tried to <em>use</em> the form inside the dragable element. The input elements of the form were not clickable, I could not get them to have focus, as if they were behind an invisible layer, which is actually what was going on. The form elements inside the dragable div they sitting in were not clickable, because they were dragable! Ack!</p>
<p>Happily I was able to find a solution for my problem: the dragable element required a <em>handle</em>.</p>
<p><a href="http://marilynburgess.com/images/2010/01/edit.gif"><img class="alignnone size-medium wp-image-544" title="edit" src="http://marilynburgess.com/images/2010/01/edit-300x157.gif" alt="" width="300" height="157" /></a></p>
<p>The above image shows the Drag.Move handle in the upper right corner of the edit list item form div. You cannot move that dragable element unless you grab it by the handle, the move icon. Using a handle frees up the rest of the element for other clickable elements, like a form.</p>
<p>The JavaScript for including a handle in your Drag.Move element is as follows:</p>
<pre class="brush: javascript">
new Drag.Move(&#039;dragableDivID&#039;, {handle: &#039;dragHandleID&#039;});
</pre>
<p>and the HTML, with some CSS:</p>
<pre class="brush: html">
&lt;style&gt;
.dragHandle{
    background:transparent url(/images/move.png) no-repeat scroll 0 0;
    cursor:move;
    float:right;
    height:30px;
    margin:15px 15px 0 0;
    width:30px;
}
&lt;/style&gt;
&lt;div class=&#039;dragableBox&#039; id=&#039;dragableDivID&#039;&gt;
     &lt;div class=&#039;dragHandle&#039; id=&#039;dragHandleID&#039;&gt;&lt;/div&gt;
     &lt;div class=&#039;dragableInner&#039;&gt; The content goes here&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>In looking for this solution I found this great tutorial series by <a href="http://www.consideropen.com/">Consider:open</a> called <a href="http://www.consideropen.com/blog/tag/30-days-of-mootools/"><strong>30 Days of mooTools</strong></a>.  The entire series is very well done. Web developers at any level are likely to learn something new about mooTools there. Check out thethe <a href="http://www.consideropen.com/blog/2008/08/30-days-of-mootools-12-tutorials-day-12-drag-and-drop-using-dragmove/">tutorial on Drag.Move</a> from the series that helped me out.</p>
<h3  class="related_post_title">You might also like...</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2010/01/maintaining-dynamic-height-on-a-fx-slide-element-with-mootools/" title="Maintaining Dynamic Height on a Fx.Slide element with Mootools">Maintaining Dynamic Height on a Fx.Slide element with Mootools</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2010/01/put-a-handle-on-mootools-drag-move/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CKEditor on List Central</title>
		<link>http://marilynburgess.com/2010/01/nicedit-on-list-central/</link>
		<comments>http://marilynburgess.com/2010/01/nicedit-on-list-central/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 16:49:47 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CKEditor]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WYSIWYG]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=477</guid>
		<description><![CDATA[I am currently working on several improvements to the List Central interface, one of which includes the addition of CKEditor. CKEditor is a Javascript What You See Is What You Get (WYSIWYG) editor, which will make it easier for List Central users to include links, and text formatting in the list item descriptions. I spent [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently working on several improvements to the List Central interface, one of which includes the addition of <a href="http://ckeditor.com/">CKEditor</a>. CKEditor is a Javascript What You See Is What You Get (WYSIWYG) editor, which will make it easier for List Central users to include links, and text formatting in the list item descriptions.</p>
<p><img class="alignnone size-full wp-image-537" title="ckeditor" src="http://marilynburgess.com/images/2009/12/ckeditor.png" alt="ckeditor" width="367" height="272" /></p>
<p>I spent a great deal of time trying out different WYSIWYG editors for List Central. I found many neat ones, but CKEditor was the one that gave me the fewest headaches in integrating the editor into the highly dynamic interface of List Central.  CKEditor is a full featured editor that offers a wealth of features that are not needed on List Central, which makes the editor a little heavier than I would like, but it&#8217;s a fair trade off for an editor that works properly.</p>
<p>One thing that I didn&#8217;t like about CKEditor is the hideous dialog popup for adding links. It is aesthetically ugly, and offers far too many options. While I certainly wouldn&#8217;t be taking away the ability to add links in editor, I couldn&#8217;t keep the functionality the way it is, I&#8217;m far to picky to let something that looks like this:</p>
<p><a href="http://marilynburgess.com/images/2009/12/ckug.gif"><img class="alignnone size-full wp-image-541" title="ckug" src="http://marilynburgess.com/images/2009/12/ckug.gif" alt="" width="250" height="230" /></a></p>
<p>to get passed me. Call me shallow if you will, but I had to make my own CKEditor plugin for adding links that would use the KISS (Keep It Simple Stupid) design principle and have the List Central asthetic.</p>
<p>CKEditor is still a young piece of open source software, and lacks proper documentation. Be careful with this, as CKEditor is the next version of FCKEditor, which is very different. Following the FCKEditor documentation is likely to lead you astray. I used the following resources around the web to figure out how to make my plugin work:</p>
<ul>
<li><a href="http://blog.tommed.co.uk/2009/09/07/how-to-create-a-ckeditor-v3-plugin">Tommed explains how to make a CKEditor plugin by building a better image uploader</a></li>
<li><a href="http://ajithmanmadhan.wordpress.com/2009/12/16/customizing-ckeditor-and-adding-a-new-toolbar-button/">Ajithmanmu explains how to create a CKEditor plugin by building a simple add link plugin.</a></li>
</ul>
<p>Happy plugin making!</p>
<h3  class="related_post_title">Random Posts</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2010/03/jamie-olivers-food-revolution/" title="Jamie Oliver&#8217;s Food Revolution">Jamie Oliver&#8217;s Food Revolution</a></li><li><a href="http://marilynburgess.com/2009/03/thank-you-failblog/" title="Thank You FAILblog!">Thank You FAILblog!</a></li><li><a href="http://marilynburgess.com/2009/04/share-buttons-are-so-easy/" title="Share Buttons are SO Easy!!">Share Buttons are SO Easy!!</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2010/01/nicedit-on-list-central/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Maintaining Dynamic Height on a Fx.Slide element with Mootools</title>
		<link>http://marilynburgess.com/2010/01/maintaining-dynamic-height-on-a-fx-slide-element-with-mootools/</link>
		<comments>http://marilynburgess.com/2010/01/maintaining-dynamic-height-on-a-fx-slide-element-with-mootools/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 03:04:35 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[dynamic height]]></category>
		<category><![CDATA[Fx.Slide]]></category>
		<category><![CDATA[mooTools]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=475</guid>
		<description><![CDATA[List Central uses mooTools for it&#8217;s JavaScript framework. I love it! It makes developing in JavaScript a pleasure, with increased reliability, and nifty eye candy to play with. I recently started using FX.Slide in the next iteration of the List Central interface. It lets the user open and close &#8220;sliders&#8221; (div&#8217;s with content in them) [...]]]></description>
			<content:encoded><![CDATA[<p>List Central uses <a href="http://mootools.net/">mooTools</a> for it&#8217;s JavaScript framework. I love it! It makes developing in JavaScript a pleasure, with increased reliability, and nifty eye candy to play with.  </p>
<p>I recently started using FX.Slide in the next iteration of the List Central interface. It lets the user open and close &#8220;sliders&#8221; (div&#8217;s with content in them) as they want them. Check out the < a href="http://demos.mootools.net/Fx.Slide">mooTools demo to see FX.Slide in action</a>.</p>
<p>I had one little problem with Fx.Slide though. The problem was that I wanted to be able to dynamically add content to an Fx.Slide, changing the height of the slider div after it has been opened. To my dismay, the implementation of Fx.Slide set the height of the div to specific numbers in pixel to achieve the vertical slider effect. This means that any content I added to the bottom of the div after it was opened would not be shown. In order for the height of the slider div to remain dynamic, I needed the height to be set to &#8220;auto&#8221;, not a specific number.</p>
<p>I had to figure out a way to maintain the the div&#8217;s ability to change in height while still using FX.Slide. I did some fiddling in mooTools source to try to achieve the effect I desired. I changed where FX.Slide set the height of the div to &#8220;auto&#8221;.  After trying it out, I was astonished that it worked! I had moved on to some other development when I realized that my change to the mooTools source brock the fluid motion of my slider. It now opened all choppy and jumpy. It was no longer pleasing to the eye. I had to put the source back the way I found it. I may have learned some about the inner workings of mooTools though the process, but really, messing with the framework&#8217;s source is a path to trouble. </p>
<p>As with many problems, this one&#8217;s solution didn&#8217;t come to me until I put the problem away for a while, and worked on other things. The solution then came to me, and like many other solutions, it seemed so simple, once I knew it.</p>
<p>The trick to maintain dynamic height on a Fx.Slide is to add an onComplete function on to the slider that sets the height of the slider to &#8220;auto&#8221; if the slider is open, like this:</p>
<pre class="brush: javascript">

var formSlide = new Fx.Slide(&#039;FormSlider&#039;, {
        onComplete: function(){
            if(this.wrapper.getStyle(&#039;height&#039;) != &quot;0px&quot;){
                // Check if the slider is open
                this.wrapper.setStyle(&#039;height&#039;, &#039;auto&#039;);
            }
        }
    }).hide();
</pre>
<p>That&#8217;s it! It works like a charm now, just as I want it to. So much trouble, for such a simple solution!</p>
<p>I expect that this solution would work the same on the width for horizontal FX.Slide&#8217;s, though I haven&#8217;t tested it. </p>
<h3  class="related_post_title">You might also like...</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2010/01/put-a-handle-on-mootools-drag-move/" title="Put a handle on mooTools Drag.Move">Put a handle on mooTools Drag.Move</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2010/01/maintaining-dynamic-height-on-a-fx-slide-element-with-mootools/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Ajax Loader Generator</title>
		<link>http://marilynburgess.com/2009/12/ajax-loader-generator/</link>
		<comments>http://marilynburgess.com/2009/12/ajax-loader-generator/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 00:45:41 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Ajax Spinner]]></category>
		<category><![CDATA[Ajaxload]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=471</guid>
		<description><![CDATA[I found this neato AJAX Spinner Generator (Ajaxlad) the other day, and I decided to use it to make some jazzier spinners for List Central. It is super easy to use, it gives you lots of options, and it&#8217;s free! It&#8217;s hard to beat that price! Check it out! Random PostsThe Future of Round CornersJamie [...]]]></description>
			<content:encoded><![CDATA[<p>I found this neato <a href="http://ajaxload.info/">AJAX Spinner Generator (Ajaxlad)</a> the other day, and I decided to use it to make some jazzier spinners for List Central. It is super easy to use, it gives you lots of options, and it&#8217;s free! It&#8217;s hard to beat that price! Check it out!</p>
<p><a href="http://ajaxload.info/"><img class="alignnone size-full wp-image-526" title="spinner" src="http://marilynburgess.com/images/2009/12/spinner1.gif" alt="spinner" width="496" height="514" /></a></p>
<h3  class="related_post_title">Random Posts</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2009/04/images-with-round-corners/" title="Images with Round Corners">Images with Round Corners</a></li><li><a href="http://marilynburgess.com/2011/08/new-music-imelda-may/" title="New Music &#8211; Imelda May">New Music &#8211; Imelda May</a></li><li><a href="http://marilynburgess.com/2009/05/companies-that-use-perl/" title="Companies that Use Perl">Companies that Use Perl</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2009/12/ajax-loader-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MooTools Date Picker</title>
		<link>http://marilynburgess.com/2009/12/mootools-date-picker/</link>
		<comments>http://marilynburgess.com/2009/12/mootools-date-picker/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 22:02:06 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[date picker]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=479</guid>
		<description><![CDATA[A new feature is on its way to the List Central interface. Soon List Central users will be able to associate a date, and time with any list item in any list, and request List Central to email him/her either once, annually, monthly, weekly or daily on that date and time. I love the date [...]]]></description>
			<content:encoded><![CDATA[<p>A new feature is on its way to the List Central interface. Soon List Central users will be able to associate a date, and time with any list item in any list, and request List Central to email him/her either once, annually, monthly, weekly or daily on that date and time.</p>
<p><img src="http://marilynburgess.com/images/2009/12/datepicker.png" alt="datepicker" title="datepicker" width="405" height="220" class="alignnone size-full wp-image-514" /></p>
<p><img src="http://marilynburgess.com/images/2009/12/timepicker.png" alt="timepicker" title="timepicker" width="381" height="221" class="alignnone size-full wp-image-515" /></p>
<p>I love the date picker Javascript script I found to help accomplish this new feature. It is the <a href="http://www.monkeyphysics.com/mootools/script/2/datepicker">MooTools DatePicker by MonkeyPhysics</a>. The script is flexible and well documented. There are even 4 different skins ready made to use in your application. Thank you <a href="http://www.monkeyphysics.com/">MonkeyPhysics</a> for building this date picker script! </p>
<h3  class="related_post_title">You might also like...</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2009/12/charcode-is-meaningless/" title="charCode is meaningless">charCode is meaningless</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2009/12/mootools-date-picker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>charCode is meaningless</title>
		<link>http://marilynburgess.com/2009/12/charcode-is-meaningless/</link>
		<comments>http://marilynburgess.com/2009/12/charcode-is-meaningless/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 22:01:48 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[charCode]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=507</guid>
		<description><![CDATA[I have seen this Javascript error in my Firefox Error Console many times, from many high profile sites about the internet. Warning: The &#8216;charCode&#8217; property of a keyup event should not be used. The value is meaningless. I&#8217;m trying not to be smug, but it does feel good to know that List Central uses the [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen this Javascript error in my Firefox Error Console many times, from many high profile sites about the internet.</p>
<p><em>Warning: The &#8216;charCode&#8217; property of a keyup event should not be used. The value is meaningless.</em></p>
<p>I&#8217;m trying not to be smug, but it does feel good to know that List Central uses the charCode concept while not throwing any Javascript errors. I&#8217;ve aimed to keep that Error Console clean through the entire development of List Central.</p>
<p>For those of you that want to get rid of that pesky charCode error, change</p>
<pre class="brush: javascript">var code = event.charCode;
</pre>
<p>to:</p>
<pre class="brush: javascript">
var code;
if (e.keyCode){
    code = e.keyCode;
}else if (e.which) {
    code = e.which;
}
var character = String.fromCharCode(code).toLowerCase();
</pre>
<h3  class="related_post_title">You might also like...</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2009/12/mootools-date-picker/" title="MooTools Date Picker">MooTools Date Picker</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2009/12/charcode-is-meaningless/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Enforcing Max-Length on a textarea</title>
		<link>http://marilynburgess.com/2009/10/enforcing-max-length-on-a-textarea/</link>
		<comments>http://marilynburgess.com/2009/10/enforcing-max-length-on-a-textarea/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 20:38:41 +0000</pubDate>
		<dc:creator>marilyn</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[max-length textarea]]></category>

		<guid isPermaLink="false">http://blog.listcentral.me/?p=417</guid>
		<description><![CDATA[Lets say you have a textarea in which you will only be saving the first 300 characters the user puts in there. You likely have a database field of type varchar(300), and a small space to fit the user input into that makes a long text input not feasible. You could let the user type [...]]]></description>
			<content:encoded><![CDATA[<p>Lets say you have a textarea in which you will only be saving the first 300 characters the user puts in there. You likely have a database field of type varchar(300), and a small space to fit the user input into that makes a long text input not feasible. You could let the user type in whatever s/he wants, and then be disappointed to find that only the first bit of their epic novel was saved. Likely your users will call your site buggy and find some other website to play with, because your lazy handling of their input did not have their needs in mind. The user must be informed that their input will be truncate at 300 characters.</p>
<p>To handle this situation you need a multi-line text input, that enforces a 300 character limit. If the user types more than 300 characters, the extra characters shouldn&#8217;t show up so that s/he knows that only what they can see displayed will be saved. For the multi-line requirement, you have to use a textarea, but textarea&#8217;s do not have a built in max-length directive like the one line text inputs do. So, we have to make out own. I went looking for a solution today, and found a rather handsome, one liner solution over at <a href="http://www2.psacake.com:81/web/js.asp">psacake</a>. Sadly though this solution is serverly flawed, to a degree in which I would say it&#8217;s unusable. The psacake solution stops the user from inputting more than 300 characters, but it also prevents the user from using the backspace to change their input. I have updated psacake&#8217;s solution to give the user a chance to chance to edit what they have written after they discover the textarea has a character limit imposed upon it.</p>
<pre class="brush: javascript">
function imposeMaxLength(event, object, MaxLen){
    var key = event.keyCode ? event.keyCode : event.which;
    if(key == 8){
        // 8 is the keycode for the backspace key
        return true;
    }else{
        return (object.value.length &lt;= MaxLen);
    }
}
</pre>
<p>Then, call they function like this:</p>
<pre class="brush: html">&lt;textarea onkeypress=&#039;return imposeMaxLength(event, this, 300);&#039;&gt;&lt;/textarea&gt;</pre>
<p>Please feel free to use this code on your site. It has passed my tests on both Firefox and IE8.</p>
<h3  class="related_post_title">Random Posts</h3><ul class="related_post"><li><a href="http://marilynburgess.com/2009/05/kiva-loans-wordpress-widget/" title="Kiva Loans Wordpress Widget">Kiva Loans Wordpress Widget</a></li><li><a href="http://marilynburgess.com/2010/07/how-come-another-google-suggest-that-makes-you-go-hmm/" title="How come: Another Google Suggest that makes you go hmm">How come: Another Google Suggest that makes you go hmm</a></li><li><a href="http://marilynburgess.com/2009/03/will-cpan-and-debian-ever-play-nice/" title="Will CPAN and Debian ever play nice?">Will CPAN and Debian ever play nice?</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://marilynburgess.com/2009/10/enforcing-max-length-on-a-textarea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

