URL: https://www.opennet.me/cgi-bin/openforum/vsluhboard.cgi
Форум: vsluhforumID3
Нить номер: 35861
[ Назад ]

Исходное сообщение
"Каталог Программ: JavaScript::Squish - Reduce/Compact JavaScript code to as few characters as possible. "

Отправлено auto_prog , 30-Окт-06 15:36 
Модуль для оптимизации размера JavaScript кода, убирая комментарии и сокращая длину переменных.

URL: http://search.cpan.org/dist/JavaScript-Squish/
Обсуждается: http://www.opennet.me/prog/info/3032.shtml


Содержание

Сообщения в этом обсуждении
"LsV"
Отправлено Foo , 30-Окт-06 15:36 
function checkAllFields(ref) {
    var chkAll = document.getElementById('checkAll');
    var checks = document.getElementsByName('reset[]');
    var removeButton = document.getElementById('removeChecked');
    var boxLength = checks.length;
    var allChecked = false;
    var totalChecked = 0;
    if ( ref == 1 ) {
        if ( chkAll.checked == true ) {
            for ( i=0; i < boxLength; i++ ) {
                checks[i].checked = true;
            }
        } else {
            for ( i=0; i < boxLength; i++ ) {
                checks[i].checked = false;
            }
        }
    } else {
        for ( i=0; i < boxLength; i++ ) {
            if ( checks[i].checked == true ) {
                allChecked = true;
                continue;
            } else {
                allChecked = false;
                break;
            }
        }
        if ( allChecked == true ) {
            chkAll.checked = true;
        } else {
            chkAll.checked = false;
        }
    }
    for ( j=0; j < boxLength; j++ ) {
        if ( checks[j].checked == true ) {
            totalChecked++;
        }
    }
    removeButton.value = "Nulstil ["+totalChecked+"] markeret";
}

"JavaScript::Squish - Reduce/Compact JavaScript code to as few characters as possible. "
Отправлено mehman , 13-Ноя-09 22:17 
function checkAllFields(ref) {
var chkAll = document.getElementById('checkAll');
var checks = document.getElementsByName('reset[]');
var removeButton = document.getElementById('removeChecked');
var boxLength = checks.length;
var allChecked = false;
var totalChecked = 0;
if ( ref == 1 ) {
if ( chkAll.checked == true ) {
for ( i=0; i < boxLength; i++ ) {
checks[i].checked = true;
}
} else {
for ( i=0; i < boxLength; i++ ) {
checks[i].checked = false;
}
}
} else {
for ( i=0; i < boxLength; i++ ) {
if ( checks[i].checked == true ) {
allChecked = true;
continue;
} else {
allChecked = false;
break;
}
}
if ( allChecked == true ) {
chkAll.checked = true;
} else {
chkAll.checked = false;
}
}
for ( j=0; j < boxLength; j++ ) {
if ( checks[j].checked == true ) {
totalChecked++;
}
}
removeButton.value = "Nulstil ["+totalChecked+"] markeret";
}