json {'img'=>full_image_url, 'tumb'=>tumb_image_url}
<img src=tumb_image_url @click=showImage(full_image_url)>
Вариантов вывода несколько
"resizeImageGet", которая при первом вызове сжимает и обрезает изображение
array(
"LOGIC"=>"OR",
array ("IBLOCK_ID" => 1, 'PROPERTY_PROPNAME' => $propValue),
array ("IBLOCK_ID" => 11, 'PROPERTY_PROPNAME' => $propValue),
array ("IBLOCK_ID" => 99, 'PROPERTY_PROPNAME' => $propValue),
)
window.addEventListener('scroll', function() {
var myBlock = document.getElementById('myBlock');
var scrollPosition = window.scrollY + window.innerHeight;
var blockPosition = myBlock.offsetTop + myBlock.offsetHeight;
if (scrollPosition >= blockPosition) {
window.scrollTo(0, blockPosition - window.innerHeight);
}
});
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["Reindex"] == "Y") {
@set_time_limit(0);
$res = CSearch::ReIndexAll(
$bFull, COption::GetOptionInt("search", "max_execution_time"), $NS, $_REQUEST["clear_suggest"] === "Y"
);
if (is_array($res)):
?>
<script>
CloseWaitWindow();
DoNext(<?echo $jsNS?>);
</script>
<?php
else:
?>
<script>
CloseWaitWindow();
EndReindex();
var search_message = BX('search_message');
if (search_message)
search_message.style.display = 'none';
</script>
<?php
endif;
}
function DoNext(NS) {
var queryString = 'Reindex=Y'
+ '&lang=<?echo htmlspecialcharsbx(LANG)?>';
...
ShowWaitWindow();
BX.ajax.post(
'search_reindex.php?' + queryString,
NS,
function (result) {
document.getElementById('reindex_result_div').innerHTML = result;
var href = document.getElementById('continue_href');
if (!href) {
CloseWaitWindow();
StopReindex();
}
}
);
return false;
}
$(document).ready(function() {
$('div br').replaceWith('\n');
var text = $('div').text().trim();
$('pre').text(text);
});
$(document).ready(function() {
var text = $('div').html().trim().replace("<br>", "\n").replace("<p>", "").replace("</p>", "");
$('pre').text(text);
});
$(document).ready(function() {
var text = $('div').clone().find("br").replaceWith("\n").end().text().trim(); // clone чтоб документ не портить
$('pre').text(text);
});
Проект на Laravel 9, на сервере установлен PHP 7.4. Что могло пойти не так?
const classes = {
Class1: class {
constructor(val) {
this.val = val;
}
method1() {
console.log('Class1', this.val);
}
},
Class2: class {
constructor(val1, val2) {
this.val1 = val1;
this.val2 = val2;
}
method2() {
console.log('Class2', this.val1, this.val2);
}
},
};
function createInstanceAddCallMethod(className, constructorParams, methodName) {
const instance = new classes[className](...constructorParams);
instance[methodName]();
}
createInstanceAddCallMethod('Class1', [ 69 ], 'method1');
createInstanceAddCallMethod('Class2', [ 187, 666 ], 'method2');
const A = class { constructor() { this.name = 'I am A';} };
const B = class { constructor() { this.name = 'I am Bee';} };
const allClasses = { A, B };
const className = 'A';
const instance = new allClasses[className]();
console.log(instance.name); // I am A