sajt u izradi..
English French German Italian Portuguese Russian Spanish
XAConverter class [JavaScript][Source File]
Created: Saturday, 16.November.2013. 14:24
/*
 * @copyright	Copyright (C) 2013 Branislav Kešelj . All rights reserved.
 * @license		GNU/GPLv2
 * v.1.1 - 17.11.2013
 */

var tl = function() {
    var R=[]; 
    var C = ['а','б','в','г','д','џ','ђ','е','ж','з','и','ј','к','л','љ','м','н','њ','о','п','р','с','т','ћ','у','ф','х','ц','ч','ш','А','Б','В','Г','Д','Џ','Ђ','Е','Ж','З','И','Ј','К','Л','Љ','М','Н','Њ','О','П','Р','С','Т','Ћ','У','Ф','Х','Ц','Ч','Ш'];
    var L = ['a','b','v','g','d','dž','đ','e','ž','z','i','j','k','l','lj','m','n','nj','o','p','r','s','t','ć','u','f','h','c','č','š','A','B','V','G','D','Dž','Đ','E','Ž','Z','I','J','K','L','Lj','M','N','Nj','O','P','R','S','T','Ć','U','F','H','C','Č','Š'];

    var T = [/(<script[^>]*?>[\s\S]*?<\/script>)/ig,/(<style[^>]*?>[\s\S]*?<\/style>)/ig,/\{#x\}([\s\S]*?)\{\/#x\}/ig,/(<[^>]*>)/ig,
         /(&quot;)/g, /(&apos;)/g, /(&amp;)/g, /(&lt;)/g, /(&gt;)/g, /(&nbsp;)/g, /(&iexcl;)/g, /(&cent;)/g, /(&pound;)/g,
         /(&curren;)/g, /(&yen;)/g, /(&brvbar;)/g, /(&sect;)/g, /(&uml;)/g, /(&copy;)/g, /(&ordf;)/g, /(&laquo;)/g, /(&not;)/g, /(&shy;)/g,
         /(&reg;)/g, /(&macr;)/g, /(&deg;)/g, /(&plusmn;)/g, /(&sup2;)/g, /(&sup3;)/g, /(&acute;)/g, /(&micro;)/g, /(&para;)/g, /(&middot;)/g,
         /(&cedil;)/g, /(&sup1;)/g, /(&ordm;)/g, /(&raquo;)/g, /(&frac14;)/g, /(&frac12;)/g, /(&frac34;)/g, /(&iquest;)/g, /(&times;)/g, /(&divide;)/g,
         /(&Oslash;)/g, /(&oslash;)/g, /(&forall;)/g, /(&part;)/g, /(&exists;)/g, /(&empty;)/g, /(&nabla;)/g, /(&isin;)/g, /(&notin;)/g, /(&ni;)/g,
         /(&prod;)/g, /(&sum;)/g, /(&minus;)/ig, /(&lowast;)/ig, /(&radic;)/ig, /(&prop;)/ig, /(&infin;)/ig, /(&ang;)/ig, /(&and;)/ig, /(&or;)/ig,
         /(&cap;)/g, /(&cup;)/g, /(&int;)/g, /(&there4;)/g, /(&sim;)/g, /(&cong;)/g, /(&asymp;)/g, /(&ne;)/g, /(&equiv;)/g, /(&le;)/g,
         /(&ge;)/g, /(&sub;)/g, /(&sup;)/g, /(&nsub;)/g, /(&sube;)/g, /(&supe;)/g, /(&oplus;)/g, /(&otimes;)/g, /(&perp;)/g, /(&sdot;)/g,
         /(&Alpha;)/g, /(&Beta;)/g, /(&Gamma;)/g, /(&Delta;)/g, /(&Epsilon;)/g, /(&Zeta;)/g, /(&Eta;)/g, /(&Theta;)/g, /(&Iota;)/g, /(&Kappa;)/g,
         /(&Lambda;)/g, /(&Mu;)/g, /(&Nu;)/g, /(&Xi;)/g, /(&Omicron;)/g, /(&Pi;)/g, /(&Rho;)/g, /(&Sigma;)/g, /(&Tau;)/g, /(&Upsilon;)/g, /(&Phi;)/g,
         /(&Chi;)/g, /(&Psi;)/g, /(&Omega;)/g, /(&alpha;)/g, /(&beta;)/g, /(&gamma;)/g, /(&delta;)/g, /(&epsilon;)/g, /(&zeta;)/g, /(&eta;)/g, /(&theta;)/g,
         /(&iota;)/g, /(&kappa;)/g, /(&lambda;)/g, /(&mu;)/g, /(&nu;)/g, /(&xi;)/g, /(&omicron;)/g, /(&pi;)/g, /(&rho;)/g, /(&sigmaf;)/g, /(&sigma;)/g,
         /(&tau;)/g, /(&upsilon;)/g, /(&phi;)/g, /(&chi;)/g, /(&psi;)/g, /(&omega;)/g, /(&thetasym;)/g, /(&upsih;)/g, /(&piv;)/g, /(&OElig;)/g, /(&oelig;)/g,
         /(&Scaron;)/g,  /(&scaron;)/g, /(&Yuml;)/g, /(&fnof;)/g, /(&circ;)/g, /(&tilde;)/g, /(&ensp;)/g, /(&emsp;)/g, /(&thinsp;)/g, /(&zwnj;)/g, /(&zwj;)/g,
         /(&lrm;)/g, /(&rlm;)/g, /(&ndash;)/ig, /(&mdash;)/ig, /(&lsquo;)/ig, /(&rsquo;)/ig, /(&sbquo;)/ig, /(&ldquo;)/ig, /(&rdquo;)/ig, /(&bdquo;)/ig, /(&dagger;)/ig,
         /(&Dagger;)/g, /(&bull;)/g, /(&hellip;)/g, /(&permil;)/g, /(&prime;)/g, /(&Prime;)/g, /(&lsaquo;)/g, /(&rsaquo;)/g, /(&oline;)/g, /(&euro;)/g, /(&trade;)/g,
         /(&larr;)/g, /(&uarr;)/g, /(&rarr;)/g, /(&darr;)/g, /(&harr;)/g, /(&crarr;)/g, /(&lceil;)/g, /(&rceil;)/g, /(&lfloor;)/g, /(&rfloor;)/g, /(&loz;)/g,
         /(&spades;)/g, /(&clubs;)/g, /(&hearts;)/g, /(&diams;)/g];

    var S=[/konju[^avjrshš][a-z]*/ig,3,/injek[a-z]*/ig,2,/nadživ[a-z]*/ig,3,/tanjug[a-z]*/ig,3,/panjeliniz[a-z]*/ig,3,/injunkt[a-z]*/ig,2,/nadžet[a-z]*/ig,3,/nadžnj[a-z]*/ig,3,
             /nadžanj[a-z]*/ig,3,/nadždrel[a-z]*/ig,3,/nadžup[a-z]*/ig,3,/odžal[^j][a-z]*/ig,2,/odžaljen/ig,2,/podžupan[a-z]*/ig,3];

    var I=[/<input[^>]*type="submit"[^>]*>/gi,/<input[^>]*type="button"[^>]*>/gi];

    Array.prototype.count = function ()
        {
        var c = 0;
        for(i in this)
        { if(typeof this[i] != "undefined") c++; }
        return c-1;
        };

    return {
        encode:function(w)
            {
			var n=1000;
            function c($1,$2)
                {
                n++; R.push('##'+n+'###'); R.push($2);
                return '##'+n+'###';
                }
            for(var i=0; i< T.count();i++)
                { w=w.replace(T[i], c); }
            return w;
            },

        encode_:function(w)
            {
            function c($1)
                { return $1.substr(0, S[i+1])+'#q#q##'+$1.substr(S[i+1]); }
            for(var i=0; i< S.count();i+=2)
                { w=w.replace(S[i], c); }
            return w;
            },

        decode:function(w)
            {
            for(var i=0; i< R.count();i+=2)
                { w=w.replace(R[i],R[i+1]); }
            R=[];
            return w;
            },

        decode_:function(w)
            { return w.replace(/#q#q##/g,''); },

        convertInputTag:function(w,l)
            {
            function c($1)
                {
                function f($1,$2)
                    { return 'value="'+tl.convert($2,l)+'"'; }
                return $1.replace(/value="([\s\S]*?)"/,f);
                }
            for(var i=0;i< I.count();i++)
                { w=w.replace(I[i], c); }
            return w;
            },

        lang:function(w)
            {
            var l= 0, c=0 ;
            for (var i=0;i<w.length;i++)
                {
                if(L.indexOf(w.charAt(i))!=-1) l++;
                    else if(C.indexOf(w.charAt(i))!=-1) c++;
                if(c>10) return 'l';
                if(l>10) return 'c';
                }
            return false ;
            },
        convert:function(w,l)
            {
            var c, d, n, u, t='';
            for (var i=0;i<w.length;i++)
                {
                c=w.charAt(i) ;
                if (l=='c')
                    {
                    d=L.indexOf(c);
                    if(d!=-1)
                        {
                        n=w.charAt(i+1);
                        if (((c=='l' || c=='n') && n=='j') || (c=='d' && n=='ž') || ((c=='L' || c=='N') && (n=='j' || n=='J')) || (c=='D' &&  (n=='ž' || n=='Ž')))
                            { d++ ; i++ ; }
                        t+=C[d];
                        }
                        else t+=c;
                    }
                    else
                        {
                        d=C.indexOf(c);
                        if (d!=-1)
                            {
                            u=0;
                            if (c=='Љ' || c=='Њ' || c=='Џ')
                                {
                                n=w.charAt(i+1) ;
                                u=C.indexOf(n);
                                }
                            t+=(u>29) ? L[d].toUpperCase():L[d] ;
                            }
                            else t+=c;
                        }
                }
            return t;
            }
        };
    }();

 

Post a comment
0
Comments | Add yours
  • No comments found
Free visitor tracking, live stats, counter, conversions for Joomla, Wordpress, Drupal, Magento and Prestashop