var sliv = {}; var inchFootMileLocalesString = 'US,GB,UK,SA,NZ,CA,AU'; var cyrillicEnabled = 'N'; sliv.currentLocaleCode = 'GB'; sliv.currentLanguageCode = 'en'; sliv.currentZoneCode = ''; sliv.isEnabled = true; sliv.foreignAlphabetLocales = ['GR', 'RU', 'PL']; sliv.preventCutPasteLocales = ['GR', 'PL']; sliv.inchFootMileLocales = inchFootMileLocalesString.split(','); sliv.preventCutPasteInInputs = function(){ $('input').die('copy paste ').live('copy paste ', function (e) { e.preventDefault(); }); }; sliv.forceCharsetOnForms = function(charset){ $('form').attr('accept-charset', charset) }; sliv.doesThisLocaleUseInches = function(){ return ( sliv.inchFootMileLocales.indexOf(sliv.currentLocaleCode) != -1 ) } function disableKeyboard(){ $('input').die('copy paste ').live('copy paste ', function (e) { e.preventDefault(); }); } $(document).ready(function(){ $('input').live('keyup',function(e){ var stringa =$(this).val(); //cirillic var patt = /[а-яА-Я]/g; //greek var patt2 = /^[α-ωΑ-Ω\s]*$/g; //polish var patt3 = /^[\sĄĆĘŁŃÓŚŹŻąćęłńóśźż]+$/; if((cyrillicEnabled=='N' && patt.test(stringa)) || patt2.test(stringa) || patt3.test(stringa)){ $(this).val(""); //disableKeyboard(); } }); if(sliv.foreignAlphabetLocales.indexOf(sliv.currentLocaleCode) != -1){ if(cyrillicEnabled=='N'){ sliv.preventCutPasteInInputs(); sliv.forceCharsetOnForms("UTF-8"); } } });