跳转到内容

MediaWiki:Common.js:修订间差异

来自猎空书评百科
无编辑摘要
标签已被回退
标签替换 手工回退
 
第1行: 第1行:
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
// 用于对CardSelectTr表格进行筛选排序 引用自星穹轨道WIKI
/*
/*
// 筛选按钮表格
* This is the JS for all skins (for both mobile and desktop) on MediaWiki.org.
*/
* Consider whether you can use a gadget with one of the options set to limit
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
* where it is loaded. See [[Extension:Gadgets#Options]].
// 判断是否触摸屏幕,强制设置ua
*/
  if (navigator.maxTouchPoints && navigator.maxTouchPoints > 2) {
/* global mw, $ */
    Object.defineProperty(navigator, 'userAgent', {
/**
      value: navigator.userAgent.replace('Macintosh', 'ipadpro'),
* Hide prefix in category
      writable: false
*
     });
* @source https://www.mediawiki.org/wiki/Snippets/Hide_prefix_in_category
  };
* @rev 5
*/
var prefix = $.trim( $( '#mw-cat-hideprefix' ).text() ) || ( mw.config.get( 'wgTitle' ) + '/' );
$( '#mw-pages' ).find( 'a' ).text( function ( i, val ) {
     return val.slice( 0, prefix.length ) === prefix ? val.slice( prefix.length ) : val;
} );


$(function() {
/**
//解决手机上按键选项hover效果不消失的问题
* @source https://www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
* @revision 2017-05-16
*/
//筛选页面列表筛选
mw.loader.using( ['mediawiki.util'], function () {
$('.filter li').on('mouseenter touchstart',function(e) {
var extraCSS = mw.util.getParamValue( 'withCSS' ),
$(this).children().addClass('hover');
extraJS = mw.util.getParamValue( 'withJS' ),
});
extraModule = mw.util.getParamValue( 'withModule' );
 
$('.filter li').on('mouseleave touchend',function(e) {
if ( extraCSS ) {
$(this).children().removeClass('hover');
// WARNING: DO NOT REMOVE THIS "IF" - REQUIRED FOR SECURITY (against XSS/CSRF attacks)
});
if ( /^MediaWiki:[^&<>=%#]*\.css$/.test( extraCSS ) ) {
mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraCSS ) + '&action=raw&ctype=text/css', 'text/css' );
$('.filter li').on('click',function(e) {
$(this).siblings().children().removeClass('active');
$(this).children().toggleClass('active');
var item = new Array();
$('.filter').find('.active').parent().each(function() {
var data_type = $(this).parent().attr('data-type');
item.push("[data-param" + data_type + "='" + $(this).attr("data-value") + "']");
});
if(item.length != 0) {
$('#wiki_table tbody').children().hide(400);
$('#wiki_table tbody').children(item.toString().replace(/,/g, '')).show(300);
//$('#wiki_table tbody').children().not(item.toString().replace(/,/g, '')).hide(1000);
} else {
} else {
$('#wiki_table tbody').children().show(300);
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
}
}
});
});
$(function InitCardSelect() {
var self = {};
var selectOptions; //所有筛选按钮
var filters = {}; //当前筛选规则
var filterKeys = []; //所有筛选Key
var showAll = true; //不筛选,显示全部
var tableRows; //所有要被筛选的行
var computedRows; //筛选后的行
var $sorter; //当前进行排序的表头
var sortDesent = false; //反向排序
function isNil(s) {
return s === '' || s === undefined || s === null || s === false
}
}
 
//点击筛选按钮时
if ( extraJS ) {
function OnSelectOptionClick(e) {
// WARNING: DO NOT REMOVE THIS "IF" - REQUIRED FOR SECURITY (against XSS/CSRF attacks)
var $x = e.data;
if ( /^MediaWiki:[^&<>=%#]*\.js$/.test( extraJS ) ) {
e.preventDefault();
mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraJS ) + '&action=raw&ctype=text/javascript' );
var label = '['+$.trim($x.text())+'] 筛选';
console.time(label);
//显示全部
if ($x.FilterKey == 0) {
for (i in selectOptions) {
selectOptions[i].Select = false;
selectOptions[i].removeClass('selected');
}
filters = {};
showAll = true;
//更新表格
self.FilterRows();
console.timeEnd(label);
return;
}
showAll = false;
var select = !$x.Select;
$x.Select = select;
//变更筛选状态
var key = $x.FilterKey;
filters[key] = filters[key] || {};
var opt = $x.FilterOpt == "AND" ? "AND" : "OR";
filters[key][opt] = filters[key][opt] || [];
if (select) {
filters[key][opt].push($x.FilterValue);
} else {
} else {
filters[key][opt] = filters[key][opt].filter(function(x) {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
return x !== $x.FilterValue;
});
if (filters[key][opt].length < 1) delete filters[key][opt];
}
}
select ? $x.addClass('selected') : $x.removeClass('selected');
self.FilterRows();
console.timeEnd(label);
}
}
 
if ( extraModule ) {
function OnHeaderSortClick(e) {
if ( /^ext\.gadget\.[^,\|]+$/.test( extraModule ) ) {
var $x = e.data;
mw.loader.load( extraModule );
e.preventDefault();
var label = '['+$.trim($x.text())+'] 排序';
console.time(label);
if ($sorter !== $x) {
//第一次:新的排序
$sorter = $x;
sortDesent = false;
} else if (!sortDesent) {
//第二次:切换排序
sortDesent = true;
} else {
} else {
//第三次:不进行排序
mw.notify( 'Only gadget modules are allowed.', { title: 'Invalid withModule value' } );
$sorter = null;
}
}
self.SortRows();
console.timeEnd(label);
}
}
//初始化
self.Init = function () {
selectOptions = $('.cardSelectOption').toArray().map(function(x) {
var $x = $(x);
var dataOption = $.trim($x.data('option'));
var dataGroup = $.trim($x.data('group'));
if (isNil(dataOption) || isNil(dataGroup)) return $x;
var splt = dataOption.split('|');
$x.FilterKey = dataGroup;
$x.FilterValue = $.trim(splt[1]);
$x.FilterOpt = $.trim($x.data('opt') || 'OR').toUpperCase();
if (filterKeys.indexOf(dataGroup) < 0)
filterKeys.push(dataGroup);
$x.click($x, OnSelectOptionClick);
return $x;
});
//$head = $('#CardSelectTabHeader');
tableRows = $('#CardSelectTr>tbody>tr').toArray().map( function(x) {
var $x = $(x);
//if (x == $head[0]) continue;
for (i in filterKeys) {
var key = filterKeys[i];
var val = $x.data('param'+key);
if (val === undefined) continue;
if (typeof val == 'number'){
val = val.toString(10);
}
var splt = val.split(',');
for (j in splt) {
var s = $.trim(splt[j]);
if (!isNil(s)) {
$x.FilterData = $x.FilterData || {};
$x.FilterData[key] = $x.FilterData[key] || [];
$x.FilterData[key].push(s);
}
}
}
return $x;
});
//computedRows = tableRows.concat([]);
$('#CardSelectTr>thead>tr>th').each(function(index, x) {
var $x = $(x);
$x.off('click').off('mousedown');
if ($x.hasClass('headerSort')) {
$x.Index = index;
//$x.SortKey = $x.data('group');
$x.click($x, OnHeaderSortClick);
}
});
}
//t1中包含t2中所有项
function includeAll(t1, t2) {
for (i in t2) {
if (t1.indexOf(t2[i]) < 0) return false;
}
return true;
}
//t1中包含t2中的任一项
function includeAny(t1, t2) {
if (t2.length == 0) return true;
for (i in t2) {
if (t1.indexOf(t2[i]) > -1) return true;
}
return false;
}
//使用show/hide来显示表格行
self.FilterRows = function() {
if (showAll) {
filters = {};
}
$('#CardSelectTr>tbody').hide();
for (var idx in tableRows) {
var $x = tableRows[idx];
var data = $x.FilterData;
var hide = false;
for (key in filters) {
hide = !data || !data[key];
if (!hide && filters[key]['AND']) {
hide = !includeAll(data[key],filters[key]['AND']);
}
if (!hide && filters[key]['OR']) {
hide = !includeAny(data[key],filters[key]['OR']);
}
if (hide) break;
}
if (!hide != !$x.Hide) {
$x.Hide = hide;
hide ? $x.hide() : $x.show();
}
}
$('#CardSelectTr .headerSort').removeClass('headerSortDown headerSortUp');
$('#CardSelectTr>tbody').show();
$sorter = null;
}
function grabSortData($tr, index) {
$tr.SortData = $tr.SortData || [];
if ($tr.SortData[index] !== undefined) return $tr.SortData[index];
var td = $tr.children('td')[index];
if (!td) {
$tr.SortData[index] = -1;
return -1;
}
var text = $.trim(td.textContent);
$tr.SortData[index] = text;
return text;
}
//对行排序,不显示的行会被移除
self.SortRows = function() {
//var residues = [];
if (!$sorter) {
computedRows = tableRows.filter(function($x) { return !$x.Hide; });
$('#CardSelectTr .headerSort').removeClass('headerSortDown headerSortUp');
}
else if (!sortDesent) {
var index = $sorter.Index;
computedRows = tableRows.filter(function($x) { return !$x.Hide; });
computedRows.sort(function compareFunction($x, $y) {
var x = grabSortData($x, index);
var y = grabSortData($y, index);
var nx = + x;
var ny = + y;
return (isNaN(nx) || isNaN(ny))
? isNaN(nx) && isNaN(ny)
? x < y ? -1 : 1
: isNaN(nx) ? 1 : -1 //字符串排后
: nx === ny
? 0
: nx < ny ? -1 : 1; //数值小的排前
//console.log (`${x} ~ ${y} => ${ret}`);
//return ret;
});
$('#CardSelectTr .headerSort').removeClass('headerSortDown headerSortUp');
$sorter.addClass('headerSortDown');
}
else {
computedRows.reverse();
$('#CardSelectTr .headerSort').removeClass('headerSortDown headerSortUp');
$sorter.addClass('headerSortUp');
}
$('#CardSelectTr>tbody').hide()
.prepend(computedRows)
.show();
}
$('.cardSelectOption').off('click').off('mousedown');
if ($('#CardSelectTabHeader').parent().is('tbody')){
$('#CardSelectTr').prepend( $('<thead/>').append($('#CardSelectTabHeader')));
}
self.Init();
console.log('CardSelectTr.js Initialized.');
return self;
});
/*筛选结束*/
/* -- 为页面加载JS脚本或CSS样式表 -- */
/* 参见[[模板:ResourceLoader]]*/
/* 来源:碧蓝航线WIKI*/
$('.resourceLoader').each(function() {
var $x = $(this);
var text = $.trim($x.text());
if (!text) return;
//加载模块
if ($x.data('isModule') == true)
return mw.loader.load(text);
//自动补充MediaWiki命名空间
var ns = text.match('^.*?:');
if (!ns) text = 'MediaWiki:' + text;
//加载CSS样式表
var mime = ($x.data('mime') || "text/javascript").toLowerCase();
if (mime == "text/css") {
if (text.slice(-4).toLowerCase() !== '.css') text = text + '.css';
//if ($x.data('debug') !== true) text = text + '&debug=false';
return mw.loader.load("//wiki.biligame.com"+mw.config.values.wgScriptPath+"/index.php?title="+text+"&action=raw&ctype=text/css", "text/css");
}
//加载JS脚本
if (ns && ns[0].toLowerCase() !== 'mediawiki:') {
return console.log('ResourceLoader: 不允许加载MediaWiki以外的js脚本');
}
if (text.slice(-3).toLowerCase() !== '.js') text = text + '.js';
//if ($x.data('debug') !== true) text = text + '&debug=false';
return mw.loader.load("//wiki.biligame.com"+mw.config.values.wgScriptPath+"/index.php?title="+text+"&action=raw&ctype=text/javascript", "text/javascript");
});
//音频事件
$('.audio-controls').click(function () {
    var audio = $(this).parent().find('audio').get(0);
    var controlBtn = $(this).find('.icon-btn');
    audio.addEventListener('ended', function() {
      audio.currentTime = 0;
      audio.pause();
      controlBtn.removeClass('icon-pause').addClass('icon-play');
    }, false); // 监听播放完成事件
    // 改变暂停/播放icon
    if (audio.paused) {
      audio.play();
      controlBtn.removeClass('icon-play').addClass('icon-pause');
    } else {
      audio.pause();
      controlBtn.removeClass('icon-pause').addClass('icon-play');
    }
  })
 
 
/* ==Popover弹出框== */
//找到Bootstrap初始化的jQuery
function getjQuery(jquery) {
        var x = [jquery, $, window.$, window.jQuery];
        var _j = window.$;
       
        for (var i = 0; i < 4; i++) {
                var j = x[i];
                if (j && j.fn) {
                        if (typeof j.fn.popover == 'function')
                                return j;
                        j.noConflict();
                        j = window.$;
                        window.$ = _j;
                        if (j && j.fn && typeof j.fn.popover == 'function')
                                return j;
                }
        }
        throw('getjQuery:未能找到Bootstrap初始化的jQuery');
}
$(function() {
        var $ = getjQuery();
       
        $('[data-toggle="wafer-popover"]').popover({
                container: false,
                content: function() {
                        var $c = $(this);
                        var content = '<p class="head">' + ($c.data('head') || '详细信息') + '</p>'
                                                + '<p>' + $c.data('text') + '</p>';
                        return content;
                },
                html: true,
                placement: 'auto bottom',
                template:
'<div class="popover wafer-popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>',
                trigger: 'hover'
        }).find('a').attr('title','');
});
/* --Popover弹出框-- */
/* == 加载Bikit == */
try { mw.loader.load('//wiki.biligame.com/wiki/MediaWiki:Bikit.js?action=raw&ctype=text/javascript');} catch(e) {}
/* -- 加载Bikit -- */
/* 技术处理外链 来源:异星工厂WIKI */
$("a").each(function(){
  url=$(this).attr("href");
  if(typeof(url)!="undefined"){
key=["game.bilibili.com","space.bilibili.com","wiki.biligame.com","qun.qq.com"];
var status=false;
key.forEach(function(k){
    status=url.replace(/^.+linkfilter\/\?url=https*:\/\/([^\/]+).*$/ig, "$1").indexOf(k)>=0||status;
});
url=status?url.replace(/^.+linkfilter\/\?url=(.+)/g, "$1"):url;
$(this).attr("href",url);
  }
});
});
//编辑器插件SmartClick引入
$(function(){
mw.loader.load("//wiki.biligame.com" + mw.util.wikiScript("") + "?title=MediaWiki:SmartClick.js&action=raw&ctype=text/javascript", "text/javascript");
console.log("SmartClick.js initialized!");
});
/* 优化版本差异,爱来自 编辑组 Lu 39886146 */
mw.loader.load("/tools/MediaWiki:DiffTool.js?action=raw&ctype=text/javascript&rand=", "text/javascript");
/* 切换标签套娃修复 */
$(".resp-tabs .resp-tabs-list .bili-list-style").unbind("click").click(function() {
    $(this).addClass("active").siblings().removeClass("active");
    var e = $(this).index();
    $(this).parents(".resp-tabs").eq(0).children(".resp-tabs-container").children(".resp-tab-content").eq(e).show().siblings().hide(),
    $(".resp-accordion-handle").hide()
})
/* ==雷达图== */
if ($('div[data-type="canvas"]')[0]) {
mw.loader.load("https://wiki.biligame.com/blhx/index.php?title=MediaWiki:Info.js&action=raw&ctype=text/javascript");
}
/* --雷达图-- */
(function(){
function IsPC(){
        var userAgentInfo = navigator.userAgent;
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
        var flag = true;
        for (var v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }
        }
        return flag;
    }
    if(IsPC()){
        pc_check();
    }
function pc_check(){
    //卡牌展示
function imgShow(){
var imgs=document.getElementById('img-box');
if (!imgs) return;
var imgList=imgs.getElementsByTagName('ul')[0].getElementsByTagName('li');
var p=document.getElementById('p-btn');
var n=document.getElementById('n-btn');
var imgBtn=document.getElementById('img-btn');
var btnList=imgBtn.getElementsByTagName('li');
var iNub=0;
var times=null;
addBtn();
//add
function addBtn()
{
for(var i=0;i<imgList.length;i++)
{
var addLi=document.createElement('li');
imgBtn.appendChild(addLi);
};
}
for(var j=0;j<btnList.length;j++)
{
btnList[0].className='sel';
btnList[j].index=j;
btnList[j].onclick=show;
}
imgs.onmouseover=function()
{
clearInterval(times);
}
imgs.onmouseout=function(){
times=setInterval(function(){
next();
},2000);
}
//下一个
n.onclick=next;
//上一个
p.onclick=function(){
iNub=iNub-1;
if(iNub<0){
iNub=btnList.length-1;
}
soll();
}
//tab
function show(){
for(var j=0;j<btnList.length;j++){
btnList[j].className='';
imgList[j].className='';
this.className='sel';
imgList[this.index].className='show';
iNub=this.index;
}
}
//next
function next(){
iNub=iNub+1;
if(iNub>=btnList.length){
iNub=0;
}
soll();
}
//soll
function soll()
{
for(var i=0;i<btnList.length;i++){
btnList[i].className="";
imgList[i].className="";
}
btnList[iNub].className="sel";
imgList[iNub].className="show";
}
times=setInterval(function(){next();},2000);
}
imgShow();
/* 图片轮播 */
    if ($('#pic-ctrl span').length > 1 && $('#pic-ctrl span').length == $('.pic-box').length) {
        setLoop();
        $('.pic').hover(function(){clearInterval(itimer)}, function(){setLoop()});
        $('#pic-ctrl span').each(function(e){
            $(this).mouseover(function(){changePicFocus(e);})
        })
    }
            var iidx=null;
    function changePicFocus(idx) {
        $('#pic-ctrl span').removeClass().eq(idx).addClass('current');
        $('.pic-box').hide().eq(idx).show();
        iidx = idx;
    };
    //图片滑过显示下方提示
    function hoverImage(){
$('.imageSlider').mouseover(function(){
$(this).children('span').stop().animate({'height':'26px'},200);
})
$('.imageSlider').mouseout(function(){
$(this).children('span').stop().animate({'height':'0px'},200);
})
}
    function setLoop() {
        itimer = setInterval(function(){
            iidx==$('#pic-ctrl span').length-1 ? iidx=0 : iidx++;
            changePicFocus(iidx);
        }, 2000);
    };
};
})();
/* --趣味测试-- */
(function(){
var mod={
    events:null,
    //pc返回true
    IsPC:function(){ 
        var userAgentInfo=navigator.userAgent; 
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"); 
        var flag = true; 
        for (var v = 0; v < Agents.length; v++) { 
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } 
        } 
        return flag; 
    },       
    int:function(submitBtn){
        mod.sub=submitBtn;
        if(mod.IsPC()){
            mod.events='click';
        }else{
            mod.events='touchstart';
            document.getElementsByTagName('body')[0].style.minWidth='100px';
        };
        mod.checks();
    },
    checks:function(){
        var ev=mod.events,
            btn=mod.sub;
$('.input-lg').attr('contenteditable','true');
//禁止按回车键时换行
$('.detection-text').on("keydown",function(e){
var keyCode=0,e=e||event;
if (e.keyCode == 13){
e.preventDefault();
}
});
//禁止按回换行
        btn.on(ev,function(){
            var vals=$.trim($('.input-lg').text());
            if(vals===''){
                $('.result').html('');
                $('.result').html('<h3>请您输入要诊断的内容</h3>');
            }else{
          var len=$('#data span').length-1;     
          if(len<0){
                alert('页面标签错误');
                return false;
            }       
            var newurl = '/'+window.wgWikiname+"/joyme_api.php?action=InterestTesting";
            $.ajax({
                  url:newurl,
                  type:"get",
                  async: false,
                  data:{"vals":vals,"len":len},
                  success:function(msg){
                            var data = eval('(' + msg + ')');
                            if(data['rs']==1){
                                    $('.result').html('');
                                    var title=$('#data span').eq(data['result']).attr('title');
                                    img_url=$('#data span').eq(data['result']).attr('data-img');
                                    url=$('#data span').eq(data['result']).attr('data-url');
                                    var html='<span>'+vals+title+'</span><a href="'+url+'"><img src="'+img_url+'"></a>';
                                    $('.result').html(html); 
                            }else{
                                    alert('程序异常');
                            }
                  }
              })
            }
        });
    }
};
mod.int($('.submit'));
/* --趣味测试end-- */
/* --分享-- */
var bdshareurl = window.location.href;
var bdsharepic = $('#bdsharepic img').attr('src');
var bdsharetitle = document.title;
bdsharedesc = $('#bdsharedesc').html();
$('.bdsharebuttonbox').html('<a href="#" class="bds_qzone" data-cmd="qzone"></a><a href="#" class="bds_tsina" data-cmd="tsina"></a><a href="#" class="bds_tqq" data-cmd="tqq"></a><a href="#" class="bds_renren" data-cmd="renren"></a><a href="#" class="bds_weixin" data-cmd="weixin"></a><a href="#" class="bds_tieba" data-cmd="tieba"></a>');
window._bd_share_config = {
common : {
bdText : bdsharetitle,
bdDesc : bdsharedesc,
bdUrl : bdshareurl,
bdPic : bdsharepic
},
share : [{
"bdSize" : 16
}],
}
with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
})();
/* --分享end-- */
// quickview
var qvel = document.querySelectorAll(".msquickview");
var qvitem = "";
for (var i = 0; i < qvel.length; i++) {
qvel[i].addEventListener(    "mouseenter",    function () {      msqv(this);    },    false  );
qvel[i].addEventListener(    "mousemove",    function () {      msqvmove(this);    },    false  );
qvel[i].addEventListener(    "mouseleave",    function () {      msqvhide(this);    },    false  );
}
function msqv(a) {
var qvigp = a.children;
for (var i = 0; i < qvigp.length; i++) {
if (qvigp[i].className == "msqvitem") {
qvitem = qvigp[i];
break;
}
}
qvitem.style.display = "block";
}
function msqvmove(a) {
var qvb = event || window.event;
if (window.innerWidth <= qvb.clientX + qvitem.clientWidth + 10)
    {qvitem.style.right ="5px";qvitem.style.left ="unset";}
else
    {qvitem.style.left = qvb.clientX + 5 + "px";qvitem.style.right ="unset";};
qvitem.style.top = qvb.clientY + 5 + "px";
  // console.clear();
  // console.log(window.innerWidth);
  // console.log("悬浮物宽度"+qvitem.clientWidth);
  // console.log(document.body.clientWidth - qvitem.clientWidth+"差值");
  // console.log(qvb.clientX);
  // console.log(qvb.clientX + qvitem.clientWidth - 5);
}
//position:fixed;clientXY=窗口位置;pageXY=文档位置;
function msqvhide(a) {
  qvitem.style.display = "none";
}
// quickview end
/* -- B站视频 抄自碧蓝航线 --*/
var BiliVideo=document.getElementsByClassName("BiliVideo")
for(var i=0,ilen=BiliVideo.length;i<ilen;i++){
var v=BiliVideo[i].dataset.v
if(!isNaN(v)){
v="aid="+v
}
else if(/^av[0-9]+$/i.test(v)){
v="aid="+v.substr(2)
}
else if(/^bv[a-z0-9]+$/i.test(v)){
v="bvid=BV"+v.substr(2)
}
else{
v="bvid=BV"+v
}
var p="page="+(Number(BiliVideo[i].dataset.p)||1)
var w=Number(BiliVideo[i].dataset.w)||600
var h=Number(BiliVideo[i].dataset.h)||421
BiliVideo[i].innerHTML='<iframe src="//www.bilibili.com/blackboard/newplayer.html?'+v+'&'+p+'&autoplay=" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" width="'+w+'" height="'+h+'" style="max-width:100%;max-height:60vw;"></iframe>'
}

2025年1月26日 (日) 05:40的最新版本

/*
 * This is the JS for all skins (for both mobile and desktop) on MediaWiki.org.
 * Consider whether you can use a gadget with one of the options set to limit
 * where it is loaded. See [[Extension:Gadgets#Options]].
 */
/* global mw, $ */
/**
 * Hide prefix in category
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Hide_prefix_in_category
 * @rev 5
 */
var prefix = $.trim( $( '#mw-cat-hideprefix' ).text() ) || ( mw.config.get( 'wgTitle' ) + '/' );
$( '#mw-pages' ).find( 'a' ).text( function ( i, val ) {
    return val.slice( 0, prefix.length ) === prefix ? val.slice( prefix.length ) : val;
} );

/**
 * @source https://www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
 * @revision 2017-05-16
 */
mw.loader.using( ['mediawiki.util'], function () {
	var extraCSS = mw.util.getParamValue( 'withCSS' ),
		extraJS = mw.util.getParamValue( 'withJS' ),
		extraModule = mw.util.getParamValue( 'withModule' );

	if ( extraCSS ) {
		// WARNING: DO NOT REMOVE THIS "IF" - REQUIRED FOR SECURITY (against XSS/CSRF attacks)
		if ( /^MediaWiki:[^&<>=%#]*\.css$/.test( extraCSS ) ) {
			mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraCSS ) + '&action=raw&ctype=text/css', 'text/css' );
		} else {
			mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
		}
	}

	if ( extraJS ) {
		// WARNING: DO NOT REMOVE THIS "IF" - REQUIRED FOR SECURITY (against XSS/CSRF attacks)
		if ( /^MediaWiki:[^&<>=%#]*\.js$/.test( extraJS ) ) {
			mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraJS ) + '&action=raw&ctype=text/javascript' );
		} else {
			mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
		}
	}

	if ( extraModule ) {
		if ( /^ext\.gadget\.[^,\|]+$/.test( extraModule ) ) {
			mw.loader.load( extraModule );
		} else {
			mw.notify( 'Only gadget modules are allowed.', { title: 'Invalid withModule value' } );
		}
	}
});