<?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; plugin</title>
	<atom:link href="http://dansnetwork.com/tag/plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://dansnetwork.com</link>
	<description>Web Design, Javascript, CSS, and More...</description>
	<lastBuildDate>Sun, 29 Apr 2012 11:36:29 +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>
	</channel>
</rss>

