jQuery dayTimr

Toma y utiliza la hora del día actual del usuario para hacer cualquier cosa a la página actual usando un simple callback. Sólo eso. ¡Funciona hasta en IE!

Get and uses the user’s current time of the day to do anything to the current page using a simple callback. Just that. Even works in IE!

Selecciona tu idioma / Select your language:

EN

Use:

$(function(){
   $('body').dayTimr();  <span class="comment">// use any HTML element</span>
});

Settings:

$('body').dayTimr({
	'nightClass' : 'night',         <span class="comment">// name of the class used if it is night time</span>
	'nightStart' : '21:00',         <span class="comment">// time when night starts, must be HH:MM (if it is >= 9 don't use the 0)</span>
	'dawnClass' : 'dawn',           <span class="comment">// name of the class used if it is dawn time</span>
	'dawnStart' : '0:00',           <span class="comment">// time when dawn starts, must be HH:MM (if it is >= 9 don't use the 0)</span>
	'morningClass' : 'morning',     <span class="comment">// name of the class used if it is morning time</span>
	'morningStart' : '7:00',        <span class="comment">// time when morning starts, must be HH:MM (if it is >= 9 don't use the 0)</span>
	'afternoonClass': 'afternoon',  <span class="comment">// name of the class used if it is afternoon time</span>
	'afternoonStart': '12:00',      <span class="comment">// time when afternoon starts, must be HH:MM (if it is >= 9 don't use the 0)</span>
	'debug' : false,                <span class="comment">// if true show what's going on in the browser's console</span>
	onNight : function(){},         <span class="comment">// callback if it is night; default it adds the nightClass to the body</span>
	onDawn : function(){},          <span class="comment">// callback if it is dawn; default it adds the dawnClass to the body</span>
	onMorning : function(){},       <span class="comment">// callback if it is morning; default it adds the morningClass to the body</span>
	onAfternoon : function(){}      <span class="comment">// callback if it is afternoon; default it adds the afternoonClass to the body</span>
});
Changelog:
  • 1.0: now you can choose your behavior through the callback.
  • 0.4.1: BUG: onMorning.call fixed.
  • 0.4: First public release.

ES

Toma y utiliza la hora del día actual del usuario para hacer cualquier cosa a la página actual a través de un callaback. Sólo eso.

Uso:

$(function(){
   $('body').dayTimr();  <span class="comment">// puedes utilizar cualquier elemento HTML</span>
});

Configuración:

$('body').dayTimr({
	'nightClass' : 'night',         <span class="comment">// nombre de la clase si es de noche</span>
	'nightStart' : '21:00',         <span class="comment">// hora cuando comienza la noche, debe ser en el formato HH:MM (si es >= 9 no antepongas el 0)</span>
	'dawnClass' : 'dawn',           <span class="comment">// nombre de la clase si es de madrugada</span>
	'dawnStart' : '0:00',           <span class="comment">// hora cuando comienza la madrugada, debe ser en el formato HH:MM (si es >= 9 no antepongas el 0)</span>
	'morningClass' : 'morning',     <span class="comment">// nombre de la clase si es de mañana</span>
	'morningStart' : '7:00',        <span class="comment">// hora cuando comienza la mañana, debe ser en el formato HH:MM (si es >= 9 no antepongas el 0)</span>
	'afternoonClass': 'afternoon',  <span class="comment">// nombre de la clase si es de tarde</span>
	'afternoonStart': '12:00',      <span class="comment">// hora cuando comienza la tarde, debe ser en el formato HH:MM (si es >= 9 no antepongas el 0)</span>
	'debug' : false,                <span class="comment">// si es true muestra lo que hace el plugin por la consola</span>
	onNight : function(){},         <span class="comment">// callback si es de noche; por defecto inyecta al body la clase definida en nightClass</span>
	onDawn : function(){},          <span class="comment">// callback si es de madrugada; por defecto inyecta al body la clase definida en dawnClass</span>
	onMorning : function(){},       <span class="comment">// callback si es de mañana; por defecto inyecta al body la clase definida en morningClass</span>
	onAfternoon : function(){}      <span class="comment">// callback si es de tarde; por defecto inyecta al body la clase definida en afternoonClass</span>
});
Cambios:
  • 1.0: ahora puedes definir el comportamiento a través del callback.
  • 0.4.1: BUG: onMorning.call solucionado.
  • 0.4: Primera publicación.

Demo/Ejemplo{.verejemplo}

Download/Bajar Plugin{.bajar}

Copyright 2013, CSSLab.cl – Free under the MIT license. Blackhole Icon from Turbomilk