17,55 → 17,67 |
$scripts = " |
<script type='text/javascript'> |
(function($){ |
// очищаем select |
$.fn.clearSelect = function() { |
return this.each(function(){ |
if(this.tagName=='SELECT') { |
this.options.length = 0; |
$(this).attr('disabled','disabled'); |
} |
}); |
} |
// заполняем select |
$.fn.fillSelect = function(dataArray) { |
return this.clearSelect.each(function(){ |
if(this.tagName=='SELECT') { |
var currentSelect = this; |
$.each(dataArray,function(index,data) { |
var option = new Option(data.text,data.value); |
if($.support.cssFloat) { |
currentSelect.add(option,null); |
} else { |
currentSelect.add(option); |
} |
}); |
} |
}); |
} |
// очищаем select |
$.fn.clearSelect = function() { |
return this.each(function(){ |
if(this.tagName=='SELECT') { |
this.options.length = 0; |
$(this).attr('disabled','disabled'); |
} |
}); |
} |
// заполняем select |
$.fn.fillSelect = function(dataArray) { |
return this.clearSelect().each(function(){ |
if(this.tagName=='SELECT') { |
var currentSelect = this; |
$.each(dataArray,function(index,data){ |
var option = new Option(data.text,data.value); |
if($.support.cssFloat) { |
currentSelect.add(option,null); |
} else { |
currentSelect.add(option); |
} |
}); |
} |
}); |
} |
})(jQuery); |
</script> |
<script type='text/javascript'> |
$(document).ready(function(){ |
// выбор дистрибутива |
function chooseDist() { |
var distValue = $('#dist').val(); |
var tmpSelect = $('#version'); |
if(distValue.length == 0) { |
tmpSelect.attr('disabled','disabled'); |
tmpSelect.clearSelect(); |
chooseVersion(); |
} else { |
$.getJSON('./request.php',{d:distValue,status:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); chooseVersion(); }); |
} |
}; |
// выбор версии дистрибутива |
function chooseVersion() { |
var distValue = $('#dist').val(); |
var versValue = $('#version').val(); |
if(distValue != 0 && versValue !=0 ) { |
$.get('./request.php',{d:distValue,v:versValue,status:2},function(data){ chooseReps(); }); |
} |
}; |
// выбор дистрибутива |
function chooseDistro(){ |
var distValue = $('#dist').val(); |
var tmpSelect = $('#version'); |
if(distValue.length == 0) { |
tmpSelect.attr('disabled','disabled'); |
tmpSelect.clearSelect(); |
chooseVersion(); |
$('#replist').css('display','none'); |
$('#getfile').css('display','none'); |
} else { |
$.getJSON('./request.php',{d:distValue,step:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); chooseVersion(); }); |
$('#replist').css('display','none'); |
$('#getfile').css('display','none'); |
} |
}; |
// Выбор версии дистрибутива |
function chooseVersion(){ |
var distValue = $('#dist').val(); |
var versionValue = $('#version').val(); |
if (distValue != 0 && versionValue != 0) { |
$.get('./request.php',{d:distValue,v:versionValue,step:2},function(data){ $('#replist').css('display','block'); $('#replist').html(data); }); |
$.get('./request.php',{d:distValue,v:versionValue,step:3},function(data){ $('#getfile').css('display','block'); $('#getfile').html(data); }); |
} else { |
$('#replist').css('display','none'); |
$('#getfile').css('display','none'); |
} |
} |
|
$('#dist').change(chooseDistro); |
$('#version').change(chooseVersion); |
|
}); |
</script> |
"; |