- 1
setEvent((a,b,c){i=(a==this)?this:return document.getElementById(a);i.on+b=c}})
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+155.2
setEvent((a,b,c){i=(a==this)?this:return document.getElementById(a);i.on+b=c}})
+166.4
function InitializeSubmenu(submenucontainerid, tablecellroid, tablecellid, fname) {
var s = "";
s = s + "function " + fname + "() { ";
s = s + "document.getElementById(submenucontainerid).style.visibility='';";
s = s + "BringToFront(submenucontainerid);";
s = s + "}";
if ((index = navigator.userAgent.indexOf("MSIE")) >= 0)
s = s + "document.getElementById('" + tablecellid + "').attachEvent(\"onmouseover\", " + fname + ");";
else
s = s + "document.getElementById('" + tablecellid + "').addEventListener(\"mouseover\", " + fname + ", true);";
s = s + "document.getElementById(tablecellroid).onclick = function() {";
s = s + "if( document.createEvent ) {";
s = s + "var evObj = document.createEvent('MouseEvents');";
s = s + "evObj.initEvent( 'click', true, false );";
s = s + "document.getElementById(tablecellid).dispatchEvent(evObj);";
s = s + "} else if( document.createEventObject ) {";
s = s + "document.getElementById(tablecellid).fireEvent('onclick');";
s = s + "}";
s = s + "}";
eval(s);
}
Как говориться, "eval() is evil" :-)
http://stackoverflow.com/questions/197769/when-is-javascripts-eval-not-evil
+165.7
function sendClicked(F)
{
var binary = document.getElementById("binary");
var binary_file = binary.value;
var binary_len = binary_file.length;
if(binary_file == ""){
binary.focus();
alert('File name can not be empty !');
return false;
}
else {
if(binary_len<=4) {
binary.focus();
alert('File is wrong !');
return false;
}
if(binary_file.charAt(0) != '/') {
if(binary_file.charAt(1) != ':') {
binary.focus();
alert('File is wrong !!');
return false;
}
}
if(binary_file.charAt(binary_len-4) != '.') {
binary.focus();
alert('File is wrong !!');
return false;
}
if(binary_file.charAt(binary_len-3) != 'B') {
if(binary_file.charAt(binary_len-3) != 'b') {
binary.focus();
alert('File is wrong !!');
return false;
}
}
if(binary_file.charAt(binary_len-2) != 'I') {
if(binary_file.charAt(binary_len-2) != 'i') {
binary.focus();
alert('File is wrong !!');
return false;
}
}
if(binary_file.charAt(binary_len-1) != 'N') {
if(binary_file.charAt(binary_len-1) != 'n') {
binary.focus();
alert('File is wrong !!');
return false;
}
}
show_div(true, "progress_div");
progress();
return true;
}
}
</script>
Со странички обновления прошивки DWL-G700AP. Из-за этого говнокода прошивается только из internet explorer.
+154.4
function _patchManualImagesClasses() {
var images=document.getElementsByTagName('img');
var re0=/^image_image_\d+$/;
var re1=/^image_middle_\d+$/;
var re2=/^image_small_\d+$/;
for(var i=0; i<images.length; i++ ) {
var id=images[i].id;
if (re0.test(id) || re1.test(id) || re2.test(id) ) {
var _m=images[i];
var align=_m.getAttribute('align');
var iClass=_m.getAttribute('className');
if (iClass == null || iClass.length==0 ) {
iClass=_m.getAttribute('class');
};
if (iClass==null || iClass.length==0 ) {
_m.setAttribute('class', 'content_img_'+align);
_m.setAttribute('className', 'content_img_'+align);
};
};
};
};
function _patchManulImagesClasses() {
_patchManualImagesClasses();
};
Первая функция нужна только ради того, чтобы для картинок сделать 10px отступ через CSS. А вот вторая — понятия не имею зачем она написана. Причем, нигде на сайте _patchManulImagesClasses, конечно, не используется.
Господи, спасибо Тебе, что дал нам Джона Резига и jQuery!
+144.4
function ppc() {
};
Пипец :-)
+149.6
<script>
function _checkCommentsForm ()
{
return true;
};
</script>
<form ... onsubmit="_checkCommentsForm();">
...
<input type="submit" onclick="_checkCommentsForm();" onmousedown="_checkCommentsForm();">
</form>
Наверное, просто из функции что-то вырезали, но осталось хорошо :-)
+144
el.setAttribute('class', 'forum_alt_over');
el.setAttribute('className', 'forum_alt_over');
Господи, ну почему не просто el.className="forum_alt_over"; ?
+165.4
<script language="JavaScript">
function change_city()
{
document.getElementById("header_18").style.display='none';
document.getElementById("header_18_add").style.display='block';
document.getElementById("header_18_add").id='header_18'; //т.к. стили прописаны для id
}
</script>
</head>
<body>
<div id="mega_scroller">
<div id="mega_scroller">
document.getElementById("header_18_add") .id='header_18'; //т.к. стили прописаны для id
http://www.cinemapark.ru/ - гении делали
+155.7
if (document.all.input.req.value == "" ||
document.all.input.req.value=="" || //на всякий пожарный надо еще раз проверить - а вдруг!
document.all.input.req.value=="") //наверное автор решил что доверяй-но проверяй
{ document.all.input.req.value=""; }
нашел в 1 из заброшенных кемто проектов для 1 из сайтов
+152.9
function $(element, method) {
if (!method) {
return document.getElementById(element);
} else {
return {
node: $(element)
}
}
}