台词试听功能(武将/皮肤)逐步上线中,在对应页面的台词板块即可试听;目前音频功能仍有缺失或错误的情况,可点击反馈提醒我们;有兴趣参与编辑的请点击下方企鹅群加入我们哦~。欢迎收藏起来防止迷路~(´▽`ʃ♡ƪ)!

如果你看到本段文字,说明该页面未正常加载全局JS,包括但不仅限于语音、评论区等部分功能将无法使用,请点击 重新加载页面,如果刷新无效,请找BWIKI客服进行反馈。
全站通知:

Widget:测试

来自三国杀OLWIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

<script src="https://wiki.biligame.com/sgs/MediaWiki:Gadget-pinyin-pro.js?action=raw&ctype=text/javascript"> //https://unpkg.com/pinyin-pro@3.13.0/dist/index.js </script> <script src="https://wiki.biligame.com/sgs/Widget:测试/json?action=raw&ctype=text/javascript"></script> <script>

 var { pinyin } = pinyinPro;
 var { customPinyin } = pinyinPro;//https://www.aies.cn/pinyin2.htm
 customPinyin(sgsPinYin);
 var CHreg = /[\u4e00-\u9fa5]+/g;
 var skin_b = ["https://web.sanguosha.com/10/pc/res/assets/runtime/general/big/static/",".png"];
 var skin_v = ["https://web.sanguosha.com/10/pc/res/assets/runtime/voice/skin/",".mp3"];

//history.pushState = function(){console.log("阻止push")}; (window.RLQ = window.RLQ || []).push([["jquery"], function () {

   $(document).ready(function(){  
    TranToPinYin(".skill-audio","data-src",skin_v);
    TranToPinYin(".skill-audio > audio","src",skin_v);

$(document).on("click",".tabber .resp-tabs-list .bili-list-style span",function(){ console.log("点击"); var taber = $(this).parents("div.tabber").eq(0); var text = $(this).text(); taber.find(".bili-list-style").filter(function(i) { return $(this).text() == text; }).click(); });

    //GetSkin(skin_b);
   });
   

}]);

function GetSkin(url_skin,limit) {

var Sel; if(limit) { Sel = $(limit).find(".img-skin").add($(limit).filter(".img-skin")); console.log(Sel); } else Sel = $(".img-skin");

Sel.each(function(){ src = $(this).attr("data-src"); NetPing(get_skin(src,url_skin),ApplySkin,$(this)); }); }

function get_skin(_src,url) { src = _src; str = src.match(CHreg);//匹配中文 console.log(str); result = ChraInfo.filter((item)=> item.名称 == str); console.log(result); if(result.length != 0) src = src.replace(str,result[0].代号);//中文换成武将代号

return url[0] + src + url[1]; }

function ApplySkin(a,url) { imgs = a.find("img"); imgs.attr("src" ,url); imgs.parent("a").attr("href",url);

imgs.after('

');

console.log("%c 三国杀" + pinyin('拼音') + "插件%c" + url, "color: #fff; padding: 5px 0; background: black;", "padding: 5px 5px 5px 0; background: #e3f7ff;"); }

function NetPing(url,a,b) {

  var imgs = b.find("img");
  var Fade = false;
  if(imgs.parents("#bili-tt-cache-block").length != 0)
  Fade = true;
   $.ajax({
       type: "GET",
       cache: true,
       url: url,
       data: "",
       success: function() {
           a(b,url);
           if(Fade)
           {
           imgs.hide();
           imgs.fadeIn();
           }
       },
       error: function() {
       }
   });

}

function TranToPinYin(selector,srcname,url_v){ //console.log(selector + "拼音转换"); var selectors = $(selector); //console.log(selectors); selectors.each(function(){ var src = ($(this).attr(srcname)); var srcZH = src.match(CHreg); //console.log(srcZH); if(srcZH!=null) { try{ src = ppy(src,srcZH[0],0); src = ppy(src,srcZH[1],1); src = ppy(src,srcZH[2],2); }catch(e) { //console.log(e); } } if(src.indexOf("spell") != -1) src = "1-spell/"+src; else if(src.indexOf("charDead_") != -1) src = "dead/"+src; $(this).attr(srcname,url_v[0] + src + url_v[1]); console.log("%c 三国杀" + pinyin('拼音')+ "插件 %c"+ $(this).attr(srcname), "color: #fff; padding: 5px 0; background: orange;", "padding: 5px 5px 5px 0; background: #e3f7ff;"); });

}

function dx(a) { return a[0].toUpperCase() + a.substr(1); } function ppy(src,str,mode) { var Mode; //武将名模式0 和 1 if(mode == 0 || mode == 1) { Mode = { v: true,toneType: 'none',type: 'array',mode: 'surname'}; } //技能模式 if(mode == 2) { Mode = { v: true,toneType: 'none',type: 'array'}; } var py = pinyin(str,Mode);

//武将名下首字母大写

var index,maxindex;

for(var i=0;i<py.length;i++) {

if(mode == 1 || mode == 2) py[i] = dx(py[i]);

index = py[i].indexOf("v"); maxindex = py[i].length - 1; if(index > 0 && index < maxindex ) py[i] = py[i].replace("v","u");

}

py = py.join("").replace(/\s*/g,""); //console.log(py); return src.replace(str,py); } //(function () { var t = function () { if(window.jQuery && $("#bili-tt-cache-block").length != 0) tt_jt(); else{window.setTimeout(t, 100);} }; t(); })();

function tt_jt() { console.log("开启tt监听");

  	// 监听dom变动,为新插入的tt注册事件

var tt_Observer = new MutationObserver(function(mutationsList){ mutationsList.forEach(function(mutation){ if (mutation.addedNodes)

           {
           mutation.addedNodes.forEach((o) => GetSkin(skin_b,o));
           console.log("有增加节点");
           }

}); });

tt_Observer.observe(document.getElementById('bili-tt-cache-block'), { childList: true, // 监视节点增删事件 subtree: true // 包含所有后代节点(而不只是子节点) }); }

console.log("%c 三国杀" + pinyin('拼音')+ "插件 %c MediaWiki:Gadget-sgsPinYin.js", "color: #fff; padding: 5px 0; background: orange;", "padding: 5px 5px 5px 0; background: #e3f7ff;");

</script>