The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

YouTube playlist not displaying in forum preview mode

2 posters

Go down

Solved YouTube playlist not displaying in forum preview mode

Post by Guest March 3rd 2016, 6:36 pm

Hey!

Since the last script changes on my forum (ref.: https://help.forumotion.com/t146030-preview-latest-topics#1001565 ) the YouTube player isn't displaying correctly in preview mode (as a guest) no more. It only happens when clicking the preview topic symbol, tho.

Logged in: http://prntscr.com/aar1ld
Guest view: http://prntscr.com/aar33j

Looks a bit sloppy without the nice player, doesn't it? Should be something small and annoying in one of those JS we may have overlooked I guess. Anyway, help is appreciated @Ange Tuteur. Ty! Btw, if you need the player script I'll be PMing you with that one. Once again, it's copyrighted material.

Board version: phpBB3
Link to my ws: http://www.friendcodes.nl (http://fcnl.actieforum.com)

Sammy


Last edited by RoXaNNeX on March 7th 2016, 8:44 pm; edited 1 time in total
avatar
Guest
Guest


Back to top Go down

Solved Re: YouTube playlist not displaying in forum preview mode

Post by Guest March 6th 2016, 11:01 am

Sorry for bumping this one, eventhough I'm aware Ange's not around no more. I'm still stuck with this one.
avatar
Guest
Guest


Back to top Go down

Solved Re: YouTube playlist not displaying in forum preview mode

Post by Ange Tuteur March 6th 2016, 11:48 pm

Hey,

JavaScript executes client-side when the page is loaded, so when the page is retrieved via AJAX it gets the raw HTML without executed javascripts. You can bypass this little quirk by creating a function in the global namespace that can be reinvoked. Firstly, if the script is using jQuery's docready function, remove this at the very beginning of the script :
Code:
$(function() {

and this at the very end of the script :
Code:
});
( It may vary, but I'm trying to walk you through the modification without posting the code )

Next add this to the very beginning of the script :
Code:
function parseYoutubePlayer() {

and this to the very end :
Code:
};

Lastly change the placement of the script to "All pages" and save.


Almost done !! Create a new script "in the topics" ( or whatever the previous placement of the script was ) and paste this as the code :
Code:
if (window.parseYoutubePlayer) {
  $(parseYoutubePlayer);
}


Now edit the preview script and replace this :
Code:
$('#topicPreviewing').load($(this).siblings('a.topictitle, .table-title a').attr('href') + ($(this).siblings('a.topictitle')[0] ? ' .post:eq(0)' : ' .post:last'));

by :
Code:
$('#topicPreviewing').load($(this).siblings('a.topictitle, .table-title a').attr('href') + ($(this).siblings('a.topictitle')[0] ? ' .post:eq(0)' : ' .post:last'), function() {
  if (window.parseYoutubePlayer) {
    parseYoutubePlayer();
  }
});

after this you should be good. Very good
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: YouTube playlist not displaying in forum preview mode

Post by Guest March 7th 2016, 8:43 pm

Oh yeah!! This is exactly how I imagined how it should be after changing the preview dimensions as well. It's so fine now! Look @ that music topic preview going now. I'm falling in love with my own website over and over again lol. This is so darn good, it's absolutely fabulous!

Thanks a lot for your help without posting the original scripts, masta @Ange Tuteur Bow 2 ! Very good

Love,

Sammy.
avatar
Guest
Guest


Back to top Go down

Solved Re: YouTube playlist not displaying in forum preview mode

Post by SLGray March 7th 2016, 9:31 pm

Topic solved and archived


YouTube playlist not displaying in forum preview mode Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51569
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum