for (var i in a[0]) { console.log(i); }
function filterClasses(str) {
var classes = str.split(' ');
var new_classes = [];
for (var i = 0, length = classes.length; i < length; i++) {
if (classes[i].substring(0, 3) == 'js_') {
continue;
}
new_classes.push(classes[i]);
}
return new_classes.join(' ');
}
var str = 'js_class1 js_1first sex_woman sp it_b_woman js_disable js_stylerForm';
alert( filterClasses(str) );
$img_width = '';
$img_height = '';
$grid_num = '';
$settings = array(
array(
'indexes' => array(2, 4, 5, 11, 13, 14, 15, 16, 20, 21, 23, 24, 25, 27, 28, 31, 32, 35, 36, 38, 39, 41),
'img_width' => 100,
'img_height' => 100,
'grid_num' => 1
),
array(
'indexes' => array(1, 3, 7, 8, 9, 10, 12, 17, 19, 22, 26, 29, 30, 34, 37, 42),
'img_width' => 400,
'img_height' => 500,
'grid_num' => 2
),
array(
'indexes' => array(6, 18, 33, 40),
'img_width' => 430,
'img_height' => 240,
'grid_num' => 3
)
);
foreach ($settings as $setting) {
if (array_search($count_block, $setting['indexes']) !== false) {
$img_width = $setting['img_width'];
$img_height = $setting['img_height'];
$grid_num = $setting['grid_num'];
break;
}
}
$numbArr["450_500"] = array(1,6,7,15,46,20);
$numbArr["100_100"] = array(5,20);
$numbArr["430_420"] = array(7,20);
if(in_array($count_block,$numbArr["450_500"])){
$img_width = '400';
$img_height = '500';
$grid_num = '2';
}elseif(in_array($count_block,$numbArr["100_100"])){
$img_width = '100';
$img_height = '100';
$grid_num = '1';
}elseif(in_array($count_block,$numbArr["430_420"])){
$img_width = '430';
$img_height = '240';
$grid_num = '3';
}