- 1
var rus_rl = ('А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я-а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я').split('-');
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+172
var rus_rl = ('А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я-а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я').split('-');
+154
// Parse strings looking for color tuples [255,255,255]
function getRGB(color) {
var result;
if (color && isArray(color) && color.length == 3)
return color;
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
}
+164
aLength = V_Array.length;
if(aLength == 1) {
if(V_Array[0][0]=='true'){
document.MainListForm.list_DV[0].checked = true;
document.MainListForm.list_NE[0].checked = true;
}else{
document.MainListForm.list_DV[0].checked = false;
document.MainListForm.list_NE[0].checked = false;
}
if(V_Array[0][1]=='true'){
document.MainListForm.list_DV[1].checked = true;
document.MainListForm.list_NE[1].checked = true;
}else{
document.MainListForm.list_DV[1].checked = false;
document.MainListForm.list_NE[1].checked = false;
}
if(V_Array[0][2]=='true'){
document.MainListForm.list_DV[2].checked = true;
document.MainListForm.list_NE[2].checked = true;
}else{
document.MainListForm.list_DV[2].checked = false;
document.MainListForm.list_NE[2].checked = false;
}
if(V_Array[0][3]=='true'){
document.MainListForm.list_DV[3].checked = true;
document.MainListForm.list_NE[3].checked = true;
}else{
document.MainListForm.list_DV[3].checked = false;
document.MainListForm.list_NE[3].checked = false;
}
return;
}
for (i = 0; i < aLength ; i++) {
if(V_Array[i][0]=='true'){
document.MainListForm[i].list_DV[0].checked = true;
document.MainListForm[i].list_NE[0].checked = true;
}else{
document.MainListForm[i].list_DV[0].checked = false;
document.MainListForm[i].list_NE[0].checked = false;
}
if(V_Array[i][1]=='true'){
document.MainListForm[i].list_DV[1].checked = true;
document.MainListForm[i].list_NE[1].checked = true;
}else{
document.MainListForm[i].list_DV[1].checked = false;
document.MainListForm[i].list_NE[1].checked = false;
}
if(V_Array[i][2]=='true'){
document.MainListForm[i].list_DV[2].checked = true;
document.MainListForm[i].list_NE[2].checked = true;
}else{
document.MainListForm[i].list_DV[2].checked = false;
document.MainListForm[i].list_NE[2].checked = false;
}
if(V_Array[i][3]=='true'){
document.MainListForm[i].list_DV[3].checked = true;
document.MainListForm[i].list_NE[3].checked = true;
}else{
document.MainListForm[i].list_DV[3].checked = false;
document.MainListForm[i].list_NE[3].checked = false;
}
}
типично китайский привет из реал лайф проект
+166
if(VisabilityOnOff==true){
document.SearchForm.searchoption[0].disabled=true;
document.SearchForm.searchoption[1].disabled=true;
}else if(VisabilityOnOff==false){
document.SearchForm.searchoption[0].disabled=false;
document.SearchForm.searchoption[1].disabled=false;
}
+165
if (aNew=='true'){
path = './page.html?show='+ashow+'&avail='+aavail+'&page='+page+'&size='+asize+'&order='+aorder+'&ordera='+aordera+'&refresh='+arefresh+'&letter='+aletter+'&sortcount='+asortcount+'&search=off&new=true';
}else{
path = './page.html?show='+ashow+'&avail='+aavail+'&page='+page+'&size='+asize+'&order='+aorder+'&ordera='+aordera+'&refresh='+arefresh+'&letter='+aletter+'&sortcount='+asortcount+'&search=off&new=false';
}
разница в &new=true/false
Код из большого серьезного продакшен проекта.
+160
<script language="javascript" type="text/javascript">
<!--
var ie=document.all?1:0;
var ns=document.getElementById&&!document.all?1:0;
function InsertSmile(SmileId)
{
if(ie)
{
document.all.message.focus();
document.all.message.value+=" "+SmileId+" ";
}
else if(ns)
{
document.forms['guestbook'].elements['message'].focus();
document.forms['guestbook'].elements['message'].value+=" "+SmileId+" ";
}
else
alert("Ваш браузер не поддерживается!");
}
// -->
</script>
+163
function onsub(text){
if (confirm(text)) {
return true;
}
else {
return false;
}
}
Копаюсь в системе биллинга...
Убило!
+159
var DatePicker = function () {
...
return {
init: function(options) {...},
showPicker: function() {...},
hidePicker: function() {...},
setDate: function(date, shiftTo) {...},
getDate: function(formated) {...},
clear: function() {...},
fixLayout: function() {...}
};
}();
$.fn.extend({
DatePicker: DatePicker.init,
DatePickerHide: DatePicker.hidePicker,
DatePickerShow: DatePicker.showPicker,
DatePickerSetDate: DatePicker.setDate,
DatePickerGetDate: DatePicker.getDate,
DatePickerClear: DatePicker.clear,
DatePickerLayout: DatePicker.fixLayout
});
Взято с http://www.eyecon.ro/datepicker/
+166
function f1(element){
if (element.value.length == 3 && event.keyCode != 8){
document.getElementById('phone2').focus();
}
}
function f2(element){
// Возврат в phone1 после стирания первого символа в phone2:
if (element.value.length == 0 && event.keyCode == 8){
setCaretPosition(document.getElementById('phone1').value.length, inp = 'phone1');
}
// Переход в phone3 после ввода третьего символа в phone2:
if(element.value.length == 3 && event.keyCode != 8){
document.getElementById('phone3').focus();
}
}
function f3(element){
// Возврат в phone2 после стирания первого символа в phone3:
if (element.value.length == 0 && event.keyCode == 8){
setCaretPosition(document.getElementById('phone2').value.length, inp = 'phone2');
}
// Переход в phone4 после ввода второго символа в phone3:
if(element.value.length == 2 && event.keyCode != 8){
document.getElementById('phone4').focus();
}
}
function f4(element){
// Возврат в phone3 после стирания первого символа в phone4:
if (element.value.length == 0 && event.keyCode == 8){
setCaretPosition(document.getElementById('phone3').value.length, inp = 'phone3');
}
}
function f5(element){
if (element.value.length == 4 && event.keyCode != 8){
document.getElementById('phone6').focus();
}
}
function f6(element){
// Возврат в phone5 после стирания первого символа в phone6:
if (element.value.length == 0 && event.keyCode == 8){
setCaretPosition(document.getElementById('phone5').value.length, inp = 'phone5');
}
}
function setCaretPosition(pos, inp){
var ctrl = document.getElementById(inp);
if(ctrl.setSelectionRange){
ctrl.focus();
ctrl.setSelectionRange(pos, pos);
}
else if(ctrl.createTextRange){
var range = ctrl.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
}
проверка на корректность ввода телефона
+159
function start(x, y, w, h) {
document.getElementById('al').style.left=x;
document.getElementById('al').style.top=y-Math.round(h/2);
document.getElementById('al').style.width=w;
document.getElementById('al').style.height=h;
h=Math.round((w+160)*h/w);
n=gdw()/100*75;
if (w<n) setTimeout('start('+(x-80)+', '+y+', '+(w+160)+', '+h+')',1);
}