an other Script failed youtube embed Script

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>"); 
  });
});
avatar
Michael_vx
Forumember

Male Posts : 664
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
avatar
Ange Tuteur
Forumaster

Male Posts : 13195
Reputation : 2910
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

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
 
avatar
Michael_vx
Forumember

Male Posts : 664
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.

avatar
SLGray
Administrator
Administrator

Male Posts : 43061
Reputation : 3047
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Back to top


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