« [TV]CSI:科学捜査班 シーズン7第158話「青春のあやまち」 | トップページ | [Form]アクセシビリティ・フォームPDFのアメリカの現状 »

[YouTube]Chromelessプレイヤータグ【AppleScript】

YouTubeのクロムレスプレイヤー用のタグを
AppleScriptで作ります。

Im00221123_73703

共有用URLから生成します。


display dialog "ShareからコピーしたURLを入力" default answer "" with icon 1 default button 2

set GetUrl to text returned of the result as Unicode text
set CntGetUrl to the length of characters of GetUrl
considering case
set cn to the offset of "v=" in GetUrl
end considering
set Vid to characters (cn + 2) thru (cn + 12) of GetUrl as Unicode text


set h_width to "570" as number
set v_hight to (h_width / 16 * 9) as integer



set HTMLtag to "" as Unicode text
set HTMLtag to HTMLtag & "<script src=\"http://www.google.com/jsapi\" type=\"text/javascript\"></script>" & return as Unicode text
set HTMLtag to HTMLtag & "<script type=\"text/javascript\" charset=\"utf-8\">google.load(\"swfobject\", \"2.2\");</script>" & return as Unicode text
set HTMLtag to HTMLtag & "<div id=\"videoDiv\">Loading...</div> " & return as Unicode text
set HTMLtag to HTMLtag & "<script type=\"application/javascript\" language=\"javascript\"> " & return as Unicode text
set HTMLtag to HTMLtag & "function updateHTML(elmId, value) {" & return as Unicode text
set HTMLtag to HTMLtag & "document.getElementById(elmId).innerHTML = value;}" & return as Unicode text
set HTMLtag to HTMLtag & "function onYouTubePlayerReady(playerId) {" & return as Unicode text
set HTMLtag to HTMLtag & "ytplayer = document.getElementById(\"ytPlayer\");" & return as Unicode text
set HTMLtag to HTMLtag & "ytplayer.cueVideoById(\"" & Vid & "\");}" & return as Unicode text
set HTMLtag to HTMLtag & "function loadPlayer() {" & return as Unicode text
set HTMLtag to HTMLtag & "var params = { allowScriptAccess: \"always\" };" & return as Unicode text
set HTMLtag to HTMLtag & "var atts = { id: \"ytPlayer\" };" & return as Unicode text
set HTMLtag to HTMLtag & "swfobject.embedSWF(\"http://www.youtube.com/apiplayer?\" +" & return as Unicode text
set HTMLtag to HTMLtag & "\"enablejsapi=1&version=3&enablejsapi=1&playerapiid=player1\", " & return as Unicode text
set HTMLtag to HTMLtag & "\"videoDiv\", \"" & h_width & "\", \"" & v_hight & "\", \"10.0.0\", null, null, params, atts);}" & return as Unicode text
set HTMLtag to HTMLtag & "function _run() {" & return as Unicode text
set HTMLtag to HTMLtag & "loadPlayer();}" & return as Unicode text
set HTMLtag to HTMLtag & "google.setOnLoadCallback(_run);" & return as Unicode text
set HTMLtag to HTMLtag & "</script> " & return as Unicode text



display dialog "タグが出来ましたコピーしてください" default answer HTMLtag with icon 1 default button 1


「Chromeless.zip」をダウンロード


「Chromeless.html」をダウンロード

|

« [TV]CSI:科学捜査班 シーズン7第158話「青春のあやまち」 | トップページ | [Form]アクセシビリティ・フォームPDFのアメリカの現状 »

YouTube」カテゴリの記事

コメント

この記事へのコメントは終了しました。