${danmakuData[i]}
`); let wait = (lastWait[options.channel] + (Math.floor(Math.random() * 1000 + 100))) / 1000; $tarDom.append($html); options.width = $html.width(); options.moveX = options.width + outWidth; options.dur = (options.width + outWidth) / (outWidth / defaultMoveOpts.dur); $html.css({ 'transform': `translateX(-${options.moveX}px)`, 'transition': `transform ${options.dur}s linear ${wait}s`, 'opacity': 1 }) lastWait[options.channel] = (wait + options.dur * 0.6) * 1000 } } function dislike($el, isReturn){ const errmsg = '减少推荐内容请求失败'; const token = options.accessKey ? '&access_key=' + options.accessKey : ''; const reason = { '4': 'UP主', '1': '不感兴趣', '12': '此类内容过多', '13': '推荐过' } const $wp = $el.closest('.dislike'); const params = { 'goto': $el.data('goto'), 'id': $el.data('id'), 'mid': $el.data('mid'), 'reason_id': $el.data('rsid'), 'rid': $el.data('rid'), 'tag_id': $el.data('tagid') } let url = `https://app.bilibili.com/x/feed/dislike`; if(isReturn){ url += '/cancel' } url += `?appkey=27eb53fc9058f8c3&build=5000000&goto=${params.goto}&id=${params.id}&mid=${params.mid}&reason_id=${params.reason_id}&rid=${params.rid}&tag_id=${params.tag_id}` + token; GM_xmlhttpRequest({ method: 'GET', url: url, onload: res => { try { const rep = JSON.parse(res.response); if (rep.code != 0) { toast(errmsg) } if(isReturn){ $wp.find('.over').hide().find('.reason').text(''); $wp.find('.ready').css({ 'display': 'flex' }); $wp.removeClass('dlike'); toast('撤销成功') }else{ $wp.find('.ready').hide(); $wp.find('.over').css({ 'display': 'flex' }).find('.reason').text($el.text()); $wp.addClass('dlike'); if($wp.closest('.ctrl').is(':hidden')){ $wp.closest('.ctrl').show() } toast('减少推荐成功') } } catch(e) { toast(errmsg) } isWait = false; }, onerror: e => { isWait = false; toast(errmsg) } }) } init() })();