/**
 * 本模块负责取消主页个性化推荐
 */ /**
 * 本模块负责取消主页个性化推荐
 */ ( function ( ) { let indexRecommend , indexFlag ; API . runWhile ( ( ) => document . querySelector ( ".bili-wrapper" ) , async function ( ) { try { let node = < HTMLDivElement > document . querySelector ( ".recommend-module.clearfix" ) ; let prev = API . addElement ( "span" , { class : "rec-btn prev" } , node , undefined , undefined , < HTMLDivElement > document . querySelector ( ".rec-btn.prev" ) ) ; let next = API . addElement ( "span" , { class : "rec-btn next" } , node , undefined , undefined , < HTMLDivElement > document . querySelector ( ".rec-btn.next" ) ) ; prev . innerHTML = next . innerHTML = "切换" ; prev . onclick = next . onclick = async ( ) => { document . querySelectorAll ( ".groom-module.home-card" ) . forEach ( d => d . remove ( ) ) ; let wait = API . addElement ( "div" , { class : "load-state" } , node , undefined , true ) ; wait . innerHTML = '<span class="loading">正在加载...</span><!----><!---->' ; indexRecommend = indexRecommend && indexRecommend . length > 20 ? indexRecommend : API . jsonCheck ( await xhr ( { url : "https://api.bilibili.com/x/web-interface/index/top/rcmd?fresh_type=3" , credentials : ! config . privateRecommend } ) ) . data . item ; indexFlag = indexRecommend . length < 20 ? 10 : indexFlag || ( ( API . uid && config . privateRecommend ) ? 10 : 20 ) ; wait . remove ( ) ; for ( let i = indexFlag - 1 ; i >= indexFlag - 10 ; i -- ) { API . addElement ( "div" , { class : "groom-module home-card" } , node , undefined , true ) . innerHTML = `<a href="//www.bilibili.com/video/av${ indexRecommend [ i ] . aid || indexRecommend [ i ] . id }" target="_blank" title="${ indexRecommend [ i ] . title }">
                        <img src="${ indexRecommend [ i ] . pic . replace ( "http:" , "" ) }@160w_100h.webp" alt="${ indexRecommend [ i ] . title }" width="160" height="100" class="pic">
                        "><!----><div class="card-mark"><p class="title">${ indexRecommend [ i ] . title }</p><p class="author">up主：${ indexRecommend [ i ] . owner . name }</p><p class="play">播放：${ API . unitFormat ( indexRecommend [ i ] . stat . view ) }</p></div></a><div class="watch-later-trigger w-later"></div></div>` ; } indexFlag = indexRecommend . length < 20 ? 10 : indexFlag < 30 ? indexFlag + 10 : 10 ; } ; prev . click ( ) ; } catch ( e ) { debug . error ( "indexRecommend.js" , e ) ; } } ) ; } ) ( ) ;