<?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>Gabriel de Kadt &#187; JavaScript</title>
	<atom:link href="http://www.lazydada.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lazydada.com</link>
	<description>Personal notes on Mac based web development and design.</description>
	<lastBuildDate>Tue, 30 Aug 2011 10:47:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>JavaScript redirect based on referrer</title>
		<link>http://www.lazydada.com/2011-06-21/javascript-redirect-based-on-referrer/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-redirect-based-on-referrer</link>
		<comments>http://www.lazydada.com/2011-06-21/javascript-redirect-based-on-referrer/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 12:26:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web design & development]]></category>
		<category><![CDATA[basics]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.lazydada.com/?p=931</guid>
		<description><![CDATA[Basic stuff (as often the case not immediately findable). You want a simple script to redirect to a different page if te referrer is such and such. In the following example the two referral page options ( foo.html and bar.html ) are separated with the double pipe (the &#8216;or&#8217; bit)&#8230;]]></description>
			<content:encoded><![CDATA[<p>Basic stuff (as often the case not immediately findable). You want a simple script to redirect to a different page if te referrer is such and such. In the following example the two referral page options  ( foo.html and bar.html ) are separated with the double pipe (the &#8216;or&#8217; bit)&#8230; </p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
if (document.referrer == (&quot;http://example.com/foo.html&quot; || &quot;http://example.com/bar.html&quot;))
      location.href = &quot;foobar.html&quot;;
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lazydada.com/2011-06-21/javascript-redirect-based-on-referrer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery in anger</title>
		<link>http://www.lazydada.com/2009-04-17/jquery-in-anger/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-in-anger</link>
		<comments>http://www.lazydada.com/2009-04-17/jquery-in-anger/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 19:10:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web design & development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[webdesign]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://www.lazydada.com/?p=228</guid>
		<description><![CDATA[[notes to self] Shadowbox Tooltip highlightFade http://jquery.offput.ca/highlightFade/old.php jquery.validate.js Lovely, lightweight carousel: http://www.gmarwaha.com/jquery/jcarousellite/ http://www.noupe.com/jquery/50-amazing-jquery-examples-part1.html http://www.jasonbradbury.com/]]></description>
			<content:encoded><![CDATA[<p>[notes to self]<br />
<strong> </strong></p>
<p><strong>Shadowbox</strong><br />
<strong> </strong></p>
<p><strong>Tooltip</strong></p>
<p><strong></strong><strong>highlightFade</strong></p>
<p>http://jquery.offput.ca/highlightFade/old.php</p>
<p><strong>jquery.validate.js</strong></p>
<p><strong>Lovely, lightweight carousel:<br />
<span style="font-weight: normal;">http://www.gmarwaha.com/jquery/jcarousellite/</span></strong></p>
<p>http://www.noupe.com/jquery/50-amazing-jquery-examples-part1.html</p>
<p>http://www.jasonbradbury.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazydada.com/2009-04-17/jquery-in-anger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avoid HTML validation errors due to your JavaScript</title>
		<link>http://www.lazydada.com/2008-11-07/avoid-html-validation-errors-due-to-your-javascript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=avoid-html-validation-errors-due-to-your-javascript</link>
		<comments>http://www.lazydada.com/2008-11-07/avoid-html-validation-errors-due-to-your-javascript/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 13:31:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web design & development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.lazydada.com/?p=150</guid>
		<description><![CDATA[One of the reasons I changed a random content rotation script that was sitting in my &#60;head> tags last month was because this JavaScript failed to validate. I don&#8217;t intend to change back &#8211; but today I found out the why-for when I came across the same thing happening in two versions of &#8220;The Son [...]]]></description>
			<content:encoded><![CDATA[<p>One of the reasons I changed a <a href="http://www.lazydada.com/2008-10-22/random-content-rotation-using-php/" target="_blank">random content rotation script</a> that was sitting in my <code>&lt;head></code> tags last month was because this JavaScript failed to validate. I don&#8217;t intend to change back &#8211; but today I found out the why-for when I came across the same thing happening in two versions of &#8220;The Son of Suckerfish&#8221;. One wrapped the JavaScript with CDATA tags the other not. That simple. Of course removing the script into its own file would do the trick too. </p>
<h4>Don&#8217;t forget to wrap up your script tags safely!</h4>
<p><code>&lt;script type="text/javascript">&lt;!--//-->&lt;![CDATA[//>&lt;!--<br />
       PUT YOUR CODE IN HERE<br />
	//-->&lt;!]]&gt;&lt;/script></code></p>
<p>This applies to all XHTML pages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazydada.com/2008-11-07/avoid-html-validation-errors-due-to-your-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Options for &#8220;hybrid modal&#8221; lightbox display of images</title>
		<link>http://www.lazydada.com/2008-05-29/options-for-hybrid-modal-lightbox-display-of-images/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=options-for-hybrid-modal-lightbox-display-of-images</link>
		<comments>http://www.lazydada.com/2008-05-29/options-for-hybrid-modal-lightbox-display-of-images/#comments</comments>
		<pubDate>Thu, 29 May 2008 16:31:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web design & development]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[webdesign]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://www.lazydada.com/?p=33</guid>
		<description><![CDATA[[Update 2009 - OK now I'm not the total newbie anymore and would have to recommend Shadowbox on top of jQuery for it's versatility and power. Slimbox is still great though.] The Contenders Slimbox The true successor to the king (Lightbox). This is the chosen one. Very lightweight, simple instructions, does what it says on [...]]]></description>
			<content:encoded><![CDATA[<p>[Update 2009 - OK now I'm not the total newbie anymore and would have to recommend <a href="#shadowbox">Shadowbox</a> on top of jQuery for it's versatility and power. Slimbox is still great though.]</p>
<hr />
<h2>The Contenders</h2>
<h4><a href="http://www.digitalia.be/software/slimbox">Slimbox</a></h4>
<p>The true successor to the king (Lightbox). This is the chosen one. Very lightweight, simple instructions, does what it says on the tin. Simple instructions for when I&#8217;ve forgotten in two weeks are further <a href="#slimboxwalkthrough">down</a>&#8230;</p>
<h4 id="shadowbox"><a href="http://mjijackson.com/shadowbox/">Shadowbox.js</a></h4>
<p>This one seems to be the current best in breadth of options but too much to read for a low level webdev monkey like me.</p>
<h4><a href="http://www.lokeshdhakar.com/projects/lightbox2/">Lightbox</a></h4>
<p>The original &#8211; but perhaps no longer the beast.</p>
<h4><a href="http://jquery.com/demo/thickbox/">Thickbox</a></h4>
<p>Could have been a contender but I balked at the heavy graphic design.</p>
<h4><a href="http://www.cabel.name/2008/02/fancyzoom-10.html">FancyZoom</a></h4>
<p>The one that started the search thanks to seeing it in action at <a href="http://www.fontshop.com/fontfeed/archives/new-fontfonts-release-44/">this</a> FontFeed article. Great tool &#8211; but as a webdev guerilla [read chimp] the commercial licence stopped me. Need a bit of slack before I can convince anybody to pay&#8230;</p>
<hr />
<h2><a name="slimboxwalkthrough">Slimbox walk-through</a></h2>
<p>Upload css and js files &#8211; add these three lines of code to the head of the HTML:</p>
<pre>&lt;script type="text/javascript" src="js/mootools.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/slimbox.js"&gt;&lt;/script&gt;
&lt;link rel="stylesheet" href="css/slimbox.css" type="text/css" media="screen" /&gt;</pre>
<p>(The last slash there may want removing according to your doctype. Are you strict enough for it?)<br />
Then craft the images links like this for single images</p>
<pre>&lt;a href="" rel="lightbox" title=""&gt;&lt;img src="" alt="" /&gt;&lt;/a&gt;</pre>
<p>or, for sets, like this (where the <tt>rel</tt> attribute has the set name&#8217;s suffix)</p>
<pre>&lt;a href="" rel="lightboxset" title=""&gt;&lt;img src="" alt="" /&gt;&lt;/a&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lazydada.com/2008-05-29/options-for-hybrid-modal-lightbox-display-of-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>InDesign CS2 export script</title>
		<link>http://www.lazydada.com/2008-02-21/indesign-cs2-export-script/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=indesign-cs2-export-script</link>
		<comments>http://www.lazydada.com/2008-02-21/indesign-cs2-export-script/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 18:08:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pre-press]]></category>
		<category><![CDATA[CS2]]></category>
		<category><![CDATA[InDesign]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://www.lazydada.com/2008-02-21/indesign-cs2-export-script/</guid>
		<description><![CDATA[This very useful JavaScript code was developed by Peter Kahrel as he found my problem interesting. Bless you Peter! The full thread is over on the Adobe&#8217;s InDesign Scripting Forum here abouts. Because there&#8217;s only a limited life for any post over there &#8211; I&#8217;m dumping here too for posterity. The purpose of the script [...]]]></description>
			<content:encoded><![CDATA[<p>This very useful JavaScript code was developed by Peter Kahrel as he found my problem interesting. Bless you Peter! The full thread is over on the Adobe&#8217;s InDesign Scripting Forum <a href="http://www.adobeforums.com/webx/?13@445.PqIgiT5CgQC@.3c05bd08/7">here abouts</a>. Because there&#8217;s only a limited life for any post over there &#8211; I&#8217;m dumping here too for posterity.</p>
<p>The purpose of the script is to export single page PDFs from a multi-page InDesign CS2 document where the page numbering has been set via page Numbering and Section Options. PDFs are exported to a predetermined PDF setting: &#8220;PDF_X-1a with Bleed &#038; co&#8221; in my case. The resulting file PDFs are named with a three-digit prefix corresponding to the page number in the InDesign document and a user defined base name &#8211; defined when the script is run. </p>
<p>A basic version of this script is supplied by Adobe in with the extras for an InDesign install but unfortunately that falls over when there is a Named Section present. Getting a stray Named Section in your document is very easy. Easier for some users mind &#8211; but still very easy. Peter &#8211; I still owe you a beer or three&#8230;</p>
<p>Here is the magic script:</p>
<pre>
#target indesign 

if(app.documents.length != 0)
   {
   var myFolder = Folder.selectDialog ("Choose a Folder");
   if(myFolder != null)
      {
      myExportPages(myFolder);
      }
   }
else
   {
   alert("Please open a document and try again.");
   } 

function myExportPages(myFolder)
{
var myPageName, myFilePath, myFile;
var myDocument = app.activeDocument;
var myDocumentName = myDocument.name;
//This next line sets the PDF export Setting
var myPDFExportPreset = app.pdfExportPresets.item("PDF_X-1a with Bleed &#038; co")
var myDialog = app.dialogs.add();
with(myDialog.dialogColumns.add().dialogRows.add())
   {
   staticTexts.add({staticLabel:"Base name:"});
   var myBaseNameField = textEditboxes.add({editContents:myDocumentName, minWidth:160});
   }
var myResult = myDialog.show({name:"ExportPages"});
if(myResult == true)
   {
   var myBaseName = myBaseNameField.editContents;
   myDialog.destroy();
   // Remember the state of each section prefix
   var section_states = myDocument.sections.everyItem().includeSectionPrefix;
   // Get all section-prefix names
   var section_names = app.activeDocument.sections.everyItem().name;
   // Enable all section prefixes
   myDocument.sections.everyItem().includeSectionPrefix = true;
   // Create two parallel arrays with page numbers:
   // one with numbers preceded by section prefixes,
   // the other with bare page numbers
   var page_ranges = [];
   var filename_pagenames = [];
   for(var i = 0; i &lt; myDocument.pages.length; i++)
      {
      page_ranges.push (myDocument.pages.item(i).name);
      var temp = strip_section (myDocument.pages[i].name, section_names);
      filename_pagenames.push (("00" + temp).slice(-3))
      }
   // Restore the section-prefix settings
   restore_section_states (myDocument, section_states);
   // Export each page
   for(var i = 0; i &lt; myDocument.pages.length; i++)
      {
      app.pdfExportPreferences.pageRange = page_ranges[i];
      myFilePath = myFolder + "/" + filename_pagenames[i] + "-" + myBaseName + ".pdf";
      myFile = new File(myFilePath);
      myDocument.exportFile(ExportFormat.pdfType, myFile, false, myPDFExportPreset);
      }
   }
else
   {
   myDialog.destroy();
   }
} 

function restore_section_states (doc, states)
{
for (var i = 0; i &lt; doc.sections.length; i++)
   doc.sections[i].includeSectionPrefix = states[i];
} 

function strip_section (pg, array)
{
for (var i = 0; i &lt; array.length; i++)
   if (array[i].length > 0)
      if (pg.match (RegExp ('^'+array[i])) != null)
         {
         pg = pg.replace (RegExp ('^'+array[i]), '');
         break
         }
return pg
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lazydada.com/2008-02-21/indesign-cs2-export-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
