CONTENTS


Lastmodified 2013-11-02 (土) 15:29:26


Vimeoを貼り付けたい

http://sns.openpne.jp/classic/communityTopic/8642

以下のコードを「vimeo.com.js」というファイル名で保存します。

コードの提供、şë×ï様 ありがとう御座います。


// Copyright (c) 2012, s-e-x-i 
// The PHP License, version 3.01
 function url2cmd(url) {
 if (!url.match(/^http:\/\/vimeo\.com\/([0-9]+)/)) {
 try { pne_url2a(url); } catch(e) { document.write('<a href="'+url+'" target="_blank">'+url+'</a>'); }
 return;
 }
 var id = RegExp.$1;
 var width = 470;
 var height = 265;
 main(id, width, height);
 }

 function main(id, width, height) {
 if (!id.match(/^[0-9]+$/)) {
 return;
 }
 if (!width) width = 0; else width = parseInt(width);
 if (!height) height = 0; else height = parseInt(height);
 if (width <= 0 || width > 470) {
 width = 470;
 }
 if (height <= 0 || height > 265) {
 height = 265;
 }
 var html = '<iframe src="http://player.vimeo.com/video/'
 + id
 + '" width="'
 + width
 + '" height="'
 + height
 + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
 document.write(html);
 }

2)保存した「vimeo.com.js」というファイルを、

 a)OpenPne 2 系

  public_html/cmd/ へ設置

 b)OpenPne 3 系

  web/cmd/ へ設置

3)以上の操作で日記などで

 
 http://vimeo.com/xxxxxxxx ←番号

と記述すれば、Vimeoの小窓が表示されます。

追加

OpenPne 2系で、右端が少しはみ出すようでしたので、

コード中の幅の指定 470px を 445pxへ変更すると、丁度良い様です。

以上


Total access 1730:本日 3:昨日 0

Counter: 1730, today: 3, yesterday: 0

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS