Changeset 84:f866267d7b3c

Show
Ignore:
Timestamp:
01/11/12 17:01:59 (12 years ago)
Author:
František Kučera <franta-hg@…>
Branch:
default
Message:

ROT13 – šifrování #18

Files:
1 added
2 modified
1 moved

Legend:

Unmodified
Added
Removed
  • vstup/css/styl.css

    r83 r84  
    125125} 
    126126 
     127.rot13 span { 
     128        color: gray; 
     129        font-family: monospace; 
     130} 
     131 
     132.rot13 a { 
     133        margin-left: -5px; 
     134        color: green; 
     135        text-decoration: none; 
     136} 
     137 
     138.rot13 a:hover { 
     139        color: red; 
     140} 
     141 
  • vstup/js/skript.js

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

    r59 r84  
    1616                <p>Vhodnost zvířete do domácnosti:</p> 
    1717                <m:měřák hodnota="95"/> 
     18                <p><m:šifra>Tučňáky si prostě oblíbíte!</m:šifra></p> 
    1819                 
    1920                <h2>Panda malá</h2> 
    2021                <p>Vivamus nec dictum dolor. Aliquam et tellus dolor. Curabitur et est sapien. Sed nec neque massa. Integer luctus erat vel arcu molestie ac dapibus dolor pretium. Curabitur eget augue non ipsum pulvinar venenatis eget et lectus. Proin fringilla aliquet sapien, non luctus est lobortis vel. Nunc vehicula volutpat varius. Aliquam suscipit accumsan sollicitudin. Morbi ultricies, mauris id elementum pellentesque, nunc dolor viverra nisl, sit amet consequat velit libero at ligula. Nulla luctus rhoncus tortor nec sollicitudin. Vivamus posuere sodales ipsum, hendrerit cursus felis pharetra sit amet. Nunc interdum facilisis massa ac congue.</p> 
    21                 <p>Aliquam erat volutpat. Quisque vitae libero est. Aliquam erat volutpat. Integer elementum, nisl nec lacinia facilisis, dolor tellus varius eros, sit amet facilisis sem sapien vitae nulla. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer rutrum sodales venenatis. Donec mollis aliquet enim, id venenatis urna faucibus sed. Suspendisse pharetra neque et nibh tincidunt suscipit. Morbi ut justo sit amet lectus faucibus tempor quis non libero. Aenean in dolor sem, in lacinia sem.</p> 
     22                <p>Aliquam erat volutpat. Quisque vitae libero est. <m:šifra>Panda malá je menší než panda velká.</m:šifra> Aliquam erat volutpat. Integer elementum, nisl nec lacinia facilisis, dolor tellus varius eros, sit amet facilisis sem sapien vitae nulla. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer rutrum sodales venenatis. Donec mollis aliquet enim, id venenatis urna faucibus sed. Suspendisse pharetra neque et nibh tincidunt suscipit. Morbi ut justo sit amet lectus faucibus tempor quis non libero. Aenean in dolor sem, in lacinia sem.</p> 
    2223                 
    2324                <p>Vhodnost zvířete do domácnosti:</p> 
     
    3132                        Pozor: v současné verzi se stahuje ze Sítě při každém generování. 
    3233                --> 
     34                 
    3335    </text> 
    3436