<?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>The Dev Shack &#187; jQuery</title>
	<atom:link href="http://www.thedevshack.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedevshack.com</link>
	<description>Technology and Programming Blog</description>
	<lastBuildDate>Mon, 06 Jun 2011 00:13:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Growl Type Notifications in Adobe AIR</title>
		<link>http://www.thedevshack.com/growl-type-notifications-in-adobe-air/</link>
		<comments>http://www.thedevshack.com/growl-type-notifications-in-adobe-air/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 18:24:42 +0000</pubDate>
		<dc:creator>mfleming</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.thedevshack.com/?p=393</guid>
		<description><![CDATA[The past week or so I have been able to work on my first Adobe AIR app using HTML/JavaScript.  So far I have been very impressed with what you can build in AIR.  The application I have been working on pings a web service via jQuery and needs to pop up an alert to the [...]]]></description>
			<content:encoded><![CDATA[<p>The past week or so I have been able to work on my first Adobe AIR app using HTML/JavaScript.  So far I have been very impressed with what you can build in AIR.  The application I have been working on pings a web service via jQuery and needs to pop up an alert to the user that new content is available for viewing.  The most difficult piece for me so far has been building the notification functionality.  My requirements called for notifications that were similar to those of some of the AIR based Twitter apps.  In the lower right corner of the screen a notification should display then auto hide after a given time frame.  I was able to get this working, but I was not happy with the display portion of the notification.  It just appeared clunky to me.<span id="more-393"></span></p>
<p>On my quest to find another way to accomplish this I joined the newly created Google Group for AIR with HTML and JavaScript.  I had mentioned in a post there that I had struggled a bit with the notifications.  Andy Matthews replied back and made me aware of jQuery plugin named BlockUI that allowed you to create Growl type notifications.  That is exactly what I was looking for.  I was able to modify some of the code I already had and implement the new plugin.  The results were great and were exactly what I needed.  The plugin also allows you to easily change the opacity, fade in and fade out times, etc…</p>
<p>There are two parts of code here that makes this work.  The first bit of code lives in my main HTML file for my application.  This code creates a new window that will essentially be the holder of the notification itself.  The last two lines of this code tell it to spawn my window and load the results of an HTML file into it.</p>
<pre class="brush:js">function displayNotification()
{
	var options = new air.NativeWindowInitOptions();

	options.type = air.NativeWindowType.LIGHTWEIGHT;
	options.transparent = true;
	options.systemChrome = air.NativeWindowSystemChrome.NONE;

	var bounds = null;
	var screen = air.Screen.mainScreen.visibleBounds;
	var windowHeight = 150;
	var windowWidth = 400;

	bounds = new air.Rectangle(
		screen.width - windowWidth - 40,
		screen.height - windowHeight - 50,
		windowWidth,
		windowHeight
	);

	var notification = air.HTMLLoader.createRootWindow(
		true,
		options,
		false,
		bounds
	);

	notification.paintsDefaultBackground = false;
	notification.stage.nativeWindow.alwaysInFront = true;
	notification.navigateInSystemBrowser = true;

	var NOTIFY_SOURCE = "growl.html";
	notification.load( new air.URLRequest( NOTIFY_SOURCE ) );
}</pre>
<p>So now that we have our window fired off, we need to create the associated HTML page that contains the notification itself.  This is where the plugin comes into play.  You can see from the code below that all the HTML page does is fire off the jQuery function to create our notification.   The plugin will then handle the display of the message, which is simple HTML code wrapped into a DIV.  I did create a stylesheet that I use for the notifications that is included as well.</p>
<pre class="brush:js">&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
	&lt;title&gt;Notify&lt;/title&gt;

	&lt;link rel="stylesheet" type="text/css" href="/css/notification.css" /&gt;

	&lt;script type="text/javascript" src="lib/air/AIRAliases.js"&gt;&lt;/script&gt;
 	&lt;script type="text/javascript" src="/lib/jquery/jquery-1.4.2.min.js"&gt;&lt;/script&gt;
	&lt;script type="text/javascript" src="/lib/jquery.blockUI.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;div class="growlUI" style="display:none"&gt;
    &lt;h1&gt;New Items Available&lt;/h1&gt;
    &lt;h2&gt;New articles have been posted&lt;/h2&gt;
&lt;/div&gt; 

&lt;script type="text/javascript"&gt;
	$(document).ready(function() {
        air.trace("Hi");

		$.blockUI({
            message: $('div.growlUI'),
            fadeIn: 700,
            fadeOut: 700,
            timeout: 2000,
            showOverlay: false,
            centerY: false,
            css: {
                width: '350px',
                top: '10px',
                left: '',
                right: '10px',
                border: 'none',
                padding: '5px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .8,
                color: '#fff'
            }
        });
	});
&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<p>The result is a nice looking notification that displays, then fades out after a few seconds.</p>
<div><a rel="attachment wp-att-402" href="http://www.thedevshack.com/growl-type-notifications-in-adobe-air/notification-2/"><img class="aligncenter size-full wp-image-402" title="notification" src="http://www.thedevshack.com/wp-content/uploads/2010/09/notification1.jpg" alt="" width="606" height="414" /></a></div>
<p>Again, thanks to Andy for pointing me over to the jQuery BlockUI plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedevshack.com/growl-type-notifications-in-adobe-air/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Using jQuery and ASP.NET</title>
		<link>http://www.thedevshack.com/using-jquery-and-aspnet/</link>
		<comments>http://www.thedevshack.com/using-jquery-and-aspnet/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 10:48:36 +0000</pubDate>
		<dc:creator>mfleming</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ClientID]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[runatserver]]></category>
		<category><![CDATA[slideDown]]></category>
		<category><![CDATA[slideUp]]></category>

		<guid isPermaLink="false">http://www.thedevshack.com/?p=167</guid>
		<description><![CDATA[I&#8217;ve been using jQuery quite a lot lately in my ColdFusion apps. I&#8217;ve been working on a .NET site and yesterday I needed to throw a little jQuery into that site. I quickly found that ASP.NET poses one issue when using jQuery or simple Javascript in the situations where you are performing an operation on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using jQuery quite a lot lately in my ColdFusion apps.  I&#8217;ve been working on a .NET site and yesterday I needed to throw a little jQuery into that site.  I quickly found that ASP.NET poses one issue when using jQuery or simple Javascript in the situations where you are performing an operation on a named element.  This relates specifically to using the ASP.NET controls, or any HTML control that has a runatserver command.  As soon as you set runatserver=&#8221;true&#8221; on a control or HTML element, ASP.NET will rename that element when the page is loaded.  For example, if I have a div element with an id attribute of &#8220;displayInfo&#8221;, ASP.NET will convert the ID into something like: ctl00_MainContent_displayInfo.  As you can imagine this makes it difficult to use in some situations.  But there is a very quick solution.</p>
<p>Microsoft has provided a simple ClientID variable that you can call that returns the correct ID of the control or HTML element.   You just append .ClientID to the ID of your element.  So in our example of above we would use displayInfo.ClientID anytime we needed to reference the displayInfo div in our jQuery or Javascript code.</p>
<p>Below is an example of using this with a little jQuery:</p>
<p><code lang="javascript[lines]"><script type="text/javascript">
        jQuery(document).ready(function($) {
            init();
        })</p>
<p>        function init() {
            $("#<%= news_item_type.ClientID %>").change(function() { slideForm($("#<%= news_item_type.ClientID %>").val()) });
        }</p>
<p>        function slideForm(formVal) {
            if (formVal == 'Detail') {
                $('#<%= detailDisplay.ClientID %>').slideDown();
                $('#<%= urlDisplay.ClientID %>').slideUp();
                $('#<%= fileDisplay.ClientID %>').slideUp();
            } else if (formVal == 'URL') {
                $('#<%= detailDisplay.ClientID %>').slideUp();
                $('#<%= urlDisplay.ClientID %>').slideDown();
                $('#<%= fileDisplay.ClientID %>').slideUp();
            } else if (formVal == 'File') {
                $('#<%= detailDisplay.ClientID %>').slideUp();
                $('#<%= urlDisplay.ClientID %>').slideUp();
                $('#<%= fileDisplay.ClientID %>').slideDown();
            }
        }
    </script></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedevshack.com/using-jquery-and-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the jQuery UI Datepicker</title>
		<link>http://www.thedevshack.com/using-the-jquery-ui-datepicker/</link>
		<comments>http://www.thedevshack.com/using-the-jquery-ui-datepicker/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 11:58:57 +0000</pubDate>
		<dc:creator>mfleming</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.thedevshack.com/using-the-jquery-ui-datepicker/</guid>
		<description><![CDATA[I have really been into learning and using jQuery the last few weeks.&#0160; I keep coming across some very simple functions that provide a much nicer UI experience.&#0160; One of these is the Datepicker widget that is a part of the jQuery UI package.&#0160; The&#0160;widget is super fast and is customizable in a variety of [...]]]></description>
			<content:encoded><![CDATA[<p>I have really been into learning and using jQuery the last few weeks.&#0160; I keep coming across some very simple functions that provide a much nicer UI experience.&#0160; One of these is the <a href="http://jqueryui.com/demos/datepicker/" target="_blank">Datepicker widget</a> that is a part of the jQuery UI package.&#0160; The&#0160;widget is super fast and is customizable in a variety of ways.&#0160; It takes only a couple of lines of code to add into your page.&#0160; To place the&#0160;widget into your code with the default setup is simply this:</p>
<p><code lang="javascript[lines]"><script type="text/javascript">
  $(function() {
   $("#datepicker").datepicker();
  });
 </script></code></p>
<p>I am not going to post any demos, as the <a href="http://jqueryui.com/demos/datepicker/" target="_blank">jQuery UI page for this widget</a> has all you need.&#0160; It also lists out all the options you can pass in to control the widget as well.&#0160; Some of the cool features I like are:</p>
</p>
<ul>
<li>You can easily set the date format it returns</li>
<li>You can restrict the selectable date range</li>
<li>You can display more than 1 month at a time</li>
<li>You can display the widget inline</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.thedevshack.com/using-the-jquery-ui-datepicker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

