- 1
if (Scene.generatedFast || (typeof generatedFast != "undefined" && generatedFast) )
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+151
if (Scene.generatedFast || (typeof generatedFast != "undefined" && generatedFast) )
+156
$.post("include/show_watching.php",
function(data) {
$('#content').empty().append(data);
}
);
Вот такой вот POST-запрос.
+161
function printf(format, value) {
return format.replace(/%s/, value.toString());
}
return {
updateProgressBar: function (percentage) {
console.log("update \"progressBar\" status");
progressBar.innerHTML = printf("<p>%s %</p>", percentage);
}
};
+164
$(document).ready(function(){
//50% прозрачность иконкам голосования
var minusBig = $(".photo-rate-block-minus"),
plusBig = $(".photo-rate-block-plus"),
minusSmall = $(".photo-rate-block-minus-small"),
plusSmall = $(".photo-rate-block-plus-small");
$(minusBig).css('opacity', '0.5');
$(plusBig).css('opacity', '0.5');
$(minusSmall).css('opacity', '0.5');
$(plusSmall).css('opacity', '0.5');
$(".photo-rate-block-minus, .photo-rate-block-plus, .photo-rate-block-minus-small, .photo-rate-block-plus-small").hover( function(){
$(this).css('opacity', '1');
}, function(){
$(this).css('opacity', '0.5');
});
});
CSS для слабаков
+153
var currentTime = (new Date()).getTime();
var diff = currentTime - this.startTime;
var min = Math.floor(Math.floor(diff/1000)/60);
if (min < 10)
min = "0"+min;
var sec = Math.floor(diff/1000)%60;
if (sec < 10)
sec = "0"+sec;
this.timeLabel.setString("TIME " + min + ":" + sec);
Классика практически, моего творения. Как это можно сделать по-человечески на JS? Всякие jQuary не катят, ибо js встраиваемый.
+151
function checked(obj) {
var undefined;
obj = '#'+obj;
if ($(obj+':checked').attr('id') == undefined) {
return 0;
}
else {
return 1;
}
}
можно встретить и такое
+167
http://habrahabr.ru/post/172015/
Наш клиент.
Не смотря на заголовок статьи, он упёрся в ограничение на количество параметров в функции.
+159
function validateForm(form){
if (isNotEmpty(form.fa)){
if (isColvo(form.fa,3)){
if (isNotEmpty(form.im)){
if (isColvo(form.im,2)){
if (isNotEmpty(form.ot)){
if (isColvo(form.ot,3)){
if(isNotEmpty(form.day)){
if(isNumbr(form.day)){
if(isNotEmpty(form.month)){
if(isNumbr(form.month)){
if(isNotEmpty(form.year)){
if (isColvo(form.year,4)){
if(isNumbr(form.year)){
if(isNotEmpty(form.city)){
if(isNotEmpty(form.road)){
if(isNotEmpty(form.house)){
if(isNumbr(form.house)){
return true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return false;
};
http://национальныйзакон.рф
+179
$.datepicker.formatDate('yy-mm-dd', new Date(2007, 1 - 1, 26));
Форматирование даты в жс. Без jQuery ясное дело не обойтись.
If you are already using jQuery UI in your project, you can use the built-in datepicker method for formatting your date object:
http://stackoverflow.com/a/7022296
Раз уж неделя стековерфловочки...
+155
//...
else if (data.indexOf('none') == -1)
{
// Экспорт в работе
// Повторять запрос раз в nSec секунд.
nSec = 3;
document.getElementById("export_loading").show();
setTimeout("loadFile({{subject_id}}, '')", nSec*1000);
}
//...
<div class='loader' id="export_loading" style="visibility: hidden; display: inline-block; text-align: center; margin-right: 13px;"><img src='/app/images/loading.gif'/> идёт формирование списка авторов</div>
<div id="messages_container" style="visibility: hidden; padding: 0px 30px 0 35px;">
</div>
Чувак вообще прикалывается)