<?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>Martini Lab Blog &#187; WebKit</title>
	<atom:link href="http://www.martinilab.com/blog/tag/webkit/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.martinilab.com/blog</link>
	<description>Web design, CSS, scripting, Adobe, tips and other scraps of things that come my way</description>
	<lastBuildDate>Fri, 20 Aug 2010 20:58:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Mobile Safari needs a little jQuery .live() love</title>
		<link>http://www.martinilab.com/blog/209/mobile-safari-needs-a-little-jquery-live-love/</link>
		<comments>http://www.martinilab.com/blog/209/mobile-safari-needs-a-little-jquery-live-love/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 22:53:08 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=209</guid>
		<description><![CDATA[file under: the importance of device testing Just a quick note about how Mobile Safari gets along with .live(). As a matter of coding style, I usually assign my actions to links and buttons. Sometimes I don’t. &#60;li&#62;Title of Something &#8230; <a href="http://www.martinilab.com/blog/209/mobile-safari-needs-a-little-jquery-live-love/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>file under: the importance of device testing</em></p>
<p>Just a quick note about how Mobile Safari gets along with <code>.live()</code>.  As a matter of coding style, I usually assign my actions to links and buttons.  Sometimes I don’t.</p>
<pre>
&lt;li&gt;Title of Something &lt;span class="more"&gt;&lt;/span&gt;&lt;/li&gt;
</pre>
<p>This code won’t get followed by a bot to show more info about the list item.</p>
<pre>
$('.more').click(function () {
    showMore();
});
</pre>
<p>Now I have an event assigned.  However, if this list item is added dynamically…</p>
<pre>
$(myListItem).appendTo('ul');

$('.more').live('click', function () {
    showMore();
});
</pre>
<p>Works great, except on Mobile Safari.  The workaround is <strong>really</strong> hacky though.  If this ‘more’ were a link (<code>&lt;a href="#" class="more"&gt;&lt;/a&gt;</code>), there wouldn’t be a problem, just like adding <code>onclick=""</code>.</p>
<pre>
&lt;li&gt;Title of Something &lt;span class="more" onclick=""&gt;&lt;/span&gt;&lt;/li&gt;
</pre>
<p>Problem Solved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/209/mobile-safari-needs-a-little-jquery-live-love/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing scribbr.com</title>
		<link>http://www.martinilab.com/blog/149/introducing-scribbrcom/</link>
		<comments>http://www.martinilab.com/blog/149/introducing-scribbrcom/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 22:51:26 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=149</guid>
		<description><![CDATA[Scribbr is a tiny web app for drawing and posting to twitter. With jQuery, the user can control the color, size, opacity of the cursor to draw on the canvas element 320 x 320 in size. Last summer, I had &#8230; <a href="http://www.martinilab.com/blog/149/introducing-scribbrcom/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://scribbr.com">Scribbr</a> is a tiny web app for drawing and posting to twitter.   With jQuery, the user can control the color, size, opacity of the cursor to draw on the <code>canvas</code> element 320 x 320 in size.</p>
<p>Last summer, I had the opportunity to work with Eisner Award winning cartoonist Scott Kurtz of <a href="http://www.pvponline.com">PVP</a>. During one conversation we had, he came up with a punch-line to what we were talking about.  I don’t remember what the subject was, but the punch-line involved a mock editorial cartoon.  He grabbed a 2″ x 2″ sticky note pad and drew the cartoon.  We had a laugh.</p>
<p>This would never happen online.  At least, not in any convenient, simple, method that I was aware of.</p>
<p>Right now, it’s very crude.  The controls are, admittedly, non-intuitive. There is no ‘Undo’ other than clearing the canvas and starting over. It doesn’t support older browsers either.</p>
<p>I’m actually quite okay with that last part. This site was immensely fun to build. Getting it to work on IE6 would have taken away from that.  Right now, I know that it works on FireFox 3.0, Safari 4.0b (or WebKit nightly build), and Google Chrome 2.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/149/introducing-scribbrcom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with WebKit css gradients</title>
		<link>http://www.martinilab.com/blog/104/fun-with-webkit-css-gradients/</link>
		<comments>http://www.martinilab.com/blog/104/fun-with-webkit-css-gradients/#comments</comments>
		<pubDate>Fri, 15 May 2009 21:38:52 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=104</guid>
		<description><![CDATA[As a follow up to yesterday’s woeful tale of using WebKit’s proprietary css properties, I wanted to follow up with a couple examples of how one can use these features without getting all “bevel-ly” The only benefit of text-shadow is &#8230; <a href="http://www.martinilab.com/blog/104/fun-with-webkit-css-gradients/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As a follow up to yesterday’s <a href="http://www.martinilab.com/blog/91/webkit-background-clip-problem/">woeful tale</a> of using WebKit’s proprietary css properties, I wanted to follow up with a couple examples of how one can use these features without getting all “bevel-ly”</p>
<p>The only benefit of <code>text-shadow</code> is not downloading graphics for what can be expressed in css.  The same goes for <code>-webkit-border-image</code>, <code>-webkit-gradient</code>, <code>-moz-border-radius</code>, anything that keeps a web designer from having to launch Photoshop is a boon to bandwidth.</p>
<p>Here are two examples of using some WebKit css gradients.*</p>
<p><em>Update: You must have the Chrome 2.0 or Safari 4.b for these to work.</em></p>
<p><a href='http://www.martinilab.com/blog/wp-content/uploads/2009/05/album.html'>Example 1</a>. is brought to you by “Killer Queen”</p>
<p>This similar looking display to that of the iPhone album display uses a radial gradient (opposed to a linear) as the background for the track names. The overall effect is a dim light. The odd numbered tracks also use a gradient to take advantage of <code>-webkit-gradient</code>’s support of alpha values.</p>
<p><a href='http://www.martinilab.com/blog/wp-content/uploads/2009/05/calendar.html'>Example 2</a>. is a css calendar.</p>
<p>This one combines linear gradients and javascript arrays.  Because <code>-webkit-gradient</code> can use rbga formatting in place of the usual hexadecimal value, calculating the values from color to another was much easier.</p>
<p>The drawback to these browser specific properties are, well, browser specific.  While adding a gradient value to your <code>div id=wrapper</code> might give it a groovy drop shadow effect on Safari, nothing is happening on either Firefox, and much less for IE.  </p>
<p>The workaround at this point is to browser detect.</p>
<pre lang="javascript" line="1">
if(jQuery.browser.safari) {
$('#wrapper').addClass('problem-solved');
}
else {
	$('#wrapper').addClass('wah-wah-wah');
}
</pre>
<p>Or whatever.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/104/fun-with-webkit-css-gradients/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>–webkit-background-clip Problems</title>
		<link>http://www.martinilab.com/blog/91/webkit-background-clip-problem/</link>
		<comments>http://www.martinilab.com/blog/91/webkit-background-clip-problem/#comments</comments>
		<pubDate>Thu, 14 May 2009 18:07:23 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=91</guid>
		<description><![CDATA[Someday, all the nifty Photoshop Blending options will be available as CSS properties. Mark my words! In the mean time, we’re kind of stuck with drop shadows, and now gradients (and text strokes) for WebKit browsers. Too bad you can’t &#8230; <a href="http://www.martinilab.com/blog/91/webkit-background-clip-problem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Someday, all the nifty Photoshop Blending options will be available as CSS properties.  Mark my words! In the mean time, we’re kind of stuck with drop shadows, and now gradients (and <a href="http://webkit.org/blog/85/introducing-text-stroke/">text strokes</a>) for WebKit browsers. Too bad you can’t use them together.</p>
<p>In order to take advantage of the background clipping, the color needs to be transparent.  First off, that pretty much ruins any other browser from displaying text.  So this is only useful to Safari users (not even the iPhone currently supports it).  In Photoshop, you can get around having a transparent color and still having a drop shadow by setting that layers Fill Opacity to 0% while the layers opacity at 100%.</p>
<p>Also, using this technique has some odd behavior with padding. In my example, I couldn’t set padding to the parent div without the effect inheriting that padding.  Restating the padding didn’t affect it either.</p>
<p>Here is the example: <a href='http://www.martinilab.com/blog/wp-content/uploads/2009/05/webkit-background-clip.html'>webkit-background-clip.html</a></p>
<p>Now, you can add the <code>-webkit-text-stroke</code> and that will work with <code>text-shadow</code>, but only on the stroke and not the text.  I’ve yet to find an example that uses all three without looking like one of Superjail’s Doctor’s <a href=" http://superjail.wordpress.com/2008/10/13/specimen-7/">genetic experiments</a>.</p>
<p>Perhaps it is for the best, getting these to work together might have been the next <code>blink</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/91/webkit-background-clip-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tackling Safari’s slow gif “feature” with jQuery</title>
		<link>http://www.martinilab.com/blog/75/tackling-safaris-slow-gif-feature-with-jquery/</link>
		<comments>http://www.martinilab.com/blog/75/tackling-safaris-slow-gif-feature-with-jquery/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 23:19:36 +0000</pubDate>
		<dc:creator>Chris Williams</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.martinilab.com/blog/?p=75</guid>
		<description><![CDATA[Safari’s WebKit has a funny behavior of displaying animated gif files at a lower frame rate than Firefox. From what I can tell, WebKit (including Google Chrome) caps the animated gif frame rates at 10fps. While it may be faster &#8230; <a href="http://www.martinilab.com/blog/75/tackling-safaris-slow-gif-feature-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Safari’s WebKit has a funny behavior of displaying animated gif files at a lower frame rate than Firefox. From what I can tell, WebKit (including Google Chrome) caps the animated gif frame rates at 10fps. While it may be faster than some IE6 browsers, it’s not exactly helpful for those files with higher frame rates.</p>
<p>For example, the popular ajax loader file that hails from Apple’s own <a href="http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGControls/XHIGControls.html">asynchronous progress indicator</a>, has 12 points and loops around once a second.  Well, for one thing, 12fps is really choppy, but it already plays slower on Apple’s nifty browser.</p>
<h2>jQuery to the rescue</h2>
<p>Did you know that jQuery can control css background positions? Are you thinking what I’m thinking?<br />
<span id="more-75"></span></p>
<h2>But first, back to drawing board</h2>
<p>So the first part was to break up the animated gif frames and spread them out across a very long canvas. Since Photoshop no longer opens animated gif files (unless you own ImageReady somewhere), Fireworks can open the file. Use Fireworks to export the frames to individual files and THEN Photoshop can import all the files as a stack.</p>
<p>File <code>&lt;Scripts&gt;</code> Load Files into Stack…</p>
<p>For our ajax loader, expand all the layers next to each other and then save it out to its own gif.  The file size won’t be that difference in fact.</p>
<h2>Now let’s get back to jQuery</h2>
<p>In our html, just set the div with a width and height to match your gif to prevent clipping and let the script do the rest.</p>
<pre lang="javascript" line="1">

$(document).ready(function(){
	var bgimage = 'url(images/ajax-loader-long.gif)';
	var frames = 24;
	var mpf = parseInt(1000/frames)  // how many miliseconds in each frame
	var currentFrame = 0;
	var offset = 0;

	$('.animate').css('background-image', bgimage);

	function animate() {
		offset = currentFrame * 64;
		$('.animate').css('background-position', '-' + offset + 'px 0px');
		currentFrame = (currentFrame == frames) ? 1 : currentFrame + 1;
	}

	setInterval(animate, mpf);
});
</pre>
<p>Now we have a script that will snap the position of the background over each “frame” at the correct frame rate. Actually, the frame rate is not divisible by 1000, but it’s close and it’s not like you could tell.</p>
<p>The only problem with this script is that it’s constantly running. If you look at the page in Firebug, your going to see the code whipping around with new values all the time. Annoying! Also, chances are your page isn’t going to need some animation playing constantly. Ajax loaders are intermittently called when a simple action is called as a… asynchronous progress indicator! Who knew.</p>
<p>So we’re going to put in a cancel command to this script: <strong>clearTimeout</strong>.</p>
<pre lang="javascript" line="1">

$(document).ready(function(){
	var bgimage = 'url(images/ajax-loader-long.gif)';
	var frames = 24;
	var mpf = parseInt(1000/frames)  // how many miliseconds in each frame
	var currentFrame = 0;
	var offset = 0;
	var runAnimate = 0;

	$('.animate').css('background-image', bgimage);

	function animate() {
		offset = currentFrame * 64;
		$('.animate').css('background-position', '-' + offset + 'px 0px');
		currentFrame = (currentFrame == frames) ? 1 : currentFrame + 1;
	}

	runAnimate = setInterval(animate, mpf);

	$('.animate').toggle(
		function () {
			clearTimeout(runAnimate);
		},
		function () {
			runAnimate = setInterval(animate, mpf);
		}
	);
});
</pre>
<p>Add in a toggle so show how to turn on and off the animation and were done.</p>
<p>It even works on ie6!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinilab.com/blog/75/tackling-safaris-slow-gif-feature-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
