JavaScript
$('.button').click(function(){
calculator.init();
});
calculator = {
_properties: {
codec: [
{
name: 'mjpeg',
title: 'MJPEG',
ratio: 1,
bpp: 0.15
},
{
name: 'mpeg4',
title: 'MPEG4',
ratio: 0.4,
bpp: 0.15
},
{
name: 'h264',
title: 'H.264',
ratio: 0.2,
bpp: 0.15
}
],
resolution: [
{
name: 'cif',
title: 'CIF',
width: 352,
height: 288
},
{
name: 'vga',
title: 'VGA',
width: 640,
height: 480
},
{
name: '4cif',
title: '4CIF',
width: 704,
height: 576
},
{
name: 'd1',
title: 'D1',
width: 720,
height: 576
},
{
name: 'hd',
title: 'HD Ready',
width: 1280,
height: 720
},
{
name: 'sxga',
title: 'SXGA',
width: 1280,
height: 1024
},
{
name: 'fhd',
title: 'Full HD',
width: 1920,
height: 1080
}
],
fps: {
min: 3,
max: 25
},
color: [
{
name: 'mono',
title: 'Чернобелый',
ratio: 0.5
},
{
name: 'multi',
title: 'Цветной',
ratio: 1
}
]
},
init: function() {
this._summary = $('<span/>').addClass('summary');
$('#calculator').html(this._summary);
this._rows = {};
this.count = 0;
this.addRow();
$('<a/>').text('Добавить строку').addClass('button').attr('href', '#').on('click', function() {
calculator.addRow();
return false;
}).appendTo('#calculator');
},
getList: function(name) {
var list = null, item = null, i = 0,
select = null, option = null;
if (this._properties[name] && this._properties[name].length) {
list = this._properties[name];
select = $('<select/>');
while (item = list[i++]) {
select.append('<option value="' + item.name + '">' + item.title + '</option>');
}
return select;
}
return false;
},
getValue: function(list, name) {
var item = null, i = 0;
if (this._properties[list]...