- 1
- 2
- 3
a=5; l=0;
.....
l= (l>a) ? 0 : l++;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+156
a=5; l=0;
.....
l= (l>a) ? 0 : l++;
Писал вчера свою задумку и были там вот эти строки... Я долго не мог вкурить, почему же у меня l все время рвано 0 ...)
+146
Battle = new Class({
// Options
selected: 1,
onPopupClose: function() {},
// Class initalisation
initialize: function(options) {
Object.append(this, options);
},
// Open popup
initPopup: function(title, selection) {
this.selected = selection;
this.popup = new LightFace.Static({
title: title,
content: 'vote-options'
});
},
// Vote
vote: function(social_network) {
var share = this.selected == 1 ? this.share1 : this.share2;
var pic = this.selected == 1 ? this.pic1 : this.pic2;
var url = '';
if(social_network == 'fb') {
url = 'http://www.facebook.com/sharer.php?s=100';
url += '&p[title]=' + encodeURIComponent(this.text);
url += '&p[summary]=' + encodeURIComponent(share);
url += '&p[url]=' + encodeURIComponent(this.url);
url += '&p[images][0]=' + encodeURIComponent(pic);
} else if(social_network == 'tw') {
url = 'http://twitter.com/share?';
url += 'text=' + encodeURIComponent(this.text);
url += '&url=' + encodeURIComponent(this.url);
url += '&counturl=' + encodeURIComponent(this.url);
} else if(social_network == 'vk') {
url = 'http://vkontakte.ru/share.php?';
url += 'url=' + encodeURIComponent(this.url);
url += '&title=' + encodeURIComponent(this.text);
url += '&description=' + encodeURIComponent(share);
url += '&image=' + encodeURIComponent(pic);
url += '&noparse=true';
} else if(social_network == 'ok') {
url = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1';
url += '&st.comments=' + encodeURIComponent(share);
url += '&st._surl=' + encodeURIComponent(this.url);
} else if(social_network == 'ml') {
url = 'http://connect.mail.ru/share?';
url += 'url=' + encodeURIComponent(this.url);
url += '&title=' + encodeURIComponent(this.text);
url += '&description=' + encodeURIComponent(share);
url += '&imageurl=' + encodeURIComponent(pic);
}
window.open(url,'','toolbar=0,status=0,width=626,height=436');
return this.vote_ns()
},
// Vote count
vote_ns: function() {
new Request({
url: '/vote/' + this.id + '/' + this.selected
}).send();
this.popup.close();
this.onPopupClose.delay(400);
var vote_count = $('vote-num-'+this.selected);
vote_count.set('text', vote_count.get('text').toInt() + 1);
$('vote-1').destroy();
$('vote-2').destroy();
$('voted_thank_you').show();
return false
},
// Askbook Promo
promoAskbook: function() {
this.promoBox = new LightFace.Static({
width: 500,
draggable: true,
title: 'AskBook.me',
content: 'askbook_promo'
});
}
});
Класс битв на 1001golos.ru
+150
var a=document.write('<textarea>') ;
document.write(a) ;
+158
$(function() {
var $track = $('#track');
var $thumb = $('#thumb');
document.getElementById('thumb').setAttribute('onDragStart', 'return false');
$thumb.mousedown(function(e) {
clickPointX = e.pageX - $(this).offset().left;
isClicked = true;
$thumb.stop();
});
});
Пример с хабры, лишний код был опущен. Видимо религия автора не позволила задать атрибут по другому.
+158
$(function()
{
$(function(){
// что-то
});
}
);
+146
... document.write('<img src="' + src + '" alt="" width="1" height="1" style="display:none"/>');
microsoft.com, 24 строчка
+146
<a class="postbtn_hide" href="#" onclick="javascript:toggleThread('75280'); return false;"></a>
Вот такое вот говнецо от небезызвестной обезьяны.
+168
jQuery(jQuery);
+163
d = d ? d.push({ajax: true}) : {ajax: true};
Похоже, что программист отметил весело новый год
+162
$('<input />').attr({
type: 'text',
readonly: true,
autocomplite: 'off',
name: 'link',
value: window.location
}).on('click',function(){$(this).select();}).appendTo(container);
$('<br />').appendTo(container);
$('<label />').attr({'for':'link'}).text('ссылка').appendTo(container);
Слегка упоролся. Доктор, я буду жить?