- 1
- 2
- 3
- 4
var IE = '\v'=='v';
if(IE) {
// тут пишем обработчик для IE броузера
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+168
var IE = '\v'=='v';
if(IE) {
// тут пишем обработчик для IE броузера
}
Самый короткий способ определения браузера IE (влючая IE.8)
+156
if ($('#stoykaKS').is(':checked')) /* 29 */
{wt.document.writeln('<div style=" position: absolute; top: 0; left: 0;"><img src="../images/stories/esd-classic/picstoykaKS.gif" /></div>');}
if ($('#stolUS01').is(':checked')) /* 8 */
{wt.document.writeln('<div style=" position: absolute; top: 0; left: 0;"><img src="../images/stories/esd-classic/picstolUS01.gif" /></div>');}
if ($('#perfoPFPX').is(':checked')) /* 21 */
{wt.document.writeln('<div style=" position: absolute; top: 0; left: 0;"><img src="../images/stories/esd-classic/picperfoPFPX.gif" /></div>');}
И так далее, несколько сотен строк.
+161
function timer() {
var t=new Date();
var sec=t.getSeconds();
var min=t.getMinutes();
var h=t.getHours();
var day=t.getDate();
var month=t.getMonth();
var year=t.getFullYear();
var d, y, m, allday, allhour, allmin, allsec;
if (year>2010) {
if (month===8) {
if (day===14) {
if (h===13) {
if (min<7) {y=year - 2011}
if (min>6) {y=year - 2010}
} else {
if (h<13) {y=year - 2011}
if (h>13) {y=year - 2010}
}
} else {
if (day<14) {y=year - 2011}
if (day>14) {y=year - 2010}
}
} else {
if (month<8) {y=year - 2011}
if (month>8) {y=year - 2010}
}
}
if (month===8) {
if (day===14) {
if (h===13) {
if (min===7) {
m=''
} else {
if (min<7) {m=month + 3}
if (min>7) {m=''}
}
} else {
if (h<13) {m=month + 3}
if (h>13) {m=''}
}
} else {
if (day<14) {m=month + 3}
if (day>14) {m=''}
}
} else {
if (month>-1 && month<8) {
if (day===14) {
if (h===13) {
if (min===7) {
m=month + 4
} else {
if (min<7) {m=month + 3}
if (min>7) {m=month + 4}
}
} else {
if (h<13) {m=month + 3}
if (h>13) {m=month + 4}
}
} else {
if (day<14) {m=month + 3}
if (day>14) {m=month + 4}
}
} else {
if (day===14) {
if (h===13) {
if (min===7) {
m=month - 8
} else {
if (min<7) {m=month - 9}
if (min>7) {m=month - 8}
}
} else {
if (h<13) {m=month - 9}
if (h>13) {m=month - 8}
}
} else {
if (day<14) {m=month - 9}
if (day>14) {m=month - 8}
}
}
}
if (day===14) {
if (h===13) {
if (min<7) {d=''}
if (min>6) {d=''}
} else {
if (h<13) {d=''}
if (h>13) {d=''}
}
}
if (day>14 && day<32) {
if (h===13) {
if (min<7) {d=day - 15}
if (min>6) {d=day - 14}
} else {
Счетчик к определённой дате, ну код естественно не весь) Писалось при изучении js почти 2 года назад)
+151
if(typeof console == 'object' && typeof console.log == 'function'){
log = console.log.bind(console);
}
else log = function(attr){}
+149
if(self.el.actions.length==2){
Prototypes.MenuFunctions[self.el.actions[0].name].call(self);
}
Сегодня утром написал.
+156
var empty = true;
_.each(records, function (val, key) {
if (records.hasOwnProperty(key)) {
empty = false;
}
});
изза того что в прототипы стандартных Object и Array напихали всяких методов типа .max .each приходится так проверять объект на пустоту)
+168
<script>
var ROOT = '/';
if (ROOT == '/')
ROOT = '';
</script>
+156
var renderHours = function(s){
var html = '<ul>';
var json = Ext.decode(s);
for(i in json)
if(typeof json[i].from_d != 'undefined')
html += '<li>с <b>'
+ hours[json[i].from_d][1]
+ '</b> - по <b>'
+ hours[json[i].to_d][1]
+ '</b> ('
+ json[i].from_h +':'+ json[i].from_m +'-'
+json[i].to_h +':'+ json[i].to_m +')</li>';
return html+'</ul>';
};
Вот такое попалось
+155
element.data('selected') ? element.show() : $.noop();
Либо человек из ассемблера пришел, либо "IF" сильно ему по жизни насолил.
+155
switch(navigator.appName) {
case "Microsoft Internet Explorer":
Key = "event.ctrlKey && event.keyCode == 13";
document.onkeydown = get_key;
break;
case "Netscape":
Key = "(e.modifiers == 2 && e.which == 10) || (e.ctrlKey && e.which == 13)";
document.captureEvents(Event.KEYDOWN);
document.onkeydown = get_key;
break;
}
}
function get_key(e) {
if (eval(Key)) {
if (check_postform()){
check_submit();
document.postform.submit();
submit_once(document.postform);
} else {return false}
}
http://forum.ixbt.com/