<?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>Cultura Digital#Blog &#187; J.A.Cobo</title>
	<atom:link href="http://blog.culturadigital.org/autor/jacobo/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.culturadigital.org</link>
	<description>Tener algo que decir; y decirlo.</description>
	<lastBuildDate>Mon, 26 Apr 2010 15:43:07 +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>Ticker (NewsTicker) con MooTools</title>
		<link>http://blog.culturadigital.org/tecnologia/desarrollo-web/ticker-newsticker-con-mootools</link>
		<comments>http://blog.culturadigital.org/tecnologia/desarrollo-web/ticker-newsticker-con-mootools#comments</comments>
		<pubDate>Sun, 25 Apr 2010 18:13:15 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[newsticker]]></category>
		<category><![CDATA[ticker]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=883</guid>
		<description><![CDATA[Como implementar un ticker de noticias, o cualquier listado sin importar las etiquetas de listas, con MooTools (habitualmente con efecto scroll).]]></description>
			<content:encoded><![CDATA[<h4>Contexto</h4>
<p>Hace poco tiempo que decidí cambiar de framework Javascript, en concreto desde que vi los problemas que <a hreflang="en" href="http://jquery.com/" title="Sitio web de jQuery">jQuery</a> tenía para trabajar con <a hreflang="en" href="http://www.w3.org/DOM/#what" title="Sitio web del W3C sobre el DOM"><abbr title="Document Object Model (Modelo de Objetos del Documento )" xml:lang="en">DOM</abbr></a> distinto de <abbr title="HyperText Markup Language (Lenguaje de Marcado de Hipertexto)" xml:lang="en">HTML</abbr>. Mi elección <a href="http://blog.culturadigital.org/proyectos-y-trabajos/proyectos-grandes-o-externos/1sctools" title="Proyecto 1SC/BETools">entonces</a> fue volver a <a hreflang="en" href="http://www.prototypejs.org/" title="Sitio web de Prototype">Prototype</a> para más tarde pasarme a <a hreflang="en" href="http://mootools.net/" title="Sitio web de MooTools">MooTools</a>.</p>
<h4>Objetivo</h4>
<p>Ahora estoy migrando el Javascript que uso en algunos sitios a esta librería, MooTools, y con esta entrada trato de ilustrar lo intuitivo y fácil que resulta trabajar con MooTools para extender Javascript y adaptarlo de una forma estándar a tus propósitos. Es, a diferencia de jQuery, para lo que está hecha esta librería.</p>
<h5>Newsticker</h5>
<p>Aunque es espectacular el ritmo de crecimiento de los plugins para MooTools en su sección Forge y en concreto los <em xml:lang="en">slideshow</em> de varios tipos, lo cierto es que no encontraba un <strong>scroll de noticias sencillo</strong> -técnicamente más conocidos como <em xml:lang="en">ticker</em> o <em xml:lang="en">newsticker</em>-.</p>
<p>Haberlos los hay, pero ninguno satisfacía mis necesidades pues: o generaban marcado que no me parecía correcto; o se basaban en procesos demasiado estrictos, demasiado complicados; o se basaban más bien en <abbr title="Cascading StyleSheets (Hojas de estilo en cascada)" xml:lang="en">CSS</abbr>. &#8230;O sea, <strong>todo demasiado estricto y yo solo quería implementar la funcionalidad para cualquier listado</strong> independientemente del estilo CSS asignado y de su marcado.<br />
Así que, como en otras ocasiones -en las BeTools por ejemplo- e inspirado en <a href="http://woork.blogspot.com/2009/05/how-to-implement-news-ticker-with.html" title="How to implement a news ticker with jQuery and ten lines of code" hreflang="en">la idea de Antonio Lupetti</a> para jQuery (es un ciclo de posiciones básicamente), decidí ponerme manos a la obra y reinventar la rueda porque a veces sigue siendo la mejor solución para conseguir exactamente lo que quieres, como en este caso.</p>
<h4>Código NewsTicker con MooTools</h4>
<p>Esta es la clase que he implementado, nada del otro mundo pero que me funciona perfecta y hace exactamente lo que quiero:</p>
<h5>Funcionalidad</h5>
<ul>
<li>Me permite <strong>aplicarlo a cualquier elemento que contenga hijos</strong>, ya sea un listado o no, aunque obviamente lo recomendable y más fiable son los listados.</li>
<li>Me permite <strong>mantener el estilo original</strong> de los elementos <strong>abstrayéndose</strong> de si se usan o no para el ticker. El ticker simplemente aplica el estilo mínimo para la funcionalidad, en este caso la visualización de un solo item del listado y de acuerdo a la altura original del elemento. Es decir, olvídate de anchos o altos estrictos preestablecidos, es la funcionalidad y punto.</li>
<li>El resto ya es lo normal: tiempo entre repeticiones, establecer un efecto, etc.</li>
</ul>
<p class="alert">Actualizado</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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
</pre></td><td class="code"><pre class="javascript" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #006600; font-style: italic;">/**
 * MooTools NewsTicker by Covi.
 * 
 * Inspirado en la idea de Antonio Lupetti 
 * (http://woork.blogspot.com/2009/05/how-to-implement-news-ticker-with.html)
 *
 * @author Covi
 * @copyright 2010 J.A.Cobo (Covi)
 * @version 0.1beta
 * @todo Interfaz y extender para ticker pequeño, slideshow...
 *
 * @license MIT License http://www.opensource.org/licenses/mit-license.php
Copyright (c) 2010 J. A. Cobo Ruz (Covi), inspired by Antonio Lupetti cycle idea.
&nbsp;
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the &quot;Software&quot;), to deal in the
Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
&nbsp;
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of
the Software.
&nbsp;
THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/</span>
<span style="color: #003366; font-weight: bold;">var</span> NewsTicker <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> <span style="color: #003366; font-weight: bold;">Class</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	Implements<span style="color: #339933;">:</span> Options<span style="color: #339933;">,</span>
&nbsp;
	options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
		autostart<span style="color: #339933;">:</span> 		<span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> 		<span style="color: #006600; font-style: italic;">// Comenzar automático o no.</span>
		animation<span style="color: #339933;">:</span> 		<span style="color: #3366CC;">'fade'</span><span style="color: #339933;">,</span> 	<span style="color: #006600; font-style: italic;">// Tipo de animación, por el momento: fade, slide (mode:horizontal|vertical).</span>
		mode<span style="color: #339933;">:</span>			<span style="color: #3366CC;">'vertical'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// Para animación slide.</span>
		transition<span style="color: #339933;">:</span>		<span style="color: #3366CC;">'sine:out'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// TODO slide con transición expo da error pues no crea el div vacío.</span>
		speed<span style="color: #339933;">:</span> 			<span style="color: #CC0000;">1000</span><span style="color: #339933;">,</span> 		<span style="color: #006600; font-style: italic;">// Velocidad de la transición en efectos.</span>
		periodical<span style="color: #339933;">:</span> 	<span style="color: #CC0000;">5000</span><span style="color: #339933;">,</span> 		<span style="color: #006600; font-style: italic;">// Periocidad de la iteración sobre los ítems.</span>
		padding<span style="color: #339933;">:</span>		<span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> 			<span style="color: #006600; font-style: italic;">// Aplicar espaciado a cada ítem si se desea (en un futuro será estilo completo).</span>
		fixedHeight<span style="color: #339933;">:</span>	<span style="color: #003366; font-weight: bold;">true</span>		<span style="color: #006600; font-style: italic;">// Alto fijo o flexible para adaptarse al alto de cada ítem.</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * Constructor
	 */</span>
	initialize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>el<span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">timer</span> 		<span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span> 	<span style="color: #339933;">=</span> el<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">setOptions</span><span style="color: #009900;">&#40;</span>options<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> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">===</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span> <span style="color: #009900;">&#41;</span> 
			<span style="color: #000066; font-weight: bold;">throw</span> <span style="color: #003366; font-weight: bold;">new</span> Error<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'El contenedor de la lista no se encontró.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// # Setup container: Establecer el alto al primer hijo del container:</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">setStyles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #3366CC;">'height'</span><span style="color: #339933;">:</span>	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">getFirst</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getComputedSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">totalHeight</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">padding</span>.<span style="color: #660066;">toInt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
			<span style="color: #3366CC;">'overflow'</span><span style="color: #339933;">:</span>	<span style="color: #3366CC;">'hidden'</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Eventos y run...</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #339933;">===</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">autostart</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">run</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;">&#125;</span><span style="color: #339933;">,</span> 
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * Efecto.
	 * @access private
	 */</span>
	_animate<span style="color: #339933;">:</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> <span style="color: #000066; font-weight: bold;">item</span> 		<span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">getFirst</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #006600; font-style: italic;">// Primer elemento del listado</span>
		<span style="color: #003366; font-weight: bold;">var</span> first 		<span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">clone</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 				<span style="color: #006600; font-style: italic;">// Clonar el ITEM ORIGINAL para situarlo al final</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Eliminar y efecto:</span>
		<span style="color: #000066; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">animation</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// # FADE:</span>
			<span style="color: #003366; font-weight: bold;">default</span><span style="color: #339933;">:</span>
			<span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'fade'</span><span style="color: #339933;">:</span>
				<span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tween'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
					duration<span style="color: #339933;">:</span> 	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">speed</span><span style="color: #339933;">,</span> 
					transition<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">transition</span><span style="color: #339933;">,</span> 
					onComplete<span style="color: #339933;">:</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;">this</span>._cycleItem<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> first<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>.<span style="color: #660066;">bind</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tween</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #006600; font-style: italic;">// # SLIDE:</span>
			<span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'slide'</span><span style="color: #339933;">:</span>
				<span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slide'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
					duration<span style="color: #339933;">:</span> 	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">speed</span><span style="color: #339933;">,</span> 
					transition<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">transition</span><span style="color: #339933;">,</span> 
					mode<span style="color: #339933;">:</span> 		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">mode</span><span style="color: #339933;">,</span> 
					onComplete<span style="color: #339933;">:</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;">this</span>._cycleItem<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> first<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>.<span style="color: #660066;">bind</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slide</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'out'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * Ciclo: Eliminar el ítem y pasarlo al final.
	 * @access private
	 */</span>
	_cycleItem<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> first<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: #339933;">!</span>$chk<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>$chk<span style="color: #009900;">&#40;</span>first<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
			<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> itemHeight 	<span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">getComputedSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">totalHeight</span><span style="color: #339933;">;</span> 	<span style="color: #006600; font-style: italic;">// Alto del ítem para ajustar el container</span>
		<span style="color: #006600; font-style: italic;">// Eliminar y copiarlo al final:</span>
		<span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">dispose</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">grab</span><span style="color: #009900;">&#40;</span>first<span style="color: #339933;">,</span> <span style="color: #3366CC;">'bottom'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// FIXME Eliminar el div vacío que deja slide (para MooTools 1.2.6)</span>
		<span style="color: #006600; font-style: italic;">// @see https://mootools.lighthouseapp.com/projects/24057/tickets/194-fxslide-sometimes-clips-the-contents-of-divs</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'slide'</span> <span style="color: #339933;">===</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">animation</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> wrongDivSlide <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">getFirst</span><span style="color: #009900;">&#40;</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> <span style="color: #3366CC;">'div'</span> <span style="color: #339933;">==</span> wrongDivSlide.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tag'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				wrongDivSlide.<span style="color: #660066;">dispose</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #003366; font-weight: bold;">var</span> nextItem 	<span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">getFirst</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #006600; font-style: italic;">// Para el ajustar el alto del container, volvemos a coger el ítem superior.</span>
				itemHeight 		<span style="color: #339933;">=</span> nextItem.<span style="color: #660066;">getComputedSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">totalHeight</span><span style="color: #339933;">;</span>
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'horizontal'</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">mode</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #003366; font-weight: bold;">var</span> myFx <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Fx.<span style="color: #660066;">Slide</span><span style="color: #009900;">&#40;</span>nextItem<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
						duration<span style="color: #339933;">:</span> 	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">speed</span><span style="color: #339933;">,</span>
						transition<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">transition</span><span style="color: #339933;">,</span> 
						mode<span style="color: #339933;">:</span>		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">mode</span>
					<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					myFx.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideIn</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;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Si no se establece como alto fijo, ajustamos el alto del container:</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">false</span> <span style="color: #339933;">===</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">fixedHeight</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">setStyle</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'height'</span><span style="color: #339933;">,</span> itemHeight<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: #339933;">,</span> 
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * Inicia el bucle para iterar sobre los ítems.
	 */</span>
	start<span style="color: #339933;">:</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;">this</span>.<span style="color: #660066;">timer</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._animate.<span style="color: #660066;">periodical</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">periodical</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * Detiene el bucle.
	 */</span>
	<span style="color: #000066;">stop</span><span style="color: #339933;">:</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>
		$clear<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">timer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * Lanza todo el proceso: establece, si procede, el bucle y los eventos.
	 */</span>
	run<span style="color: #339933;">:</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;">this</span>.<span style="color: #660066;">container</span>.<span style="color: #660066;">addEvents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #3366CC;">&quot;mouseover&quot;</span><span style="color: #339933;">:</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;">this</span>.<span style="color: #000066;">stop</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: #660066;">bind</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: #339933;">,</span>
			<span style="color: #3366CC;">&quot;mouseout&quot;</span><span style="color: #339933;">:</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;">this</span>.<span style="color: #660066;">start</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: #660066;">bind</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">start</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;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h5>Uso</h5>
<p>Por ejemplo para elementos con la clase newsticker:</p>

<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:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;">$$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.newsticker'</span><span style="color: #009900;">&#41;</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: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> myTicker <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> NewsTicker<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
		periodical<span style="color: #339933;">:</span>		<span style="color: #CC0000;">5000</span><span style="color: #339933;">,</span> 
		animation<span style="color: #339933;">:</span>		<span style="color: #3366CC;">'slide'</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>

<h6>Opciones</h6>
<p>Las opciones, valga la redundancia, son opcionales ya que se establecen las siguientes por defecto:</p>

<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="javascript" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;">options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
		autostart<span style="color: #339933;">:</span> 		<span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> 		<span style="color: #006600; font-style: italic;">// Comenzar automático o no.</span>
		animation<span style="color: #339933;">:</span> 		<span style="color: #3366CC;">'fade'</span><span style="color: #339933;">,</span> 	<span style="color: #006600; font-style: italic;">// Tipo de animación, por el momento: fade, slide (mode:horizontal|vertical).</span>
		mode<span style="color: #339933;">:</span>			<span style="color: #3366CC;">'vertical'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// Para animación slide.</span>
		transition<span style="color: #339933;">:</span>		<span style="color: #3366CC;">'sine:out'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// TODO slide con transición expo da error pues no crea el div vacío.</span>
		speed<span style="color: #339933;">:</span> 			<span style="color: #CC0000;">1000</span><span style="color: #339933;">,</span> 		<span style="color: #006600; font-style: italic;">// Velocidad de la transición en efectos.</span>
		periodical<span style="color: #339933;">:</span> 	<span style="color: #CC0000;">5000</span><span style="color: #339933;">,</span> 		<span style="color: #006600; font-style: italic;">// Periocidad de la iteración sobre los ítems.</span>
		padding<span style="color: #339933;">:</span>		<span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> 			<span style="color: #006600; font-style: italic;">// Aplicar espaciado a cada ítem si se desea (en un futuro será estilo completo).</span>
		fixedHeight<span style="color: #339933;">:</span>	<span style="color: #003366; font-weight: bold;">true</span>		<span style="color: #006600; font-style: italic;">// Alto fijo o flexible para adaptarse al alto de cada ítem.</span>
	<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<ul>
<li>(Boolean) <strong>Autostart</strong> (true): <em>true|false</em>. Comenzar o no automáticamente, obvio.</li>
<li>(String) <strong>Animation</strong> (&#8216;fade&#8217;): <em>fade|slide</em> por el momento. Tipo de animación (efecto) a usar en las transiciones de ítems.</li>
<li>(String) <strong>Mode</strong> (&#8216;vertical&#8217;): <em>vertical|horizontal</em>. Modo del efecto slide si se usa..</li>
<li>(String) <strong>Transition</strong> (&#8216;bounce:out&#8217;): <em><a href="http://mootools.net/docs/core/Fx/Fx.Transitions" title="MooTools Docs Fx.Transitions">Fx.Transitions</a> (sine|bounce|bounce:in|&#8230;)</em>. Tipo de transición para el efecto.</li>
<li>(Integer) <strong>Speed</strong> (1000): <em>Número</em>. Velocidad de la transición (opción anterior) del efecto.</li>
<li>(Integer) <strong>Periodical</strong> (5000): <em>Número</em>. Lapso de tiempo entre el intercambio de ítems.</li>
<li>(Integer) <strong>Padding</strong> (0): <em>Número</em>. Espaciado a aplicar al item.<br />
Me gustaría hacer de esto una opción para aplicar un estilo completo si se decide, daría más control sobre la visualización y corregiría posibles fallos que pudiera haber.</li>
<li>(Boolean) <strong>FixedHeight</strong> (true): <em>Número</em>. Alto fijo o flexible para adaptarse al alto de cada ítem.</li>
</ul>
<h5>Notas</h5>
<p>Quiero extenderlo bastante más, mejorarlo, añadir más efectos&#8230; pero para ilustrar creo que sobra.<br />
Este código se distribuye bajo la licencia del <abbr title="Massachusetts Institute of Technology (Instituto de Tecnología de Massachusetts)" xml:lang="en">MIT</abbr> (MIT License: <a href="http://www.opensource.org/licenses/mit-license.php" title="MIT License" hreflang="en">http://www.opensource.org/licenses/mit-license.php</a>), por lo tanto hay que mantener el copyright de la cabecera.</p>
<p><del datetime="2010-04-25T21:44:43+00:00" title="Eliminado el 25/04/2010 21:44 h">PD: Aún no tengo implementado MooTools en el blog y no hay demo pero pronto pondré alguna.</del></p>
<h4>Demo</h4>
<p>Demo y tests en MooShell:<br />
<a href="http://mootools.net/shell/XaUJA/3/" title="Demo NewsTicker en MooShell">http://mootools.net/shell/XaUJA/3/</a>.</p>
<h5>MooShell iframe</h5>
<p>Por si no resultará obvio: <strong>pulsa en la pestaña RESULT para ver el resultado de la demo</strong>.<br />
<iframe style="width: 100%; height: 300px" src="http://mootools.net/shell/XaUJA/3/embedded/"></iframe></p>
<h4>TODO</h4>
<ol>
<li>Cada ítem debe tener su propia altura si los ítems no tienen la misma.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/tecnologia/desarrollo-web/ticker-newsticker-con-mootools/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress Widgets con shortcode</title>
		<link>http://blog.culturadigital.org/tecnologia/desarrollo-web/wordpress-widgets-con-shortcode</link>
		<comments>http://blog.culturadigital.org/tecnologia/desarrollo-web/wordpress-widgets-con-shortcode#comments</comments>
		<pubDate>Thu, 15 Apr 2010 15:17:24 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Plugins WP]]></category>
		<category><![CDATA[shortcode]]></category>
		<category><![CDATA[the_widget]]></category>
		<category><![CDATA[widgets]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=860</guid>
		<description><![CDATA[Wordpress: Cómo usar Widgets en el contenido de las entradas a través de <em>Shortcode</em>.]]></description>
			<content:encoded><![CDATA[<div class="headerImg"><object data="http://blog.culturadigital.org/media/2010/04/php-code-widget.jpg" type="image/jpeg" height="200px" width="100%"><param name="background-position" value="0 10%" /><param name="background-color" value="#FFF" /><param name="border" value="1px solid #FFF" /><param name="border-radius" value=".3em" /></object>
<p class="opacity7">Imagen de ejemplo de código PHP</p>
</div>
<h4>Contexto</h4>
<p>Aprovechando la función <em class="tt">the_widget()</em> para llamar a tus widgets desde plantillas de «themes» en Wordpress; imagino que es normal que la gente también vaya queriendo usarlo en los contenidos de las entradas.<br />
Aunque se pueden usar plugins para ejecutar código <acronym title="PHP: Hypertext Preprocessor" xml:lang="en">PHP</acronym> en el contenido, a mí hace tiempo que no me gusta en absoluto&#8230; por cómodo que pueda ser.</p>
<h4>Objetivo</h4>
<p>Esta es una función simple que he estado probando para <strong>llamar, por ahora, a los widgets que por defecto incorpora Wordpress</strong> a través de <em><a href="http://codex.wordpress.org/Shortcode API" title="Wordpress Codex: Shortcode">Shortcode</a></em>. Digo <em>por ahora</em> porque también se puede llamar a otros widgets instalados por plugins, por ti mismo&#8230; aunque no se comprueba si están activos ni nada más, solo se comprueba si existe la clase que gestiona el widget -que creo que sobra- y si es una instancia válida (ver siguiente).</p>
<p>Esto significa que los widgets que no utilicen la <a href="http://codex.wordpress.org/Widgets_API" title="Wordpress Codex: Widget API">nueva API</a>, es decir, que no sean instancias de <em class="tt">WP_Widget</em>, no se reconocen y no se pueden utilizar. No obstante, migrar un antiguo widget a la nueva <abbr title="Application programming interface" xml:lang="en">API</abbr>, basada en objetos, es muy fácil ¿eh?</p>
<h4>Código</h4>
<p>En fin, esto es lo que estoy probando ahora y no va mal.</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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
</pre></td><td class="code"><pre class="php" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'myWidgetSC'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #009933; font-style: italic;">/**
 * Shortcode para the_widget().
 * 
 * @uses WP_Widget
 * 
 * @param array $atts: Shortcode atts.
 * @return string $output: Salida del widget (the_widget)
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> myWidgetSC<span style="color: #009900;">&#40;</span><span style="color: #000088;">$atts</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_widget_factory</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// # Parámetros base:</span>
	<span style="color: #000088;">$output</span> 	<span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$msgError</span>	<span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;p class=&quot;error&quot;&gt;%s&lt;/p&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$instance</span>	<span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// No se pasan argumentos extra del widget, es peligroso:</span>
	<span style="color: #000088;">$defaultArgs</span><span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'after_widget'</span> 	<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'before_title'</span> 	<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'after_title'</span> 	<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// # Init check:</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_widget_factory</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgError</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'No tenemos acceso a, o no podemos generar, Widgets.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// # Options: para Debug</span>
	<span style="color: #666666; font-style: italic;">/*$options 	= shortcode_atts(array(
		'widget_name' 	=&gt; false, 
	), $atts);
	extract($options);*/</span>
	<span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span>shortcode_atts<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'widget_name'</span> 	<span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$atts</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$widget_name</span> <span style="color: #339933;">=</span> esc_html<span style="color: #009900;">&#40;</span><span style="color: #000088;">$widget_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// FIXME Eliminar la clave widget_name en concreto.</span>
	<span style="color: #990000;">array_shift</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$atts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Eliminar parámetro nombre del Widget para parsear los argumentos del mismo.</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// # Check:</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">class_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$widget_name</span>&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
		<span style="color: #b1b100;">return</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgError</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'El Widget: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$widget_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' no existe.'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$widget</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_widget_factory</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgets</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$widget_name</span>&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$widget</span> instanceof WP_Widget<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgError</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'El widget no es una instancia válida de WP_Widget.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Settings del widget original cacheado:</span>
		<span style="color: #000088;">$widgetSettings</span> <span style="color: #339933;">=</span> <span style="color: #990000;">current</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$widget</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_settings</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// Formatear instancia final para el widget:</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$widgetSettings</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Limpiar los valores cacheados del widget original:</span>
			<span style="color: #000088;">$defaultSettings</span><span style="color: #339933;">=</span> <span style="color: #990000;">array_fill_keys</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$widgetSettings</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// Parsear los valores pasados por shortcode de acuerdo a los settings del widget:</span>
			<span style="color: #000088;">$instance</span> 	<span style="color: #339933;">=</span> wp_parse_args<span style="color: #009900;">&#40;</span><span style="color: #000088;">$atts</span><span style="color: #339933;">,</span> <span style="color: #000088;">$defaultSettings</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// # Run...</span>
	<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// Menos pesado aunque más inseguro; the_widget() vuelve a instanciar el Widget:</span>
	<span style="color: #666666; font-style: italic;">//$widget-&gt;widget($defaultArgs, $instance); // Sin parámetros extra</span>
	<span style="color: #666666; font-style: italic;">// Más seguro pero redundante (con argumentos da problemas con tags html y es inseguro): </span>
	the_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$widget_name</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$instance</span><span style="color: #339933;">,</span> <span style="color: #000088;">$defaultArgs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ob_get_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// # Return:</span>
	<span style="color: #b1b100;">return</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$output</span> <span style="color: #339933;">:</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msgError</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'El widget no generó contenido.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
add_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'widget'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'myWidgetSC'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h4>Uso</h4>
<pre>[widget widget_name="WP_Widget_RSS" url="http://blog.culturadigital.org/feed/" items="5"]</pre>
<h4>Notas</h4>
<dl>
<dt class="strong">Opciones comunes de los widgets:</dt>
<dd>He intentado que se pudieran añadir argumentos típicos de los widgets como <em>before_title</em> y demás pero&#8230;, a parte de ser un coñazo por los resultados impredecibles que puede dar el uso de etiquetas html, también es peligroso usarlos a no ser que se haga una limpieza que a mí se me antoja demasiado intensiva, teniendo en cuenta que estamos en el contenido y si se quieren incluir etiquetas html, al menos antes y después del widget, es tan fácil como incluirlas en la entrada y punto.</dd>
<dt class="strong">Más simple:</dt>
<dd>Obviamente, se puede hacer mucho más reducido y simple, entre otras cosas, si no se quieren comprobar los argumentos del Widget al que se llama por ejemplo (a partir de la línea 50 del código en el bloque condicional).</dd>
<dt class="strong">Más simple todavía:</dt>
<dd>Yo he preferido documentarme directamente en la clase <a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/widgets.php" title="TRAC Wordpress WP_Widget">WP_Widget</a>, pero hay otras opciones. Por ejemplo, en <a href="http://digwp.com/2010/04/call-widget-with-shortcode/" title="Digging into Wordpress: Call a Widget with a Shortcode"><em>Digging into Wordpress</em></a> tenéis para widgets sin parámetros.</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/tecnologia/desarrollo-web/wordpress-widgets-con-shortcode/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Animations</title>
		<link>http://blog.culturadigital.org/tecnologia/desarrollo-web/diseno-web-desarrollo-web-2/css-animations</link>
		<comments>http://blog.culturadigital.org/tecnologia/desarrollo-web/diseno-web-desarrollo-web-2/css-animations#comments</comments>
		<pubDate>Sun, 21 Mar 2010 15:53:32 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Diseño web]]></category>
		<category><![CDATA[animaciones]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[diseño web]]></category>
		<category><![CDATA[dock]]></category>
		<category><![CDATA[estándares]]></category>
		<category><![CDATA[W3C]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=848</guid>
		<description><![CDATA[Mi malestar en general sobre la dirección que está tomando el W3C y en concreto sobre las animaciones CSS para CSS3.]]></description>
			<content:encoded><![CDATA[<p>Buscando artículos sobre el problema de Firefox para aplicar bordes redondeados directamente en imágenes -no las recorta (<em>crop</em>) aun en 3.6-, llego por casualidad y leo en Anieto <a href="http://www.anieto2k.com/2008/04/02/dock-estilo-macos-con-css-animations" title="Dock estilo MacOS con CSS Animations">una de sus entradas</a> sobre las Animaciones CSS aplicadas a un dock estilo Mac OS, Avant Window Navigator en para Gnome, etc.</p>
<p>Aunque hace tiempo de su implantación y de la entrada, no he podido evitar expresar mi descontento con la dirección que está tomando el W3C con cuestiones como esta y HTML5 entre muchas otras. Ya he dicho muchas veces que soy muy talibán de XML, en este caso en concreto de XHTML.</p>
<h4>CSS Animations</h4>
<p>En mi opinión, esto debería ser parte de las animaciones estándar: SVG, al menos en XHTML. No debería haber ningún problema al incrustarlo en un documento con ambos Doctypes.</p>
<p>Si no, como dicen en los comentarios de la entrada, esto va a empezar a ser lo que fue en su día con la Guerra de los navegadores y un batiburrillo de soportes en todas las tecnologías para hacer lo mismo.<br />
No entiendo por qué el W3C no sigue manteniéndolo todo tan simple como al principio:</p>
<ul>
<li>Estructura: (X)HTML;</li>
<li>estilo visual: CSS;</li>
<li>animaciones: como parte de SVG, PNG&#8230;;</li>
<li>objetos: object&#8230;</li>
</ul>
<p>Juro que no lo entiendo, imagino que Microsoft y Adobe cada vez ejercen más influencia en el W3C. Una pena<br />
:(</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/tecnologia/desarrollo-web/diseno-web-desarrollo-web-2/css-animations/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mejora visualmente tus kbd con CSS</title>
		<link>http://blog.culturadigital.org/tecnologia/desarrollo-web/mejora-visualmente-tus-kbd-con-css</link>
		<comments>http://blog.culturadigital.org/tecnologia/desarrollo-web/mejora-visualmente-tus-kbd-con-css#comments</comments>
		<pubDate>Thu, 25 Feb 2010 19:03:49 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Diseño web]]></category>
		<category><![CDATA[Trabajos]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[estilo]]></category>
		<category><![CDATA[kbd]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=821</guid>
		<description><![CDATA[Hace tiempo que no publico nada en el blog y hoy, tras volver a mejorar el estilo visual para contenidos que usan la etiqueta kbd (keyboard) en algunos de mis trabajos, he decidido publicar el estilo CSS que utilizo y que, personalmente, me gusta bastante como queda.
Parte de la regla principal está inspirada en el [...]]]></description>
			<content:encoded><![CDATA[<p>Hace tiempo que no publico nada en el blog y hoy, tras volver a mejorar el estilo visual para contenidos que usan la etiqueta <span class="tt">kbd</span> (<dfn title="Teclado, en inglés" xml:lang="en">keyboard</dfn>) en algunos de mis trabajos, he decidido publicar el estilo CSS que utilizo y que, personalmente, me gusta bastante como queda.<br />
Parte de la regla principal está inspirada en el estilo por defecto que usa Wikipedia, pero ciertamente la adapté a mi gusto y añadí más efectos como el estado <em>sobre</em>, bordes redondeados, fuentes y colores&#8230; si sigo casi que es la regla entera :D</p>
<h4>Ejemplo</h4>
<p>En definitiva, el estilo para la etiqueta kbd y que se puede apreciar ampliamente en la sección <a href="http://blog.culturadigital.org/accesibilidad">Accesibilidad</a> queda así:</p>
<p><kbd>Alt</kbd></p>
<h4>Reglas CSS</h4>
<p>Las reglas CSS son las siguientes:</p>
<p>En mi <strong>basic.css</strong>:<br />
Una regla genérica y común anterior:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="css" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;">pre<span style="color: #00AA00;">,</span> code<span style="color: #00AA00;">,</span> tt<span style="color: #00AA00;">,</span> kbd <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span>		<span style="color: #933;">0.87em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span>		Monaco<span style="color: #00AA00;">,</span> <span style="color: #ff0000;">'Andale Mono'</span><span style="color: #00AA00;">,</span> 
				<span style="color: #ff0000;">'Bitstream Vera Sans Mono'</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">monospace</span> !important<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span>			<span style="color: #cc00cc;">#008000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>* <strong>Nota</strong>: Aunque <em>Monaco</em> me gusta mucho, antes usaba la nueva fuente monoespaciada de Windows Vista para edición de código <em>Consolas</em>, pero su tamaño varía mucho con el resto de fuentes alternativas. Creo que también hay que tener cuidado, aunque no recuerdo cierto, con <em>Andale Mono</em>.<br />
&#8230;aunque siempre se puede recurrir a <span class="tt">@font-face {}</span> para usar una fuente propia o incluso a <em><a href="http://www.google.es/search?q=cufon" title="Buscar en Google sobre la técnica cufon">cufon</a></em>.</p>
<p>Personalización para el estilo final:</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="css" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;">kbd <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> 		<span style="color: #cc66cc;">0</span> <span style="color: #933;">0.5em</span> <span style="color: #933;">0.5em</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> 		<span style="color: #cc66cc;">0</span> <span style="color: #933;">0.5em</span> <span style="color: #933;">0.1em</span> <span style="color: #933;">0.25em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> 			<span style="color: #933;">4em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> 		<span style="color: #933;">4em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> 		<span style="color: #933;">4em</span><span style="color: #00AA00;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span>		<span style="color: #cc00cc;">#EEE</span> <span style="color: #993333;">none</span> <span style="color: #993333;">repeat</span> <span style="color: #993333;">scroll</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span>			<span style="color: #933;">0.23em</span> <span style="color: #993333;">outset</span> <span style="color: #cc00cc;">#DDD</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-bottom-color</span><span style="color: #00AA00;">:</span>	<span style="color: #cc00cc;">#BBB</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-right-color</span><span style="color: #00AA00;">:</span>	<span style="color: #cc00cc;">#BBB</span><span style="color: #00AA00;">;</span>
	border-radius<span style="color: #00AA00;">:</span> 		<span style="color: #933;">0.3em</span><span style="color: #00AA00;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span>			<span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> 		<span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span>		<span style="color: #993333;">nowrap</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
kbd<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> 		<span style="color: #cc66cc;">0</span> <span style="color: #933;">0.75em</span> <span style="color: #933;">0.75em</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> 		<span style="color: #cc66cc;">0</span> <span style="color: #933;">0.53em</span> <span style="color: #933;">0.13em</span> <span style="color: #933;">0.28em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span>			<span style="color: #933;">0.1em</span> <span style="color: #993333;">outset</span> <span style="color: #cc00cc;">#DDD</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-bottom-color</span><span style="color: #00AA00;">:</span>	<span style="color: #cc00cc;">#EEE</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-right-color</span><span style="color: #00AA00;">:</span>	<span style="color: #cc00cc;">#EEE</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span>			<span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Básicamente cambiamos los bordes inferior y derecho a otro color para el efecto de sombreado, además del tamaño para el efecto <em>pulsada</em>. Luego ajustamos los espaciados y márgenes para que, al reducir o aumentar el tamaño de los bordes, el del botón no varíe -al menos demasiado (nota siguiente)-.</p>
<p>Pueden existir problemas al usar medidas relativas&#8230; pero yo al menos ya me he acostumbrado a ellas y prácticamente no diseño nada en base a píxeles.<br />
&#8230;es algo arriesgado, sobre todo con navegadores poco estándares, pero diseñando de un modo más flexible y aceptando las variaciones de estos últimos -que las tienen con o sin píxeles- al final el resultado es casi más gratificante. Los píxeles quedan casi en exclusiva para elementos que no redimensionen o que solo lo hagan dentro de unos límites conocidos. Por ejemplo un elemento que sepas solo se ampliará o reducirá por un lado y dejes un espacio para una imagen de tamaño fijo. No obstante, incluso en casos así se sigue pudiendo prescindir de ellos perfectamente.</p>
<p>Además ajustamos el texto, como en los teclados, un poco a la parte superior izquierda, un efecto sutil en teclas pequeñas y visible en las grandes.</p>
<h5>Jugando un poco, más ejemplos</h5>
<p>Aquí viene otra de las bondades de los tamaños relativos: aunque no sean medidas exactas de teclas, las teclas grandes -con más texto- se autoexpanden. Y permiten jugar un poco con su contenido aunque de forma menos semántica. En concreto, añadiendo texto y ajustando la autoexpansión, se le da sentido a las teclas cuando no se usa CSS. Por ejemplo:<br />
Para <kbd>Ctrl</kbd> y <kbd>Alt</kbd>, el mismo tamaño del texto es suficiente, pero para mayúsculas simples (shift) podemos o añadir la palabra inglesa, u ocultarla mediante algo de CSS de presentación -del que no me gusta pero bueno- y conseguir el tamaño deseado.</p>
<p><kbd>&uArr; Shift</kbd><br />
Versión ocultando <em>shift</em> sin extras:<br />
<kbd>&uArr; <span style="visibility:hidden;">Shift</span></kbd><br />
Una tecla más real, mayúsculas corta:<br />
<kbd><span style="font-size:1.4em;">&uArr;</span> <span style="visibility:hidden; letter-spacing:-2em;">Shift</span></kbd><br />
Mayúsculas larga:<br />
<kbd><span style="font-size:1.4em;">&uArr;</span> <span style="visibility:hidden; letter-spacing:0.8em;">Shift</span></kbd></p>
<p>Espacio:<br />
<kbd><span style="visibility:hidden; letter-spacing:3em;">Shift</span></kbd></p>
<p>Retroceso:<br />
<kbd><span style="font-size:1.4em;">&larr;</span><span style="visibility:hidden;">return</span></kbd><br />
:D</p>
<p>Bueno, ahí queda por si le gusta o interesa a alguien.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/tecnologia/desarrollo-web/mejora-visualmente-tus-kbd-con-css/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recuperando el sentido de la web. Tim Berners-Lee</title>
		<link>http://blog.culturadigital.org/tecnologia/internet/recuperando-el-sentido-de-la-web-tim-berners-lee</link>
		<comments>http://blog.culturadigital.org/tecnologia/internet/recuperando-el-sentido-de-la-web-tim-berners-lee#comments</comments>
		<pubDate>Fri, 29 Jan 2010 02:45:46 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Berners Lee]]></category>
		<category><![CDATA[relaciones]]></category>
		<category><![CDATA[semántica]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=798</guid>
		<description><![CDATA[Si bien se habla de nuevos propósitos, creo que no deja de ser el principio básico que la frenética mente de este hombre ideó en su día. Si no simplemente, un cambio de perspectiva, de punto de vista; la forma en cómo vemos la web y la importancia de HTTP como la piedra angular de [...]]]></description>
			<content:encoded><![CDATA[<p>Si bien se habla de nuevos propósitos, creo que no deja de ser el principio básico que la frenética mente de <a href="http://www.w3.org/People/Berners-Lee/" title="W3C: Tim Berners-Lee" hreflang="en">este hombre</a> ideó en su día. Si no simplemente, un cambio de perspectiva, de punto de vista; <strong>la forma en cómo vemos la web</strong> y la importancia de <strong><acronym title="del inglés HyperText Transfer Protocol (protocolo de transferencia de hipertexto )" xml:lang="en">HTTP</acronym> como la piedra angular de las relaciones</strong>. Tan sencillo y básico como potente.</p>
<h4>Todo son datos</h4>
<p>En especial me gusta el apunte que hace sobre de la poca importancia que se le da hoy en día a publicar un <a href="http://es.wikipedia.org/wiki/Página web" title="Wikipedia: Página web">documento web</a>&#8230;<br />
Son datos, y deberían contener hipervínculos, hipervínculos que enlazan más datos y, ya que estamos de moda con Avatar, conforman un todo superior de entidad propia: Una gran red de datos disponible para todo el mundo. Lo que nunca se han cansado de defender los gurús de la web: <em>enlaza, enlaza y enlaza</em>.</p>
<h4>Todo se puede relacionar</h4>
<p>Cualquier dato, por mínimo que sea, es susceptible de ser enlazado, de ser ampliado; por sí mismo puede significar quizá poco pero tiene un valor incalculable -y diría que infinito- en un conjunto lógico de datos relacionados. De ahí también en parte el valor que mucha gente no ve cuando aportas datos en las <a href="http://es.wikipedia.org/wiki/Red social" title="Wikipedia: Red social">redes sociales</a>; la tontería -lo digo por nimiedad- de simplemente <a href="http://es.wikipedia.org/wiki/Folcsonomía">etiquetar</a> a <a href="http://blog.primate.es/2009/10/22/flickr-permite-etiquetar-personas-en-nuestras-fotos/" title="Blog Primate - Flickr permite etiquetar personas en nuestras fotos">personas en fotos</a>, algo a lo que muchos nos negamos, es de un valor incalculable para <a href="http://www.facebook.com/" title="Facebook">la empresa que gestione</a> los datos por ejemplo.</p>
<p>Al final y como no, también se vuelve indefectiblemente a un punto importante: los estándares.<br />
Para que la relación entre datos sea viable y compatible. Separar contenido, datos, del diseño visual. Esto es datos en bruto con los que se pueda trabajar, manipular de forma libre.<br />
<ins datetime="2010-01-29T02:52:30+00:00" title="29/01/2010 02:52:30+00:00">Lo que ahora me causa algo de sensación es comprobar que se está empezando a consolidar el término web 3.0 y que uno de sus defensores es precisamente uno de estos gurúes: <a href="http://www.zeldman.com/" title="Web de Jeffrey Zeldman" hreflang="en">Jeffrey Zeldman</a>. Con el que por cierto comparto las mismas reservas sobre la web 2.0 como mencionaba al final de esta entrada.<br />
Aunque en mi opinión, la llamada web 3.0 es esto que hablamos, una vuelta a los orígenes, maquillada de tecnología punta para rivalizar con la «deslumbrante» y <em xml:lang="en">glossy</em> 2.0.</ins></p>
<h4>El vídeo</h4>
<p><object width="446" height="326"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talks/dynamic/TimBerners-Lee_2009-medium.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/TimBerners-Lee-2009.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=484&#038;introDuration=16500&#038;adDuration=4000&#038;postAdDuration=2000&#038;adKeys=talk=tim_berners_lee_on_the_next_web;year=2009;theme=what_s_next_in_tech;event=TED2009;&#038;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /></object></p>
<p>Lo cual vuelve a relanzar mis propósitos sobre algunos conceptos a la hora de publicar datos, por ejemplo, en un blog (<em>el contenido de mi primer blog casero se escribía en XML</em>). O distribuir APIs y canales de distribución -y, como no, relación- de contenido en proyectos para las administraciones.</p>
<h4>Conclusiones</h4>
<p>En este último caso siento la misma frustración que Berners-Lee cuando veo que la <acronym title="Agencia Española de Meteorología">AEMET</acronym> no publica <abbr title="Application Program Interface" xml:lang="en">API</abbr>, que el <acronym title="Instituto Nacional de Estadística">INE</acronym> tampoco, que la <acronym title="Dirección General de Tráfico">DGT</acronym> al menos ya sí lo hace en parte.<br />
Pero sobre todo, cuando los recursos que desarrollo y publico en el sitio para un ayuntamiento son los menos apreciados: redes sociales, sindicación de contenidos en infinidad de formatos, accesibilidad, semántica, APIs de datos en proyecto; y en su lugar se aprecian cuatro, con perdón, mierdas de efectos y pijadas, precisamente y a lo que vamos, WEB 2.0.</p>
<p>Como anécdota&#8230; no deja de impresionarme -y si no es en la gente es en mí- la influencia de Avatar, y no hablo precisamente del  películón en exclusiva -que por cierto no he hablado de él aún porque no encuentro palabras, literalmente-, sino del mundo que ha creado Cameron para la misma.<br />
No es que sea un concepto nuevo ni a nivel tecnológico: Internet, ni a nivel filosófico y biológico quizá: Gaia; pero se sitúa en las nuevas tecnologías y ayuda a relanzar la web en este nueva ola de postmodernismo audiovisual donde se empezaba a perder y menospreciar el sentido real de la web. Sí, el de la 1.0 en especial.</p>
<p>Por cosas como estas es por lo que nunca me he visto capaz de borrar las entradas antiguas del blog :D</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/tecnologia/internet/recuperando-el-sentido-de-la-web-tim-berners-lee/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Pacific: Comming in 2010</title>
		<link>http://blog.culturadigital.org/television-y-video/the-pacific-comming-in-2010</link>
		<comments>http://blog.culturadigital.org/television-y-video/the-pacific-comming-in-2010#comments</comments>
		<pubDate>Sun, 06 Dec 2009 22:34:54 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Historia]]></category>
		<category><![CDATA[Televisión y vídeo]]></category>
		<category><![CDATA[WWII]]></category>
		<category><![CDATA[Band of Brothers]]></category>
		<category><![CDATA[Canal Plus]]></category>
		<category><![CDATA[HBO]]></category>
		<category><![CDATA[series]]></category>
		<category><![CDATA[The Pacific]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=776</guid>
		<description><![CDATA[USA, marzo de 2010:



Por finnnn; por favor, que nos la pongan en abierto si acaso después del Plus; quizá TeleCinco siga teniendo contrato con HBO que, como a la mayoría de los que le interese esta noticia ya sabrán, ya pusieron «Hermanos de Sangre» («Band of Brothers») conociendo que habría otra miniserie para el Pacífico.
Lo [...]]]></description>
			<content:encoded><![CDATA[<p><strong>USA, marzo de 2010</strong>:</p>
<div class="center" width="80%">
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='320' height='305' id='mediumFlashEmbedded'><param name='movie' value='http://hbo.a.mms.mavenapps.net/mms/rt/1/site/hbo-hbocom1-pub01-live/current/pacific/multipleCategoryPlayer/client/embedded/embedded.swf'/><param name='allowScriptAccess' value='always'/><param name='scale' value='noscale'/><param name='salign' value='LT'/><param name='bgcolor' value='#000000'/><param name='wmode' value='window'/><param name='FlashVars' value='playerId=pacific&#038;referralObject=9944140'/><embed type='application/x-shockwave-flash' src='http://hbo.a.mms.mavenapps.net/mms/rt/1/site/hbo-hbocom1-pub01-live/current/pacific/multipleCategoryPlayer/client/embedded/embedded.swf' id='mediumFlashEmbedded' pluginspage='http://www.macromedia.com/go/getflashplayer' menu='false' quality='high' play='false' name='mediumFlash' height='305' width='320' allowScriptAccess='always' scale='noscale' salign='LT' bgcolor='#000000' wmode='window' flashvars='playerId=pacific&#038;referralObject=9944140'/></object>
</div>
<p>Por finnnn; por favor, que nos la pongan en abierto si acaso después del Plus; quizá TeleCinco siga teniendo contrato con HBO que, como a la mayoría de los que le interese esta noticia ya sabrán, ya pusieron «Hermanos de Sangre» («Band of Brothers») conociendo que habría otra miniserie para el Pacífico.</p>
<p>Lo genial, aunque lo dudo, sería poderla ver <del datetime="2009-12-06T22:46:48+00:00">en marzo que es cuando se estrena en USA imagino pero, como decía, yo me conformo con que nos la pongan</del> en abierto. ¿Quizá Cuatro, o Antena 3&#8230; que ya han tenido también series de la HBO?</p>
<h4>Actualización</h4>
<p>Anteriormente la euforia pudo conmigo y hablaba de verla en marzo&#8230; ¡qué locura en este país!, ¿quien va a poner una serie en V.O.?? Que bien podrían hacerlo para verlas en tiempo de emisión yankee, total, el Plus por ejemplo emite, o al menos antes lo hacía aunque a deshoras, en V.O.; es decir subtítulos hay que meterle tarde o temprano y más hoy en día con la TDT que imagino van dándose patadas en culo desde que aparecen las emisiones.<br />
O sea&#8230; si primero se subtitula, imagino que es el guión que luego queda para el audio localizado, ¿no?<br />
Me respondo a mí mismo: en fin, comercialmente es una tontería hacer eso; al menos hoy en día.</p>
<p>Así que nos quedan algunas herramientas para los aficionados a las series, y en concreto quizá, del V.O.<br />
A riesgo de que se pasen por aquí los nuevos inquisidores de la Economía Sostenible, la combinación sería:</p>
<ul>
<li>Mininova (original) + subtitulos.es o análoga. <em>La mejor y más rápida opción en mi opinión ya que incuso puedes hacerte tus propios arreglos para los subtítulos, si no incluso intentar traducirla tú mismo</em>.</li>
<li>O más simple: seriesyonkis y tal y cual. Creo que es muy obvio que van a tardar más.</li>
</ul>
<h4>Enlaces de interés</h4>
<ul>
<li><a href="http://www.hbo.com/events/pacific/">Enlace a la promoción de la HBO</a></li>
<li><a href="http://www.plus.es/articulo/Series/CANAL-ESTRENARA-MINISERIE-THE-PACIFIC/20090807pluutmsrs_1/Tes/">Noticia en Canal Plus</a></li>
<li><a href="http://es.wikipedia.org/wiki/The_Pacific">The Pacific en Wikipedia</a></li>
</ul>
<p>PD: Por cierto, la cabecera es muy al estilo, conceptualmente, de <a href="http://blog.culturadigital.org/television-y-video/mad-men-esperemos-que-dure">Mad Men</a>.<br />
Por otra parte&#8230; viendo la suerte que tengo en mis deseos y peticiones sobre series&#8230; ggg, me da que no la veremos en abierto hasta el otoño o invierno de 2010 y eso con suerte :D</p>
<p>PD2: Ummm&#8230; estaba pensando quien era el actor rubio de pelo rizado -tipo querubín británico- que sale en varias ocasiones y trailers y ya me he acordado de quien es: ^^! <em>Tim</em> o <em>Timmy</em> -<a href="http://www.imdb.com/name/nm0001515/" title="Ficha IMDb">Joshep Mazzello</a>-, de Parque Jurásico, jiji :D</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/television-y-video/the-pacific-comming-in-2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Foto Trivial: ¿Hellcat, P36..? y ¿B-25 Mitchell, B-17..?</title>
		<link>http://blog.culturadigital.org/historia/wwii/foto-trivial-%c2%bfhellcat-p36-y-%c2%bfb-25-mitchell-b-17</link>
		<comments>http://blog.culturadigital.org/historia/wwii/foto-trivial-%c2%bfhellcat-p36-y-%c2%bfb-25-mitchell-b-17#comments</comments>
		<pubDate>Tue, 24 Nov 2009 20:02:49 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Historia]]></category>
		<category><![CDATA[WWII]]></category>
		<category><![CDATA[aviación]]></category>
		<category><![CDATA[B-17]]></category>
		<category><![CDATA[B-25 Mitchell]]></category>
		<category><![CDATA[Corsair]]></category>
		<category><![CDATA[Golden Gate]]></category>
		<category><![CDATA[Trivial]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=770</guid>
		<description><![CDATA[Esto es como el «culo o codo» del Hormiguero para los frikis de la aviación y en concreto la aviación de la WWII en el Pacífico; &#8230;porque eso sí creo que me queda más o menos claro a excepción del bombardero: que son aparatos embarcados o al menos de la US NAVY.
La foto

Bien, el fondo [...]]]></description>
			<content:encoded><![CDATA[<p>Esto es como el «culo o codo» del <em>Hormiguero</em> para los frikis de la aviación y en concreto la aviación de la WWII en el Pacífico; &#8230;porque eso sí creo que me queda más o menos claro a excepción del bombardero: que son aparatos embarcados o al menos de la US NAVY.</p>
<h4>La foto</h4>
<p><a href="http://smg.photobucket.com/albums/v429/covi/?action=view&#038;current=PassingTheGoldenGate-1.jpg"><img src="http://img.photobucket.com/albums/v429/covi/PassingTheGoldenGate-1.jpg" alt="Golden Gate,Corsair,B25 Mitchell,B17,P47" width="600px"></a></p>
<p>Bien, el fondo es el <em>Golden Gate</em> ^^</p>
<p>El aparato del fondo es un <em>Corsair</em> de Grumman (F4U Corsair).</p>
<h4>¿Cual es el siguiente más próximo?</h4>
<p>:shock:<br />
En un principio, por contexto y de un vistazo rápido, había pensado que era un <strong>Hellcat</strong> ya que el ángulo del morro no es tan pronunciado como el del <strong>Wildcat</strong>. Pero más de cerca y mirando la protección -esto pasa a la siguiente cuestión-, por cierto increíblemente reluciente, del eje de la hélice no me parecía que fuera ninguno de los dos y sí más un Corsair. Pero no puede ser este último por la forma del ala.</p>
<p>De seguido y por la tobera en la nariz del morro, pensé que quizá fuera algún caza de la aviación de tierra, en concreto de los Marines (USMC), por ejemplo el famoso <strong>P40</strong>; pero el morro es más bien ovalado y no circular completamente, además de un motor radial abierto. Lo que me llevaba de nuevo a un caza embarcado de la Marina.</p>
<p>Por la misma razón anterior, la forma del morro y el rotor despejan la duda sobre si es <strong>alguno de Hawker</strong>, por ejemplo el <strong>Tempest o el Typhoon</strong>, a parte de que es extraño que entre 3 aviones americanos incluyeran uno británico. Así que en todo caso sería un <strong>P-47</strong> pero tampoco coincide ni esa tobera ni la forma del rotor.</p>
<p>Además, y de aquí las suposiciones iniciales acerca de un Grumman, los anteriores son de ala elíptica o al menos no son alas más o menos rectas. Y en la foto, ese caza tiene un borde exterior del ala con toda la pinta de un Hellcat, un ala recta o como mucho trapezoidal.</p>
<p>Con esto se barajan las opciones más conocidas y famosas de la aviación de la marina yankee en el periodo de la Guerra del Pacífico en concreto, que creo es en donde se concentra el contexto de la foto.</p>
<p>Así que solo me queda la opción de que pudiera ser un <strong>Curtiss P36</strong>; aunque la tobera sigue despistando mucho y es posible que se colocara para mejorar el rendimiento -refrigeración ¿y turbo?- al ser un aparato viejo, y no sea de ningún diseño original.</p>
<h4>B-25 Mitchell o B-17</h4>
<p>Como decía, al fijarme en la protección del eje del segundo aparato vi el reflejo desde donde se toma la foto. Yo imagino que se hizo exprofeso aunque creo que el resultado fue algo peor del esperado.<br />
No obstante, se puede ver bastante bien el aparato que acompaña a los otros dos y desde parece ser que se toma la foto.</p>
<p>Es un bombardero medio de la USAAF y es más factible que un fotógrafo trabaje desde allí que desde cualquier otro aparato más pequeño. Al principio y rápido creí que era un <strong>B-17</strong> del modelo de fuselaje en aluminio, el plateado al estilo de los nuevos -relativamente, claro- B-52.<br />
Pero la forma del morro, o sea, donde la posición del operador de bombardeo o de la mira del bombardeo y los artilleros de proa es algo diferente, más cerrada y más parecida al <strong>B-25 Mitchell</strong>. La forma del morro en general también está más estilizada y menos tosca -¿aerodinámica?- al estilo del B-25.</p>
<p>Estas cuestiones también lo distinguen de los modelos comunes de<strong> Liberator</strong> (B-24) con un morro de cabina abierta para los artilleros de proa. Así que casi aseguro que es un B-25 Mitchell.</p>
<h4>Sugerencias</h4>
<p>&#8230;pues eso, amantes de la aviación: estáis invitados a participar ;)</p>
<h4>Actualizaciones y soluciones</h4>
<p>Sobre el primero, acabo de encontrar que también podría ser algún Douglas, en concreto el A-33&#8230;<br />
También podría ser un bombardero ligero como el Avenger, mirando&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/historia/wwii/foto-trivial-%c2%bfhellcat-p36-y-%c2%bfb-25-mitchell-b-17/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SVG: Un ejemplo más de su potencial</title>
		<link>http://blog.culturadigital.org/tecnologia/desarrollo-web/svg-un-ejemplo-mas-de-su-potencial</link>
		<comments>http://blog.culturadigital.org/tecnologia/desarrollo-web/svg-un-ejemplo-mas-de-su-potencial#comments</comments>
		<pubDate>Tue, 17 Nov 2009 16:35:23 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Diseño web]]></category>
		<category><![CDATA[animación]]></category>
		<category><![CDATA[estándares-web]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=758</guid>
		<description><![CDATA[Como siempre, una breve introducción:
Como a no poca gente creo, me encantan los créditos finales de The Bourne Identity (El caso Bourne) y la saga en general -creo que es obvio que Extreme Ways tiene mucho que ver :D -.
Hace poco vi algunos vídeos en Youtube para recrear los efectos de los créditos desde diferentes [...]]]></description>
			<content:encoded><![CDATA[<p>Como siempre, una breve introducción:</p>
<p>Como a no poca gente creo, me encantan los créditos finales de <strong>The Bourne Identity</strong> (<em>El caso Bourne</em>) y la saga en general -creo que es obvio que <em title="Extreme Ways del álbum 18 de Moby">Extreme Ways</em> tiene mucho que ver :D -.<br />
Hace poco vi algunos vídeos en Youtube para <strong>recrear los efectos de los créditos</strong> desde diferentes aplicaciones pero sobre todo con <em>After Effects</em>, que por cierto es genial, y en ese mismo instante pensé: vamos a demostrar que no necesitamos Flash para hacer lo mismo de forma estándar, es decir: <strong>con SVG</strong>.</p>
<h4>Ejemplo de créditos finales Bourne con SVG</h4>
<p>Anoche realicé mi primera aproximación en apenas una hora y los resultados prometían mucho. Debo aclarar que solo es eso: una aproximación, además de que no estoy muy puesto aún en la animación declarativa -nativa- de SVG ya que solo está soportada por Opera, Safari creo, y poco más. Normalmente yo utilizo scripting pero con el tiempo y el aumento de soporte todo pasará a ser declarativa, en su mayor parte al menos.</p>
<p>Lo que quiero decir es que estos han sido mis primeros pasos en animación declarativa SVG, no está optimizado ni acabado, solo pretende mostrar el potencial de SVG.</p>
<h4>Resultado</h4>
<p class="alert"><strong>Muy importante</strong>: Como decía, la animación declarativa solo está soportada -que yo sepa hasta ahora- en Opera y Safari, no sé si webkit en general como por ejemplo Chrome. Por lo tanto necesitas un navegador compatible para ver la animación de este SVG, aunque no de su contenido para ver como funciona.</p>
<p>Nota: :D Es muy recomendable escuchar de fondo, sobre todo el comienzo, el tema «<strong>Extreme Ways</strong>» de los créditos; es del álbum, estupendo por cierto, «18», de «Moby», y aunque no lo he mirado creo recordar que se puede hacer también con animación SVG.<br />
<object data="http://blog.culturadigital.org/media/2009/11/bourne2.svg" type="image/svg+xml"><img src="http://blog.culturadigital.org/media/2009/11/bourne2.svg" alt="The Bourne Identity end credits" title="The Bourne Identity end credits" class="aligncenter size-full wp-image-759" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/tecnologia/desarrollo-web/svg-un-ejemplo-mas-de-su-potencial/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SVG: A vueltas con los Estándares</title>
		<link>http://blog.culturadigital.org/tecnologia/desarrollo-web/svg-a-vueltas-con-los-estandares</link>
		<comments>http://blog.culturadigital.org/tecnologia/desarrollo-web/svg-a-vueltas-con-los-estandares#comments</comments>
		<pubDate>Fri, 23 Oct 2009 20:10:36 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[estándares-web]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=717</guid>
		<description><![CDATA[La potencia de SVG -estándar de gráficos escalables vectoriales-, por ejemplo, para generar mapas con datos dinámicos:

Battleground Europe Tools &#8211; Pantallazo del MapViewer en la versión 39beta.

Me he encontrado de repente sorprendido porque aún no había escrito nada sobre SVG&#8230; con lo inmerso que estoy en ello ahora mismo en relación a las Battleground Europe [...]]]></description>
			<content:encoded><![CDATA[<p>La potencia de SVG -estándar de gráficos escalables vectoriales-, por ejemplo, para generar mapas con datos dinámicos:</p>
<div class="headerImg"><object data="http://www.1spanishcompany.co.uk/ftp-fotos/Covi/1SCTools/screenshots/BeTools.MapViewer.v0.39.jpg" type="image/jpeg" height="200px" width="100%"><param name="background-color" value="#222" /><param name="background-position" value="47% 15%" /><param name="background-border" value="1px solid #222"/><param name="border-radius" value="0.25em"/></object>
<p class="opacity7">Battleground Europe Tools &#8211; <a href="http://1spanishcompany.co.uk/ftp-fotos/Covi/1SCTools/screenshots/Pantallazo-Map%20Viewer.v38.jpg" title="Ver imagen">Pantallazo</a> del MapViewer en la versión 39beta.</p>
</div>
<p>Me he encontrado de repente sorprendido porque aún no había escrito nada sobre SVG&#8230; con lo inmerso que estoy en ello ahora mismo en relación a las <a href="http://betools.culturadigital.org" title="Sitio de las BeTools">Battleground Europe Tools</a>; una aplicación de monitorización para jugadores de <a href="http://battlegroundeurope.com">Battleground Europe</a> y que está centrada en la creación de un mapa lo más parecido al del juego, para poder seguir el desarrollo de la campaña online y sin necesidad de entrar en él. &#8230;de hecho, tengo una sección en el blog sobre el proyecto: <a href="http://blog.culturadigital.org/search/1sctools" title="buscar contenido relacionado">BE/1SCTools</a>.</p>
<p>Para no enrollarme mucho más, solo voy a dejar unas capturas del potencial de SVG como estándar para gráficos vectoriales y escalables en la web; es decir, en lugar de formatos o tecnologías propietarias como por ejemplo gif, flash&#8230; y/o no nativos como este último. Además sin necesidad de plugins, como el de Adobe por ejemplo, y sin <a href="http://blog.culturadigital.org/tecnologia/desarrollo-web/svg-un-ejemplo-mas-de-su-potencial">animaciones declarativas</a> ya que aún están muy poco soportadas, sustituyendo las mismas con Javascript, en este caso Ecmascript.</p>
<h4>Capturas Battleground Europe Tools</h4>
<p>v.39beta:<br />
<img src="http://www.1spanishcompany.co.uk/ftp-fotos/Covi/1SCTools/screenshots/BeTools.MapViewer.v0.39.jpg" alt="Map Viewer - v.39b" /></p>
<p><img src="http://1spanishcompany.co.uk/ftp-fotos/Covi/1SCTools/screenshots/Pantallazo-Map%20Viewer.v38.jpg" alt="Map Viewer - v.38" /></p>
<p><img src="http://1spanishcompany.co.uk/ftp-fotos/Covi/1SCTools/screenshots/Pantallazo-Map%20Viewer.2.v38.jpg" alt="Map Viewer (2) - v.38" /></p>
<p><img src="http://1spanishcompany.co.uk/ftp-fotos/Covi/1SCTools/screenshots/homeMapZoom.jpg" alt="Home - v.38" /></p>
<h4>Scripting: Javascript, Ecmascript, DOM&#8230;</h4>
<p>En el sentido del <em>scripting</em>, he aprendido mucho gracias, paradójicamente, a las pocas, por no decir ninguna, librerías Javascript que trabajan con el DOM de XML&#8230; o al menos de SVG en concreto. Y me refiero muy en parte a jQuery que desde luego hace lo que indica en su eslogan pero lo cierto es que se queda corta en el sentido global de extender y mejorar Javascript -como ya hace comentaba Anieto2K-. Es decir, por ejemplo mootools se abstrae más del tipo de documento o del DOM en este caso para montar un framework genérico que extienda y mejore de verdad Javascript&#8230; lo que ellos denominan «como debería ser Javascript».</p>
<p>He de decir que en este caso me ha sorprendido mucho mucho Prototype, el primer framework Javascript que usé en los albores de AJAX en la web 2.0, e imagino que es debido a su sólida génesis. De ahí que ni haya crecido como otras librerías&#8230; ni se haya desvirtuado que es lo bueno.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/tecnologia/desarrollo-web/svg-a-vueltas-con-los-estandares/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XHTML: Object en lugar de img</title>
		<link>http://blog.culturadigital.org/tecnologia/desarrollo-web/xhtml-object-en-lugar-de-img</link>
		<comments>http://blog.culturadigital.org/tecnologia/desarrollo-web/xhtml-object-en-lugar-de-img#comments</comments>
		<pubDate>Thu, 08 Oct 2009 16:43:24 +0000</pubDate>
		<dc:creator>J.A.Cobo</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Diseño web]]></category>
		<category><![CDATA[estándares-web]]></category>
		<category><![CDATA[img]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://blog.culturadigital.org/?p=648</guid>
		<description><![CDATA[En una entrada anterior comentaba las bondades de jQuery para hacer compatible el uso, por ejemplo, de un objeto en XML (XHTML) con navegadores que no lo soportaran, para aprovechar su potencial y crear imágenes bonitas de cabecera sin marcado no válido.
Quedó algo confuso desde el punto de vista de usar objetos; ahora pretendo concretar [...]]]></description>
			<content:encoded><![CDATA[<p>En una entrada anterior comentaba las bondades de jQuery para hacer compatible el uso, por ejemplo, de un objeto en XML (XHTML) con navegadores que no lo soportaran, para aprovechar su potencial y crear imágenes bonitas de cabecera sin marcado no válido.<br />
Quedó algo confuso desde el punto de vista de usar objetos; ahora pretendo concretar e ilustrar la idea del <strong>potencial de <tt>&lt;object&gt;</tt> (estándar del W3C) frente <tt>&lt;img&gt;</tt></strong>.</p>
<h4>Lo fundamental: diseñar en base a estándares</h4>
<p>La cuestión fundamental es: &lt;object&gt; nos da muchísimas más posibilidades y es más flexible que &lt;img&gt;; además es estándar, compatible con los navegadores actuales y con soporte para mucho mucho tiempo en el futuro.</p>
<p>La funcionalidad es la misma prácticamente que con la etiqueta propietaria de Netscape (img) usado de forma básica, pero ésta es extensible de mil y una maneras ya que se pueden usar parámetros que se abstraen del marcado estructural, y además es mucho más flexible y potente para contenido alternativo en navegadores que no lo soporten.</p>
<p>Es más estándar y coherente, por lo tanto más semántica, por ejemplo se puede establecer el mime type del objeto, etc. O sea, proporciona más información al navegador que, en teoría, debería redundar en un mayor rendimiento y menos coste de proceso.<br />
<strong>Es decir, todo son beneficios</strong>.</p>
<h5>¿Por qué resistirse?</h5>
<p>Existe un ámbito de ciertas opiniones clásicas que se escudan en la usabilidad y que saltan a la palestra siempre que se habla de Estándares web, de marcado basura, obsoleto, Flash, soporte Internet Explorer y profesionalidad; en especial cuando al parecer se ejerce intrusismo laboral y se presupone falta de experiencia.<br />
En referencia a esta última cuestión: No entiendo porqué les parece un sacrilegio olvidar de una vez a Internet Explorer 6 e inferiores, y por añadidura prácticamente el HTML clásico y obsoleto. En mi opinión diría que ya está bien y basta de dar soporte a un software con más de diez años y 5 sin actualizarse por no decir 7. Eso, es una aberración obvia en el desarrollo -y soporte- de software y no hubiera pasado nunca si su propietario no fuera Microsoft.</p>
<h6>Profesionalidad o pereza</h6>
<p>No, no es dar al cliente algo que funcione seguro, se trata de ser profesional; y ser profesional significa trabajar bien y superar las dificultades -entiendo yo, claro-, no hacer chapuzas de las que tenemos muchos ejemplos, ejemplos profesionales: web del Congreso, de Telefónica (ver ejemplo de la copia para promoción IPhone: Apple con Javascript válido y Telefónica con Flash xD) y algunas de Microsoft&#8230;</p>
<p>Quiero decir, SÍ es posible diseñar en base a los estándares y que tu diseño funcione, por ejemplo, en Internet Explorer -no me refiero al 6 en exclusiva- sin tener que escribir marcado basura, propietario u obsoleto. Otra cosa es pasar del tema, cobrar un pastón pero seguir siendo un chapucero, aun teniendo quinientos mil títulos académicos.</p>
<p>&#8230;y tampoco me creo que porque se use un sistema de gestión mastodóntico -administración pública- sea imposible proporcionar salidas de documentos válidas. Y si es el caso, si han migrado y actualizado la administración, deberían haber migrado también ese sistema&#8230; por que no será por falta de dinero para hacerlo.</p>
<h4>Ejemplos</h4>
<p>Como mencionaba, en el ejemplo de una imagen de cabecera bonita la <em>tendencia natural</em> es usar una división, aplicar estilos incrustados e insertar una imagen de fondo. La solución directa también podría ser diseñar dos versiones o más de una imagen, como ocurre en Wordpress cuando subes medios o casi en cualquier CMS.<br />
Bien&#8230; :D rentable no es que sea mucho la verdad, eso sin contar con que por ejemplo quieras posicionar esa imagen de mil formas distintas: ¿una versión para cada caso o estilo que quieras aplicar?<br />
¿Porqué tener 20 versiones de la misma imagen para solo aplicar estilos?</p>
<p>La solución, en mi opinión obvia, es usarla como fondo y aplicar CSS. El problema a superar como decía es usar marcado válido, estructural y semántico. Ese es el problema que hay superar y ser profesional.</p>
<h5>Ejemplo no profesional o falto de recursos</h5>
<h6>Lo más terrorífico: tengo mil versiones para una imagen</h6>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> </span>
<span style="color: #009900;">		<span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;mi versión de imagen, de entre unas 4/5 para aplicar un estilo caprichoso&quot;</span> </span>
<span style="color: #009900;">		<span style="color: #000066;">alt</span>=<span style="color: #ff0000;">&quot;Mi contenido alternativo se reduce a esta patatilla.&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;br</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		Cristina Scabbia de Lacuna Coil.
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Si bueno&#8230; puedes incrustar estilos, javascript&#8230; o incluso podría no ser ni javascript intrusivo y CSS externo pero es muy muy fácil caer en la clasitis por ejemplo; sin contar con que img se cae en XHTML 2.0, y se caerá de todo en un futuro muy cercano, y sus limitaciones obvias.</p>
<h6>Estilos incrustados</h6>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;headerImg&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;height:200px; background:#333 url(http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg) </span>
<span style="color: #009900;">	no-repeat 0 30%;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Cristina Scabbia de Lacuna Coil.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Algo es algo, al menos eliminamos la etiqueta imagen, las posibles versiones de una imagen y pasamos a usar una sola. Igualmente se nos va al garete sin CSS.</p>
<h5>Como tengo recursos, puedo ser estándar</h5>
<p>Esto es y debería ser la base. Que un maquetador se dedique a hacer las cosas correctamente, como mandan los cánones -en este caso los estándares web-; tener una versión portable y mantenible venga quien venga después; jueguen como quieran jugar después con los objetos y les den la salida que prefieran. Como hemos dicho mil veces: abstracción de la estructura, en este caso frente al diseño visual:</p>
<h6>Object</h6>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;headerImg&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;object</span> <span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg&quot;</span> </span>
<span style="color: #009900;">		<span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;image/jpeg&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;200px&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;background-position&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;0% 30%&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/object<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Cristina Scabbia de Lacuna Coil.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Cojonudo:<br />
Por lo pronto, funciona, aunque no del todo bien, sin CSS, o sea de forma básica. Podemos jugar con los parámetros del objeto desde cualquier lenguaje de servidor que parsee el HTML, con Javascript&#8230; el caso es que se abstrae del estilo visual.<br />
Es coherente y semántico ya que proporciona información a los renderizadores: navegadores, etc.</p>
<p>Por ejemplo les dice que es una imagen/jpeg y se supone que en un futuro si no ya, da la posibilidad a los desarrolladores de navegadores web optimizar su funcionamiento y hacerlos más rápidos, sino ya desarrollar plugins específicos para imágenes, en concreto si tienen transparencias o no (png, gif vs jpeg, bmp&#8230;)&#8230; bff, y muchas cosas más imagino.<br />
Es decir, todo lo que sea dar información concreta sobre los elementos del documento es beneficio y renderización optimizada del navegador, algo que creo que se pierde, y se perdía, con HTML que normalmente es muy poco semántico, hasta ahora al menos.</p>
<h4>Casos probados</h4>
<h5>Todo funcional, con Javascript y CSS al vuelo</h5>
<p>Usando Javascript para gestionar el objeto:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;headerImg&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;object</span> <span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg&quot;</span> </span>
<span style="color: #009900;">		<span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;image/jpeg&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;200px&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;background-position&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;0% 30%&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/object<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Cristina Scabbia de Lacuna Coil.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<div class="headerImg"><object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" type="image/jpeg" height="200px" width="100%"><param name="background-position" value="0% 30%" /></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
<p>Vamos a jugar un poco con la imagen, no necesito más versiones de la misma, no necesito CSS incrustado, solo los parámetros del objeto que para eso están:<br />
<em>En este caso se gestiona con Javascript (jQuery) generando, eso sí, CSS al vuelo, pero como digo&#8230; es un proceso externo al marcado que es de lo que se trata.</em></p>
<p><tt>param name="background-position" value="50% 30%"</tt>:</p>
<div class="headerImg"><object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" type="image/jpeg" height="200px" width="100%"><param name="background-position" value="50% 30%" /></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
<p><tt>param name="background-position" value="70% 70%"</tt>:</p>
<div class="headerImg"><object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" type="image/jpeg" height="200px" width="100%"><param name="background-position" value="70% 70%" /></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
<p><tt>param name="background-color" value="red"</tt>:</p>
<div class="headerImg"><object data="http://nop" type="image/jpeg" height="200px" width="100%"><param name="background-position" value="70% 70%" /><param name="background-color" value="red" /></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
<p><tt>param name="background-border" value="5px solid blue"</tt>:</p>
<div class="headerImg"><object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" type="image/jpeg" height="200px" width="100%"><param name="background-position" value="70% 70%" /><param name="background-border" value="5px solid blue" /></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
<p><tt>param name="background-position" value="50% 0"</tt><br />
<tt>param name="background-border" value="1px solid blue"</tt><br />
<tt>param name="border-radius" value="3em 3em 0 0"</tt>:</p>
<div class="headerImg"><object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" type="image/jpeg" height="200px" width="100%"><param name="background-position" value="50% 0" /><param name="background-border" value="1px solid blue" /><param name="border-radius" value="3em 3em 0 0" /></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
<p>¿Más pequeña?<br />
<tt>&lt;object [...]height="100px" width="50%"[...]</tt><br />
<tt>param name="background-position" value="50% 0"</tt><br />
<tt>param name="background-border" value="1px solid blue"</tt><br />
<tt>param name="border-radius" value="3em 3em 0 0"</tt>:</p>
<div class="headerImg"><object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" type="image/jpeg" height="100px" width="50%"><param name="background-position" value="50% 0" /><param name="background-border" value="1px solid blue" /><param name="border-radius" value="3em 3em 0 0" /></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
<h6>Conclusión</h6>
<p>Con imagen (<tt>&lt;img&gt;</tt>) es inevitable o caer en clasitis o establecer atributos no estándares (<em>hacks</em>). Además se hace trabajar al navegador con cuestiones raras que no tiene porqué entender; es decir: debe intentar buscar atributos, por ejemplo rel -<em class="x-small">que se usa mucho y mal para hacks ya que su función no es ni por asomo esa salvo contadas excepciones</em>- que no concuerdan con nada de lo que conoce. Cuando si usamos un objeto, sabe perfectamente de qué se trata, lo renderiza y punto porque él no se encarga de gestionar sus parámetros; al menos y que yo sepa en este caso (mime type: imagen/jpeg), no sé exactamente como se comportan con otros objetos pero en cualquier caso les ayudamos a comportarse mejor porque concretamos un medio.</p>
<p>Alguien puede pensar que simplemente es una pasarela para atributos CSS, pero no obstante es igual de válido que con imagen (van a comportarse de la misma manera aplicando clases y reglas CSS) y te ofrece además estas posibilidades: gestionarlo con cualquier lenguaje sin marcado no válido, inventado o extra. Además, tu marcado será válido también para XML, lo que lo convierte en portable, estándar y por lo tanto mantenible, y compatible con el pasado y futuro.</p>
<p><strong>En resumen</strong>: Es por lo que precisamente, actualmente el W3C mantiene <tt>&lt;object&gt;</tt> en el estándar para elementos multimedia frente a la simpleza y pobreza de <tt>&lt;img&gt;</tt> de Netscape. Y obviamente porque es un elemento multimedia, claro.</p>
<h6>¿No es demasiado complicado?</h6>
<p>No nos equivoquemos, object puede ser tan simple como img:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;25%&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">alt</span>=<span style="color: #ff0000;">&quot;Cristina Scabbia, Lacuna Coil&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;object</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;25%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	Cristina Scabbia, Lacuna Coil
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/object<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><img src="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" width="25%" alt="Cristina Scabbia, Lacuna Coil" /><br />
<object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" width="25%">Cristina Scabbia, Lacuna Coil</object><br />
Pero es aún mejor, <em>potencial del contenido alternativo</em> y parámetros propios:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;object</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;image/jpeg&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;no existo&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;25%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;italic&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Tu navegador no puede mostrar esta imagen de <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://es.wikipedia.org/wiki/Cristina Scabbia&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Cristina Scabbia en Wikipedia&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Cristina Scabbia, Lacuna Coil<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
	cantando con su característico gesto apasionado, bajo la tenue iluminación azul del escenario.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/object<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><object type="image/jpeg" data="no existo" width="25%">
<p class="italic">Tu navegador no puede mostrar esta imagen de <a href="http://es.wikipedia.org/wiki/Cristina Scabbia" title="Cristina Scabbia en Wikipedia">Cristina Scabbia, Lacuna Coil</a>cantando con su característico gesto apasionado, bajo la tenue iluminación azul del escenario.</p>
<p></object><br />
Tampoco quiero confundir a nadie, el cierre de la etiqueta de imagen solo significa que esa etiqueta no tiene contenido, pero se puede especificar con contenido:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;no existo&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;25%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;italic&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Tu navegador no puede mostrar esta imagen de <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> </span>
<span style="color: #009900;">		<span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://es.wikipedia.org/wiki/Cristina Scabbia&quot;</span> </span>
<span style="color: #009900;">		<span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Cristina Scabbia en Wikipedia&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Cristina Scabbia, Lacuna Coil<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		cantando con su característico gesto apasionado, bajo la tenue iluminación azul del escenario.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>No obstante sigue siendo muy pobre en comparación con object, no es estándar y por lo tanto si se renderiza bien solo es fruto de una funcionalidad específica del navegador en uso, por lo tanto es jugar con fuego. De hecho, una etiqueta de cierre de img está prohibida.<br />
Más referencias: <a href="http://html.conclase.net/w3c/html401-es/struct/objects.html#h-13.1">W3C &#8211; HTML4</a></p>
<h5>Salvando las dificultades</h5>
<h6>Sin Javascript y con reglas CSS</h6>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;object</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;image/jpeg&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;headerImg&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/object<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Cristina Scabbia de Lacuna Coil.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Yo prefiero con XML cerrar una etiqueta vacía: <del datetime="2009-10-08T13:41:00+00:00"><tt>class="testImgHead"&gt;&lt;/object&gt;</tt></del> <tt>class="testImgHead"/&gt;</tt></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;">[...].static.flickr.com/41/115559256_918ab03490_o_d.jpg&quot;/&gt;</pre></div></div>

<p><object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" type="image/jpeg" class="headerImg" height="200px" width="100%"></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
<p>Para solucionar la expansión máxima de la imagen, bastaría con añadir una clase CSS que la redujera en el caso de estar desactivado Javascript. Ej:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #6666ff;">.adjustHeaderImageNoJs</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span> !important<span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Puede bastar con !important (cuidado IE6) pero dependería del CSS 
y siempre se puede aplicar más especificidad con herencia */</span>
html body <span style="color: #6666ff;">.post</span> <span style="color: #6666ff;">.entry</span> <span style="color: #6666ff;">.etc</span>... div<span style="color: #6666ff;">.headerImage</span><span style="color: #6666ff;">.adjustHeaderImageNoJs</span> object <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>¿Cómo?</strong> «<em>Captain Obvious to the rescue</em>» que dirían los <em>yankis</em> ^.^ , muy fácil -relativamente, claro-, eliminando dicha clase mediante Javascript 8) &#8230; o/y viceversa.<br />
Por ejemplo y a bote pronto -ojo-:</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
</pre></td><td class="code"><pre class="javascript" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;"><span style="color: #006600; font-style: italic;">// Entendiendo que tenemos esta y el resto de funciones básicas</span>
<span style="color: #006600; font-style: italic;">// ...porque es un coñazo, ponerme a escribir ahora aquí el bucle para encontrar la clase.</span>
<span style="color: #003366; font-weight: bold;">var</span> newClasses	<span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Esto será string, no array.</span>
<span style="color: #003366; font-weight: bold;">var</span> objectClasses	<span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> myObjects		<span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'headerImg'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// DOM 2 en todo caso</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">;</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;=</span> myObjects.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> myObject		<span style="color: #339933;">=</span> myObjects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> objectAttrClass	<span style="color: #339933;">=</span> myObject.<span style="color: #660066;">getAttributeNS</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'class'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> objectClasses	<span style="color: #339933;">=</span> objectAttrClass.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">' '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// Eliminar todas las clases:</span>
	myObject.<span style="color: #660066;">removeAttributeNS</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'class'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// Volver a añadirlas excepto la que no queremos:</span>
	<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">;</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;=</span> objectClasses.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</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: #3366CC;">'adjustHeaderImageNoJs'</span> <span style="color: #339933;">!=</span> objectClasses<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// La clase que ajusta el objeto sin Js</span>
			newClasses <span style="color: #339933;">+=</span> objectClasses<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' '</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #006600; font-style: italic;">// Volver a añadir el atributo de clase</span>
	myObject.<span style="color: #660066;">setAttributeNS</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'class'</span><span style="color: #339933;">,</span> newClasses<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">// Resto de instrucciones de proceso del objeto.</span></pre></td></tr></table></div>

<p>..mmm, como siempre, con jQuery sería tan sencillo como esto:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:Consolas, Monaco, 'Lucida Sans Typewriter', 'Lucida Console', 'Andale Mono', monospace;">jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.headerImg'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'adjustHeaderImageNoJs'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h6>Sin Javascript ni CSS</h6>
<div><object data="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" type="image/jpeg" class="headerImg" width="200px" height="200px"></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
<p>Tendríamos un problema ya algo serio ya que la imagen se expandiría sin remedio, esta vez sí, sin alternativa a usar una etiqueta de imagen&#8230; que no obstante, tendría el mismo problema:</p>
<div><img src="http://farm1.static.flickr.com/41/115559256_918ab03490_o_d.jpg" class="headerImg" width="200px" height="200px"></object>
<p>Cristina Scabbia de Lacuna Coil.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.culturadigital.org/tecnologia/desarrollo-web/xhtml-object-en-lugar-de-img/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
