FC2動画のアメブロ記事への貼り付け | リアナのカスタマイズ日記(CSS編集用デザイン)

リアナのカスタマイズ日記(CSS編集用デザイン)

アメブロ 新CSS CSS編集用デザイン 無料
カスタマイズ アメブロカスタマイズ 初心者
CSS スタイルシート デザイン
javascript jQuery

★ FC2動画のアメブロ記事への貼り付け


● 内容

① FC2動画はフリープラグインには貼り付けられますが、記事には
  貼り付けられません。
  この記事では記事に貼りつける方法を紹介します。

② 私のブログでは、スクリプトを記事に貼る方法の記事を紹介していますが、
  その記事の方法で行うとスクリプト上エラーが出るようですので、違う方法を
  この記事で紹介します。

③ FC2動画をフリープラグインに貼った後に、その動画の <script>タグ部分を
 FirefoxのブラウザのFirebugの機能を使ってコピーして、その内容を
 変換する必要があります。

● やり方

① 下記変換フォームでスクリプトを変換して、記事やメッセージボードや
  フリースペースへ貼る。

・ スクリプトの例


<script src="http://static.fc2.com/video/js/outerplayer.min.js" url="http://video.fc2.com/ja/content/20131006TPspbrf4/" tk="TlRJMk5UYzNNemM9" tl="ぞんびのしょーん" sj="27" d="5960" w="448" h="224" charset="UTF-8"></script>





 スクリプトスクリプト内容に入れて、タグ変換をクリックしてください。
 結果が表示されますので、変換されたタグをHTMLモードで記事や
 メッセージボードやフリースペースへ貼ってください。

 この変換では、href=http://ameblo.jp/★ の部分は取り除いています。
 (必要でないと思われるので)





② 下記をフリープラグインへ追加します


<script type='text/javascript' src='http://stat100.ameba.jp/blog/js/apm001.js'></script>
<script type="text/javascript" src="http://usrcss.ameblo.jp/skin/templates/6d/7d/10030757386.css"></script>
<script type="text/javascript">
NG_tag_change_fc2v();
</script>

● 実例(400×224)






● ソースの内容

① 変換フォームのソースコード

<div class="NG_tag_area" style="display: none;"> &lt;form name=&quot;NG_tag_fc2v_chg&quot;&gt;&lt;fieldset&gt;&lt;legend&gt;★ 禁止タグ用変換(FC2動画)&lt;/legend&gt;◆ スクリプト内容     &lt;textarea name=&quot;NG_tag_fc2v_chg_in&quot; cols=&quot;60&quot; rows=&quot;90&quot; style=&quot;height:150px;overflow:auto;font-size:12px;width:470px;&quot;&gt;&lt;/textarea&gt;&lt;input type=&quot;button&quot; name=&quot;NG_tag_fc2v_go&quot; value=&quot;タグ変換&quot; onClick=&quot;NG_tag_fc2v_Create()&quot;&gt;&lt;input type=&quot;reset&quot; name=&quot;NG_tag_reset&quot; value=&quot;リセット&quot;&gt;&lt;textarea name=&quot;NG_tag_chg_out&quot; cols=&quot;60&quot; rows=&quot;90&quot; style=&quot;height:150px;overflow:auto;font-size:12px;width:470px;&quot;&gt;結果&lt;/textarea&gt;&lt;/fieldset&gt;&lt;/form&gt;</div>


② 変換フォームの実行関数( NG_tag_fc2v_Create() )

function NG_tag_fc2v_Create(){
$(document).ready(function(){
var script_str = document.NG_tag_fc2v_chg.NG_tag_fc2v_chg_in.value;
var fc2v_url_w = script_str.substring(script_str.indexOf('url="')+5,script_str.indexOf('"',script_str.indexOf('url="')+5));
var fc2v_url_w2 = fc2v_url_w.substring(fc2v_url_w.indexOf('ja/content/')+11,fc2v_url_w.length-1);
var fc2v_url = 'http://video.fc2.com/flv2.swf?i='+fc2v_url_w2;
var fc2v_tk = script_str.substring(script_str.indexOf('tk="')+4 ,script_str.indexOf('"',script_str.indexOf('tk="')+4));
var fc2v_tl = script_str.substring(script_str.indexOf('tl="')+4 ,script_str.indexOf('"',script_str.indexOf('tl="')+4));
var fc2v_sj = script_str.substring(script_str.indexOf('sj="')+4 ,script_str.indexOf('"',script_str.indexOf('sj="')+4));
var fc2v_d = script_str.substring(script_str.indexOf('d="')+3 ,script_str.indexOf('"',script_str.indexOf('d="')+3));
var fc2v_width = script_str.substring(script_str.indexOf('w="')+3 ,script_str.indexOf('"',script_str.indexOf('w="')+3));
var fc2v_height = script_str.substring(script_str.indexOf('h="')+3 ,script_str.indexOf('"',script_str.indexOf('h="')+3));
var fc2v_html = "";
fc2v_html += '<div style="display: none;" class="NG_tag_area_fc2v">';
fc2v_html += '<div style="width: '+fc2v_width+'px;height: '+fc2v_height+'px">';
fc2v_html += '&lt;object width=&quot;'+fc2v_width+'px&quot; align=&quot;middle&quot; height=&quot;'+fc2v_height+'px&quot; id=&quot;flv2&quot; wmode=&quot;transparent&quot; codebase=&quot;';
fc2v_html += 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot;&gt;&lt;param value=&quot;sameDomain&quot; name=&quot;allowScriptAccess&quot;&gt;&lt;param value=&quot;';
fc2v_html += fc2v_url+'&amp;d=3085&amp;movie_stop=off&amp;no_progressive=1&amp;otag=1&amp;sj='+fc2v_sj+'&amp;rel=1&amp;lang=ja&amp;tk='+fc2v_tk+'&amp;';
fc2v_html += 'tl='+fc2v_tl+'&quot; name=&quot;movie&quot;&gt;&lt;param value=&quot;high&quot; name=&quot;quality&quot;&gt;&lt;param value=&quot;#ffffff&quot; name=&quot;bgcolor&quot;&gt;&lt;param value=&quot;true&quot; name=&quot;allowFullScreen&quot;&gt;&lt;embed width=&quot;100%&quot; align=&quot;middle&quot; height=&quot;100%&quot; allowfullscreen=&quot;true&quot; pluginspage=&quot;';
fc2v_html += 'http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;sameDomain&quot; name=&quot;flv2&quot; wmode=&quot;transparent&quot; bgcolor=&quot;#ffffff&quot; quality=&quot;high&quot; src=&quot;';
fc2v_html += fc2v_url+'&amp;d='+fc2v_d+'&amp;movie_stop=off&amp;no_progressive=1&amp;otag=1&amp;sj='+fc2v_sj+'&amp;rel=1&amp;lang=ja&amp;tk='+fc2v_tk+'&amp;tl='+fc2v_tl;
fc2v_html += '&quot;&gt;&lt;/object&gt;</div></div>';
document.NG_tag_fc2v_chg.NG_tag_chg_out.value=fc2v_html;
});
}


③ NG_tag_change_fc2v() 関数のソースコード

function NG_tag_change_fc2v(){// 記事・メッセージボードの禁止タグを防ぐ(FC2 Video)
$(document).ready(function(){
$(".NG_tag_area_fc2v").each(function(){
var NG_tag_datax=$(this).html();
var NG_tag_data=NG_tag_datax.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/<br>/g,"").replace(/<BR>/g,"");
$(this).html(NG_tag_data).css("display","block");
});
});
}