MediaWiki:BilibiliVideo.js

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
$(function() {
    $(".bvideo").each(function(i){
        var bvid = $(this).data("bvid");
        var aid = $(this).data("aid");
        var cid = $(this).data("cid");
        var page = $(this).data("page");
        var title = $(this).data("title");
        var width = $(this).data("width");
        var height = $(this).data("height");
        
        $("<iframe>").css({
            "width":width,
            "height":height,
            "margin":"0 10px;"
        }).attr({
            "max-width":"100%",
            "scrolling":"no",
            "border":"0",
            "frameborder":"no",
            "framespacing":"0",
            "allowfullscreen":"true",
            "src":`//player.bilibili.com/player.html?aid=${aid}&bvid=${bvid}&page=${page}&cid=${cid}&high_quality=1&crossDomain=1&autoplay=0`
        }).appendTo($(this));
    });
});