author | František Kučera <franta-hg@frantovo.cz> |
Sat, 14 Jan 2012 22:52:24 +0100 | |
changeset 88 | e856711b66e9 |
parent 84 | f866267d7b3c |
child 93 | 5b55827de220 |
permissions | -rw-r--r-- |
84
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
1 |
/** |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
2 |
* XML Web generátor – program na generování webových stránek |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
3 |
* Copyright © 2012 František Kučera (frantovo.cz) |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
4 |
* |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
5 |
* This program is free software: you can redistribute it and/or modify |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
7 |
* the Free Software Foundation, either version 3 of the License, or |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
8 |
* (at your option) any later version. |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
9 |
* |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
13 |
* GNU General Public License for more details. |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
14 |
* |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
17 |
*/ |
11
78a8dd1eeb2b
statický obsah a úloha pro čištění
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
|
84
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
19 |
/** |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
20 |
* XML Web generátor – jmenný prostor |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
21 |
*/ |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
22 |
var xwg = { |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
23 |
/** |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
24 |
* Zašifruje/dešifruje obsah elementu pomocí Rot13. |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
25 |
* @param id ID elementu, jehož text chceme změnit. |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
26 |
*/ |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
27 |
rot13: function(id) { |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
28 |
var e = document.getElementById(id); |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
29 |
e.textContent = e.textContent.rot13(); |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
30 |
} |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
31 |
}; |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
32 |
|
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
33 |
/** |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
34 |
* Vrací hodnotu textového řetězce zašifrovanou/dešifrovanou algoritmem Rot13 |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
35 |
*/ |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
36 |
String.prototype.rot13 = function() { |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
37 |
return this.replace(/[a-zA-Z]/g, function(z) { |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
38 |
return String.fromCharCode((z <= "Z" ? 90 : 122) >= (z = z.charCodeAt(0) + 13) ? z : z - 26); |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
39 |
}); |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
40 |
}; |
f866267d7b3c
ROT13 – šifrování #18
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
41 |