YouTubeリンク作成 幅指定&テキストリンク&はてブ数付き

    @@ -22,7 +22,7 @@ var html = '<iframe width="' + userWidth + '" height="' + userHeight +'" src="http://www.youtube.com/embed/' + url + '" frameborder="0" allowfullscreen></iframe>'; - html += "'<br /><a href="http://www.youtuve.com/watch?v=' + url + '" target="_blank">' + title + '</a>'; + html += '<br /><a href="http://www.youtuve.com/watch?v=' + url + '" target="_blank">' + title + '</a>'; html += '<a href="http://b.hatena.ne.jp/entry/http://www.youtube.com/watch?v=' + url + '" target="_blank" rel="nofollow"><img src="http://b.hatena.ne.jp/entry/image/http://www.youtube.com/watch?v=' + url + '" alt="" style="border:none" /></a>';
  • /*
     * @title YouTubeリンク作成 幅指定&テキストリンク&はてブ数付き
     * @description YouTubeリンク 幅指定&テキストリンク&はてブ数付き - 幅指定したい。テキストリンク入れたい。はてなブックマークの登録数入れたい。YouTubeへのリンク作成をカンタンにするブックマークレット。
     * @include http://*
     * @license MIT License
     * @require 
     * @private
     * @require jQuery
     */
    
    var url    = $("meta[name='twitter:player']").eq(0).attr("content").match(/embed\/(.*)/);
    var width  = $("meta[name='twitter:player:width']").eq(0).attr("content");
    var height = $("meta[name='twitter:player:height']").eq(0).attr("content");
    var title  = $("meta[name='title']").eq(0).attr("content");
    url    = RegExp.$1; 
    
    var userWidth = window.prompt("width", "450");
    
    if (userWidth){
    
      var userHeight = Math.floor(userWidth / width * height); 
    
      var html = '<iframe width="' + userWidth + '" height="' + userHeight +'" src="http://www.youtube.com/embed/' + url + '" frameborder="0" allowfullscreen></iframe>';
    
      html += '<br /><a href="http://www.youtuve.com/watch?v=' + url + '" target="_blank">' + title + '</a>'; 
    
      html += '<a href="http://b.hatena.ne.jp/entry/http://www.youtube.com/watch?v=' + url + '" target="_blank" rel="nofollow"><img src="http://b.hatena.ne.jp/entry/image/http://www.youtube.com/watch?v=' + url + '" alt="" style="border:none" /></a>';
    
      window.prompt("copy this code!", html);
    
    }
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2013/04/24 22:05:39 - 2013-04-24
  2. 2013/04/23 22:56:35 - 2013-04-23
  3. 2013/04/23 22:56:04 - 2013-04-23
  4. 2013/04/23 22:49:25 - 2013-04-23