微件:ProfileSwitch

来自Mooncell - 玩家共同构筑的FGO中文Wiki
跳到导航 跳到搜索

<style> .tl_svt_profile_cn_ {display: block;} .tl_svt_profile_jp_ {display: none;}

  1. ooui-svt-profile-option-container- {margin-bottom: 4px;}

</style>

<script> (window.RLQ=window.RLQ||[]).push(['jquery',function() { mediaWiki.loader.using(['oojs-ui-widgets','oojs-ui-core']).then(function() { var buttonSelectItems = []; buttonSelectItems.push(new OO.ui.ButtonOptionWidget( {data: 1, label: "日文"} )); buttonSelectItems.push(new OO.ui.ButtonOptionWidget( {data: 2, label: "中文"} )); buttonSelectItems.push(new OO.ui.ButtonOptionWidget( {data: 3, label: "对照"} ));

var buttonSelect = new OO.ui.ButtonSelectWidget({items: buttonSelectItems});

$('#ooui-svt-profile-option-container-').append( buttonSelect.$element ); buttonSelect.selectItemByData(2);

buttonSelect.on('select', function(selected) { var status = selected.getData();

$(".tl_svt_profile_jp_").css("display", (status & 1) ? "block" : "none");

                       $(".tl_svt_profile_jp_").css("border-top", (status == 3) ? "1px solid #ccc" : "none");

$(".tl_svt_profile_cn_").css("display", (status & 2) ? "block" : "none"); }); }); }]); </script>