<?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>Mas que Wordpress - Tutoriales, recursos web, JQuery y PHP, Wordpress , twitter y muchos recursos más &#187; Plugins</title>
	<atom:link href="http://www.masquewordpress.com/category/plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.masquewordpress.com</link>
	<description>Tutoriales y recursos web sobre JQuery , PHP, Wordpress , twitter. Aprende diseño web y programación</description>
	<lastBuildDate>Mon, 06 Feb 2012 15:02:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WP Network Recent Posts Plugin</title>
		<link>http://www.masquewordpress.com/wp-network-recent-posts-plugin/</link>
		<comments>http://www.masquewordpress.com/wp-network-recent-posts-plugin/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 02:11:37 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[plugins wordpress]]></category>

		<guid isPermaLink="false">http://www.masquewordpress.com/?p=1082</guid>
		<description><![CDATA[WP Network Recent Posts Plugin es un plugin de WordPress que crea un Widget fácilmente configurable donde podremos elegir que blogs queremos usar de nuestra red de blogs para mostrar así los posts más recientes. Este plugin lo realize para un cliente que tiene un comunidad basada en WordPress Mu y Buddypress y me parece [...]]]></description>
			<content:encoded><![CDATA[<p>WP Network Recent Posts Plugin es un plugin de WordPress que crea un Widget fácilmente configurable donde podremos elegir que blogs queremos usar de nuestra red de blogs para mostrar así los posts más recientes.<br />
Este plugin lo realize para un cliente que tiene un comunidad basada en WordPress Mu y Buddypress y me parece buena idea compartirlo con todos ustedes por si alguno lo necesita.<br />
<a href="http://www.masquewordpress.com/wp-content/uploads/2011/12/wp-network-recent-posts1.jpg"><img class="aligncenter size-medium wp-image-1087" title="wp-network-recent-posts" src="http://www.masquewordpress.com/wp-content/uploads/2011/12/wp-network-recent-posts1-145x300.jpg" alt="" width="145" height="300" /></a>Mi cliente no necesitaba más que esto por lo que esta versión del plugin no trae muchas más opciones de las que pueden ver que son:</p>
<ul>
<li>Título del widget</li>
<li>Número de posts a mostrar por cada blog</li>
<li>Tamaño de las thumbnails</li>
<li>Los blogs a seleccionar de la red de Blogs</li>
<li>Mostrar los títulos de los blogs</li>
<li>Dar credito al autor del plugin</li>
<li>Posibilidad de editar la hoja de estilos del widget desde el settings page</li>
</ul>
<div>Si le resulta útil a más gente y piden alguna mejora , puede que le añada algo a una próxima versión. Los interesados lo pueden descargar en <a href="http://wordpress.org/extend/plugins/wp-recent-network-posts/">http://wordpress.org/extend/plugins/wp-recent-network-posts/</a></div>
<div>Saludos!</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/wp-network-recent-posts-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Plugin jQuery para limitar caracteres en un campo de texto</title>
		<link>http://www.masquewordpress.com/plugin-jquery-para-limitar-caracteres-en-un-campo-de-texto/</link>
		<comments>http://www.masquewordpress.com/plugin-jquery-para-limitar-caracteres-en-un-campo-de-texto/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 15:36:02 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[jquery.plugin]]></category>
		<category><![CDATA[tutorial jquery]]></category>

		<guid isPermaLink="false">http://masquewordpress.com/?p=811</guid>
		<description><![CDATA[[offtopic] Antes de empezar este artículo quiero dar mis condolencias a la Familia Jobs. Para mi Steve Jobs siempre fue un grande , incluso antes de enamorarme de sus productos y SO. Siempre recomiendo ver un discurso dado por el para los alumnos de Standford Bridge. Lo pueden encontrar en http://www.youtube.com/watch?feature=player_embedded&#38;v=14v3kV47oZU [/offtopic] Hoy les voy [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>[offtopic] Antes de empezar este artículo quiero dar mis condolencias a la Familia Jobs. Para mi Steve Jobs siempre fue un grande , incluso antes de enamorarme de sus productos y SO. Siempre recomiendo ver un discurso dado por el para los alumnos de Standford Bridge. Lo pueden encontrar en http://www.youtube.com/watch?feature=player_embedded&amp;v=14v3kV47oZU [/offtopic]</p></blockquote>
<p>Hoy les voy a enseñar 2 cosas. <strong>Como limitar los caracteres de un campo de texto ya sea un textarea o un input</strong> y <strong>como crear un plugin de Jquery</strong>.<br />
<span id="more-811"></span><br />
Lo primero que necesitamos en un nuevo formulario dentro de una <strong>página HTML</strong> y le vamos a agregar un <strong>etiqueta span</strong> que será donde mostremos los caracteres que nos quedan con <strong>id=&#8221;counter&#8221;</strong>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE  HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;  &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
   &lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script  type=&quot;text/javascript&quot;&gt;
        $(document).ready(function() {
        //Nuestras funciones jQuery
        });
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form  id=&quot;formulario&quot;  method=&quot;POST&quot; action=&quot;?&quot;&gt;
    &lt;textarea  id=&quot;text&quot;&gt;&lt;/textarea&gt;
    &lt;span  id=&quot;counter&quot;&gt;&lt;/span&gt;
    &lt;input type=&quot;submit&quot;  value=&quot;submit&quot;&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>Ahora escribamos nuestra función para mostrar cuantos caracteres nos quedan.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> caracteres<span style="color: #339933;">=</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#counter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Te quedan &lt;strong&gt;&quot;</span><span style="color: #339933;">+</span> caracteres<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/strong&gt; caracteres&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Creamos una función que en el evento keyup que compruebe que la cantidad de caracteres escritos no es mayor que el limite que establecimos anteriormente. En caso contrario borra el valor de campo que excede dicho limite:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keyup</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> caracteres<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> caracteres<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Explicando un poco esta función vemos que cada vez que se levanta el dedo de un tecla <strong>obtenemos el length(cantidad)</strong> de caracteres del <strong>valor(val)</strong> de nuestro campo de texto y lo comparamos con la cantidad estipulada anteriormente.<br />
Si es mayor el valor del campo es sustituido por el valor actual menos el limite estipulado. Es decir, con la <strong>función substr</strong> recortamos la cadena de texto desde el caracter 0 hasta 100 y el resultado sustituye el valor del campo de texto.</p>
<p>Ahora cambiemos la frase de nuestro counter.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span>  quedan <span style="color: #339933;">=</span> caracteres <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#counter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Te quedan &lt;strong&gt;&quot;</span><span style="color: #339933;">+</span> quedan<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/strong&gt; caracteres.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Aquí solamente restamos el limite establecido menos la cantidad de caracteres de nuestro campo.</p>
<p>Y si queremos agregarle un toque de color podemos hacer lo siguiente:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>quedan <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#counter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;color&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;red&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">else</span>
<span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#counter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;color&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;black&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Si nos quedan menos de diez caracteres , nuestro mensaje se volvera rojo!</p>
<p>El script entero entonces queda de la siguiente forma:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> caracteres <span style="color: #339933;">=</span> <span style="color: #CC0000;">220</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#counter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Te quedan &lt;strong&gt;&quot;</span><span style="color: #339933;">+</span>  caracteres<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/strong&gt; caracteres.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keyup</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> caracteres<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> caracteres<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #003366; font-weight: bold;">var</span> quedan <span style="color: #339933;">=</span> caracteres <span style="color: #339933;">-</span>  $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#counter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Te quedan &lt;strong&gt;&quot;</span><span style="color: #339933;">+</span>  quedan<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/strong&gt; caracteres.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>quedan <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#counter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;color&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;red&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">else</span>
    <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#counter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;color&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;black&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Pueden ver el ejemplo funcionando en <a href="http://jsfiddle.net/sa4HH/">http://jsfiddle.net/sa4HH/</a></strong></p>
<h3>Crear un Plugin jQuery para delimitar los campos de texto</h3>
<p>Por lo general vamos a necesitar este código en más de una ocasión y para varios campos de texto, por lo que repetir todo una y otra vez no es aceptable. En este caso nos conviene crear un simple plugin de jQuery que será facil de aplicar.<br />
Para ello siguiendo la lógica de jQuery vamos a crear la base de nuestro plugin que lo vamos a llamar <strong>&#8220;limitar&#8221;</strong>:<br />
¡</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">limitar</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      defaults <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
        limite<span style="color: #339933;">:</span> <span style="color: #CC0000;">200</span><span style="color: #339933;">,</span>
        id_counter<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
        clase_alert<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span>
     <span style="color: #009900;">&#125;</span>
   <span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>defaults<span style="color: #339933;">,</span>  options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Al declarar nuestro <strong>plugin limitar</strong> hemos creado unos valores por defecto que paso a explicar.</p>
<ul>
<li><strong>limite</strong>: Es el límite por defecto. En este caso <strong>200</strong> caracteres.</li>
<li><strong>id_counter</strong>: Es el id del campo donde mostraremos el mensaje de caracteres faltantes. Por defecto es <strong>false</strong>, por lo que no mostraríamos ningún mensaje.</li>
<li><strong>clase_alert</strong>: En lugar de cambiar el color si los caracteres son menos que diez vamos a asignarle un clase para así dar más libertad a la hora de aplicar estilo a este mensaje de alerta. Por defecto no se asigna ninguna clase ya que es <strong>false</strong>.</li>
</ul>
<p>Ahora debemos terminar la función de nuestro plugin:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> caracteres <span style="color: #339933;">=</span> options.<span style="color: #660066;">limite</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">id_counter</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">+</span>options.<span style="color: #660066;">id_counter</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Te quedan &lt;strong&gt;&quot;</span><span style="color: #339933;">+</span> caracteres <span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/strong&gt; caracteres.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keyup</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> caracteres<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> caracteres<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">id_counter</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> quedan <span style="color: #339933;">=</span>  caracteres <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">+</span>options.<span style="color: #660066;">id_counter</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Te quedan &lt;strong&gt;&quot;</span><span style="color: #339933;">+</span> quedan <span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/strong&gt; caracteres&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>quedan <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">+</span>options.<span style="color: #660066;">id_counter</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">clase_alert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000066; font-weight: bold;">else</span>
            <span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">+</span>options.<span style="color: #660066;">id_counter</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">clase_alert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Estamos replicando nuestra función del principio con la única diferencia que usamos los valores dentro del array <strong>options</strong> para dar más flexibilidad al código y miren que sin por ejemplo <strong>options.id_counter es false</strong> nunca mostraremos el mensaje.</p>
<p>El plugin entero que debemos guardar como jquery.limitar.js quedaría de la siguiente forma:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">limitar</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      defaults <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
        limite<span style="color: #339933;">:</span> <span style="color: #CC0000;">200</span><span style="color: #339933;">,</span>
        id_counter<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
        clase_alert<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span>
     <span style="color: #009900;">&#125;</span>
   <span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>defaults<span style="color: #339933;">,</span>  options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> caracteres <span style="color: #339933;">=</span> options.<span style="color: #660066;">limite</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">id_counter</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">+</span>options.<span style="color: #660066;">id_counter</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Te quedan &lt;strong&gt;&quot;</span><span style="color: #339933;">+</span> caracteres <span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/strong&gt; caracteres.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keyup</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> caracteres<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> caracteres<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">id_counter</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> quedan <span style="color: #339933;">=</span>  caracteres <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">+</span>options.<span style="color: #660066;">id_counter</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Te quedan &lt;strong&gt;&quot;</span><span style="color: #339933;">+</span> quedan <span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/strong&gt; caracteres&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>quedan <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">+</span>options.<span style="color: #660066;">id_counter</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">clase_alert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000066; font-weight: bold;">else</span>
            <span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span><span style="color: #339933;">+</span>options.<span style="color: #660066;">id_counter</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">clase_alert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Para usarlo tan solo debemos llamarlo de la siguiente manera (no se olviden de crear la clase para dar estilo al mensaje de alerta):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;script  type=&quot;text/javascript&quot; src=&quot;jquery.limit.js&quot;&gt;&lt;/script&gt;
&lt;style&gt;
.alert{
    color: red;
    font-weight:bold;
}
&lt;/style&gt;
&lt;script  type=&quot;text/javascript&quot;&gt;
    $(document).ready(function() {
        $(&quot;#testo&quot;).limitar({
            limite: 100,
            id_counter: &quot;counter&quot;,
            clase_alert: &quot;alert&quot;
            });
         });
&lt;/script&gt;</pre></td></tr></table></div>

<p>Pueden ver el ejemplo funcionando en <a href="http://jsfiddle.net/V7Gs6/1/">http://jsfiddle.net/V7Gs6/1/</a></p>
<p>Saludos!!!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/plugin-jquery-para-limitar-caracteres-en-un-campo-de-texto/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducción  a JQuery Template plugin jquery.tmpl.js</title>
		<link>http://www.masquewordpress.com/introduccion-a-jquery-template-plugin-jquery-tmpl-js/</link>
		<comments>http://www.masquewordpress.com/introduccion-a-jquery-template-plugin-jquery-tmpl-js/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 22:28:52 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[jquery.plugin]]></category>
		<category><![CDATA[jquery.tmpl.js]]></category>

		<guid isPermaLink="false">http://masquewordpress.com/?p=667</guid>
		<description><![CDATA[Hace poco el equipo de JQuery anuncio que el  plugin de templates de Microsoft es ahora soportado oficialmente. Esto quiere decir que el propio equipo de JQuery se va a encargar de su desarollo y actualizaciones. A continuación les explico como integrarlo y usarlo de una forma sencilla. Para este ejemplo vamos a utilizar mis [...]]]></description>
			<content:encoded><![CDATA[<p>Hace poco el equipo de JQuery <a href="http://api.jquery.com/category/plugins/templates/">anuncio</a> que el  <a href="http://github.com/jquery/jquery-tmpl">plugin de templates</a> de Microsoft es ahora soportado oficialmente. Esto quiere decir que el propio equipo de JQuery se va a encargar de su desarollo y actualizaciones. A continuación les explico como integrarlo y usarlo de una forma sencilla.</p>
<p><span id="more-667"></span></p>
<div id="ejemplo">
<div class="wrap-ej"><a href="http://masquewordpress.com/ejemplos/jquery-templates.zip" class="descarga"></a><a href="http://masquewordpress.com/ejemplos/jquery-templates/" class="demo"></a></div>
</div>
<p>Para este ejemplo vamos a utilizar <a href="http://masquewordpress.com/tag/twitter">mis últimos tweets en Twitter</a> de manera que sirvan para rellenar el template que vamos a crear previamente.</p>
<h3>1. El primer paso es <a href="http://masquewordpress.com/recursos/como-mejorar-velocidad-carga-pagina-web/">integrar JQuery</a> y el plugin de templates</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>  
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.tmpl.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></td></tr></table></div>

<h3>2. Creamos el template</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;tweets&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/x-jquery-tmpl&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${imgSource}&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${username}&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span> ${username} <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span> ${tweet} <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		{{if geo}}
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span> ${geo} <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
		{{/if}}
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></td></tr></table></div>

<p>Cabe destacar que:</p>
<ul>
<li>Nuestro template se encuentra dentro de las tags <strong>&lt;script&gt;</strong> y el type usado es <strong>text/x-jquery-tmpl</strong></li>
<li>Las variables tienen el siguiente formato <strong>${</strong>nombreDeVariable<strong><span><span>}</span></span></strong></li>
<li><span><span>Se pueden crear <strong>sentencias if</strong> de la siguiente manera</span></span><strong><span><span> {{if </span></span></strong><span><span>condicion</span></span><strong><span><span>}</span></span></strong><strong><span><span>}</span></span></strong><strong><span><span> </span></span></strong><span><span>sentencia a ejecutar</span></span><strong><span><span> {{/if</span></span></strong><strong><span><span>}</span></span></strong><strong><span><span>}</span></span></strong></li>
</ul>
<h3>3. Buscamos algun dato para renderizar en nuestro template</h3>
<p>En este caso usando la SEARCH API de Twitter obtenemos los últimos resultados donde mencionan <a href="http://twitter.com/chifliiiii">mi cuenta de twitter</a>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
&nbsp;
 $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'GET'</span><span style="color: #339933;">,</span>
    dataType <span style="color: #339933;">:</span> <span style="color: #3366CC;">'jsonp'</span><span style="color: #339933;">,</span>
    url <span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://search.twitter.com/search.json?q=chifliiiii'</span><span style="color: #339933;">,</span>
&nbsp;
    success <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>tweets<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #003366; font-weight: bold;">var</span> twitter <span style="color: #339933;">=</span> $.<span style="color: #660066;">map</span><span style="color: #009900;">&#40;</span>tweets.<span style="color: #660066;">results</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>obj<span style="color: #339933;">,</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
             username <span style="color: #339933;">:</span> obj.<span style="color: #660066;">from_user</span><span style="color: #339933;">,</span>
             tweet <span style="color: #339933;">:</span> obj.<span style="color: #660066;">text</span><span style="color: #339933;">,</span>
             imgSource <span style="color: #339933;">:</span> obj.<span style="color: #660066;">profile_image_url</span><span style="color: #339933;">,</span>
             geo <span style="color: #339933;">:</span> obj.<span style="color: #660066;">geo</span>
          <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Como veran usamos las variables definidas en el paso anterior para almacenar los varoles devueltos.</p>
<h3>4. Creamos el espacio donde actuara nuestra template</h3>
<p>Si recuerdan nuestra template no era más que un elemento <strong>&lt;li&gt;</strong> de una lista desordenada. Por lo que debemos crear dicha lista.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;tweets&quot;</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></td></tr></table></div>

<h3>5. Enlazamos los datos al template y lo introducimos a la lista</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#tweets'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tmpl</span><span style="color: #009900;">&#40;</span>twitter<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#twitter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<ul>
<li>Seleccionamos el script (template) con id = tweets </li>
<li> Le pasamos el array twitter creado con .map al template </li>
<li> Añadimos lo anterior a la lista con id twitter</li>
</ul>
<p>Y con eso ya estaría todo en su sitio de manera que todo junto quedaría de la siguiente forma:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE HTML&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">charset</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;UTF-8&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style.css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.tmpl.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span> Algunos tweets de mi cuenta <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;tweets&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/x-jquery-tmpl&quot;</span>&gt;</span>
         <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${imgSource}&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${userName}&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span> ${username} <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span> ${tweet} <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
            {{if geo}}
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
               ${geo}
            <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
            {{/if}}
         <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;twitter&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
         $.ajax({
            type : 'GET',
            dataType : 'jsonp',
            url : 'http://search.twitter.com/search.json?q=chifliiiii',
&nbsp;
            success : function(tweets) {
               var twitter = $.map(tweets.results, function(obj, index) {
                  return {
                     username : obj.from_user,
                     tweet : obj.text,
                     imgSource : obj.profile_image_url,
                     geo : obj.geo
                  };
               });
&nbsp;
               $('#tweets').tmpl(twitter).appendTo('#twitter');
            }
      });
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></td></tr></table></div>

<p>Un saludo y hasta la proxima!!!</p>
<div id="ejemplo">
<div class="wrap-ej"><a href="http://masquewordpress.com/ejemplos/jquery-templates.zip" class="descarga"></a><a href="http://masquewordpress.com/ejemplos/jquery-templates/" class="demo"></a></div>
</div>
<p>Via | <a href="http://net.tutsplus.com/">Nettuts+</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/introduccion-a-jquery-template-plugin-jquery-tmpl-js/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Test it Yourself &#8211; Plugin para wordpress</title>
		<link>http://www.masquewordpress.com/test-it-yourself-plugin-para-wordpress/</link>
		<comments>http://www.masquewordpress.com/test-it-yourself-plugin-para-wordpress/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 17:27:09 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[plugins wordpress]]></category>
		<category><![CDATA[test it yourself]]></category>

		<guid isPermaLink="false">http://masquewordpress.com/?p=592</guid>
		<description><![CDATA[Español Test it Yourself es un plugin para wordpress que te permite agregar un editor en tus post para que los visitantes puedan probar tus ejemplos y ejecutar código de forma fácil. Pueden ver un ejemplo a continuación: Es mi primer plugin para wordpress (espero que no el último), si les parece interesante y quieren [...]]]></description>
			<content:encoded><![CDATA[<h2>Español</h2>
<p><strong>Test it Yourself</strong> es un plugin para wordpress que te permite agregar un editor en tus post para que los visitantes puedan probar tus ejemplos y ejecutar código de forma fácil.<br />
Pueden ver un ejemplo a continuación:<br />

   <script type="text/javascript">
$(document).ready(function () {
	$("#clear__tiy_0").click( function() {
		$("#input_tiy_0").val("");
		$("#output_tiy_0").attr("src","about:blank");
	});
});
</script>
   <div class="testiy" >
   <form id="tester_tiy_0" target="output_tiy_0" method="post" action="http://www.masquewordpress.com/wp-content/plugins/test-it-yourself/show.php">


<textarea id="input_tiy_0" wrap="logical" cols="90" rows="12" name="input" class="input"><html>
<head />
<body>

<script type="text/javascript">
   document.write("Hello World!");
</script>

</body>
</html>

</textarea>

	<p>
		<input class="inputbutton" id="exec_tiy_0" value="Test It" type="submit" /> <input class="inputbutton" id="clear__tiy_0" value="Clear All" type="submit" />
	</p>
	
	<iframe id="output_tiy_0" src="about:blank" name="output_tiy_0" class="output" frameborder="0"> </iframe>
	</form>	
   
   
   
   </div></p>
<p>Es mi primer  plugin para wordpress (espero que no el último), si les parece interesante y quieren saber más, sigan leyendo. En unos días voy a explicar cuales son los pasos básicos para hacer un plugin de wordpress.<br />
<span id="more-592"></span></p>
<p><strong>Test it Yourself</strong> es muy fácil de implementar, tan solo tenes que usar el shortcode <strong>[testiy]</strong> en tu editor . Y si querés mostrar un código por defecto lo podes usar de la siguiente manera ,<strong>[testiy] tu código aca [/testiy]</strong></p>
<p>Es una herramienta excelente para blogs de desarolladores o donde se muestren diversos tutoriales de diseño web.</p>
<p>También se puede añadir al template page de la siguiente forma:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> do_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[testiy]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Para modificar el diseño tan solo edita el archivo css localizado en la carpeta <strong>test-it-yourself </strong> de tu directorio wp-content/plugins/.</p>
<p>Y para añadir más de uno <strong>Test it Yourself </strong>hay agregar id`s de la siguiente forma<strong> [testiy id="1"] [/testiy] </strong> para que el plugin sepa diferenciarlos.<br />
Si el plugin llega a gustar le voy a ir agregando más funcionalidades, tengan en cuenta que es el primero que realizo. <img src='http://www.masquewordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Saludos</p>
<p>Link de desarga: <a href="http://wordpress.org/extend/plugins/test-it-yourself/">http://wordpress.org/extend/plugins/test-it-yourself/</a></p>
<p>PD: Si te sirvió y estas interesado en ayudar a mantener el host <img src='http://www.masquewordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="UNXGMCDDAQUAS" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/es_ES/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<h2>English</h2>
<p><strong>Test it Yourself</strong> is a wordpress puglin that will allow you to easily insert an editor  to let the visitors test snippets codes like for example:</p>

   <script type="text/javascript">
$(document).ready(function () {
	$("#clear__tiy_1").click( function() {
		$("#input_tiy_1").val("");
		$("#output_tiy_1").attr("src","about:blank");
	});
});
</script>
   <div class="testiy" >
   <form id="tester_tiy_1" target="output_tiy_1" method="post" action="http://www.masquewordpress.com/wp-content/plugins/test-it-yourself/show.php">


<textarea id="input_tiy_1" wrap="logical" cols="90" rows="12" name="input" class="input">
<html>
<head />
<body>

<script type="text/javascript">
   document.write("Hello World!");
</script>

</body>
</html>

</textarea>

	<p>
		<input class="inputbutton" id="exec_tiy_1" value="Test It" type="submit" /> <input class="inputbutton" id="clear__tiy_1" value="Clear All" type="submit" />
	</p>
	
	<iframe id="output_tiy_1" src="about:blank" name="output_tiy_1" class="output" frameborder="0"> </iframe>
	</form>	
   
   
   
   </div>
<p>Its really easy to implement , all you need its to use a <strong>[testiy]</strong> shortcode in your HTML code or if you want to show some default code just use <strong>[testiy] your code here [/testiy]</strong></p>
<p>Its a great tool for developers and tutorials blogs to let visitors test source code wihout leaving the site.</p>
<p>You can also use it  in your template pages like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> do_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[testiy]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>To modify the layout just edit the css file located in <strong>test-it-yourself </strong> wp-content/plugins folder.</p>
<p>And to add more than one <strong>Test it Yourself </strong>you need to add id`s like <strong> [testiy id="1"]</strong> to let the plugin difference between them..</p>
<p>Download link: <a href="http://wordpress.org/extend/plugins/test-it-yourself/">http://wordpress.org/extend/plugins/test-it-yourself/</a><br />
Thanks a hope you enjoyed it .Its my first plugin , if people like it , ill will add some features. Thanks and leave feedback please.</p>
<p>PD:If you want to help with the host please <img src='http://www.masquewordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="UNXGMCDDAQUAS" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/es_ES/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/test-it-yourself-plugin-para-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>JcubeiT &#8211; Plugin JQuery para hacer cubos  con HTML5</title>
		<link>http://www.masquewordpress.com/jcubeit-plugin-jquery-para-hacer-cubos-con-html5/</link>
		<comments>http://www.masquewordpress.com/jcubeit-plugin-jquery-para-hacer-cubos-con-html5/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 22:48:32 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[jquery.plugin]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://masquewordpress.com/?p=427</guid>
		<description><![CDATA[Buenas tardes!! Como ven sigo experimentando y haciendo plugins para JQuery. Hoy se me dio por hacer uno bastante gracioso basado en las explicaciones de lanrat acerca de como construir un cubo usando las nuevas propiedades CSS. Su utilización es muy sencilla, tan solo necesitamos 3 objetos ( las caras visibles del cubo) dentro de [...]]]></description>
			<content:encoded><![CDATA[<p>Buenas tardes!! Como ven sigo <a href="http://masquewordpress.com/jquery/jquery-nightmode-plugin/">experimentando</a> y haciendo <a href="http://masquewordpress.com/tag/jquery-plugin/">plugins</a> para JQuery.</p>
<p>Hoy se me dio por hacer uno bastante gracioso basado en las explicaciones de <a href="http://lanrat.com/code/html5-cube">lanrat</a> acerca de como construir un cubo usando <a href="http://masquewordpress.com/tutoriales/esquinas-redondeadas-y-degradados-con-css3/">las nuevas propiedades CSS</a>.</p>
<p style="text-align: center;"><img class="size-full wp-image-430  aligncenter" title="social" src="http://masquewordpress.com/wp-content/uploads/2010/06/social.gif" alt="" width="160" height="140" /></p>
<p>Su utilización es muy sencilla, tan solo necesitamos 3 objetos ( las caras visibles del cubo) dentro de un objeto contenedor. Dichos objetos pueden ser links , imágenes, otros divs, etc</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cube&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>Una vez que tenemos nuestra estructura HTML armada debemos aplicar el plugin de la siguiente forma:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.jcubeit.js&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
						   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.cube'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">JcubeiT</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
						   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Y voila!! Tendremos un cubo perfecto con el cual podremos hacer un poco más original nuestros diseños.</p>
<p>El plugin posee algunos <strong>valores por defecto</strong> que se pueden cambiar pasando opciones.</p>
<ul>
<li><strong>size</strong>:&#8217;200px&#8217;</li>
<li><strong>background</strong>: &#8216;#666&#8242;</li>
<li><strong>border</strong>: true</li>
<li><strong>borderColor</strong>: &#8216;#000&#8242;</li>
<li><strong>rounded</strong>: false</li>
</ul>
<p>Podemos cambiar estos valores pasando las opciones como se suele hacer en JQuery</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> opciones<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span> size<span style="color: #339933;">:</span><span style="color: #3366CC;">'100px'</span> <span style="color: #339933;">,</span> border<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.cube'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">JcubeiT</span><span style="color: #009900;">&#40;</span>opciones<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//o simplemente</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.cube'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">JcubeiT</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> size<span style="color: #339933;">:</span><span style="color: #3366CC;">'100px'</span> <span style="color: #339933;">,</span> border<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Jugando con las opciones podremos crear por ejemplo una barra de menu más original</p>
<p style="text-align: center;">
<img class="size-full wp-image-431  aligncenter" title="menu" src="http://masquewordpress.com/wp-content/uploads/2010/06/menu.gif" alt="" width="200" height="198" /></p>
<p>Pueden ver el <a href="http://masquewordpress.com/ejemplos/jcubeit-plugin/">ejemplo online</a> o <a href="http://plugins.jquery.com/files/jquery.jcubeit.zip">descargarse el código</a> desde la página oficial de JQuery</p>
<h2>ENGLISH</h2>
<p>Hello!As you see im still  <a href="http://masquewordpress.com/jquery/jquery-nightmode-plugin/">experiencing</a> and doing <a href="http://masquewordpress.com/tag/jquery-plugin/">plugins</a> for JQuery</p>
<p>Today I did a pretty funny one based on the explanations of  <a href="http://lanrat.com/code/html5-cube">lanrat</a>  about how to build a cube using <a href="http://masquewordpress.com/tutoriales/esquinas-redondeadas-y-degradados-con-css3/">new CSS properties</a>.</p>
<p style="text-align: center;"><img class="size-full wp-image-430  aligncenter" title="social" src="http://masquewordpress.com/wp-content/uploads/2010/06/social.gif" alt="" width="160" height="140" /></p>
<p>Its use is very simple,  you only need 3 objects (the visible faces of the cube) inside of a container object. Such objects could be links, images, other divs, etc.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cube&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3.jpg&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>Once we have our HTML structure we have to apply the plugin like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.jcubeit.js&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
						   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.cube'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">JcubeiT</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
						   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>And voila! We will have a perfect cube to be a little more original in our designs.</p>
<p>The plugin has some <strong>defaults  values</strong> that can be changed via the options var.</p>
<ul>
<li><strong>size</strong>:&#8217;200px&#8217;</li>
<li><strong>background</strong>: &#8216;#666&#8242;</li>
<li><strong>border</strong>: true</li>
<li><strong>borderColor</strong>: &#8216;#000&#8242;</li>
<li><strong>rounded</strong>: false</li>
</ul>
<p>We may change these values from the options as is usually done in JQuery</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> opciones<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span> size<span style="color: #339933;">:</span><span style="color: #3366CC;">'100px'</span> <span style="color: #339933;">,</span> border<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.cube'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">JcubeiT</span><span style="color: #009900;">&#40;</span>opciones<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//or just</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.cube'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">JcubeiT</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> size<span style="color: #339933;">:</span><span style="color: #3366CC;">'100px'</span> <span style="color: #339933;">,</span> border<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Playing with the options we can create for example a more original menu bar</p>
<p style="text-align: center;">
<img class="size-full wp-image-431  aligncenter" title="menu" src="http://masquewordpress.com/wp-content/uploads/2010/06/menu.gif" alt="" width="200" height="198" /></p>
<p>You can check the <a href="http://masquewordpress.com/ejemplos/jcubeit-plugin/">online demo</a> or <a href="http://plugins.jquery.com/files/jquery.jcubeit.zip">download the plugin</a> from JQuery </p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/jcubeit-plugin-jquery-para-hacer-cubos-con-html5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JQuery nightMode Plugin</title>
		<link>http://www.masquewordpress.com/jquery-nightmode-plugin/</link>
		<comments>http://www.masquewordpress.com/jquery-nightmode-plugin/#comments</comments>
		<pubDate>Sat, 01 May 2010 16:11:50 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[jquery.plugin]]></category>
		<category><![CDATA[nightMode]]></category>

		<guid isPermaLink="false">http://masquewordpress.com/?p=387</guid>
		<description><![CDATA[Download JQuery nightMode Plugin /////////////////////////ESPAÑOL ////////////////////// Anoche estaba aburrido y me puse a trabajar en un plugin para JQuery ya que nunca habia echo ninguno . Así nacio nightMode Plugin que es simplemente un script chiquitito que cambia el color de las letras y el fondo de pantalla. Con eso logramos ahorrar un poco de [...]]]></description>
			<content:encoded><![CDATA[<p>Download <a href="http://masquewordpress.com/plugins/jquery.nightmode.js">JQuery nightMode Plugin</a></p>
<p>/////////////////////////<strong>ESPAÑOL</strong> //////////////////////</p>
<p>Anoche estaba aburrido y me puse a trabajar en un plugin para JQuery ya que nunca habia echo ninguno . Así nacio <strong>nightMode</strong> Plugin que es simplemente un script chiquitito que cambia el color de las letras y el fondo de pantalla. Con eso logramos ahorrar un poco de energia apagando algunos pixeles de nuestra pantalla y además nos facilita la lectura. Espero que les guste!!</p>
<p>El color tanto de las letras o el fondo se puede cambiar pasando opciones.</p>
<p>Uso:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"> <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nightmode&quot;</span>&gt;</span>Turn nightmode On/off<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
               $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#nightmode'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                           $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nightMode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Tan solo cambiar body por cualquier selector válido</p>
<p>También se puede ejecutar con opciones</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"> <span style="color: #003366; font-weight: bold;">var</span> options<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span>
      color<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#ffffff'</span><span style="color: #339933;">,</span>
     background<span style="color: #339933;">:</span><span style="color: #3366CC;">'#ccc'</span>
 <span style="color: #009900;">&#125;</span>
 $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nightMode</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Pueden probar como funciona haciendo click en la lamparita que aparece en la parte superior derecha de mi blog <img src='http://www.masquewordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Descargar <a href="http://masquewordpress.com/plugins/jquery.nightmode.js">JQuery nightMode Plugin</a></p>
<p>////////////////////////<strong>ENGLISH</strong>/////////////////////////////<br />
<strong><br />
JQuery nightMode Plugin</strong> its a funny tiny plugin that will allow you to change your background and letter colors for a night mode. Saving energy turning off pixels of your screen and allowing you to have a confortable read .</p>
<p>Letter colors and background can be moddified by options</p>
<p>Ussage:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"> <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nightmode&quot;</span>&gt;</span>Turn nightmode On/off<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"> $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
               $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#nightmode'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                           $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nightMode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p> Just change body to any valid selector you wish</p>
<p>Can also be called with options:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"> <span style="color: #003366; font-weight: bold;">var</span> options<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span>
      color<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#ffffff'</span><span style="color: #339933;">,</span>
      background<span style="color: #339933;">:</span><span style="color: #3366CC;">'#ccc'</span>
 <span style="color: #009900;">&#125;</span>
 $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nightMode</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>You can try how it works by clicking on the light bulb on the top right corner of my blog <img src='http://www.masquewordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
Download <a href="http://masquewordpress.com/plugins/jquery.nightmode.js">JQuery nightMode Plugin</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/jquery-nightmode-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

