- 1
- 2
- 3
for (i = 1; i < <?php echo count($prog[1])?>; i++){
if (document.getElementById('module'+i).checked)
module_tmp= Math.abs($('#module'+i).val())+module_tmp;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+159
for (i = 1; i < <?php echo count($prog[1])?>; i++){
if (document.getElementById('module'+i).checked)
module_tmp= Math.abs($('#module'+i).val())+module_tmp;
+158
// create singelton object, see below
function singelton(classDesc) {
return classDesc;
}
var LetterTypeAction = singelton(
{
selectLetterType : function(controlId, index) {
letterTypeManager.selectLetterType(controlId, index);
},
addLetterType : function() {
letterTypeManager.addLetterType();
},
saveLetterType : function() {
var tempLetterType = new LetterTypeDef();
tempLetterType.setId(currentLetterType.getId());
tempLetterType.setAbbreviation(TextUtils.trim(ControlUtils.getValueById(letterTypeAbbrId)));
tempLetterType.setDescription(TextUtils.trim(ControlUtils.getValueById(letterTypeDescrId)));
letterTypeManager.saveLetterType(tempLetterType);
},
changeLetterType : function() {
letterTypeManager.changeLetterType();
},
deleteLetterType : function() {
letterTypeManager.deleteLetterType(currentLetterType);
},
cancelLetterType : function() {
letterTypeManager.cancelLetterType();
},
sortLetterType : function(columnId) {
letterTypeManager.sortLetterType(columnId);
}
}
);
новый паттерн проектирования, добавляющий в код мусор
+177
function yap(){
return function(){
yap();
}
}
Вот такое оно, функциональное програмирование
+165
function trim(str) {
str = str.replace(/^\s\s*/, '');
let ws = /\s/;
let i = str.length;
while (ws.test(str.charAt(--i)));
return str.slice(0, i + 1);
}
Очень суровый товарищ.
Посмотреть: https://addons.mozilla.org/ru/firefox/files/browse/106116 (bootstrap.js)
Если вдруг будет откорректировано, вот нужная версия: https://addons.mozilla.org/ru/firefox/addon/264089/versions/0.3.7.3
P.S. let: https://developer.mozilla.org/en/JavaScript/Reference/Statements/let
+160
// http://www.domw.net/js.js
function open(name){
document.getElementById(name).style.display = ''
}
// http://www.domw.net/
<a href="http://lite.webim.ru/decoda/webim/client.php?locale=ru" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 && window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open('http://lite.webim.ru/decoda/webim/client.php?locale=ru', 'webim', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=600,height=420,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;" style="font-size:14px;padding-left:30px;color:#A77934">Нашли ошибку?</a>
+166
function isArray(o) {
return Object.prototype.toString.call(o) === '[object Array]';
}
ЖИСТОКЕ
+173
function isNullorUndefined(val) {
var u;
return ((u === val) || (val == null));
}
Из онлайн примеров одного разработчика элементов интерфейса (за большие бабки продают между прочим).
+153
this.exec = function(code,op){
op = op || 0;
for(cp=0;cp<code.length;cp++){
if(code[cp]=='op'){this.stack.push(op)}
else if(code[cp].isNumber){this.stack.push(parseFloat(code[cp]))}
else if(this.vars[code[cp]] != undefined){this.stack.push(this.vars[code[cp]])}
else if(this.refs[code[cp]] != undefined){this.call(code[cp])}
else if(this.mathOp.oneOf(code[cp])){this.mathOp(code[cp])}
else if(code[cp] == '->'){cp++;this.vars[code[cp]]=this.stack.pop();}
}
}
Еще один говнокод из моего известного некоторым особо внимательным личностям проекта
+160
var vk = {
al: parseInt('2') || 4,
intnat: '' ? true : false,
lang: 0,
rtl: parseInt('') || 0,
version: 1029,
zero: false
}
parseInt('2') || 4 — для чего это? Выдаст же 2.
+158
$(this).parents('#orig').clone().appendTo('#main');
Клонирование элементов формы