- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
if (a == 10)
{
<какие-то действия>
}
else
{
<один в один те же самые действия>
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+152
if (a == 10)
{
<какие-то действия>
}
else
{
<один в один те же самые действия>
}
Безысходность.
+170
<form id ='activate'>
<div class ='form-control'>
<label>Введите код подтверждения из SMS</label>
<input type ='text' name ='code' class ='form-control' />
</div>
<button class = 'btn btn-success'>Активировать</button>
</form>
<script>
$(function () {
$('#activate').submit(function () {
if ($('#activate [name="code"]').val != '<?php echo $secretCode; ?>') {
alert('Вы ввели неверный код!')
return false;
}
})
})
</script>
Бог безопасности
+159
$(document).ready(function(){
$('.result_count').hide();
$('.contentLeft li').on('click',function(){
$('.contentLeft li input[type="radio"]').attr('checked',false);
$('li.activebutton input[type="radio"]').attr('checked',true);
});
$('.contentLeftValut li label').on('click',function(){
$('.contentLeftValut li').removeClass('act_li');
$(this).closest('li').addClass('act_li');
$('.contentLeftValut li input[type="radio"]').attr('checked',false);
$('li.act_li input[type="radio"]').attr('checked',true);
});
$('.calculBlock').change(function()
{
$('.error').html('');
var first_array = {"1":1,"2":2,"3":3,"4":4,"5":5,"6":7,"7":10,"8":12,"9":15,"10":17,"11":20,"12":22,"13":25,"14":27,"15":30,"16":32,"17":35,"18":40,"19":45,"20":50,"21":55,"22":60,"23":65,
"24":70,"25":75,"26":80,"27":85,"28":90,"29":95,"30":100}
var two_array = {"1":123.7,"2":154.3,"3":175.4,"4":199.3,"5":212.8,"6":278.3,"7":312.2,
"8":378.5,"9":439.4,"10":472.8,"11":532.8,"12":566.9,"13":621.6,"14":664.3,
"15":739.2,"16":775.1,"17":829.1,"18":929.0,"19":1008.8,"20":1159.3,"21":1260.9,"22":1361.0,"23":1462.7,
"24":1563.4,"25":1674.3,"26":1785.3,"27":1896.2,"28":2007.1,"29":2118.1,"30":2229.0}
var three_array = {"1":20.47,"2":23.66,"3":34.04,"4":37.3,"5":40.57,"6":41.14,"7":56.95,
"8":60.58,"9":66.07,"10":69.73,"11":75.17,"12":79.01,"13":86.63,"14":90.05,
"15":94.93,"16":102.47,"17":109.78,"18":117.89,"19":126.04,"20":134.21,"21":142.31,"22":150.45,"23":158.59,
"24":166.71,"25":238.12,"26":253.02,"27":267.92,"28":282.82,"29":297.72,"30":312.62}
var error = 0;
var ves = 0;
var result = 0;
var firstPlace = Math.ceil($('.firstPlace').val());
if (firstPlace == ""||$.isNumeric(firstPlace)){
$('.error').html('Введите точку отправки');
return;
}
else{
var lastPlace = Math.ceil($('.lastPlace').val());
if ((lastPlace == "" ) || ($.isNumeric(lastPlace))){
$('.error').html('Введите точку доставки');
return;
}
else{
var weight = Math.ceil($('.weight').val());
if ((weight=="" ) || (isNaN(weight))){
$('.error').html('Введите вес груза');
return;
}
else{
var length = Math.ceil($('.length').val());
if ((length=="" ) || (isNaN(length))){
$('.error').html('Введите длину груза');
return;
}
else{
var height = Math.ceil($('.height').val());
if ((height=="" ) || (isNaN(height))){
$('.error').html('Введите высоту груза');
return;
}
else{
var width = Math.ceil($('.width').val());
if ((width=="" ) || (isNaN(width))){
$('.error').html('Введите ширину груза');
return;
}
else{
var price = Math.ceil($('.price').val());
if ((price=="" ) || (isNaN(price))){
$('.error').html('Введите цену груза');
}
else{
var ob_ves = length*height*width/5000;
if(weight > Math.round(ob_ves)){
ves = weight;
}
else{ves = Math.round(ob_ves);
}
if( (($('#p_eks').is(':checked')) && ($('#usa').is(':checked'))) || ( ($('#g_eks').is(':checked')) && ($('#usa').is(':checked'))) ){
for (var i=1;i <= 30;i++){
if (ves <= first_array[i]){
result = two_array[i] + ves*4;
break;
}
}
}
if( (($('#p_eks').is(':checked')) && ($('#euro').is(':checked'))) || ( ($('#g_eks').is(':checked')) && ($('#euro').is(':checked'))) ){
for (var i=1;i <= 30;i++){
if (ves <= first_array[i]){
Ай, блять. Калькулятор.
+158
if ($('ul.menu>li>ul>ul>li>a.active-trail').length == 1) {
$('ul.menu>li>ul>ul>li>a.active-trail').addClass('work-active');
if ($('ul.menu>li>ul>ul>li>a.active-trail').parent('li.hide_li').length == 1) {
$('li.active-trail').removeClass('active-trail');
} else {
$('.active-trail').removeClass('active-trail');
}
$('.work-active').addClass('active-trail');
$('.menu>.first ul').show();
$('li.first').addClass('activefirst');
$('#block-system-main-menu ul.menu>li.first a').css("border-bottom", "none");
} else if ($('ul.menu>li>ul>li>a.active-trail').length == 1) {
$('ul.menu>li>ul>li>a.active-trail').addClass('work-active');
$('.active-trail').removeClass('active-trail');
$('.work-active').addClass('active-trail');
$('.menu>.first ul').show();
$('li.first').addClass('activefirst');
$('#block-system-main-menu ul.menu>li.first a').css("border-bottom", "none");
} else {
$('#block-system-main-menu ul.menu>li.first a').css("border-bottom", "1px #E7E7E7 solid");
}
Грамотное удаление активных классов меню
+162
function makeRequest(params)
{
var tParams = new Object();
try{
tParams.accepts = params.accepts
}
catch(e){}
try{
tParams.async = params.async
}
catch(e){}
try{
tParams.beforeSend = params.beforeSend
}
catch(e){}
try{
tParams.cache = params.cache
}
catch(e){}
очередной тревел-стартап
http://www.corteos.ru/Scripts/helpers.js
+158
$("a").easyTooltip();
$("a#link").easyTooltip({
tooltipId: "easyTooltip2",
content: '<img src="new/img/our_work/mosdacha_g.jpg" />'
});
Неуверенный программист.
+144
asdasd
asd
asd
asd
asf
2
F
if
+158
$(document).ready(function() {
$('.tab1').click(function () {
$('.tab-t1').show();
$('.tab-t2').hide();
$('.tab-t3').hide();
$('.tab1 i').addClass('active');
$('.tab2 i').removeClass('active');
$('.tab2 i').removeClass('active');
});
$('.tab2').click(function () {
$('.tab-t1').hide();
$('.tab-t2').show();
$('.tab-t3').hide();
$('.tab1 i').removeClass('active');
$('.tab2 i').addClass('active');
$('.tab3 i').removeClass('active');
});
$('.tab3').click(function () {
$('.tab-t1').hide();
$('.tab-t2').hide();
$('.tab-t3').show();
$('.tab1 i').removeClass('active');
$('.tab2 i').removeClass('active');
$('.tab3 i').addClass('active');
});
});
Из тестового задания
+152
function init() {
if (!document.body) return;
var body = document.body;
var html = document.documentElement;
// ...
}
// ...
https://gist.github.com/galambalazs/6477177/
Плавный скролл, я вот только не пойму, почему "if (!document.body) return;"?
Типа <body> тэга может не существовать?!
+165
var shops=new Array();
shops[shops.length] = new Array('',' ');
shops[shops.length] = new Array(' The Jewel Box', '135956406_923');
shops[shops.length] = new Array(' Склад 1', '135956406_923');
И таких вызовов порядка 2к
via http://pickpoint.ru/monitoring/