you are in: codestackercodes [RSS] → tag: html [RSS]

useful html5 attributes for iOS Delicious Email

show/hide lines
   1  <!-- For a username, you don't want to autocorrect, nor do you want a capitalised first letter. -->
   2  <input type="text" autocorrect="off" autocapitalize="off">
   3  
   4  <!-- Turn telephone detection off -->
   5  <meta name="format-detection" content="telephone=no" />
   6  
   7  <!-- Make webpage an app (get rid of top bar) when bookmarked to home screen -->
   8  <meta name="apple-mobile-web-app-capable" content="yes" />
   9  
  10  <!-- Number keyboards -->
  11  <input type="tel" /> <input pattern="[0-9]*">
  12  
  13  <!-- URL/Emails -->
  14  <input type="url"> <input type="email">
  15  
  16  <!-- Links -->
  17  <a href="http://maps.google.com/maps?q=Moon">Open in Google Maps</a>
  18  <a href="tel:01234567890">Open the phone</a>
  19  <a href="twitter:Tweet Tweet Tweet">Open the Twitter for iPhone app</a>
created by leozera — 11 July 2011 — get a short url — tags: html html5 ios embed

Gerador de CPF, NIT, CNPJ e CEI válidos Delicious Email

show/hide lines
   1  <html>
   2  <head>
   3  	<title>Gerador de CPF, CNPJ e NIT Válidos</title>
   4  	<script language="javascript">
   5  		function gera_random(n) {
   6  		    var ranNum = Math.round(Math.random()*n);
   7  		    return ranNum;
   8  		}
   9  
  10  		function mod(dividendo,divisor) {
  11  			return Math.round(dividendo - (Math.floor(dividendo/divisor)*divisor));
  12  		}
  13  
  14  		function cpf() {
  15  			var n = 9;
  16  			var n1 = gera_random(n);
  17  		 	var n2 = gera_random(n);
  18  		 	var n3 = gera_random(n);
  19  		 	var n4 = gera_random(n);
  20  		 	var n5 = gera_random(n);
  21  		 	var n6 = gera_random(n);
  22  		 	var n7 = gera_random(n);
  23  		 	var n8 = gera_random(n);
  24  		 	var n9 = gera_random(n);
  25  		 	var d1 = n9*2+n8*3+n7*4+n6*5+n5*6+n4*7+n3*8+n2*9+n1*10;
  26  		 	d1 = 11 - (mod(d1,11));
  27  		 	if (d1>=10) d1 = 0;
  28  		 	var d2 = d1*2+n9*3+n8*4+n7*5+n6*6+n5*7+n4*8+n3*9+n2*10+n1*11;
  29  		 	d2 = 11 - (mod(d2,11));
  30  		 	if (d2>=10) d2 = 0;
  31  	
  32  			if (document.form1.mascara.checked)
  33  		 	  return ''+n1+n2+n3+'.'+n4+n5+n6+'.'+n7+n8+n9+'-'+d1+d2;
  34  			else
  35  			  return ''+n1+n2+n3+n4+n5+n6+n7+n8+n9+d1+d2;
  36  		}
  37  
  38  		function cnpj() {
  39  			var n = 9;
  40  			var n1  = gera_random(n);
  41  		 	var n2  = gera_random(n);
  42  		 	var n3  = gera_random(n);
  43  		 	var n4  = gera_random(n);
  44  		 	var n5  = gera_random(n);
  45  		 	var n6  = gera_random(n);
  46  		 	var n7  = gera_random(n);
  47  		 	var n8  = gera_random(n);
  48  		 	var n9  = 0;//gera_random(n);
  49  		 	var n10 = 0;//gera_random(n);
  50  		 	var n11 = 0;//gera_random(n);	
  51  		 	var n12 = 1;//gera_random(n);		
  52  			var d1 = n12*2+n11*3+n10*4+n9*5+n8*6+n7*7+n6*8+n5*9+n4*2+n3*3+n2*4+n1*5;
  53  		 	d1 = 11 - ( mod(d1,11) );
  54  		 	if (d1>=10) d1 = 0;
  55  		 	var d2 = d1*2+n12*3+n11*4+n10*5+n9*6+n8*7+n7*8+n6*9+n5*2+n4*3+n3*4+n2*5+n1*6;
  56  		 	d2 = 11 - ( mod(d2,11) );
  57  		 	if (d2>=10) d2 = 0;
  58  	
  59  			if (document.form1.mascara.checked)
  60  				return ''+n1+n2+'.'+n3+n4+n5+'.'+n6+n7+n8+'/'+n9+n10+n11+n12+'-'+d1+d2;
  61  			else
  62  				return ''+n1+n2+n3+n4+n5+n6+n7+n8+n9+n10+n11+n12+d1+d2;
  63  		}
  64  
  65  		function nit() {
  66  			var n = 9;
  67  			var n1  = 1;//gera_random(n);
  68  		 	var n2  = gera_random(n);
  69  		 	var n3  = gera_random(n);
  70  		 	var n4  = gera_random(n);
  71  		 	var n5  = gera_random(n);
  72  		 	var n6  = gera_random(n);
  73  		 	var n7  = gera_random(n);
  74  		 	var n8  = gera_random(n);
  75  		 	var n9  = gera_random(n);
  76  		 	var n10 = gera_random(n);
  77  		
  78  			var d1 =  n1*3 + n2*2 + n3*9 + n4*8 + n5*7 + n6*6 + n7*5 + n8*4 + n9*3 + n10*2;
  79  		 	d1 = 11 - ( mod(d1,11) );
  80  		 	if (d1>=10) d1 = 0;
  81   	
  82  			if (document.form1.mascara.checked)
  83  				return ''+n1+n2+n3+'.'+n4+n5+n6+n7+n8+'.'+n9+n10+'-'+d1;
  84  			else
  85  				return ''+n1+n2+n3+n4+n5+n6+n7+n8+n9+n10+d1;
  86  		}
  87  
  88  		function cei() {
  89  			var n = 9;
  90  			var n1  = 2; // deve ser diferente de 0
  91  		 	var n2  = gera_random(n);
  92  		 	var n3  = gera_random(n);
  93  		 	var n4  = gera_random(n);
  94  		 	var n5  = gera_random(n);
  95  		 	var n6  = gera_random(n);
  96  		 	var n7  = gera_random(n);
  97  		 	var n8  = gera_random(n);
  98  		 	var n9  = gera_random(n);
  99  		 	var n10 = gera_random(n);
 100  			var n11 = 8; // atividade 
 101  		
 102  			var aux1 =  n1*7 + n2*4 + n3*1 + n4*8 + n5*5 + n6*2 + n7*1 + n8*6 + n9*3 + n10*7 + n11 * 4;
 103  			var aux2 = aux1 + '';
 104  	
 105  			var aux3 = parseInt(aux2[aux2.length - 1]) + parseInt(aux2[aux2.length - 2]);
 106  			var Soma = parseInt(aux1);	
 107  			var d1 = parseInt((10 - (Soma % 10 + parseInt(Soma / 10)) % 10) % 10);
 108  			d1 = Math.abs(d1);
 109  
 110  			if (document.form1.mascara.checked)
 111  		 	  return ''+n1+n2+'.'+n3+n4+n5+'.'+n6+n7+n8+n9+n10+'/'+n11+d1;
 112  			else
 113  			  return ''+n1+n2+n3+n4+n5+n6+n7+n8+n9+n10+n11+d1;
 114  		}
 115  
 116  		function gera() {
 117  			if (document.form1.tipo[0].checked)
 118  				document.form1.numero.value = cpf();
 119  			else if (document.form1.tipo[1].checked)
 120  				document.form1.numero.value = cnpj();
 121  			else if (document.form1.tipo[2].checked)
 122  				document.form1.numero.value = nit();
 123  		    else if (document.form1.tipo[3].checked)
 124  				document.form1.numero.value = cei();
 125  		}
 126  	</script>
 127  </head>
 128  <body>
 129  	<h1>Gerador de CPF, NIT, CNPJ, CEI válidos</h1>
 130  	<form name="form1" method="post" action="">		
 131  		<label for="numero">Número:</label> <input name="numero" id="numero" size="20" type="text" /><br/>
 132  		Tipo: 
 133  		<input name="tipo" value="cpf" checked="checked" type="radio"> <label for="cpf">CPF</label> 
 134  		<input name="tipo" value="cnpj" id="cnpj" type="radio" /> <label for="cnpf">CNPJ</label>
 135  		<input name="tipo" value="nit" id="nit" type="radio"> <label for="nit">NIT</label>
 136  		<input name="tipo" value="cei" id="cei" type="radio"> <label for="cei">CEI</label><br/>
 137  		<input name="mascara" value="mascara" id="mascara" type="checkbox"> <label for="mascara">Máscara</label><br/><br/>
 138  
 139  		<input name="button" value="Gerar" onclick="gera()" type="button">
 140  	</form>
 141  </body>
 142  </html>
created by leozera — 21 June 2011 — get a short url — tags: cei cnpj cpf nit embed

submit a form with a link Delicious Email

show/hide lines
   1  <!-- view -->
   2  <%= form_for(@category) do |f| %>
   3  	<!-- fields... -->
   4  	<%= link_to 'Submit', '#', :class => 'submit_me' %>
   5  <% end %>
   6  
   7  <!-- javascript --> 
   8  $('.submit_me').click(function() {
   9    $(this).parent().submit();
  10    return false;
  11  });
created by leozera — 07 June 2011 — get a short url — tags: rails embed

embed youtube using html5 Delicious Email

via http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html

show/hide lines
   1  <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
   2  </iframe>
created by leozera — 13 April 2011 — get a short url — tags: html5 youtube embed

hide address bar in safari mobile Delicious Email

this code lets you hide the address bar in safari mobile. your webapp will look like a native one.

show/hide lines
   1  <body onload="window.scrollTo(0, 1)">
created by leozera — 05 February 2011 — get a short url — tags: ios safari embed

wordpress categories dropdown Delicious Email

show/hide lines
   1  <!-- old way -->
   2  <?php wp_list_categories('orderby=name&exclude=1&title_li='); ?>
   3  
   4  <!-- dropdown -->
   5  <select onchange='document.location.href=this.options[this.selectedIndex].value;'>
   6  	<option><?php echo attribute_escape(__('Select Month')); ?></option>
   7  <?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?>
   8  </select>
created by leozera — 04 February 2011 — get a short url — tags: wordpress embed

wordpress archives dropdown Delicious Email

show/hide lines
   1  <!-- original way -->
   2  <?php wp_get_archives('type=monthly'); ?>
   3  
   4  <!-- dropdown -->
   5  <select onchange='document.location.href=this.options[this.selectedIndex].value;'>
   6  	<option><?php echo attribute_escape(__('Select Month')); ?></option>
   7  	<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?>
   8  </select>
created by leozera — 04 February 2011 — get a short url — tags: wordpress embed

image-free tag shape Delicious Email

preview: http://playground.deaxon.com/css/tag-shape/

show/hide lines
   1  <!doctype html>
   2  <title>Image-free tag shape</title>
   3  <style>
   4    ul {list-style:none}
   5    a {
   6      float:left;
   7      margin-right:8px;
   8      padding:2px 7px 3px 19px;
   9      font:700 .7em "lucida grande", arial, sans-serif;
  10      color:#3d5295;
  11      text-decoration:none;
  12      text-shadow:0 1px 0 rgba(255,255,255,.5);
  13      border-radius:0 .4em .4em 0;
  14      background:
  15        -moz-linear-gradient(
  16          -45deg,
  17          transparent 50%,
  18          #d0daf7 50%
  19        ),
  20        -moz-linear-gradient(
  21          45deg,
  22          transparent 50%,
  23          #d0daf7 50%
  24        ),
  25        -moz-linear-gradient(
  26          #d0daf7,
  27          #d0daf7
  28        );
  29      background:
  30        -webkit-gradient(
  31          linear,
  32          0 0, 100% 100%,
  33          color-stop(.5,transparent),
  34          color-stop(.5,#d0daf7)
  35        ),
  36        -webkit-gradient(
  37          linear,
  38          0 100%, 100% 0,
  39          color-stop(.5,transparent),
  40          color-stop(.5,#d0daf7)
  41        ),
  42        -webkit-gradient(
  43          linear,
  44          0 0, 100% 0,
  45          from(#d0daf7),
  46          to(#d0daf7)
  47        );
  48      background-repeat:no-repeat;
  49      background-position:0 0, 0 100%, 10px 0;
  50      background-size:10px 53%, 10px 50%, 100% 100%;
  51      -moz-padding-start:14px;
  52      -webkit-mask-image:-webkit-gradient(
  53        radial,
  54        11 50%, 2.9, 11 50%, 3,
  55        from(transparent),
  56        to(rgba(0,0,0,1))
  57      )}
  58  </style>
  59  <ul>
  60    <li><a href=.>icon</a>
  61    <li><a href=.>48px</a>
  62    <li><a href=.>free</a>
  63  </ul>
created by leozera — 27 January 2011 — get a short url — tags: css3 embed

link to a pdf and specify the zoom Delicious Email

full reference here: http://www.rdpslides.com/psfaq/FAQ00050.htm

show/hide lines
   1  <a href="/uploads/document.pdf#zoom=100&page=3">
   2    Open PDF on Page 3 with 100% Zoom
   3  </a>
created by leozera — 27 January 2011 — get a short url — tags: pdf embed

iOS volume-style popup in Mobile Safari Delicious Email

preview: http://cl.ly/4AK4

show/hide lines
   1  <style>
   2  div#popup {
   3          background-color: rgba(0,0,0,.5);
   4          border-radius: 10px;
   5          color: #ffffff;
   6          font-weight: bold;
   7          font-family: Arial;
   8          height: 160px;
   9          line-height: 50px;
  10          margin: 0 auto;
  11          text-align: center;
  12          text-shadow: 0px 1px 0px #000000;
  13          -webkit-border-radius: 10px;
  14          border-radius: 10px;
  15          width: 160px;
  16  }
  17  </style>
  18  
  19  <li id="toggle">
  20          <a href="#">button <!--activates the popup--> </a>
  21  </li>
  22  
  23  <div id="popup" style="display: none">Popup...</div> 
  24  
  25  <!--popup script must be placed below the DIV--> 
  26  <script> 
  27          $("#toggle").click(function () {
  28          $("#popup").fadeIn("fast");
  29          $("#popup").delay(3500).fadeOut();
  30  });
  31  </script> 
  32  <!--/popup script--> 
created by leozera — 27 January 2011 — get a short url — tags: css ios embed
Displaying records 1 - 10 of 26