<?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>Pearl Tech &#187; jQuery</title>
	<atom:link href="http://blog.pearltechnology.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pearltechnology.com</link>
	<description></description>
	<lastBuildDate>Thu, 05 Jan 2012 14:47:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JQGrid and Jquery &#8211; Move toolbar below pager</title>
		<link>http://blog.pearltechnology.com/jqgrid-and-jquery-move-toolbar-below-pager/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/jqgrid-and-jquery-move-toolbar-below-pager/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 14:47:55 +0000</pubDate>
		<dc:creator>Chad Ferguson</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[JQGrid]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1288</guid>
		<description><![CDATA[For a current client it was requested that I move the JQGrid toolbar below the pager if a pager exists. The Toolbar is a nice feature of the JQGrid which can be used for pratically anything. Unfortunately the way the toolbar is set up can be hard to work with. The toolbar can be set [...]]]></description>
			<content:encoded><![CDATA[<p>For a current client it was requested that I move the JQGrid toolbar below the pager if a pager exists. The Toolbar is a nice feature of the JQGrid which can be used for pratically anything. Unfortunately the way the toolbar is set up can be hard to work with. The toolbar can be set into one of 3 positions: Above the header row (Top), below the footer row (Bottom), and both (Both). When the either the top or bottom option is selected a toolbar with id t_<your gridid> is created. If the Both option is selected the Top toolbar will have an id of t_<your gridid> and the bottom will have an id of tb_<your gridid>. This complicates things since I only want to move the bottom toolbar. Thankefully Jquery has a method, <a href="http://api.jquery.com/last/">Last</a>, that will solve the problem. Last does what we need which is grab the last child of a selector. The grid&#8217;s sections are divided up into divs under a parent div with the id of gview_<your gridid>. If a bottom toolbar exists, it will always be the last div under that parent. So first we check if a pager exists, then get the last child of the gview div, and if that child has a class of ui-userdata, which indicates that it is a toolbar, we can detach it and insert it after the pager as seen below.</p>
<p><code><br />
function moveLowerJQGridToolbar(gridid) {<br />
    var pager = $('#' + gridid + '_pager');<br />
    if ($(pager).exists()) {<br />
        var lastChild = $('#gview_' + gridid).children().last();<br />
        if (lastChild.hasClass('ui-userdata')) {<br />
            var toolbar = $(lastChild).detach();<br />
            $(toolbar).insertAfter(pager);<br />
        }<br />
    }<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/jqgrid-and-jquery-move-toolbar-below-pager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Jquery with Custom Html Helpers in MVC2</title>
		<link>http://blog.pearltechnology.com/using-jquery-with-custom-html-helpers-in-mvc2/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/using-jquery-with-custom-html-helpers-in-mvc2/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 15:58:28 +0000</pubDate>
		<dc:creator>Chad Ferguson</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Html Helpers]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[MVC2]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=896</guid>
		<description><![CDATA[While preparing for an upcoming exam I was looking into the usage of Html Helpers with MVC2 and thought it may be simple to easily add extension methods for Jquery UI controls. I have had several sites that have utilized multiple Jquery UI DatePicker controls and it would be a great time saver to simply [...]]]></description>
			<content:encoded><![CDATA[<p>While preparing for an upcoming exam I was looking into the usage of Html Helpers with MVC2 and thought it may be simple to easily add extension methods for Jquery UI controls. I have had several sites that have utilized multiple Jquery UI DatePicker controls and it would be a great time saver to simply call a method to generate the control and its script tags. </p>
<p>First we will need to create a class for the Html Helper, I usually prefer to add a folder to my solution called Helpers. Both the class and the method will need to be static. In addition you will need to add a HtmlHelper parameter to the method that is preceded by the keyword <em>this</em>. This first parameter of the extension method indicates the class that the extension method extends, which in our case would be a input control.</p>
<p><code><br />
using System;<br />
using System.Web.Mvc;</p>
<p>public static class DatePickerExtensions<br />
    {<br />
        public static string DatePicker(this HtmlHelper helper, string id)<br />
        {</p>
<p>        }<br />
    }<br />
</code></p>
<p>Next within our DatePicker Method we will want to add the input control and the Jquery, and I found this easiest way to do this was to use TagBuilders. The TagBuilder Class is a utility that easily allows you to build html tags. We will be using two TagBuilders, one for generating our input box, and a second TagBuilder for the script tag. An overview of the TagBuilder class can be found <a href="http://www.asp.net/mvc/tutorials/using-the-tagbuilder-class-to-build-html-helpers-cs">here</a>. Any script tag will need to be written with the TagBuilders InnerHtml property, or it will be interpreted as text on the page. The resulting code is below:</p>
<p><code><br />
using System;<br />
using System.Web.Mvc;</p>
<p>namespace MvcApplication1.Helpers<br />
{<br />
    public static class DatePickerExtensions<br />
    {<br />
        public static string DatePicker(this HtmlHelper helper, string id)<br />
        {<br />
            var builder = new TagBuilder("input");<br />
            builder.GenerateId(id);<br />
            builder.MergeAttribute("type", "text");</p>
<p>            var scriptBuilder = new TagBuilder("script");<br />
            scriptBuilder.InnerHtml = "$(function() { $('#" + id + "').datepicker();});";<br />
            return builder.ToString(TagRenderMode.Normal) + scriptBuilder.ToString(TagRenderMode.Normal);<br />
        }<br />
    }<br />
}<br />
</code></p>
<p>Next to be able add the control easily on any page we will need to add the Namespace for our Helpers to the web.config file as shown below.</p>
<p><code><br />
&lt;pages&gt;<br />
      &lt;namespaces&gt;<br />
        &lt;add namespace="System.Web.Mvc" /&gt;<br />
        &lt;add namespace="System.Web.Mvc.Ajax" /&gt;<br />
        &lt;add namespace="System.Web.Mvc.Html" /&gt;<br />
        &lt;add namespace="System.Web.Routing" /&gt;<br />
        <strong>&lt;add namespace="MvcApplication1.Helpers"/&gt;</strong><br />
      &lt;/namespaces&gt;<br />
    &lt;/pages&gt;<br />
</code></p>
<p>Finally we can easily add our DatePicker control anywhere to our site with our new Extension.<br />
<code><br />
Date: &lt;%= Html.DatePicker("myDatePicker") %&gt;<br />
</code></p>
<p>This short tutorial assumes that your site is already set up for using JQuery, and the UI controls. Details for using Jquery can be found <a href="http://jqueryui.com/demos/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/using-jquery-with-custom-html-helpers-in-mvc2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX-aware Session Expiry in ASP.NET MVC</title>
		<link>http://blog.pearltechnology.com/ajax-aware-session-expiry-in-asp-net-mvc/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/ajax-aware-session-expiry-in-asp-net-mvc/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 14:48:31 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MS AJAX]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Session State]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=811</guid>
		<description><![CDATA[When you build ASP.NET MVC applications that require Forms-based or Windows authentication (e.g. login.aspx) and ASP.NET Session State, you need to make sure you properly handle redirecting the application to the appropriate login page when the users session has expired. This becomes more of a challenge when you start building layers of the application using [...]]]></description>
			<content:encoded><![CDATA[<p>When you build ASP.NET MVC applications that require Forms-based or Windows authentication (<em>e.g. login.aspx</em>) and ASP.NET Session State, you need to make sure you properly handle redirecting the application to the appropriate login page when the users session has expired. This becomes more of a challenge when you start building layers of the application using AJAX for partial page rendering.</p>
<p>There are many approaches here, but we have discovered one that works regardless of which AJAX mechanism you are building upon (MS AJAX, jQuery, XMLHttpRequest, etc.). </p>
<p>The approach we took is to add a tag block to the <strong>Login.aspx</strong> page. This marker will be used to tell us when we&#8217;ve been redirected to the Login.aspx page from an AJAX request sent to IIS. Here is a sample snippet that you could use.</p>
<pre name="code" language="html">
<input type="hidden" id="ajaxexpiry" />
</pre>
<p>After you&#8217;ve added this token to your login page, you can begin checking for the existence of this tag when you receive AJAX responses back from the application server. Here is how we implemented it.</p>
<pre name="code" language="javascript">
// tell MS AJAX request manager that we have to check for valid login session (Ajax.ActionLink)
Sys.Net.WebRequestManager.add_completedRequest(function (result) {
    IsValidSession(result.get_responseData()); // capture returned ajax response data
});

// attach all ajax completion requests for session review
$('*').ajaxComplete(function (e, xhr, settings) {
    IsValidSession(xhr.responseText);
});

/// Checks for invalid session [JQUERY/MSAJAX]
function IsValidSession(response_data) {
    if (response_data.match(/id="ajaxexpiry"/gi) != null)  // pattern to locate
        window.location.href = "/"; ; // redirect matching to login page
}
</pre>
<p>The code above is made up of three separate blocks. The first block handles MS AJAX integration. We leverage the <a href="http://msdn.microsoft.com/en-us/library/bb397435.aspx">WebRequestManager&#8217;s</a> completed request handler in the <em>MicrosoftAjax.js</em> library. In the next section we integrate the jQuery AJAX framework by using the <a href="http://api.jquery.com/ajaxComplete/">ajaxComplete()</a> method handler. </p>
<p>Once we&#8217;ve collected the response data from the AJAX requests (MS AJAX or jQuery), we can process the text by matching on the tag pattern (id=&#8221;ajaxexpiry&#8221;) we created earlier. This is done in the IsValidSession routine called by each AJAX interface above. If we discover a match on our token, we will redirect the user to the login page. In our example, the login page is at the root of the domain, but in your instance, you may need to customize accordingly.</p>
<p>Another possible solution to this issue is to use a <a href="http://stackoverflow.com/questions/2319020/mvc-with-jquery-handling-session-expire">periodic polling routine</a> to request content from the server. However, this approach puts additional load on your application server unnecessarily. We chose to do the session checking locally, and check for session expire only when necessary on the client (<em>thus no impact to server resources</em>).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/ajax-aware-session-expiry-in-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Printer Friendly jQuery</title>
		<link>http://blog.pearltechnology.com/printer-friendly-jquery/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/printer-friendly-jquery/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 13:39:46 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery print tabs]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[jQuery widgets]]></category>
		<category><![CDATA[printer friendly]]></category>
		<category><![CDATA[Sharepoint Web Parts]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=344</guid>
		<description><![CDATA[Building websites to support different browsers is easy business when you&#8217;re relying on the jQuery framework. However, building printer friendly web content is another hurdle for application developers. I recently came across some useful jQuery for printing Sharepoint web parts. The idea was pure genius &#8211; wrap the bit of HTML you want to print [...]]]></description>
			<content:encoded><![CDATA[<p>Building websites to support different browsers is easy business when you&#8217;re relying on the <a href="http://jquery.com/">jQuery framework</a>. However, building printer friendly web content is another hurdle for application developers. I recently came across some <a href="http://www.endusersharepoint.com/2009/04/06/jquery-for-everyone-print-any-web-parts-plugin/">useful jQuery</a> for printing Sharepoint web parts. The idea was pure genius &#8211; wrap the bit of HTML you want to print into its own document window and inform the browser of your intentions to print. The key idea here is that we want to print <em>a portion of a webpage</em>, not the entire web page. If we wanted to print the entire webpage, I would recommend going the route of using the @media tag <a href="http://www.w3.org/TR/CSS2/media.html">found in CSS 2.0</a>. However, you will eventually run into printing quirks when you are building interactive websites.</p>
<p>Although I wasn&#8217;t using Sharepoint for this website, I was using jQuery, so I leveraged this idea to print specific portions of a website instead of only Sharepoint specific content. This site was also using <a href="http://jqueryui.com/">jQuery UI</a> for creating rich internet content, specifically the <a href="http://jqueryui.com/demos/tabs/">tabs</a>, <a href="http://jqueryui.com/demos/accordion/">accordion</a>, and <a href="http://jqueryui.com/demos/dialog/">dialog</a> widgets. The incredible thing about widgets is that they allow for highly interactive sites, yet the trouble with widgets is that they are not conducive to easily printing their content.</p>
<p>If you tried printing the <a href="http://jqueryui.com/demos/tabs/default.html">default tabs example</a> using jQuery UI, you end up with something that looks like this&#8230;</p>
<p><center><a href="http://blog.pearltechnology.com/wp-content/uploads/2009/09/jquery-tabs-default-functionality.PNG#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="alignnone size-medium wp-image-355" title="jquery tabs default functionality" src="http://blog.pearltechnology.com/wp-content/uploads/2009/09/jquery-tabs-default-functionality-300x119.PNG" alt="jquery tabs default functionality" width="300" height="119" /></a></center></p>
<p>At first glance, you may not realize the problem with this. The content of the inactive tabs is hidden from the print view. In our requirements, we needed to print all the content for each tab, whether it was active or not. Now you begin to see the clash between interactive content and printer friendly widgets.</p>
<p>There is a solution to this problem, but it varies depending on how you setup your widgets. Here are some tips to setup the print view. For printed tabs to work, you need to create some hidden panel headers and utilize some CSS to display the hidden tabs contents. The solution I came up with contains a &#8220;Printer Friendly&#8221; link which triggers the dynamic CSS changes for printing all the tabs contents.</p>
<p><center><a href="http://blog.pearltechnology.com/wp-content/uploads/2009/09/jquery-tabs-printer-friendly.PNG#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="alignnone size-medium wp-image-372" title="jquery tabs printer friendly" src="http://blog.pearltechnology.com/wp-content/uploads/2009/09/jquery-tabs-printer-friendly-300x47.PNG" alt="jquery tabs printer friendly" width="300" height="47" /></a></center></p>
<p>Add the following HTML to your page where you want the locate the &#8220;Printer Friendly&#8221; link for the tab widgets.</p>
<pre name="code" language="html">
<div id="dialog-1">
<h3>Printer Friendly Here</h3>
</div>
</pre>
<p>Here is the printer friendly window that is created after clicking on the &#8220;Printer Friendly&#8221; link.</p>
<p><center><a href="http://blog.pearltechnology.com/wp-content/uploads/2009/09/jquery-tabs-printer-friendly-dialog.PNG#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="alignnone size-medium wp-image-375" title="jquery tabs printer friendly dialog" src="http://blog.pearltechnology.com/wp-content/uploads/2009/09/jquery-tabs-printer-friendly-dialog-299x111.PNG" alt="jquery tabs printer friendly dialog" width="299" height="111" /></a></center></p>
<p>Here is the jQuery script that enables the printer-friendly jQuery UI tabs to happen.</p>
<pre name="code" language="jscript">$(function() {
	        $("#tabs").tabs();

	        // remove any print headers that we may have added
	        $("div.printHeader").remove();

	        // assign our id for print navigation removal
	        $("#tabs&gt;ul").each(function() {
	            $(this).addClass("tab-nav");
	        });

	        // create printer friendly tab view
	        $("#tabs&gt;ul&gt;li&gt;a").each(function() {
	            // what tab is this?
	            var tabNum = $(this).attr("href").replace("#", "");

	            // get our content for this tab
	            var tabContent = $("div[id=" + tabNum + "]");

	            // prepend our print header along with tab theme style
	            $(tabContent).before("
<div class="printHeader &quot; + $(this).parent().parent().parent().attr(&quot;class&quot;) + &quot;">\n" +
    	                            "
<ul class="&quot; + $(this).parent().parent().attr(&quot;class&quot;).replace(&quot;tab-nav&quot;, &quot;&quot;) + &quot;">\n" +
	                                    "
<li>" + $(this).text() + "

\n" +
	                                "</li>
</ul>

\n" +
	                            "</div>

\n");
	        });

	        drawPrinterFriendly(); // creates printer friendly links
	    });

	    // Prints contents of a dialog
	    // source: http://www.endusersharepoint.com/2008/12/09/jquery-for-everyone-print-any-web-part/
	    // remarks: added removal of printer friendly link
	    function printDialog(tagid, title) {
	        if (tagid) {
	            var CSSContent = ".printInfo,.tab-nav { display:none;}\n.ui-tabs .ui-tabs-hide,.printHeader { display: block !important; }\n";
	            var printCss = "
<!--
\n" + CSSContent + "
-->

";
	            // build html for print page
	            // remarks: we use parent here since the dialog is in a wrapped container
	            var html = "\n\n" + $("head").html() + "\n" + printCss + "\n\n\n" + $("#" + tagid).parent().html() +
                    "\n\n";
	            var printWP = window.open("", "printWebPart"); //open new window
	            printWP.document.open();
	            //insert content
	            printWP.document.write(html);
	            printWP.document.close();
	            //open print dialog
	            printWP.print();
	        }
	    }

	    // creates printer friendly link for matching dialog H3 tags
	    function drawPrinterFriendly() {
	        // find all dialogs by their TD
	        var tags = $("*[id^='dialog-']");
	        // loop through dialogs
	        tags.each(function() {
	            //get id for print function
	            var tagid = $(this).attr("id");
	            //append an image with onClick event
	            $(this).find("h3").html("").append(
                        "
<div class="printInfo">" +
                        "  <a onclick="printDialog(&quot; + " href="##utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Printer Friendly" +
                        "  </a>" +
                        "</div>

"
                    );
	        });
	    }</pre>
<p>You can find the entire solution <a href="http://blog.pearltechnology.com/wp-content/uploads/2009/09/printer-friendly-jquery.zip#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">here</a>. This solution can easily be adapted to work with other widgets (dialogs, accordions, etc.) with the inclusion of the H3 tag inside a div with id prefix &#8220;dialog-&#8221;. Possibly in the future I will create a <a href="http://plugins.jquery.com/">jQuery plugin</a> that encapsulates this functionality for simple integration into your site. Have you found a better approach for printing select portions of a page containing jQuery widgets?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/printer-friendly-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web Developer Bookmarklets</title>
		<link>http://blog.pearltechnology.com/web-developer-bookmarklets/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/web-developer-bookmarklets/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 14:00:48 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[bookmarklets]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=144</guid>
		<description><![CDATA[Bookmarklets can be powerful aids for web development. With jQuery providing so much innovation in the browser landscape, many bookmarklets are pushing the bar. Here are some interesting ones that I&#8217;ve found incredibly useful and use in conjunction with (or absence of) the built-in browser developer tools.

jQuerify is a simple way to inject the jQuery [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Bookmarklet">Bookmarklets</a> can be powerful aids for web development. With jQuery providing so much innovation in the browser landscape, many bookmarklets are pushing the bar. Here are some interesting ones that I&#8217;ve found incredibly useful and use in conjunction with (<em>or absence of</em>) the built-in browser developer tools.</p>
<ul>
<li><a href="http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet">jQuerify</a> is a simple way to inject the jQuery framework into any website and enable immediate DOM manipulation. To try it out, just drag <a href="javascript:%20(function(){var%20el=document.createElement('div'),b=document.getElementsByTagName('body')[0];otherlib=false,msg='';el.style.position='fixed';el.style.height='32px';el.style.width='220px';el.style.marginLeft='-110px';el.style.top='0';el.style.left='50%';el.style.padding='5px%2010px%205px%2010px';el.style.zIndex=1001;el.style.fontSize='12px';el.style.color='#222';el.style.backgroundColor='#f99';if(typeof%20jQuery!='undefined'){msg='This%20page%20already%20using%20jQuery%20v'+jQuery.fn.jquery;return%20showMsg();}else%20if(typeof%20$=='function'){otherlib=true;}%20function%20getScript(url,success){var%20script=document.createElement('script');script.src=url;var%20head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&amp;&amp;(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success();}};head.appendChild(script);}%20getScript('http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',function(){if(typeof%20jQuery=='undefined'){msg='Sorry,%20but%20jQuery%20wasn\'t%20able%20to%20load';}else{msg='This%20page%20is%20now%20jQuerified%20with%20v'+jQuery.fn.jquery;if(otherlib){msg+='%20and%20noConflict().%20Use%20$jq(),%20not%20$().';}}%20return%20showMsg();});function%20showMsg(){el.innerHTML=msg;b.appendChild(el);window.setTimeout(function(){if(typeof%20jQuery=='undefined'){b.removeChild(el);}else{jQuery(el).fadeOut('slow',function(){jQuery(this).remove();});if(otherlib){$jq=jQuery.noConflict();}}},2500);}})();#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">this link</a> to your bookmark list. Depending on the browser you&#8217;re using, you can then enter any javascript commands via the console window in Firebug, IE 8 Developer Tools, or Chrome Developer Tools.
<p><img class="alignnone size-full wp-image-151" title="jquerified" src="http://blog.pearltechnology.com/wp-content/uploads/2009/09/jquerified.PNG" alt="jquerified" width="239" height="31" /></p>
<p>If the website you are visiting already has jQuery installed, the bookmarklet will not inject the framework again.</p>
<p><img class="alignnone size-full wp-image-154" title="jquerified-ignored" src="http://blog.pearltechnology.com/wp-content/uploads/2009/09/jquerified-ignored.PNG" alt="jquerified-ignored" width="241" height="27" /></p>
<p>Here is some sample jQuery code which would highlight a post in red, the blog entry in blue, and perform some simple animation to the sidebar on this website. Click <a href="javascript:%20(function(){var%20el=document.createElement('div'),b=document.getElementsByTagName('body')[0];otherlib=false,msg='';el.style.position='fixed';el.style.height='32px';el.style.width='220px';el.style.marginLeft='-110px';el.style.top='0';el.style.left='50%';el.style.padding='5px%2010px%205px%2010px';el.style.zIndex=1001;el.style.fontSize='12px';el.style.color='#222';el.style.backgroundColor='#f99';if(typeof%20jQuery!='undefined'){msg='This%20page%20already%20using%20jQuery%20v'+jQuery.fn.jquery;return%20showMsg();}else%20if(typeof%20$=='function'){otherlib=true;}%20function%20getScript(url,success){var%20script=document.createElement('script');script.src=url;var%20head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&amp;&amp;(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success();}};head.appendChild(script);}%20getScript('http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',function(){if(typeof%20jQuery=='undefined'){msg='Sorry,%20but%20jQuery%20wasn\'t%20able%20to%20load';}else{msg='This%20page%20is%20now%20jQuerified%20with%20v'+jQuery.fn.jquery;if(otherlib){msg+='%20and%20noConflict().%20Use%20$jq(),%20not%20$().';}}%20return%20showMsg();});function%20showMsg(){el.innerHTML=msg;b.appendChild(el);window.setTimeout(function(){if(typeof%20jQuery=='undefined'){b.removeChild(el);}else{jQuery(el).fadeOut('slow',function(){jQuery(this).remove();});if(otherlib){$jq=jQuery.noConflict();}}},2500);$('div[class=post]:first').css('border','2px%20solid%20red');$('div[class=entry]:first').css('border','2px%20solid%20blue');$('div[class=sidebg]').slideToggle(4000).fadeIn('fast');}})();#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">here</a> to see it in action.</p>
<pre name="code" class="jscript">$("div[class=post]:first").css("border", "2px solid red");
$("div[class=entry]:first").css("border", "2px solid blue");
$("div[class=sidebg]").slideToggle(4000).fadeIn("fast");</pre>
</li>
<li><a href="http://getfirebug.com/lite.html">Firebug Lite</a> is another useful bookmarklet if you&#8217;re currently using a browser that doesn&#8217;t support plugins or have its own set of developer tools. It has support for both online and offline integration. Click <a href="javascript:var firebug=document.createElement('script');firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">here</a> to see an example or simply drag and drop <a href="javascript:var firebug=document.createElement('script');firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">this link</a> into your bookmarks.
<p><a href="http://blog.pearltechnology.com/wp-content/uploads/2009/09/firebug-lite.PNG#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="alignnone size-medium wp-image-174" title="Firebug Lite" src="http://blog.pearltechnology.com/wp-content/uploads/2009/09/firebug-lite-300x111.PNG" alt="Firebug Lite" width="300" height="111" /></a></p>
<p>You can now enter commands into the console and manipulate the DOM just like you were using an assisted native browser extension. Enjoy!</li>
</ul>
<p>Do you have any great developer bookmarklets that you&#8217;d like to share? Please comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/web-developer-bookmarklets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery notifications using jGrowl</title>
		<link>http://blog.pearltechnology.com/jquery-notifications-using-jgrowl/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/jquery-notifications-using-jgrowl/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 14:23:45 +0000</pubDate>
		<dc:creator>AaronH</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=40</guid>
		<description><![CDATA[When creating rich internet applications (RIA), having good communication back to the end user is critical. jGrowl is an excellent tool to provide instant notifications messages to the client using the jQuery framework. jGrowl is simple to use and easy to configure. Here is a quick introduction on how to get started with it. This [...]]]></description>
			<content:encoded><![CDATA[<p><span>When creating rich <span>internet</span> applications (RIA), having good communication back to the end user is critical. </span><a title="jGrowl" href="http://stanlemon.net/projects/jgrowl.html" target="_blank"><span><span>jGrowl</span></span></a> is an excellent tool to provide instant notifications messages to the client using the <a title="jQuery" href="http://jquery.com/" target="_blank"><span><span>jQuery</span></span></a><span> framework. <span>jGrowl</span> is simple to use and easy to configure. Here is a quick introduction on how to get started with it. This article assumes you are already using the jQuery framework in your existing site.</span></p>
<p>First, you need to download the jGrowl extension from <a href="http://plugins.jquery.com/project/jgrowl">here</a>. After including the JavaScript reference to your source, you can begin creating messages by adding the following JavaScript to your page.</p>
<pre name="code" class="jscript">$.jGrowl("Customer order successfully submitted!");</pre>
<p>jGrowl notifications can be sticky (<em>i.e. you must close them</em>) and they can also accumulate if you want to post several notifications at once. Here&#8217;s a quick glimpse of how these notifications can appear with some enhanced styling applied.<br />
<center><br />
<div id="attachment_105" class="wp-caption aligncenter" style="width: 270px"><img class="size-full wp-image-105 " title="Sample jGrowl Notification" src="http://blog.pearltechnology.com/wp-content/uploads/2009/08/jGrowl.PNG" alt="jGrowl Sample Notification" width="260" height="317" /><p class="wp-caption-text">jGrowl Sample Notification</p></div><br />
</center><br />
The first notice above is using HTML to render the message, while the second notice is using purely text to notify the user of an action or interaction with the page. Happy growling!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/jquery-notifications-using-jgrowl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

