The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

YouTube playlist not displaying in forum preview mode

View previous topic View next topic Go down

Solved YouTube playlist not displaying in forum preview mode

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

Hey!

Since the last script changes on my forum (ref.: http://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

Guest
Guest


Back to top Go down

Solved Re: YouTube playlist not displaying in forum preview mode

Post by Guest on 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.

Guest
Guest


Back to top Go down

Solved Re: YouTube playlist not displaying in forum preview mode

Post by Ange Tuteur on 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
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: YouTube playlist not displaying in forum preview mode

Post by Guest on 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.

Guest
Guest


Back to top Go down

Solved Re: YouTube playlist not displaying in forum preview mode

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

Topic solved and archived


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


SLGray
Administrator
Administrator

Male Posts : 36663
Reputation : 2444
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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