Common overall_footer.html js questions help

User avatar
axew3
w3all User
w3all User
Posts: 2852
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: pre - 2.8.9 logs

Post by axew3 »

Hello, but it is given by the same old extension you want to use
/* 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() {
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):

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>
User avatar
Ezrael
User www
User www
Posts: 95
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

Re: pre - 2.8.9 logs

Post by Ezrael »

The mention Plugin is causing an error message which I started to ignore but it's not causing the issue! I deactivated the extension, merged the cache and deleted the browser cache. The issue was still there.
User avatar
axew3
w3all User
w3all User
Posts: 2852
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: pre - 2.8.9 logs

Post by axew3 »

I see that you are using a custom extension that add a popup, be more explicit about this next time.

i assume that to fix your problem so, you need to change the code that reposition others default phpBB popups, adding to it the specific one, in this case
#bbcode_wizard for the div to be repositioned, and .abbc3_button that's the class of all the editor buttons
so change this into the overall_footer.html added code

Code: Select all

// Lightbox scroll fix, #phpbb_confirm scroll fix, #phpbb_alert scroll fix
$(".postimage,.dropdown-contents li a,#add_files").on("click", function(e) {
  var g = $($(this.getBoundingClientRect().top));
  var t = parseInt(g[Object.keys(g)[0]]);
  $("#phpbb_alert,#phpbb_confirm,#lightbox").animate({top: t+'px'}, 100);
});
into

Code: Select all

// Lightbox scroll fix, #phpbb_confirm scroll fix, #phpbb_alert scroll fix
$(".abbc3_button,.postimage,.dropdown-contents li a,#add_files").on("click", function(e) {
  var g = $($(this.getBoundingClientRect().top));
  var t = parseInt(g[Object.keys(g)[0]]);
  $("#bbcode_wizard,#phpbb_alert,#phpbb_confirm,#lightbox").animate({top: t+'px'}, 100);
});
User avatar
Ezrael
User www
User www
Posts: 95
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

Re: pre - 2.8.9 logs

Post by Ezrael »

Code: Select all

// Lightbox scroll fix, #phpbb_confirm scroll fix, #phpbb_alert scroll fix
$(".abbc3_button,.postimage,.dropdown-contents li a,#add_files").on("click", function(e) {
  var g = $($(this.getBoundingClientRect().top));
  var t = parseInt(g[Object.keys(g)[0]]);
  $("#bbcode_wizard,#phpbb_alert,#phpbb_confirm,#lightbox").animate({top: t+'px'}, 100);
});
This solved an issue which I didn't mean. If I subscribe or unsubscribe a topic the message still didn't show up at the bottom.
Attachments
Screenshot 2024-07-15 at 19.03.43.png
Screenshot 2024-07-15 at 19.03.43.png (38.01 KiB) Viewed 315 times
User avatar
axew3
w3all User
w3all User
Posts: 2852
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Common overall_footer questions help

Post by axew3 »

then change into

Code: Select all

// Lightbox scroll fix, #phpbb_confirm scroll fix, #phpbb_alert scroll fix
$(".dropdown-contents-cp,.abbc3_button,.postimage,.dropdown-contents li a,#add_files").on("click", function(e) {
  var g = $($(this.getBoundingClientRect().top));
  var t = parseInt(g[Object.keys(g)[0]]);
  $("#bbcode_wizard,#phpbb_alert,#phpbb_confirm,#lightbox").animate({top: t+'px'}, 100);
});
unfortunately the coder of the extension or theme changed the default .dropdown-contents selector into .dropdown-contents-cp so it need to be added into the jQuery onclick, while the popup that it fire in this case is phpBB default #phpbb_alert, so it's not required any other addition into the second animate jQuery.
User avatar
Ezrael
User www
User www
Posts: 95
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

Re: Common overall_footer.html js questions help

Post by Ezrael »

Perfect! Now everything is working like it should
Post Reply