Widget:支援卡选择器
<script type="text/javascript"> function addCardfunction(){
if (window.WidgetCommonCSSLoaded === undefined) { window.WidgetCommonCSSLoaded = function() { console.log('Loading WidgetCommon.css ...'); }; mw.loader.load( mw.util.getUrl( 'MediaWiki:WidgetCommon.css', { action:'raw' } ) + '&ctype=text/css' , 'text/css' );
}
// 支援卡绑定 for (let i = 0; i < $(".support-sel-area").length; i++) { $($(".support-sel-area")[i]).click(function() { $("#support-preload-"+card_local).html($($(".support-sel-area")[i]).prop("outerHTML"));
$("#hover-1").hide();
$("#mb-support-sel").hide(200); console.log(i); looseBody(); }); }
//支援卡选择点击事件
$("#support-preload-0").click(function() { $("#mb-support-sel").show(200); $("#hover-1").show(); card_local = "0"; fixedBody(); }); //支援卡类型筛选 $(".type-icon").each(function(idx, e){ e.onclick = function(){ if(/active/.test($(this).attr("class"))){ $(this).removeClass("active"); $(".popup-support").each(function(idx, e){ $(e).show(); }); } else { $(".type-icon").each(function(idx, e){ $(e).removeClass("active"); }); $(this).addClass("active"); let type = $(this).attr("data-type"); $(".popup-support").each(function(idx, e){ if (type === $(e).attr("data-param2")) { $(e).show(); } else { $(e).hide(); } }); } } });
//关闭支援卡弹窗的点击事件
$("#support-sel-cancel").click(function() {
$("#hover-1").hide();
$("#mb-support-sel").hide(200); looseBody(); });
//修正tab标签
$(".resp-tabs .resp-tabs-list .bili-list-style").click(function(){$(this).addClass("active").siblings().removeClass("active");var e=$(this).index();$(this).parents(".resp-tabs").find(".resp-tab-content").eq(e).show().siblings().hide(),$(".resp-accordion-handle").hide()})
}
function fixedBody () {
let scrollTop = document.body.scrollTop || document.documentElement.scrollTop; document.body.style.cssText += 'position:fixed;width:100%;top:-' + scrollTop + 'px;'; }
function looseBody () { let body = document.body; body.style.position = ; let top = body.style.top; document.body.scrollTop = document.documentElement.scrollTop = -parseInt(top); body.style.top = ; } </script> <hr class="expandtemplates-div" param="
" callback="addCardfunction"/>