vstup/js/skript.js
changeset 93 5b55827de220
parent 84 f866267d7b3c
equal deleted inserted replaced
92:8d34f2020884 93:5b55827de220
    25 	 * @param id ID elementu, jehož text chceme změnit.
    25 	 * @param id ID elementu, jehož text chceme změnit.
    26 	 */
    26 	 */
    27 	rot13: function(id) {
    27 	rot13: function(id) {
    28 		var e = document.getElementById(id);
    28 		var e = document.getElementById(id);
    29 		e.textContent = e.textContent.rot13();
    29 		e.textContent = e.textContent.rot13();
    30 	}
    30 	},
       
    31 
       
    32 	/**
       
    33 	 * Vloží klikatelný odkaz.
       
    34 	 * @param id ID span elementu obsahujícího data
       
    35 	 */
       
    36 	odkazNaElektronickouPoštu: function(id) {
       
    37 		var spanČesky = document.getElementById(id);
       
    38 		var spanObsah = document.getElementById(id + "b");
       
    39 		var česky = spanČesky.innerHTML;
       
    40 		var adresa = česky.replace(" zavináč ", "@").replace(" tečka ",".");
       
    41 
       
    42 		var odkaz = document.createElement("a");
       
    43 		odkaz.href = "mailto:" + adresa;
       
    44 		if (spanObsah.innerHTML.length > 0) {
       
    45 			odkaz.innerHTML = spanObsah.innerHTML;
       
    46 		} else {
       
    47 			odkaz.innerHTML = adresa;
       
    48 		}
       
    49 
       
    50 		spanČesky.parentNode.insertBefore(odkaz, spanČesky);
       
    51 		spanČesky.parentNode.removeChild(spanČesky);
       
    52 		spanObsah.parentNode.removeChild(spanObsah);
       
    53 	},
       
    54 
    31 };
    55 };
    32 
    56 
    33 /**
    57 /**
    34  * Vrací hodnotu textového řetězce zašifrovanou/dešifrovanou algoritmem Rot13 
    58  * Vrací hodnotu textového řetězce zašifrovanou/dešifrovanou algoritmem Rot13 
    35  */
    59  */