youtube embed for ameblo 1st

    @@ -39,7 +39,8 @@ var txt = '<iframe width="' + width +'" height="' + height + '" src="//www.youtube.com/embed/' + video + '" frameborder="0" allowfullscreen</iframe>'; // document.location("http://blog.ameba.jp/ucs/entry/srventryinsertinput.do?entry_text="+txt); - window.open("http://www.yahoo.jp"); + alert("hoge"); + window.open("http://www.yahoo.co.jp"); // prompt("アメブロへのYoutubeの貼付\n\nCTRL+C や COMMAND + Cなどを押し\nクリップボードにコピーして下さい",txt); },
  • /*
     * @title youtube embed for ameblo 1st
     * @description Youtubeの動画をアメブロにうめこむ
     * @include http://www.youtube.com/watch*
     * @include https://www.youtube.com/watch*
     * @license MIT License
     * @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js 
     * 
     */
    
    (function(){
    function getUrlVars()
    {
        var vars = [], hash;
        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
        for(var i = 0; i < hashes.length; i++)
        {
            hash = hashes[i].split('=');
            vars.push(hash[0]);
            vars[hash[0]] = hash[1];
        }
        return vars;
    }
    
        var protocol = window.location.protocol;
        var oembed = protocol + '//www.youtube.com/oembed?url=';
        var video = getUrlVars()["v"];
        var youtube = protocol + '//www.youtube.com/watch?v=' + video;
        var url = oembed + youtube + '&format=json';
    
        $.ajax({
            url: url,
        }).then(
            function(data){
    
            var title = data.title;
            var height = data.height;
            var width = data.width;
            var txt = '<iframe width="' + width +'" height="' + height + '" src="//www.youtube.com/embed/' + video + '" frameborder="0" allowfullscreen</iframe>';
    
    //        document.location("http://blog.ameba.jp/ucs/entry/srventryinsertinput.do?entry_text="+txt);
           alert("hoge");
           window.open("http://www.yahoo.co.jp");
    //        prompt("アメブロへのYoutubeの貼付\n\nCTRL+C や COMMAND + Cなどを押し\nクリップボードにコピーして下さい",txt);
    
            },
    
            function(data){alert("アメブロへのYoutubeの貼付\n\n埋込許可が無いか他のエラーです");}
        );
    
        })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2013/11/20 01:02:58 - 2013-11-20
  2. 2013/11/20 00:43:04 - 2013-11-20
  3. 2013/11/20 00:08:35 - 2013-11-20
  4. 2013/11/20 00:02:25 - 2013-11-20
  5. 2013/11/19 23:40:44 - 2013-11-19
  6. 2013/11/19 23:34:40 - 2013-11-19
  7. 2013/11/19 23:33:40 - 2013-11-19
  8. 2013/11/19 23:23:49 - 2013-11-19
  9. 2013/11/19 23:18:39 - 2013-11-19
  10. 2013/11/19 23:16:38 - 2013-11-19