Created
July 20, 2010 16:36
-
-
Save azu/483198 to your computer and use it in GitHub Desktop.
nm動画をロードしたらwrapperに変えるフィルタ
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
Event.observe(window, "DOMContentLoaded", function() { | |
// 下のタグが含まれていた場合は自動でwrapperに変えない | |
var lists = ["音楽", "東方自作アレンジ"]; | |
var w = window, | |
document = w.document, | |
t = w.Video.title; | |
var flvplayer = $("flvplayer"); | |
if (flvplayer.src.indexOf("flvplayer_wrapper") == -1) { | |
var tags = w.Video.tags; | |
for (var i = 0, l = tags.length; i < l; i++) { | |
for (var j = 0, m = lists.length; j < m; j++) { | |
if (lists[j] == tags[i]) { | |
return; | |
} | |
} | |
} | |
var loadRatio = setInterval(function() { | |
if (gm_playlistController.playlist.id == "alter") { | |
document.title = t; | |
clearInterval(loadRatio); | |
} | |
var ratio = flvplayer.ext_getLoadedRatio(); | |
if (!ratio) return; | |
else if (ratio < 1) document.title = "(" + (ratio * 100 | 0) + "% loaded) " + t; | |
else if (ratio == 1) { | |
chplyr(); | |
document.title = "○" + t; | |
clearInterval(loadRatio); | |
} | |
}, | |
1000); | |
} | |
function chplyr() { | |
var so = new SWFObject("flvplayer_wrapper.swf", "flvplayer", "952", "510", "10", ""); | |
for (var i in window.so.variables) { | |
so.addVariable(i, window.so.variables[i]); | |
} | |
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"); | |
//if(window.so.variables.movie_type=='mp4') so.addParam("quality","low"); | |
so.addParam("allowScriptAccess", "always"); | |
so.write("flvplayer_container"); | |
} | |
},false); |
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
[Replace] | |
Name = Wrapper replace.jsJavaScript埋め込み | |
URL = www.nicovideo.jp/watch/nm | |
Require = so\.addVariable\("movie_type", "swf" | |
Match< | |
</body> | |
> | |
Replace< | |
<script type="text/javascript" charset="utf-8" src="/local/Nicocache_wrapper_replace.js"></script> | |
</body> | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment