<?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>JavaScript &#8211; here&#039;s what I did&#8230;</title>
	<atom:link href="https://www.hereswhatidid.com/category/development/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.hereswhatidid.com/</link>
	<description>The Development Blog of Gabe Shackle</description>
	<lastBuildDate>Fri, 20 Apr 2018 13:08:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.4.2</generator>
	<item>
		<title>List variation SKUs within the WooCommerce product edit screen</title>
		<link>https://www.hereswhatidid.com/2016/05/list-variation-skus-within-woocommerce-product-edit-screen/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Wed, 04 May 2016 16:03:21 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.hereswhatidid.com/?p=655</guid>

					<description><![CDATA[This snippet will replace the existing post ID displayed in the WooCommerce product edit screen with the variation&#8217;s SKU if one exists. Often times the variation SKU is far more useful to an admin than the internal WordPress post ID so having it displayed on the edit screen makes the administration process much easier.]]></description>
										<content:encoded><![CDATA[<p>This snippet will replace the existing post ID displayed in the WooCommerce product edit screen with the variation&#8217;s SKU if one exists. Often times the variation SKU is far more useful to an admin than the internal WordPress post ID so having it displayed on the edit screen makes the administration process much easier.</p>
<p><a href="https://www.hereswhatidid.com/media/woocommerce-sku-snippet.png"><img class="alignnone size-full wp-image-656" src="https://www.hereswhatidid.com/media/woocommerce-sku-snippet.png" alt="woocommerce-sku-snippet" width="650" height="272" srcset="https://www.hereswhatidid.com/media/woocommerce-sku-snippet.png 650w, https://www.hereswhatidid.com/media/woocommerce-sku-snippet-580x243.png 580w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<script src="https://gist.github.com/hereswhatidid/88ffd83eb2e2840c43e589f30f335b4f.js"></script>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Knockout.js Extenders: Grouped</title>
		<link>https://www.hereswhatidid.com/2014/02/knockout-js-extenders-grouped/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Thu, 27 Feb 2014 03:31:24 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Knockout.js]]></category>
		<guid isPermaLink="false">https://www.hereswhatidid.com/?p=522</guid>

					<description><![CDATA[I wrote this extender to more easily handle outputting observable arrays in row+column layout.  Typically, when running a simple foreach loop to display the content of an observable array you&#8217;re forced to include the row+column logic within the view itself or you have to write additional helper functions in the view model.  I ran in [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I wrote this extender to more easily handle outputting observable arrays in row+column layout.  Typically, when running a simple foreach loop to display the content of an observable array you&#8217;re forced to include the row+column logic within the view itself or you have to write additional helper functions in the view model.  I ran in to a situation where several different observable arrays needed to be displayed in row+column grids and rather than handling that functionality in the view or view model, I created this extension to generate a property of the observable array that is simply an additional observable array of the parent that has all the elements arranged in groups of whatever quantity that is specified.</p>
<script src="https://gist.github.com/hereswhatidid/8553151.js"></script>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Media Chooser Demo Plugin</title>
		<link>https://www.hereswhatidid.com/2013/07/media-chooser-demo-plugin/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Wed, 10 Jul 2013 22:58:46 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.hereswhatidid.com/?p=436</guid>

					<description><![CDATA[The demo plugin can be downloaded here.]]></description>
										<content:encoded><![CDATA[<p>The demo plugin can be <a href="https://www.hereswhatidid.com/wp-content/uploads/2013/07/media-chooser-demo1.zip">downloaded here</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Move Gravity Forms jQuery calls to footer</title>
		<link>https://www.hereswhatidid.com/2013/01/move-gravity-forms-jquery-calls-to-footer/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Thu, 10 Jan 2013 22:31:56 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.hereswhatidid.com/?p=365</guid>

					<description><![CDATA[Gravity Forms by default will write an inline JavaScript call to jQuery on every form you add to a page.  This will throw an error if you&#8217;re loading jQuery in the footer of your site (which you should be doing).  This is the error: Uncaught ReferenceError: jQuery is not defined There&#8217;s an extremely hidden bit [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Gravity Forms by default will write an inline JavaScript call to jQuery on every form you add to a page.  This will throw an error if you&#8217;re loading jQuery in the footer of your site (which you should be doing).  This is the error:</p>
<p>Uncaught ReferenceError: jQuery is not defined</p>
<p>There&#8217;s an extremely hidden bit of documentation on how to override this behavior here:</p>
<pre class="prettyprint linenums">
&lt;?php
add_filter("gform_init_scripts_footer", "init_scripts");
function init_scripts() {
return true;
}
?&gt;
</pre>
<p>This code should be placed within your theme&#8217;s functions.php file.</p>
<p><a href="http://www.gravityhelp.com/documentation/page/Gform_init_scripts_footer" target="_blank">http://www.gravityhelp.com/documentation/page/Gform_init_scripts_footer</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Google News style floating sidebar</title>
		<link>https://www.hereswhatidid.com/2011/02/google-news-style-floating-sidebar/</link>
					<comments>https://www.hereswhatidid.com/2011/02/google-news-style-floating-sidebar/#comments</comments>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 03:34:09 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<guid isPermaLink="false">https://www.hereswhatidid.com/?p=244</guid>

					<description><![CDATA[I noticed a subtle but nice feature on the Google News main page recently.  The left-hand navigation that has the various section headings remains fixed to the top left area as you scroll down but it does not overlap the top banner area.  Also, if your browser window is too small to fit the entire [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I noticed a subtle but nice feature on the Google News main page recently.  The left-hand navigation that has the various section headings remains fixed to the top left area as you scroll down but it does not overlap the top banner area.  Also, if your browser window is too small to fit the entire navigation vertically, when you mouseover the navigation area a set of vertical scroll bars appears.  After a little digging it turns out they did this with a combination of CSS and JavaScript.  Here&#8217;s a simple demo I&#8217;ve set up that illustrates how I believe they achieved the effect.</p>
<p><span id="more-244"></span><br />
Initially, the sidebar area is set to a non-fixed position.  In my example I&#8217;m just floating it to the left of the main content area.  It also has overflow set to hidden.  Here is the CSS for the sidebar:</p>
<pre class="prettyprint linenums">
&lt;style type="text/css"&gt;
#sidebar { float: left; width: 180px; margin: 10px 0 0 0; font-size: 11px; line-height: 15px; }
#sidebar #pinned { width: 180px; height: 100%; overflow-y: hidden; }
#sidebar #pinned.pin-set { position: fixed; height: 100%; top: 0px; z-index: 99; }
#sidebar:hover #pinned { overflow-y: auto !important; }
&lt;/style&gt;
</pre>
<p>The pin-set class is what I&#8217;ll apply to the sidebar content area (#pinned) when the user scrolls far enough down that the header is covered.  Here is the JavaScript required for that effect.  I&#8217;m using jQuery for simplicity of selectors and events:</p>
<pre class="prettyprint linenums">
&lt;script type="text/javascript"&gt;
(function($) {
$(function() {
var int_sideheight = $(window).height() - $('#header').height() - 10;
$('#pinned').css('height',int_sideheight+'px');
$(window).scroll(function() {
if ($(this).scrollTop() &gt; $('#header').height()) {
$('#pinned').addClass('pin-set').css('height','100%');
} else {
var int_sideheight = $(window).height() - $('#header').height() - 10;
$('#pinned').removeClass('pin-set').css('height',int_sideheight+'px');
}
});
});
})(jQuery);
&lt;/script&gt;
</pre>
<p>What I&#8217;m doing is checking to seel when the scrollTop() is greater than the height of the header area. If it is, then apply that pin-set class to the sidebar navigation area.  If it isn&#8217;t, I&#8217;m clearing the class so that the sidebar area will always remain below the header area.  The mouseover scroll bar effect is purely CSS-driven.</p>
<p><a href="https://www.hereswhatidid.com/coding/fixedsidebar/sidebar.php" target="_blank">View a working demo of this code here.</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.hereswhatidid.com/2011/02/google-news-style-floating-sidebar/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Using jQuery to find elements that contain a specific text string</title>
		<link>https://www.hereswhatidid.com/2011/02/using-jquery-to-find-elements-that-contain-a-specific-text-string/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Wed, 23 Feb 2011 22:31:31 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<guid isPermaLink="false">https://www.hereswhatidid.com/?p=241</guid>

					<description><![CDATA[This snippet of code uses the .filter() function within jQuery to find all &#8220;li&#8221; elements that contain just the text &#8220;findthis&#8221;.]]></description>
										<content:encoded><![CDATA[<p>This snippet of code uses the .filter() function within jQuery to find all &#8220;li&#8221; elements that contain just the text &#8220;findthis&#8221;.</p>
<pre class="prettyprint linenums">
$('li:contains(&quot;findthis&quot;)').filter(function() {
  return $(this).text() == &quot;findthis&quot;;
}).addClass('active');
</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Read the Agreement Validator</title>
		<link>https://www.hereswhatidid.com/2011/02/read-the-agreement-validator/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Fri, 04 Feb 2011 20:51:06 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[SEO]]></category>
		<guid isPermaLink="false">https://www.hereswhatidid.com/?p=175</guid>

					<description><![CDATA[Recently a client wanted to have a user agreement added to an enrollment form. The catch was that I needed to confirm that the user had at least scrolled through the text before allowing them to continue on with the form submission. Once again, jQuery to the rescue! HTML jQuery JavaScript: I&#8217;m currently working on [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Recently a client wanted to have a user agreement added to an enrollment form.  The catch was that I needed to confirm that the user had at least scrolled through the text before allowing them to continue on with the form submission.  Once again, jQuery to the rescue!<span id="more-175"></span></p>
<p>HTML</p>
<pre class="prettyprint linenums">
&lt;div class=&quot;agreement&quot;&gt;
  &lt;div class=&quot;agreement-inner&quot;&gt;
    Content for agreement goes here...
  &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;agreement-agree&quot;&gt;
  This is the stuff I want activated when the agreement has been read.
&lt;/div&gt;
</pre>
<p>jQuery JavaScript:</p>
<pre class="prettyprint linenums">
$(&quot;.agreement&quot;).scroll(function() {
  if ($(this).scrollTop() &gt;= ($('.agreement-inner',this).height() - $(this).height())) {
    $('.agreement-agree').removeClass('disabled');
    $('.agreement').unbind('scroll');
    $('.agreement-agree').fadeTo(0,1);
  }
});
</pre>
<p>I&#8217;m currently working on deploying this to a generic jQuery plugin that will let you specify the content that needs to be scrolled through as well as the content should become enabled once that criteria is met.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Google Static Maps</title>
		<link>https://www.hereswhatidid.com/2010/11/google-static-maps/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Thu, 04 Nov 2010 04:26:05 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">http://hereswhatidid/?p=44</guid>

					<description><![CDATA[This is a nice utility for embedding a static version of a Google Maps location. For example, if you didn&#8217;t want to actually embed the fully functional Google Map but just an image of that map you can use this to dynamically generate it based on URL parameters. That means if the address changes or you [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is a nice utility for embedding a static version of a Google Maps location.  For example, if you didn&#8217;t want to actually embed the fully functional Google Map but just an image of that map you can use this to dynamically generate it based on URL parameters. That means if the address changes or you want to switch the view from Map to Satellite, all you need to do it pass a different value to the image path.  Here&#8217;s a a couple examples:</p>
<p><img src="http://maps.google.com/maps/api/staticmap?center=Risdall+Marketing+Group,550+Main+St,New+Brighton,MN+55112&amp;zoom=14&amp;size=200x200&amp;sensor=false&amp;markers=size:mid|color:blue|550+Main+St,New+Brighton,MN+55112" alt="" width="200" height="200" /> <img src="http://maps.google.com/maps/api/staticmap?center=Risdall+Marketing+Group,550+Main+St,New+Brighton,MN+55112&amp;zoom=14&amp;size=200x200&amp;sensor=false&amp;markers=size:mid|color:green|550+Main+St,New+Brighton,MN+55112&amp;maptype=satellite" alt="" width="200" height="200" /></p>
<p>These images are both generated on the fly via Google Maps.</p>
<p>[sourcecode lang=&#8221;html&#8221;]&lt;img src=&quot;http://maps.google.com/maps/api/staticmap?center=Risdall+Marketing+Group,550+Main+St,New+Brighton,MN+55112&amp;zoom=14&amp;size=200&#215;200&amp;sensor=false&amp;markers=size:mid|color:blue|550+Main+St,New+Brighton,MN+55112&quot; /&gt;[/sourcecode]</p>
<p>[sourcecode lang=&#8221;html&#8221;]&lt;img src=&quot;http://maps.google.com/maps/api/staticmap?center=Risdall+Marketing+Group,550+Main+St,New+Brighton,MN+55112&amp;zoom=14&amp;size=200&#215;200&amp;sensor=false&amp;markers=size:mid|color:green|550+Main+St,New+Brighton,MN+55112&amp;maptype=satellite&quot; /&gt;[/sourcecode]</p>
<p>The bandwidth limitation is 1000 unique (different) image requests per  viewer per day.  Which means you would only see a limit on users who  happen to view 1000 DIFFERENT static Google Maps images within a 24 hour  period.</p>
<p><a href="http://code.google.com/apis/maps/documentation/staticmaps/" target="_blank">Here&#8217;s the full api developers guide.</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ajax Autocomplete jQuery Plugin</title>
		<link>https://www.hereswhatidid.com/2010/10/ajax-autocomplete-jquery-plugin/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Fri, 29 Oct 2010 02:01:44 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<guid isPermaLink="false">http://hereswhatidid/?p=40</guid>

					<description><![CDATA[This is a nice little plugin for easily adding auto-complete functionality to form fields. All it looks for is a datasource formatted as JSON. I&#8217;ve put an example here using PHP to access a dinosaur name database returning the previously stored values. https://www.hereswhatidid.com/coding/autocomplete/ The project site is here: http://jqueryui.com/demos/autocomplete/ jQuery Code: [sourcecode lang=&#8221;javascript&#8221;](function($) { $(function() [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is a nice little plugin for easily adding auto-complete functionality to form fields.  All it looks for is a datasource formatted as JSON.  I&#8217;ve put an example here using PHP to access a dinosaur name database returning the previously stored values.</p>
<p><a href="https://www.hereswhatidid.com/coding/autocomplete/" target="_blank">https://www.hereswhatidid.com/coding/autocomplete/</a></p>
<p>The project site is here: <a href="http://jqueryui.com/demos/autocomplete/">http://jqueryui.com/demos/autocomplete/</a></p>
<p>jQuery Code:</p>
<p>[sourcecode lang=&#8221;javascript&#8221;](function($) {<br />
	$(function() {<br />
		$( &#8216;#s&#8217; ).autocomplete({<br />
			source: &#8216;tags.php&#8217;,<br />
			minLength: 2<br />
		});<br />
	});<br />
})(jQuery);[/sourcecode]</p>
<p>PHP for JSON Remote Data:</p>
<p>[sourcecode lang=&#8221;php&#8221;]$return_arr = array();</p>
<p>$dbhost = &#8216;hostname&#8217;;<br />
$dbuser = &#8216;username&#8217;;<br />
$dbpass = &#8216;password&#8217;;<br />
$dbname = &#8216;databasename&#8217;;</p>
<p>$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (&#8216;Error connecting to database&#8217;);<br />
mysql_select_db($dbname);<br />
if ($conn) {<br />
	$fetch = mysql_query(&quot;SELECT * FROM `sample-dinosaurs` WHERE DinoName LIKE &#8216;%&quot;.$_GET[&#8216;term&#8217;].&quot;%&#8217;&quot;);<br />
	while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {<br />
		$row_array[&#8216;label&#8217;] = $row[&#8216;DinoName&#8217;];<br />
    array_push($return_arr,$row_array);<br />
  }<br />
}<br />
mysql_close($conn);<br />
echo json_encode($return_arr);[/sourcecode]</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>jQuery data function speed variations</title>
		<link>https://www.hereswhatidid.com/2010/10/jquery-data-function-speed-variations/</link>
		
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Tue, 12 Oct 2010 02:01:19 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<guid isPermaLink="false">http://hereswhatidid/?p=38</guid>

					<description><![CDATA[It&#8217;s always worth looking up a function that you may be using heavily to see if there&#8217;s a faster way to call it. For example, getting and setting variables using the data() function within jQuery can vary greatly depending on how you call it. Here&#8217;s a site that compares the speed differences in various browsers: [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s always worth looking up a function that you may be using heavily to see if there&#8217;s a faster way to call it. For example, getting and setting variables using the data() function within jQuery can vary greatly depending on how you call it. Here&#8217;s a site that compares the speed differences in various browsers:</p>
<p><a href="http://jsperf.com/jquery-data-vs-jqueryselection-data">http://jsperf.com/jquery-data-vs-jqueryselection-data</a></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
