<?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>DansNetwork.com &#187; javascript</title>
	<atom:link href="http://dansnetwork.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://dansnetwork.com</link>
	<description>Web Design, Javascript, CSS, and More...</description>
	<lastBuildDate>Sat, 19 Nov 2011 15:51:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Content Expirator &#8211; jQuery Content Expiration Plugin</title>
		<link>http://dansnetwork.com/content-expirator-jquery-content-expiration-plugin/</link>
		<comments>http://dansnetwork.com/content-expirator-jquery-content-expiration-plugin/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 20:19:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://dansnetwork.com/?p=125</guid>
		<description><![CDATA[Content Expirator is a jQuery utility plugin that provides an easy way to give DOM elements an expiration date. If the element is found to be expired, its 'display' parameter is set to 'none'. A better approach would be to perform this function server side with a server side language, but this is a quick [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.dansnetwork.com/img/content_expirator.jpg" class="right" alt="Content Expirator" title="Content Expirator" /><strong>Content Expirator</strong> is a jQuery utility plugin that provides an easy way to give DOM elements an expiration date. If the element is found to be expired, its 'display' parameter is set to 'none'. <i>A better approach would be to perform this function server side with a server side language, but this is a quick and easy way to implement it client side.</i></p>
<p><strong>Download:</strong> <a href="http://static.dansnetwork.com/source/jQuery/jquery.content_expirator-0.1.0.js" title="Content Expirator">jquery.content_expirator-0.1.0.js</a></p>
<p>&nbsp;</p>
<p class="clear">Let's say your client has given you a flyer to put on their website for an event.</p>
<pre class="brush: xml;">&lt;img src=&quot;easter_flyer_2010.jpg&quot; class=&quot;aligncenter&quot; alt=&quot;Easter Flyer&quot; /&gt;</pre>
<p>After Easter is over, you're going to want to take this flyer off of their site. Instead of manually editing the site on the Monday after Easter to take it down, you can give it an expiration date so that it isn't displayed after Easter.</p>
<pre class="brush: xml;">&lt;img src=&quot;easter_flyer_2010.jpg&quot; class=&quot;exp-2010-04-04 aligncenter&quot; alt=&quot;Easter Flyer&quot; /&gt;</pre>
<p>The Content Expirator looks for an element containing a class name (must be the first one listed) containing the prefix 'exp'. When it comes across one, it compares the date (formatted year-month-day) with the current day to decide if the element's 'display' (style) parameter should be set to 'none'.</p>
<p>Calling The Function:</p>
<p>default:</p>
<pre class="brush: jscript;">$(document).ready(function(){
    jQuery.contentExpirator();
});
// looks for -&gt; 'exp-year-month-day'</pre>
<p>custom prefix:</p>
<pre class="brush: jscript;">$(document).ready(function(){
    jQuery.contentExpirator('end');
});
// looks for -&gt; 'end-year-month-day'</pre>
<div class="codenplay">
&lt;script&gt;
<textarea class="cpJS">
(function($){
    $.contentExpirator = function(prfx){
        var pfix = prfx || 'exp';
        $("[class|="+pfix+"]").each(function(){
            var eString = $(this).attr('class').split(' ')[0];
            var dString = eString.split('-');
            var d = new Date(dString[1],dString[2].toString()-1,dString[3]);
            var today = new Date();
            if(d < today){
                $(this).css('display','none');
            }
        });
    }
})(jQuery);</textarea>
&lt;html&gt;
<textarea class="cpHTML">
<!doctype html>
<html lang="en" class="no-js">
<head>
  
  <meta charset="utf-8" />
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script>
  <script>
    $(document).ready(function(){
      jQuery.contentExpirator();
    });
  </script>
</head>
<body>
  <div class="exp-2100-12-03">You Should See Me</div>
  <div class="exp-2010-12-03">You Should Not See Me</div>
</body>
</html>
</textarea>
Result:<br /><iframe src="http://dansnetwork.com/wp-content/plugins/codenplay/index.html" class="cpResult run"></iframe><br /><a class="cpRun" title="Run" href="#run">Run</a></div><script type="text/javascript">var codenplay={}; codenplay.WP_PLUGIN_URL = "http://dansnetwork.com/wp-content/plugins";</script><script type="text/javascript" src="http://dansnetwork.com/wp-content/plugins/codenplay/js/LAB.min.js"></script><link rel="stylesheet" type="text/css" href="http://dansnetwork.com/wp-content/plugins/codenplay/css/style.css" />]]></content:encoded>
			<wfw:commentRss>http://dansnetwork.com/content-expirator-jquery-content-expiration-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery Classes &#8211; An Object Oriented Approach</title>
		<link>http://dansnetwork.com/jquery-classes-object-oriented-approach/</link>
		<comments>http://dansnetwork.com/jquery-classes-object-oriented-approach/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 04:40:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://dansnetwork.com/?p=33</guid>
		<description><![CDATA[MooTools has been my framework of choice for the past couple of years. I've worked my way up to using Classes for most of my projects and really liked using the OOP approach. For the past couple of projects, I started using Wordpress as my CMS and every time ended up using jQuery. I was [...]]]></description>
			<content:encoded><![CDATA[<p>MooTools has been my framework of choice for the past couple of years. I've worked my way up to using <a title="MooTools Classes" href="http://mootools.net/docs/Class/Class">Classes</a> for most of my projects and really liked using the OOP approach. For the past couple of projects, I started using Wordpress as my CMS and every time ended up using jQuery. I was disappointed to find out that it didn't have the native Class library that MooTools did. Fortunately there is a plugin available to assist with this task:</p>
<p>- A plugin that adds class functionality to jQuery: <a title="jQuery-Klass" href="http://code.google.com/p/jquery-klass/">jQuery-Klass</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dansnetwork.com/jquery-classes-object-oriented-approach/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaScript ISO8601/RFC3339 Date Parser</title>
		<link>http://dansnetwork.com/javascript-iso8601rfc3339-date-parser/</link>
		<comments>http://dansnetwork.com/javascript-iso8601rfc3339-date-parser/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 03:26:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[iso8601]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.dansnetwork.com/2008/11/01/javascript-iso8601rfc3339-date-parser/</guid>
		<description><![CDATA[Updated (bug fix): 2-11-09
In need of a JavaScript function that would parse an ISO8601 compliant date, I came across an attempt (http://delete.me.uk/2005/03/iso8601.html) and rewrote it (because I'm all about reinventing the wheel). My function extends the Date object and allows you to pass in an ISO8601 date (2008-11-01T20:39:57.78-06:00). The function will then return the Date. [...]]]></description>
			<content:encoded><![CDATA[<p>Updated (bug fix): 2-11-09</p>
<p>In need of a JavaScript function that would parse an ISO8601 compliant date, I came across an attempt (<a href="http://delete.me.uk/2005/03/iso8601.html" title="iso8601">http://delete.me.uk/2005/03/iso8601.html</a>) and rewrote it (because I'm all about reinventing the wheel). My function extends the Date object and allows you to pass in an ISO8601 date (<strong>2008-11-01T20:39:57.78-06:00</strong>). The function will then return the Date. In the date string argument the dashes and colons are optional. The decimal point for milliseconds is mandatory (although specifying milliseconds isn't). If a timezone offset is specified, the '+' or '-' sign must be included. This function should also work with iCalendar(RFC2445) formatted dates. If a the date string doesn't match the format, there will be a final attempt to parse it with the built in Date.parse() method.</p>
<p>Code:</p>
<pre class="brush: jscript;">

Date.prototype.setISO8601 = function(dString){

var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;

if (dString.toString().match(new RegExp(regexp))) {
var d = dString.match(new RegExp(regexp));
var offset = 0;

this.setUTCDate(1);
this.setUTCFullYear(parseInt(d[1],10));
this.setUTCMonth(parseInt(d[3],10) - 1);
this.setUTCDate(parseInt(d[5],10));
this.setUTCHours(parseInt(d[7],10));
this.setUTCMinutes(parseInt(d[9],10));
this.setUTCSeconds(parseInt(d[11],10));
if (d[12])
this.setUTCMilliseconds(parseFloat(d[12]) * 1000);
else
this.setUTCMilliseconds(0);
if (d[13] != 'Z') {
offset = (d[15] * 60) + parseInt(d[17],10);
offset *= ((d[14] == '-') ? -1 : 1);
this.setTime(this.getTime() - offset * 60 * 1000);
}
}
else {
this.setTime(Date.parse(dString));
}
return this;
};
</pre>
<p>Usage:</p>
<pre class="brush: jscript;">

var today = new Date();
today.setISO8601('2008-12-19T16:39:57.67Z');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dansnetwork.com/javascript-iso8601rfc3339-date-parser/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MooTools Events Calendar &#8211; Web Embeddable Javascript Calendar</title>
		<link>http://dansnetwork.com/mootools-events-calendar-web-embeddable-javascript-calendar/</link>
		<comments>http://dansnetwork.com/mootools-events-calendar-web-embeddable-javascript-calendar/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 02:06:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://blog.dansnetwork.com/2008/10/03/mootools-events-calendar-web-embeddable-javascript-calendar/</guid>
		<description><![CDATA[This is the official release of the unofficial MooTools Events Calendar. It is an embeddable web calendar that was built using the MooTools JavaScript framework. Currently, it is still under development, but may be sufficient for your needs. Check out the project page here: MooTools Events Calendar
-
v0.3.0 (August 5, 2009)


Accepts events that span across multiple [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://dansnetwork.com/mootools/images/mooECal_150.jpg" border="0" alt="Month View" hspace="10" vspace="5" width="150" height="81" align="left" />This is the official release of the unofficial MooTools Events Calendar. It is an embeddable web calendar that was built using the MooTools JavaScript framework. Currently, it is still under development, but may be sufficient for your needs. Check out the project page here: <a title="MooTools Events Calendar" href="http://dansnetwork.com/mootools/events-calendar/">MooTools Events Calendar</a></p>
<p>-</p>
<p><strong><span style="text-decoration: underline;">v0.3.0 (August 5, 2009)<br />
</span></strong></p>
<ul>
<li>Accepts events that span across multiple days</li>
<li>MooTools v1.2.3 required.</li>
</ul>
<p><strong><span style="text-decoration: underline;">v0.2.2 (April 11, 2009)<br />
</span></strong></p>
<ul>
<li>Fixed a rendering problem for people outside of the U.S.</li>
<li>Added the option for weeks to start on Monday</li>
</ul>
<p><strong><span style="text-decoration: underline;">v0.2.1 (Feb 9, 2009)<br />
</span></strong></p>
<ul>
<li>bug fix - usage error with parseInt(). Events wouldn't load on the 8th and 9th of a month.</li>
<li>HTML allowed in events. This allows for events to link elsewhere.</li>
</ul>
<p><strong><span style="text-decoration: underline;">v0.2.0 (Feb 1, 2009) </span></strong></p>
<ul>
<li>uses plug-ins or direct loading through the constructor for events</li>
<li>uses iCal/ISO 8601 dates/times for event input</li>
<li>different style sheets can be used for 3 different sized calendars</li>
</ul>
<p><span style="text-decoration: underline;"><strong>v0.1.0 (Oct 3, 2008) </strong></span></p>
<ul>
<li>month, week, and day views</li>
<li>tool tips for month view events (using Tips)</li>
<li>scrolling day events for month view (using Scroller)</li>
<li>events loaded manually or possibly through a JSON feed</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dansnetwork.com/mootools-events-calendar-web-embeddable-javascript-calendar/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Javascript Date Object &#8211; Adding and Subtracting Months</title>
		<link>http://dansnetwork.com/javascript-date-object-adding-and-subtracting-months/</link>
		<comments>http://dansnetwork.com/javascript-date-object-adding-and-subtracting-months/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 12:05:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[extending the DOM]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.dansnetwork.com/2008/09/18/javascript-date-object-adding-and-subtracting-months/</guid>
		<description><![CDATA[There is a slight problem with the Javascript Date() Object when trying to advance to the next month or go back to the previous month. For example, if your date is set to October 31, 2008 and you add one month, you'd probably expect the new date to be November 30, 2008 because November 31st [...]]]></description>
			<content:encoded><![CDATA[<p>There is a slight problem with the Javascript Date() Object when trying to advance to the next month or go back to the previous month. For example, if your date is set to October 31, 2008 and you add one month, you'd probably expect the new date to be November 30, 2008 because November 31st doesn't exist. This, however, isn't the case. Javascript automatically advances your Date object to December 1st. This functionality is very useful in most situations(i.e. adding days to a date, determining the number of days in a month or if it's a leap year), but not for adding/subtracting months. I've put together some functions below that extend the Date() object: <strong>nextMonth()</strong> and <strong>prevMonth()</strong> <em>See the example below for their usage and please feel free to use these in your applications.</em></p>
<p>Extends the Date Object:</p>
<pre class="brush: jscript;">
function prevMonth(){
var thisMonth = this.getMonth();
this.setMonth(thisMonth-1);
if(this.getMonth() != thisMonth-1 &amp;&amp; (this.getMonth() != 11 || (thisMonth == 11 &amp;&amp; this.getDate() == 1)))
this.setDate(0);
}
function nextMonth(){
var thisMonth = this.getMonth();
this.setMonth(thisMonth+1);
if(this.getMonth() != thisMonth+1 &amp;&amp; this.getMonth() != 0)
this.setDate(0);
}

Date.prototype.nextMonth = nextMonth;
Date.prototype.prevMonth = prevMonth;
</pre>
<p>Example of Usage:</p>
<pre class="brush: jscript;">

function getPrevMonth(){
var today = new Date(2008,9,31); //set &quot;today&quot; to October 31, 2008
today.prevMonth(); //show one month earlier -&gt; September 30, 2008 (instead of September 31, 2008 which converts to October 1st, 2008
}
function getNextMonth(){
var today = new Date(2008,9,31); //set &quot;today&quot; to October 31, 2008
today.nextMonth(); //show one month later -&gt; November 30, 2008 (instead of November 31, 2008 which converts to December 1st, 2008
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dansnetwork.com/javascript-date-object-adding-and-subtracting-months/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stop A Page From Loading</title>
		<link>http://dansnetwork.com/stop-a-page-from-loading/</link>
		<comments>http://dansnetwork.com/stop-a-page-from-loading/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 00:40:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://blog.dansnetwork.com/2008/07/04/stop-a-page-from-loading/</guid>
		<description><![CDATA[I've recently put together a page that included over 550 thumbnails that were set to load dynamically. They were grouped together to be viewed throughout several "pages". Originally, if you went to the second page without waiting for the first to finish loading, you'd be unimpressed with the presentation. The second page would begin to [...]]]></description>
			<content:encoded><![CDATA[<p>I've recently put together a page that included over 550 thumbnails that were set to load dynamically. They were grouped together to be viewed throughout several "pages". Originally, if you went to the second page without waiting for the first to finish loading, you'd be unimpressed with the presentation. The second page would begin to load only after the first was finished and so on. I needed to come up with a way to stop the thumbs from loading when you went to the next page and here's what I came up with. It works with Firefox, Safari, and the troublemaker...Internet Explorer.</p>
<p><strong>Using Mootools:</strong></p>
<pre style="font-family: Courier New,Courier,mono">function stopLoad()
{
   $try(
      function(){window.stop()},
      function(){document.execCommand('Stop')}
   )
}</pre>
<p><strong>Using Prototype:</strong></p>
<pre style="font-family: Courier New,Courier,mono">function stopLoad()
{
   Try.these(
      function(){window.stop()},
      function(){document.execCommand('Stop')}
   )
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://dansnetwork.com/stop-a-page-from-loading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Appending With AJAX For A Clean Body</title>
		<link>http://dansnetwork.com/appending-with-ajax-for-a-clean-body/</link>
		<comments>http://dansnetwork.com/appending-with-ajax-for-a-clean-body/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 02:28:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.dansnetwork.com/2008/01/24/appending-with-ajax-for-a-clean-body/</guid>
		<description><![CDATA[It may sound painful, but really, it's not.
 So you want to add content to the bottom of your web page without reloading the whole page or DIV that the majority of your content is located in? You could add a separate DIV to the bottom of your page and use the document.getElementByID('myDIV').innerHTML = xmlHttp [...]]]></description>
			<content:encoded><![CDATA[<p align="left">It may sound painful, but really, it's not.</p>
<p align="left"> So you want to add content to the bottom of your web page without reloading the whole page or DIV that the majority of your content is located in? You could add a separate DIV to the bottom of your page and use the <font color="#3366ff">document.getElementByID('myDIV').innerHTML = <span style="font-style: italic">xmlHttp response</span>;</font> method to append the new content...</p>
<p><strong> But, what if you want to append multiple times?</strong></p>
<ul>
<li><font color="#008000"> add rows to your favorite database's front end</font></li>
<li><font color="#008000"> add stories to the front page, as the user scrolls down, like on DZone's home page</font></li>
<li><font color="#008000"> use it on the top end to dynamically stack new content without user intervention</font></li>
</ul>
<h4><u>Why not include new DIV tags within your response code?</u></h4>
<p><span style="font-weight: bold">Existing DIV at the bottom of your page:</span></p>
<blockquote><p> &lt;div id="newdiv001"&gt;</p>
<p>&lt;/div&gt;</p></blockquote>
<p><span style="font-weight: bold">xmlHttp Response from the server:</span></p>
<blockquote><p> latest news flash here&lt;/div&gt;<br />
&lt;div id="newdiv002"&gt;</p></blockquote>
<p><span style="font-weight: bold">After it's inserted into your existing DIV, it'll look like this:</span></p>
<blockquote><p> &lt;div id="newdiv001"&gt;<br />
latest news flash here&lt;/div&gt;<br />
&lt;div id="newdiv002"&gt;</p>
<p>&lt;/div&gt;</p></blockquote>
<p>... and now "newdiv002" is ready to take the next response.<br />
The important thing to remember here, is to keep track of your DIV ids. By using a number at the end of your id's name, you can keep track of it with a simple counter.</p>
]]></content:encoded>
			<wfw:commentRss>http://dansnetwork.com/appending-with-ajax-for-a-clean-body/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Analytics Date Range &#8211; Analytics Today</title>
		<link>http://dansnetwork.com/google-analytics-date-range-analytics-today/</link>
		<comments>http://dansnetwork.com/google-analytics-date-range-analytics-today/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 02:11:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.dansnetwork.com/2008/01/09/google-analytics-date-range-analytics-today/</guid>
		<description><![CDATA[Google Analytic's default date range is one month. As of this writing, there isn't a way to change it. When tracking the visitors of multiple websites, it is often nice to be able to see the activity of the current day. In order to change the date range, you have to use the Flash based [...]]]></description>
			<content:encoded><![CDATA[<p>Google Analytic's default date range is one month. As of this writing, there isn't a way to change it. When tracking the visitors of multiple websites, it is often nice to be able to see the activity of the current day. In order to change the date range, you have to use the Flash based calendar on the right hand side of the page. The calendar sends a request back to Google servers to fetch the information for the date range that you chose. Although nice to use, it can be time consuming and tedious.</p>
<blockquote><p><img src="http://blog.dansnetwork.com/images/ganalytics.jpg" alt="Analytics Calendar" border="0" /></p></blockquote>
<p>The other way to request a date range is to pass a date parameter in the URL:</p>
<p><span style="color: #808080">Example:<br />
<em>https: //google.com....dashboard?...</em><strong>&amp;pdr=20080109-20080109</strong></span></p>
<p><span style="color: #808080"><em>parameter</em>: <strong>pdr</strong></span></p>
<p><span style="color: #808080"><em>value</em>: <strong>20080109-20080109</strong> (YearMonthDay-YearMonthDay)</span></p>
<p><a href="http://www.google.com/url?sa=t&amp;ct=res&amp;cd=1&amp;url=https%3A%2F%2Faddons.mozilla.org%2Fen-US%2Ffirefox%2Faddon%2F748&amp;ei=J3CFR8jaEqjkigHx8YX5BA&amp;usg=AFQjCNGwTfL-iNiyO_EdM51X1x7LgP1rEg&amp;sig2=xN0k47R7np-n69HRoJGWFQ" title="Greasemonkey Add-on" target="_blank">Greasemonkey</a> is a Firefox Add-on that allows customized JavaScript to be added to any web page that you visit.</p>
<p>I've written a user script called Analytics Today that sets your Analytics date range to the current day instead of the previous month. You can still obviously change the range just as you do now. Please feel free to try it out. I've included it, along with source code, below!</p>
<p>-</p>
<blockquote><p><strong>Download it here -&gt;  <a href="http://blog.dansnetwork.com/images/analyticstoday.user.js" title="Analytics Today" target="_blank">AnalyticsToday.user.js </a> - v0.1.3 (10-21-08)</strong></p></blockquote>
<p>-</p>
<p><strong>Source Code:</strong></p>
<pre class="brush: jscript;">// ==UserScript==
// @name          Analytics Today - v0.1.3
// @namespace     blog.dansnetwork.com
// @description   Sets Google Analytic's default date range to today.

// @include       https://www.google.com/analytics/reporting*

// @exclude
// ==/UserScript==

var url = window.location.href;
var urlParam = &quot;&amp;pdr=&quot;;

var today = new Date();
var day = today.getDate().toString();
var month = (today.getMonth() + 1).toString();
var year = today.getFullYear().toString();
var todaysRange;

if(day &lt; 10)
day = '0' + day;
if(month &lt; 10)
month = '0' + month;

var todaysRange = year + month + day + '-' + year + month + day;

if(url.indexOf(urlParam) &lt; 0)
window.location.href += '&amp;pdr=' + todaysRange;</pre>
]]></content:encoded>
			<wfw:commentRss>http://dansnetwork.com/google-analytics-date-range-analytics-today/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

