<?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>Adventures in Japanese Programming &#187; prototype</title>
	<atom:link href="http://blog.japanesetesting.com/tag/prototype/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.japanesetesting.com</link>
	<description>Design and Programming of a mISV Site</description>
	<lastBuildDate>Fri, 23 Jul 2010 13:29:11 +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>Return of the FaceBox: Iframes!</title>
		<link>http://blog.japanesetesting.com/2009/10/19/return-of-the-facebox-iframes/</link>
		<comments>http://blog.japanesetesting.com/2009/10/19/return-of-the-facebox-iframes/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 07:27:36 +0000</pubDate>
		<dc:creator>Harisenbon</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[facebox]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://blog.japanesetesting.com/?p=106</guid>
		<description><![CDATA[This article is a follow-up to my (oddly?) popular article Simple Modal Boxes: FaceBox with Prototype which, as the name implies, talks about how to get FaceBox ( the amazingly cool JQuery Facebox-like modal window) to work with the Prototype framework, and then releases that code under the MIT license.
Where things went wrong: IFrames
I was [...]]]></description>
			<content:encoded><![CDATA[<p>This article is a follow-up to my (oddly?) popular article <a href="http://blog.japanesetesting.com/2009/08/28/simple-modal-boxes-facebox-with-prototype/" target="_blank">Simple Modal Boxes: FaceBox with Prototype</a> which, as the name implies, talks about how to get <a href="http://famspam.com/facebox" target="_blank">FaceBox </a>( the amazingly cool JQuery Facebox-like modal window) to work with the Prototype framework, and then releases that code under the MIT license.</p>
<div id="attachment_93" class="wp-caption aligncenter" style="width: 360px"><img class="size-full wp-image-93" title="ippatsu_facebox" src="http://blog.japanesetesting.com/wp-content/uploads/2009/08/ippatsu_facebox.jpg" alt="Ippatsu's Flashcard FaceBox" width="350" height="220" /><p class="wp-caption-text">Ippatsu&#39;s Flashcard FaceBox</p></div>
<h2>Where things went wrong: IFrames</h2>
<p>I was fairly forthcoming about it when I released version 1.1, but my FaceBox had a major problem: Loading full HTML pages <em>(as opposed to html snippets)</em> borked the system. It was a combination of the &lt;head&gt; and &lt;body&gt; tags along with all that excess Javascript and CSS being loaded into an inline div that pretty much did it in. IE6 would display it (poorly) while anything else just gave up and displayed an empty box.</p>
<p><strong>So I fixed it. </strong></p>
<p>Starting with version 1.2 you can set a facebox to load in an IFrame by simply adding the tag &#8220;iframe&#8221; to the rel tag of the link.</p>
<pre class="brush: xml;">
So
&lt;a rel=&quot;facebox&quot; href=&quot;mypage.html&quot;&gt;My Page!&lt;/a&gt;

becomes
&lt;a rel=&quot;facebox iframe&quot; href=&quot;http://google.com&quot;&gt;Google&lt;/a&gt;
</pre>
<p>and now you&#8217;re cooking with crisco. The page will be loaded in an IFrame, and any links will be self-contained within that iframe unless you specifically break out of it.</p>
<h2>Breaking backwards compatibility</h2>
<p>So, I am a big believer in backwards compatibility, but unfortunately adding the iframe option, along with my desire to adhere to better HTML coding practices has made me break backwards compatibility with version 1.1.</p>
<h3>But wait!</h3>
<p>It&#8217;s <strong>simple </strong>to change over, and you can change over almost all your code with a simple search/replace! <strong>So let&#8217;s get to it!</strong></p>
<h2>New way to handle classes</h2>
<p>The old way of handing classes was to simply put all the classes you wanted to use after a hyphen after the facebox tag, like so:</p>
<pre class="brush: xml;">
&lt;a href=&quot;mypage.html&quot; rel=&quot;facebox-class1 class2&quot;&gt;My Classy Page!&lt;/a&gt;
</pre>
<p>This brings about the problem that now &#8220;iframe&#8221; is just thought of as a class. (It&#8217;s also not very contained, and rather messy). So I changed to to be more self-contained by putting the classes in square brackets []:</p>
<p><strong>The new Code</strong></p>
<pre class="brush: xml;">
&lt;a href=&quot;mypage.html&quot; rel=&quot;facebox[class1 class2]&quot;&gt;My Classy Page!&lt;/a&gt;
</pre>
<p>Now you know exactly what is a class, and what is not, and it&#8217;s easier to use it in conjunction with the IFrames option above.</p>
<pre class="brush: xml;">
&lt;a href=&quot;http://google.com&quot; rel=&quot;facebox[class1 class2] iframe&quot;&gt;This loads google in its own classy iframe&lt;/a&gt;
</pre>
<p>Simple as pie.</p>
<h2>New way to handle styles</h2>
<p>Originally, my way to handle styles (useful for setting the height and width of a Facebox for a single message or page) was to put the data in the <strong>rev</strong> tag and just pass that through to the FaceBox. However, with the new class syntax, I had a chance to change the way that the styling works.</p>
<p><em>Also, the <strong>rev </strong>tag is used to describe how the <strong>current</strong> document applies to the link, so it really isn&#8217;t a good place to put the data syntactically. It&#8217;s much better to put it in the <strong>rel</strong> tag along with the class information.</em></p>
<h3>The new code</h3>
<pre class="brush: xml;">
So where you used to use the rev tag:
&lt;a href=&quot;mypage.html&quot; rel=&quot;facebox&quot; rev=&quot;width: 500px; height: 300px&quot;&gt;My Stylish Page!&lt;/a&gt;

You'll now use curly brackets in the rel tag:
&lt;a href=&quot;mypage.html&quot; rel=&quot;facebox{width: 500px; height: 300px}&quot;&gt;My Stylish Page!&lt;/a&gt;
</pre>
<p>And we can combine that with the iframes and classes above, to further customize our facebox</p>
<pre class="brush: xml;">
Class and Style
&lt;a href=&quot;mypage.html&quot; rel=&quot;facebox[class1 class2]{width: 500px; height: 300px}&quot;&gt;My Classy Stylish Page!&lt;/a&gt;

Iframe Class and Style
&lt;a href=&quot;http://google.com&quot; rel=&quot;facebox[class1 class2]{width: 500px; height: 300px} iframe&quot;&gt;This loads google in its own classy and stylish iframe&lt;/a&gt;
</pre>
<h2>Download the code</h2>
<p>You can download the code right here! It&#8217;s Open sourced under the MIT License.</p>
<p>If you find any problems or bugs, feel free to drop me a comment!</p>
<p>Download <a href="/download/facebox_1_2.zip">FaceBox v 1.2</a> (Open sourced under the MIT License)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.japanesetesting.com/2009/10/19/return-of-the-facebox-iframes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
