<?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>mitcho.com &#187; MIT</title>
	<atom:link href="http://mitcho.com/blog/tag/mit/feed/" rel="self" type="application/rss+xml" />
	<link>http://mitcho.com</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 02:04:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
		<item>
		<title>Creating an image-sized iframe overlay with Shadowbox</title>
		<link>http://mitcho.com/blog/how-to/creating-an-image-sized-iframe-overlay-with-shadowbox/</link>
		<comments>http://mitcho.com/blog/how-to/creating-an-image-sized-iframe-overlay-with-shadowbox/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 05:33:50 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MIT]]></category>
		<category><![CDATA[shadowbox]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=3293</guid>
		<description><![CDATA[I recently have been working with the Shadowbox JavaScript library for an upcoming revision to the MIT Edgerton Digital Collections website. Shadowbox is a nice lightbox library designed to work with various JavaScript libraries like jQuery, prototype, and mootools with a nice modular design. Shadowbox is organized around different &#8220;players&#8221;—one for each kind of media [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/life/im-seriously-dreaming-of-a-white-christmas/' rel='bookmark' title='I&#8217;m Seriously Dreaming of a White Christmas'>I&#8217;m Seriously Dreaming of a White Christmas</a></li>
<li><a href='http://mitcho.com/blog/life/the-gift-that-keeps-on-giving/' rel='bookmark' title='The Gift That Keeps On Giving'>The Gift That Keeps On Giving</a></li>
<li><a href='http://mitcho.com/blog/life/atayal-cultural-festival/' rel='bookmark' title='Atayal cultural festival'>Atayal cultural festival</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I recently have been working with the <a href="http://www.shadowbox-js.com/">Shadowbox</a> JavaScript library for an upcoming revision to the MIT <a href="http://edgerton-digital-collections.org">Edgerton Digital Collections</a> website. Shadowbox is a nice <a href="http://en.wikipedia.org/wiki/Lightbox (JavaScript)">lightbox</a> library designed to work with various JavaScript libraries like jQuery, prototype, and mootools with a nice modular design.</p>

<p>Shadowbox is organized around different &#8220;players&#8221;—one for each kind of media that will be displayed. The library by default comes with players for Flash, HTML fragments, <code>iframe</code>s, QuickTime, and Windows Media. Some of these players, like those for images and video, automatically recognize the media size and adjust the lightbox accordingly, while others such as the <code>iframe</code> player can use a set size or can fill the screen. For the Edgerton site, though, we had a need for displaying an <code>iframe</code> but in the dimensions of a set image, so that we could display the image with an overlay. Here are some notes on how to implement a custom player for Shadowbox.</p>

<p><span id="more-3293"></span>
The first step to getting Shadowbox to recognize a custom player is to modify the players loaded by <code>shadowbox.js</code>. I called my player &#8220;hybrid,&#8221; as it&#8217;s like a cross between the <code>iframe</code> and <code>img</code> players.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Shadowbox.<span style="color: #660066;">options</span>.<span style="color: #660066;">players</span><span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;html&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;iframe&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;img&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;hybrid&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>


<p>Now Shadowbox will try to look for the file <code>players/shadowbox-hybrid.js</code>. That&#8217;s where we will create our custom player. Start by duplicating the <code>iframe</code> player file. Next, we can make one more change to <code>shadowbox.js</code>. In the <code>getPlayer</code> function, add a line that will return &#8220;<code>hybrid</code>&#8221; when it recognizes a lightbox which should use the hybrid player. I added the following line, which uses the hybrid player when the text &#8220;<code>galleries</code>&#8221; is in the <code>a</code> tag&#8217;s <code>href</code> attribute.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/galleries/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;hybrid&quot;</span><span style="color: #339933;">;</span></pre></div></div>


<p>Finally, you must actually write the new player. There&#8217;s a readme file which describes the interface:</p>

<blockquote>
<p>All players should implement the same interface. This makes it possible for the Shadowbox class to know what methods to call and properties to check on player objects.</p>
<p>The interface is described here, with some simple explanations of how each method and/or property is to be used.</p>
<dl>
<dt><strong>height</strong></dt>
    <dd>(Number) The height of the object (in pixels)</dd>
<dt><strong>width</strong></dt>
    <dd>(Number) The width of the object (in pixels)</dd>
<dt><strong>ready</strong></dt>
    <dd>(optional, Boolean) True if the content is ready to be loaded, false otherwise. Useful when the script should wait until the content loads before proceeding (see below)</dd>
<dt><strong>resizable</strong></dt>
    <dd>(optional, Boolean) True if the content can be dynamically resized by the script (e.g. images, but not most movie formats)</dd>
<dt><strong>append()</strong></dt>
    <dd>Appends this object to the DOM</dd>
<dt><strong>remove()</strong></dt>
    <dd>Removes this object from the DOM</dd>
<dt><strong>onLoad()</strong></dt>
    <dd>(optional) Called after the content is loaded and the loading layer is hidden</dd>
<dt><strong>onWindowResize()</strong></dt>
    <dd>(optional) Called when the window is resized</dd>
</dl>
</blockquote>

<p>I found these directions quite easy to follow. For our purposes, there was also a note on how to set an object&#8217;s height and width based on an image.</p>

<p>Hopefully these notes are helpful for others who hope to take full advantage of this very powerful JavaScript library.</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/life/im-seriously-dreaming-of-a-white-christmas/' rel='bookmark' title='I&#8217;m Seriously Dreaming of a White Christmas'>I&#8217;m Seriously Dreaming of a White Christmas</a></li>
<li><a href='http://mitcho.com/blog/life/the-gift-that-keeps-on-giving/' rel='bookmark' title='The Gift That Keeps On Giving'>The Gift That Keeps On Giving</a></li>
<li><a href='http://mitcho.com/blog/life/atayal-cultural-festival/' rel='bookmark' title='Atayal cultural festival'>Atayal cultural festival</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/how-to/creating-an-image-sized-iframe-overlay-with-shadowbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Living in the Stata Center</title>
		<link>http://mitcho.com/blog/life/living-in-the-stata-center/</link>
		<comments>http://mitcho.com/blog/life/living-in-the-stata-center/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 18:49:22 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[linguistics]]></category>
		<category><![CDATA[MIT]]></category>
		<category><![CDATA[Stata Center]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2914</guid>
		<description><![CDATA[We&#8217;re now three weeks into the semester at MIT where I just started a PhD program in linguistics. The Linguistics and Philosophy department is housed in The Ray and Maria Stata Center, also known as building 32. It&#8217;s a Frank Gehry building and thus crazy looking.1 We see photographers on the street from time to [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/observation/im-busy-to-die/' rel='bookmark' title='I&#8217;m Busy to Die'>I&#8217;m Busy to Die</a></li>
<li><a href='http://mitcho.com/blog/life/dinner-with-barack-and-hillary/' rel='bookmark' title='Dinner with Barack and Hillary'>Dinner with Barack and Hillary</a></li>
<li><a href='http://mitcho.com/blog/life/travel/linguistics-in-%e5%98%89%e7%be%a9/' rel='bookmark' title='Linguistics in 嘉義'>Linguistics in 嘉義</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re now three weeks into the semester at MIT where I just started a PhD program in <a href="http://web.mit.edu/linguistics/">linguistics</a>. The Linguistics and Philosophy department is housed in The Ray and Maria <a href="http://en.wikipedia.org/wiki/Stata Center">Stata Center</a>, also known as building 32. It&#8217;s a <a href="http://en.wikipedia.org/wiki/Frank Gehry">Frank Gehry</a> building and thus crazy looking.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>

<p><zp:boston/statacenter/statacenter02.jpg><zp:boston/statacenter/statacenter09.jpg></p>

<p><span id="more-2914"></span>
We see photographers on the street from time to time taking pictures of the building. In fact, the first day I got to Boston this fall, I walked into my hotel room and there was a framed photo of Stata on the wall.</p>

<p><zp:boston/statacenter/statacenter15.jpg></p>

<p>The department basically occupies the eighth and ninth floors of the <a href="http://en.wikipedia.org/wiki/Alexander W. Dreyfoos, Jr.">Dreyfoos</a> tower side. There&#8217;s a nice common space with some red couches and a spiral staircase.</p>

<p><zp:boston/statacenter/statacenter07.jpg><zp:boston/statacenter/statacenter08.jpg></p>

<p>All of us first years share an office together on the ninth floor (32-D976). The room is elliptical, with our desks along the side with windows and the other &#8220;wall&#8221; being a series of wooden bookshelves. It&#8217;s great to share an office with the cohort, as we all take all the same classes the first year as well.</p>

<p><zp:boston/statacenter/statacenter04.jpg><zp:boston/statacenter/statacenter12.jpg><zp:boston/statacenter/statacenter01.jpg><zp:boston/statacenter/statacenter03.jpg></p>

<p>Here&#8217;s the room for &#8220;Meg Data&#8221; just across the hall from our office. I was really hoping it was a woman named &#8220;Meg Data&#8221;&#8230; marrying her would get me one step closer to becoming &#8220;Dr. Data.&#8221; Alas, &#8220;Meg Data&#8221; or &#8220;MEG Data&#8221; apparently is simply a label for some data store—possibly some servers. <img src='http://mitcho.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>

<p><zp:boston/statacenter/statacenter06.jpg></p>

<p>The majority of the building is the <a href="http://www.csail.mit.edu/">Computer Science and Artificial Intelligence Lab (CSAIL)</a> so there are posters up for fun-looking talks that I&#8217;m too busy for.</p>

<p><zp:boston/statacenter/statacenter10.jpg></p>

<p>Here&#8217;s my desk (with <a href="http://foxkeh.jp">Foxkeh</a>!) and my new bike which I&#8217;ve been bringing up to the office. The final photo is a photo of me with an &#8220;I ♥ The Web&#8221; poster in commemoration of <a href="http://mozilla.org/onewebday">OneWebDay</a>.</p>

<p><zp:boston/statacenter/statacenter13.jpg><zp:boston/statacenter/statacenter05.jpg><zp:boston/statacenter/statacenter14.jpg></p>

<p>We&#8217;ve been getting pretty busy with the readings and work for our classes, as well as occasionally hanging out. I hope to write some more posts both linguistic and non-linguistic in the coming days on life at MIT.</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>It also apparently has some structural problems; most notably <a href="http://tig.csail.mit.edu/leaks.pdf">leaks</a>.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/observation/im-busy-to-die/' rel='bookmark' title='I&#8217;m Busy to Die'>I&#8217;m Busy to Die</a></li>
<li><a href='http://mitcho.com/blog/life/dinner-with-barack-and-hillary/' rel='bookmark' title='Dinner with Barack and Hillary'>Dinner with Barack and Hillary</a></li>
<li><a href='http://mitcho.com/blog/life/travel/linguistics-in-%e5%98%89%e7%be%a9/' rel='bookmark' title='Linguistics in 嘉義'>Linguistics in 嘉義</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/life/living-in-the-stata-center/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

