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.

an other Script failed youtube embed Script

View previous topic View next topic Go down

Solved an other Script failed youtube embed Script

Post by Michael_vx on October 26th 2015, 1:16 pm

to be honest i did not start the Script from 0 i felt much lazy to start from 0
i find by luck an old Script that used the old links of youtube
i changed the links to the new youtube system but it did not work
now im a bit confused if the Script is correct or not
Code:
Query(function(){

  var ancho = "560";
  var alto = "315";
 
jQuery('.postbody a[href*="youtube.com/watch"]').each(function(){
      var ytid = jQuery(this).attr('href').split("?v=")[1].split("&")[0];                               
      jQuery(this).html("<iframe width="+ancho+" height="+alto+" src=https://www.youtube.com/embed/"+ytid+" frameborder=0 allowfullscreen></iframe><br>"); 
  });
});

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: an other Script failed youtube embed Script

Post by Ange Tuteur on October 26th 2015, 1:35 pm

Hi @Michael_vx,

It looks like you're missing a "j" on jQuery at the beginning. Try adding that in. Wink

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: an other Script failed youtube embed Script

Post by Michael_vx on October 26th 2015, 7:31 pm

i guess im getting more stupid Very Happy
i solved this one by your help again
Code:
jQuery(function(){

  var ancho = "560";
  var alto = "315";
 
  jQuery('.postbody a[href*="youtube.com/watch"]').each(function(){
      var ytid = jQuery(this).attr('href').split("v=")[1].split("&")[0];                               
      jQuery(this).html("<iframe width="+ancho+" height="+alto+" src=https://www.youtube.com/embed/"+ytid+" frameborder=0 allowfullscreen></iframe><br>"); 
  });
});
thanks wont be Enough

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: an other Script failed youtube embed Script

Post by SLGray on October 26th 2015, 7:38 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 : 36705
Reputation : 2445
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