Re: pre - 2.8.9 logs
Posted: Sun Jul 14, 2024 6:33 am
Hello, but it is given by the same old extension you want to use
This line throw error that make it so fail all the subsequent JS code that run after on page.
It is easily solvable ifyou find out the file of this extension that inject into the DOM the code above, that run even when (i assume) there is not an image attached. So just a little addition of code to fix this would make the extension work fine.
PS
If you find out the file where the above is outputted into the extension code files, it probably should be changed into this to work (or something like, that check for the existence of the element before to execute code, not sure if this fix the issue, or do not let it fire at all even when there are attachments, in that case the code should be little modified to achieve the fact, that it should run only when really needed so to not cause an error):
/* Add resize attach in phpBB3.1 && Anvar bb3.mobi */
Code: Select all
<script type="text/javascript">
$(document).ready(function() {
/* Add resize attach in phpBB3.1 && Anvar bb3.mobi */
$('dl.thumbnail img, dt.attach-image img').load(function() {
var w = $(this).width();
var h = $(this).height();
var rh = $(this).height();
if (w > h) {
h = w;
w = w*(h/rh);
}
$(this).width(w*(2/3));
$(this).height(h*(2/3));
});
$('dl.thumbnail img, dt.attach-image img').each(function() {
var src = $(this).attr('src');
$(this).attr('src', '');
$(this).attr('src', src);
});
});
</script>
Code: Select all
$('dl.thumbnail img, dt.attach-image img').load(function() {
It is easily solvable ifyou find out the file of this extension that inject into the DOM the code above, that run even when (i assume) there is not an image attached. So just a little addition of code to fix this would make the extension work fine.
PS
If you find out the file where the above is outputted into the extension code files, it probably should be changed into this to work (or something like, that check for the existence of the element before to execute code, not sure if this fix the issue, or do not let it fire at all even when there are attachments, in that case the code should be little modified to achieve the fact, that it should run only when really needed so to not cause an error):
Code: Select all
<script type="text/javascript">
$(document).ready(function() {
/* Add resize attach in phpBB3.1 && Anvar bb3.mobi */
if($('dl.thumbnail img, dt.attach-image img').length){
$('dl.thumbnail img, dt.attach-image img').load(function() {
var w = $(this).width();
var h = $(this).height();
var rh = $(this).height();
if (w > h) {
h = w;
w = w*(h/rh);
}
$(this).width(w*(2/3));
$(this).height(h*(2/3));
});
$('dl.thumbnail img, dt.attach-image img').each(function() {
var src = $(this).attr('src');
$(this).attr('src', '');
$(this).attr('src', src);
});
}
});
</script>