Created
May 5, 2009 08:28
-
-
Save azu/106892 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 元 script.js | FB2 [ http://oamaxa2.u-abel.net/wordpress/?p=255 ] | |
var nltools=function(){this.initialize.apply(this,arguments);}; | |
nltools.prototype={ | |
initialize:function(){ | |
//playerとそのpathの設定 | |
this.player=[ | |
{name:"Wrapper",path:"flvplayer_wrapper.swf"}, | |
{name:"Nicoplayer",path:"/swf/nicoplayer.swf"}, | |
{name:"New player",path:"/swf/new/nicoplayer.swf"} | |
]; | |
this.load(); | |
}, | |
load:function(){ | |
if($("tools")) return; | |
var self=this; | |
var table=document.createElement('table'); | |
table.id="tools"; | |
table.className="TXT12"; | |
table.cellPadding=0; | |
var addPoint=document.getElementById("mymemory_add_form"); | |
addPoint.parentNode.parentNode.insertBefore(table,addPoint.parentNode); | |
var tbody=document.createElement("tbody"); | |
table.appendChild(tbody); | |
var tr=document.createElement('tr'); | |
table.appendChild(tr); | |
var td_select=document.createElement('td'); | |
var select=document.createElement('select'); | |
select.className="TXT12"; | |
select.addEventListener('change',function(){ | |
var so=new SWFObject(select.value,"flvplayer","952","540","10",""); | |
var vars=["v","videoId","movie_type","wv_id","wv_title","thumbTitle","thumbDescription","player_version_xml"]; | |
for(var i=0; i<vars.length; i++){ | |
var VARS=eval("window.so.variables."+vars[i]); | |
if(!VARS) return; | |
so.addVariable(vars[i],VARS); | |
} | |
so.addVariable("noBanner","1"); | |
so.addVariable("noNicomesse","1"); | |
//mp4動画であればflashの画質を"低"にする。低スペック用。(要コメントアウト) | |
//if(window.so.variables.movie_type=='mp4') so.addParam("quality","low"); | |
so.addParam("allowScriptAccess","always"); | |
so.write("flvplayer_container"); | |
},false); | |
tr.appendChild(td_select); | |
for(var i=0; i<self.player.length; i++){ | |
var opt=document.createElement('option'); | |
opt.value=self.player[i].path; | |
opt.innerHTML=self.player[i].name; | |
select.appendChild(opt); | |
} | |
td_select.appendChild(select); | |
} | |
}; | |
function addEvent(elm, evType, fn, useCapture) { | |
if (elm.addEventListener) { | |
elm.addEventListener(evType, fn, useCapture); | |
return true; | |
} | |
else if (elm.attachEvent) { | |
var r = elm.attachEvent('on' + evType, fn); | |
return r; | |
} | |
else {//MacIE、Opera6、Netfront3.0、Netscape3 | |
elm['on' + evType] = fn; | |
} | |
} | |
addEvent(window,"load", function(){ | |
new nltools(); | |
} ,false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment