var html = '<div class="box"><strong><!-- comment-->Яблоко<!-- /comment--></strong>Текст текст тектс<!-- comment-->Груша<!-- /comment-->Текст текст</div>';
var arr = html.match(/<!-- comment-->(.*?)<!-- \/comment-->/g).map(function(val){
return val.replace(/<!-- \/?comment-->/g,'');
});
console.log(arr);
owl.trigger('refresh.owl.carousel');
function navbar(){
if( $("#nav").height() == 800 ){
$("#nav").height('0px');
}else{
$("#nav").height('800px');
}
}
// PHP
$db =&JFactory::getDBO();
$query = 'SELECT * FROM `#__virtuemart_countries` WHERE virtuemart_country_id >= "1" AND virtuemart_country_id <= "30"';
$db->setQuery($query);
$result = $db->loadObjectList();
$si = [];
$sk = [];
foreach($result as $row) {
$si[$row->virtuemart_country_id] = $row->country_3_code;
$sk[$row->virtuemart_country_id] = $row->country_3_code;
};
// JS
jQuery(function($) {
$('body').on('change', '#virtuemart_country_id', function() {
var ssnull = '',
s = {
i: <?php echo json_encode($si) ?>,
k: <?php echo json_encode($sk) ?>,
},
selector = {
i: $('#inn_field'),
k: $('#kpp_field'),
}
val = $(this).val();
if (val == 0) {
selector.i.val($ssnull);
selector.k.val($ssnull);
return;
}
$.each(s, function(key, data) {
$.each(data, function(index, value) {
if(val == index + 1) {
selector[key].val(value);
}
});
});
});
});
$fileUrl = isset($get['file']) ? $get['file'] : null;
$filePath = ($fileUrl) ? $_SERVER['DOCUMENT_ROOT'] . '/' . $fileUrl ? null;
if (file_exists($filePath)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($filePath);
}
location.href = "скрипт.php?file=image/img.jpg";
$.ajax({
url: "getme.php?id=<?=$_GET['id']?>",
cache: false,
success: function(html){
$("#meblock").html(html);
if($(html).find('> div').hasClass('.response')){
$('html, body').animate({
scrollTop: $(".down").offset().top
}, 2000);
}
}
});