<?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>Adam Gotterer &#187; JavaScript</title>
	<atom:link href="http://www.adamgotterer.com/category/programming/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adamgotterer.com</link>
	<description>Find the secrets to infinite income, and automate it!</description>
	<lastBuildDate>Wed, 21 Jul 2010 02:44:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Facebook Invite Bookmarklet</title>
		<link>http://www.adamgotterer.com/2009/02/04/facebook-invite-bookmarklet/</link>
		<comments>http://www.adamgotterer.com/2009/02/04/facebook-invite-bookmarklet/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 04:05:30 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2009/02/04/facebook-invite-bookmarklet/</guid>
		<description><![CDATA[One of the best Facebook features is the ability to invite friends to events. The most annoying part about this system is the inability to invite more then 100 friends at a time (Facebook: wheres the invite all!?). In the past I have clicked one by one and sent invites in blocks of 100. Today [...]]]></description>
			<content:encoded><![CDATA[<p>One of the best Facebook features is the ability to invite friends to events. The most annoying part about this system is the inability to invite more then 100 friends at a time (Facebook: wheres the invite all!?). In the past I have clicked one by one and sent invites in blocks of 100. Today was the day that I had enough! I made a bookmarklet to automate the bulk of the process. Unfortunately it can’t do all the work for you, but it will automatically adds users to the invite in blocks of 100 with a single click. Heres how it works&#8230;</p>
<p>Step 1) Log in to Facebook and browse to the event &#8220;Invite people to come&#8221; page.</p>
<p>2) Setup a new bookmarklet with this code (or optionally paste in the address bar on that page):</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">javascript<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">var</span> e<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>e.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'type'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'text/javascript'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>e.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>setTimeout<span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #003366; font-weight: bold;">var</span> friends <span style="color: #339933;">=</span> $$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#friends_list span input'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #003366; font-weight: bold;">var</span> offset <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span><span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Please enter an offset'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>offset <span style="color: #339933;">&gt;</span> friends.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'All done!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> offset<span style="color: #339933;">;</span> x <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> offset <span style="color: #339933;">+</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>friends<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">onclick</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 3000<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>void<span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>3) Click the bookmarklet and enter 0 when prompted. (0 represents your current offset, you will need to keep track of this.)</p>
<p>4) Click invite</p>
<p>5) Repeat and increase the offset by 100 until all friends have been sent invites</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2009/02/04/facebook-invite-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Weebly Puzzle</title>
		<link>http://www.adamgotterer.com/2008/05/28/weebly-puzzle/</link>
		<comments>http://www.adamgotterer.com/2008/05/28/weebly-puzzle/#comments</comments>
		<pubDate>Wed, 28 May 2008 05:06:51 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2008/05/28/weebly-puzzle/</guid>
		<description><![CDATA[This site attracts a decent amount of JavaScript folks so I thought this would be relevant and maybe even helpful. I read news.ycombinator.com everyday (or several times a day). If you are into the startup world, you should as well. It has by far the best startup news and a great community. The feedback and [...]]]></description>
			<content:encoded><![CDATA[<p>This site attracts a decent amount of JavaScript folks so I thought this would be relevant and maybe even helpful. I read <a href="http://news.ycombinator.com">news.ycombinator.com</a> everyday (or several times a day). If you are into the startup world, you should as well. It has by far the best startup news and a great community. The feedback and questions posted on there are generally informative and trolling is at a bare minimum. It&#8217;s what reddit used to be. Regardless, I came across a job posting at <a href="http://www.weebly.com">Weebly</a> for a web developer position. The job description came with a little JavaScript puzzle. I had no intention of actually applying for the job, but when ever I find these puzzles I like to do them. I&#8217;m not going to post the results, because thats not cool. If you want to check your answer email me your best guess. But it entertained me for about 20 minutes. So if you&#8217;re bored or actually looking for a job check it out at <a href="http://www.weebly.com/jobs.html">http://www.weebly.com/jobs.html</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2008/05/28/weebly-puzzle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Prototype XUL</title>
		<link>http://www.adamgotterer.com/2008/02/23/using-prototype-xul/</link>
		<comments>http://www.adamgotterer.com/2008/02/23/using-prototype-xul/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 22:33:10 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[FireFox Extension]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Prototype XUL]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2008/02/23/using-prototype-xul/</guid>
		<description><![CDATA[The examples here are taken from Function page of the Prototype JS api documentation. They have been re-written to reflect the Prototype XUL changes. Hope they help!
argumentNames
var fn = function(foo, bar) {
   return foo + bar;
};

argumentNames(fn); //['foo', 'bar']

bind
var fn = function(foo, bar) {
   return foo + bar;
};

argumentNames(fn); //-> ['foo', 'bar']

bindAsEventListener
var obj [...]]]></description>
			<content:encoded><![CDATA[<p>The examples here are taken from <a href="http://prototypejs.org/api/function">Function page</a> of the Prototype JS api documentation. They have been re-written to reflect the Prototype XUL changes. Hope they help!</p>
<h2><span style="text-decoration: underline;">argumentNames</span></h2>
<pre>var fn = function(foo, bar) {
   return foo + bar;
};

argumentNames(fn); //['foo', 'bar']</pre>
<hr />
<h2><span style="text-decoration: underline;">bind</span></h2>
<pre lang="javascript">var fn = function(foo, bar) {
   return foo + bar;
};

argumentNames(fn); //-> ['foo', 'bar']</pre>
<hr />
<h2><span style="text-decoration: underline;">bindAsEventListener</span></h2>
<pre lang="javascript">var obj = { name: 'A nice demo' };

function handler(e) {
  var tag = Event.element(e).tagName.toLowerCase();
  var data = $A(arguments);
  data.shift();
  alert(this.name + '\nClick on a ' + tag + '\nOther args: ' + data.join(', '));
}

Event.observe(document, 'click', bindAsEventListener(obj, handler, 1, 2, 3));</pre>
<hr />
<h2><span style="text-decoration: underline;">curry</span></h2>
<pre lang="javascript">String.prototype.splitOnSpaces = curry(String.prototype.split, " ");
"foo bar baz thud".splitOnSpaces(); //-> ["foo", "bar", "baz", "thud"]</pre>
<hr />
<h2><span style="text-decoration: underline;">defer</span></h2>
<pre lang="javascript">function hideNewElement() {
  $('inserted').hide();
};

function insertThenHide(markup) {
  $('container').insert(markup);

  // Prototype XUL
  defer(hideNewElement);
}

insertThenHide("

Lorem ipsum

");</pre>
<hr />
<h2><span style="text-decoration: underline;">delay</span></h2>
<pre lang="javascript">// before:
window.setTimeout(function() {
Element.addClassName('foo', 'bar'); }, 1000);

// after:
delay(Element.addClassName, 1, 'foo', 'bar');

// clearing a timeout
var id = delay(Element.hide, 5, 'foo');
window.clearTimeout(id);</pre>
<hr />
<h2><span style="text-decoration: underline;">delay</span></h2>
<pre lang="javascript">// start off with a simple function that does an operation
// on the target object:
var fn = function(target, foo) {
  target.value = foo;
};

var object = {};

// use the original function
fn(object, 'bar');
object.value //-> 'bar'

// if we methodize it and copy over to the object, it becomes
// a method of the object and takes 1 argument less:

object.fnMethodized = methodize(fn);

object.fnMethodized('boom!');
object.value //-> 'boom!'</pre>
<hr />
<h2><span style="text-decoration: underline;">wrap</span></h2>
<pre lang="javascript">String.prototype.capitalize = wrap(String.prototype.capitalize,
  function(proceed, eachWord) {
    if (eachWord &#038;&#038; this.include(" ")) {
      // capitalize each word in the string
      return this.split(" ").invoke("capitalize").join(" ");
    } else {
      // proceed using the original function
      return proceed();
    }
  });

"hello world".capitalize()     // "Hello world"
"hello world".capitalize(true) // "Hello World"</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2008/02/23/using-prototype-xul/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prototype XUL Documentation</title>
		<link>http://www.adamgotterer.com/2008/02/23/prototype-xul-documentation/</link>
		<comments>http://www.adamgotterer.com/2008/02/23/prototype-xul-documentation/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 22:23:05 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[FireFox Extension]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Prototype XUL]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2008/02/23/prototype-xul-documentation/</guid>
		<description><![CDATA[For the most part the functionality of Prototype XUL works the same as normal prototype. The prototype documentation can be found here. The underlying changes are in the methods that extend Prototype.function. The functions that have been re-written are: argumentNames, bind, bindAsEventListener, curry, delay, defer, wrap and methodize. The core difference in use, is that [...]]]></description>
			<content:encoded><![CDATA[<p>For the most part the functionality of <a href="http://www.adamgotterer.com/2008/02/19/prototype-xul-javascript-framework-1602/">Prototype XUL</a> works the same as normal prototype. The prototype documentation can be <a href="http://www.prototypejs.org/api">found here</a>. The underlying changes are in the methods that extend Prototype.function. The functions that have been re-written are: argumentNames, bind, bindAsEventListener, curry, delay, defer, wrap and methodize. The core difference in use, is that these functions can not be extended from objects anymore and must be explicitly called.</p>
<h2><u>argumentNames</u></h2>
<pre line="0" lang="javascript">
argumentNames(someFunction) //-> Array</pre>
<hr />
<h2><u>bind</u></h2>
<pre line="0" lang="javascript">
bind(thisObj, someFunction) //-> Function</pre>
<hr />
<h2><u>bindAsEventListener</u></h2>
<pre line="0" lang="javascript">
bindAsEventListener(thisObj, someFunction) //-> Function</pre>
<hr />
<h2><u>curry</u></h2>
<pre line="0" lang="javascript">
curry(someFunction, [args...]) //-> Function</pre>
<hr />
<h2><u>defer</u></h2>
<pre line="0" lang="javascript">
curry(someFunction, [args...]) //-> Number</pre>
<hr />
<h2><u>delay</u></h2>
<pre line="0" lang="javascript">
delay(someFunction, seconds, [args...]) //-> Number</pre>
<hr />
<h2><u>methodize</u></h2>
<pre line="0" lang="javascript">
delay(someFunction, [args...]) //-> Function</pre>
<hr />
<h2><u>wrap</u></h2>
<pre line="0" lang="javascript">
delay(wrapperFunction, someFunction, [args...]) //-> Function</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2008/02/23/prototype-xul-documentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prototype XUL Update</title>
		<link>http://www.adamgotterer.com/2008/02/21/prototype-xul-update/</link>
		<comments>http://www.adamgotterer.com/2008/02/21/prototype-xul-update/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 07:16:12 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[FireFox Extension]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Prototype XUL]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2008/02/21/prototype-xul-update/</guid>
		<description><![CDATA[While writing out the Prototype XUL documention I came across a nasty little bug that took me a few hours to fix. I will wrap up the documentation tomorrow. If you downloaded the Prototype XUL 1.6.0.2 file anytime before today, please upgrade (the version number has not change).
]]></description>
			<content:encoded><![CDATA[<p>While writing out the Prototype XUL documention I came across a nasty little bug that took me a few hours to fix. I will wrap up the documentation tomorrow. If you downloaded the Prototype XUL 1.6.0.2 file anytime before today, please <a href="http://www.adamgotterer.com/wp-content/uploads/2008/02/prototype_xul_1_6_0_2.js">upgrade</a> (the version number has not change).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2008/02/21/prototype-xul-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Prototype XUL JavaScript Framework 1.6.0.2</title>
		<link>http://www.adamgotterer.com/2008/02/19/prototype-xul-javascript-framework-1602/</link>
		<comments>http://www.adamgotterer.com/2008/02/19/prototype-xul-javascript-framework-1602/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 06:58:36 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[FireFox Extension]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Prototype XUL]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2008/02/19/prototype-xul-javascript-framework-1602/</guid>
		<description><![CDATA[Drum roll please&#8230; After three attempts/failures, I present to you the newest version of the Prototype XUL library! The previous released version technically never worked. It was something I threw together for a Firefox project that only required the basic of functionality (Ajax.Request, utility functions, etc.). I was under the impression that converting the functions [...]]]></description>
			<content:encoded><![CDATA[<p>Drum roll please&#8230; After three attempts/failures, I present to you the newest version of the Prototype XUL library! The <a href="http://www.adamgotterer.com/2007/11/07/prototype_xul_javascript_160_rc1/">previous released</a> version technically never worked. It was something I threw together for a Firefox project that only required the basic of functionality (Ajax.Request, utility functions, etc.). I was under the impression that converting the functions that failed due to the known <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=300079">XUL function bug</a> would solve all the problems. Unfortunately this was not the case and under these assumptions more complex functionality ceased to work correctly. This version has gone through a finer examination, conversion and code update to (hopefully) be a fully functional representation of prototype. Hopefully Firefox 3 will have this bug corrected and I wont have to release many future updates. Please post any bug reports, questions or feedback in the comments section, this will help reduce duplication and make my life easier :). Enjoy!</p>
<p><strong>WARNING:</strong> I have not fully tested this library!</p>
<p><strong>Disclaimer:</strong> This modified version of the Prototye JavaScript framework is in no way affiliated, distributed or supported by Sam Stephenson or the Prototype library project. This library has been modified from its original intended version/use and I take no responsibility for any bugs, damages or problems this library may cause.</p>
<p><a href="http://www.adamgotterer.com/wp-content/uploads/2008/02/prototype_xul_1_6_0_2.js"><img src="http://www.adamgotterer.com/wp-content/uploads/2007/11/prototype_xul.gif" alt="Download Prototype XUL" border="0" /></a></p>
<p>* Most up to date version as of 2/22/08<br />
* <a href="http://www.adamgotterer.com/2008/02/23/prototype-xul-documentation/">Documentation</a><br />
* <a href="http://www.adamgotterer.com/2008/02/23/using-prototype-xul/">Examples</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2008/02/19/prototype-xul-javascript-framework-1602/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Firefox Extension &#8211; Preference Handeling</title>
		<link>http://www.adamgotterer.com/2007/12/06/firefox-extension-preference-handeling/</link>
		<comments>http://www.adamgotterer.com/2007/12/06/firefox-extension-preference-handeling/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 02:46:42 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[FireFox Extension]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2007/12/06/firefox-extension-preference-handeling/</guid>
		<description><![CDATA[I wrote a class to deal with preference handling in the PriceAdvance Firefox extension. I found the Mozilla documentation to be difficult to understand. So, I decided to share the class. Theres a little bug in Firefox that took me two days and borderline suicide to figure out&#8230; Extensions can have a default preference file [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a class to deal with preference handling in the PriceAdvance Firefox extension. I found the Mozilla <a href="http://developer.mozilla.org/en/docs/nsIPrefService">documentation</a> to be difficult to understand. So, I decided to share the class. Theres a little bug in Firefox that took me two days and borderline suicide to figure out&#8230; Extensions can have a default preference file that you can query using the preference interface. These preference files are &#8220;magically&#8221; loaded from a very specific file folder/location &#8211;  &#8220;defaults\preferences\xxxxx.js&#8221;. To set a preference you simply put   &#8220;pref(&#8221;branch_title.variable_name&#8221;, value);&#8221; in the file. If you use the class I made these preferences can be accessed like this: &#8220;Preference.getPref(&#8221;variable_name&#8221;)&#8221;. Now the bug I found is with the way you configure your extension. If the extension is bundled and installed &#8220;properly&#8221; it will work without a hitch. For development purposes I have my extension using a pointer from the extension folder to another folder location where I do all the work. Apparently when its setup as a pointer it wont load the preference files. Whats really annoying is theres no way to verify if the magical files have been loaded or not. Because of this I have avoided preference defaults and use my own variables class.</p>
<pre line="0" lang="javascript">
Preferences = {
initialize: function() {
  this.prefs = Components.classes['@mozilla.org/preferences-service;1']
  .getService(Components.interfaces.nsIPrefService)
  .getBranch('extensions.branch_title.');

  this.prefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
},

getPref: function(name) {
  var type = this.prefs.getPrefType(name);

  if (type == this.prefs.PREF_STRING)
    return this.prefs.getCharPref(name);
  else if (type == this.prefs.PREF_INT)
    return this.prefs.getIntPref(name);
  else if (type == this.prefs.PREF_BOOL)
   return this.prefs.getBoolPref(name);
},

setPref: function(name, value) {
  var type = this.prefs.getPrefType(name);

  if(type == 0) {
    if(typeof(value) == 'number')
      type = 64;
    else if(typeof(value) == 'string')
      type = 32;
    else if(typeof(value) == 'boolean')
      type = 128;
  }

  if (type == this.prefs.PREF_STRING)
    this.prefs.setCharPref(name, value);
  else if (type == this.prefs.PREF_INT)
    this.prefs.setIntPref(name, value);
  else if (type == this.prefs.PREF_BOOL)
    this.prefs.setBoolPref(name, value);
}
};

// USAGE:
Preferences.initialize();
Preference.setPref('this_works', true);
alert(Preference.getPref('this_works'));
/******************/</pre>
<p>To view preference variables that have been set, type &#8220;about:config&#8221; into the address bar and filter for your branch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2007/12/06/firefox-extension-preference-handeling/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JavaScript Rich Text Editors</title>
		<link>http://www.adamgotterer.com/2007/11/11/rich-text-editors/</link>
		<comments>http://www.adamgotterer.com/2007/11/11/rich-text-editors/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 16:53:35 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2007/11/11/rich-text-editors/</guid>
		<description><![CDATA[For the past week I have been working on this custom JavaScript rich text editor for the CollegeHumor article writer. Our current editor is using FCKeditor, which has been decent but has only recently become compatible with all browsers. For the re-write we messed around with the ever so popular TinyMCE, which in my opinion [...]]]></description>
			<content:encoded><![CDATA[<p>For the past week I have been working on this custom JavaScript rich text editor for the CollegeHumor <a href="http://www.collegehumor.com/editor">article writer</a>. Our current editor is using <a href="http://www.fckeditor.net/">FCKeditor</a>, which has been decent but has only recently become compatible with all browsers. For the re-write we messed around with the ever so popular <a href="http://tinymce.moxiecode.com/">TinyMCE</a>, which in my opinion I liked better then FCK. I found the problem with both of them to be customization and overhead. There&#8217;s a handful of other editors out there that we messed around with, but I found these two to be the most popular, have the best documentation and supporting community.</p>
<p>If you are going to use all of the features the full package offers, writing one from scratch is going to be a daunting task. Why re-invent the wheel? TinyMCE has a pretty sweet setup that lets you easily create themes and plugins. They even give you access to override some of the core functionality without touching the core files. In the CollegeHumor situation we are looking to customize almost every action and eliminate the overhead of the features we don&#8217;t plan to use. The CH article writer is clearly not one of the most visited pages on the site, but I cant imagine how it would perform if it was. These out of box editors are thousands of lines of JavaScript, tons of includes, graphics and html files. If you used something like this as the primary editor for say a large social site, it would be a waste of bandwidth and suffer from slow page loads on the client side.</p>
<p>So if you decide you want to code your own, Microsoft and Mozilla both have interfaces that ease creating custom rich text editors. For the basic features; bold, italic, justify, font size, etc. there is a single line commands that deal with the actual placement and HTML. Basically all it takes to get a super basic editor is an IFrame set to &#8220;design mode&#8221; and a few command buttons.</p>
<p><a href="http://msdn2.microsoft.com/en-us/library/ms536419.aspx">Microsoft execCommand docs</a><br />
<a href="http://www.mozilla.org/editor/midas-spec.html"> Mozilla execCommand docs</a><br />
<a href="http://www.quirksmode.org/dom/execCommand.html"> Browser Compatibility chart</a></p>
<p>If you end up dynamically generating the IFrame, beware of a quirk in Mozilla that requires the IFrame to be completely loaded before it can be set to design mode. The way I dealt with this was to put an event handler on window/load that triggers the design mode once I know everything has been downloaded. I have seen a few examples use short timers to set design mode after the IFrame was appended. I found this to work most of the time, but sometimes if the browser hiccuped an extra second it would try and add it before the IFrame was loaded, which threw an error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2007/11/11/rich-text-editors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Prototype XUL JavaScript Framework 1.6.0_rc1</title>
		<link>http://www.adamgotterer.com/2007/11/07/prototype_xul_javascript_160_rc1/</link>
		<comments>http://www.adamgotterer.com/2007/11/07/prototype_xul_javascript_160_rc1/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 05:51:00 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[FireFox Extension]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Prototype XUL]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2007/11/07/prototype_xul_javascript_160_rc1/</guid>
		<description><![CDATA[A few days ago I posted about a FireFox bug that affected Function.prototype in the Chrome environment. The two modified prototype libraries that I posted were starting to get a little outdated. I spent the night modifying the most recent version of Prototype 1.6.0_rc1 framework to work in Chrome. I have also removed as many [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I <a href="http://www.adamgotterer.com/2007/11/03/prototype-xul-javascript-library/">posted</a> about a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=300079">FireFox bug</a> that affected Function.prototype in the Chrome environment. The two modified prototype libraries that I posted were starting to get a little outdated. I spent the night modifying the most recent version of Prototype 1.6.0_rc1 framework to work in Chrome. I have also removed as many references as I could find to browsers other then Mozilla/Gecko. If you find any bugs or make any changes, please let me know so I can update the posted code.</p>
<p><strong>WARNING:</strong> I have not fully tested this library!</p>
<p><strong>Disclaimer:</strong>  This modified version of the Prototye JavaScript framework is in no way affiliated, distributed or supported by Sam Stephenson or the Prototype library project. This library has been modified from its original intended version/use and I take no responsibility for any bugs, damages or problems this library may cause.</p>
<p><a href="http://www.adamgotterer.com/2008/02/19/prototype-xul-javascript-framework-1602/" title="Download Prototype XUL"><img src="http://www.adamgotterer.com/wp-content/uploads/2007/11/prototype_xul.gif" alt="Download Prototype XUL" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2007/11/07/prototype_xul_javascript_160_rc1/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>script.aculo.us 1.8.0 Released Today</title>
		<link>http://www.adamgotterer.com/2007/11/06/scriptaculous-180-released-today/</link>
		<comments>http://www.adamgotterer.com/2007/11/06/scriptaculous-180-released-today/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 00:15:06 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adamgotterer.com/2007/11/06/scriptaculous-180-released-today/</guid>
		<description><![CDATA[
A new version of script.aculo.us was released today. The biggest change is the upgrade to prototype 1.6 final, which I have been running since its release. There were a few other minor updates, you can read the full change log.
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://script.aculo.us/"><img src="http://www.adamgotterer.com/wp-content/uploads/2007/11/scriptaculous.gif" alt="Scriptaculous Logo" border="0" /></a></p>
<p>A new version of <a href="http://script.aculo.us">script.aculo.us</a> was released today. The biggest change is the upgrade to <a href="http://www.prototypejs.org">prototype</a> 1.6 final, which I have been running since its release. There were a few other minor updates, you can read the full <a href="http://dev.rubyonrails.org/browser/spinoffs/scriptaculous/CHANGELOG?rev=8083">change log</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamgotterer.com/2007/11/06/scriptaculous-180-released-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
