跳转到内容

User:Renamed user 63506961370/js/综艺玩很大.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
(function() {
    'use strict';
	if(location.pathname!="/wiki/%E7%B6%9C%E8%97%9D%E7%8E%A9%E5%BE%88%E5%A4%A7")
		return;


    $(".NavHead").each(function(){
        let head = $(this).text();
        let m= head.match(/回\s*(\d+)(\s*-\s*(\d+))/);
        if(!m)
            return;

        let startEpisode= m[1];
        let endEpisode;
        if(m.length==4)
            endEpisode=m[3];
        else
            endEpisode=startEpisode;

        let contentList=$(".contentList");
        let episodeNumbers= $.merge(contentList.find("td[rowspan=2]:first-child +td"), contentList.find("td:first-child:not([rowspan])"));
        episodeNumbers=episodeNumbers.toArray();
        let episodeTd= episodeNumbers.find(element=>element.innerText.trim()===startEpisode);
        let $yellowTeamTd = $(episodeTd).next().next();
        let yellowMembers= $yellowTeamTd.text().trim();
        let $blackTeamTd = $yellowTeamTd.next();
        let blackMembers= $blackTeamTd.text().trim();
        let $gameMastersTd = $blackTeamTd.next();
        let gameMasters= $gameMastersTd.text().trim();

        let $descriptionArea= $(this).next().find("tr:nth-child(2) td");
        let newContent=
`<p>关主 ${gameMasters}</p>
<p>黄队成员 ${yellowMembers}</p>
<p>黑队成员 ${blackMembers}</p>`;
        let html = $descriptionArea.html() + newContent;
        $descriptionArea.html(html);
    });
})();