');
htmlStr.Append(' ');
htmlStr.Append(' ' + data.likeCount+ '');
htmlStr.Append('');
htmlStr.Append(' ' + data.onlineCount+ '');
htmlStr.Append('');
htmlStr.Append('
');
if (config.egg.open && Object.keys(config.egg.upsInfo).some(e => e === data.user.id)) {
const eggCoverUrl = config.egg.upsInfo[data.user.id].coverUrls[config.egg.type];
htmlStr.Append(' ');
htmlStr.Append('

');
htmlStr.Append('

');
htmlStr.Append('
');
htmlStr.Append(' ');
}else {
htmlStr.Append('
');
htmlStr.Append('

');
htmlStr.Append('
');
htmlStr.Append('
');
}
htmlStr.Append('
');
htmlStr.Append('
');
htmlStr.Append('
');
htmlStr.Append('
');
htmlStr.Append('
直播中
');
htmlStr.Append('
');
htmlStr.Append('
');
htmlStr.Append('

');
htmlStr.Append('
');
htmlStr.Append('
');
htmlStr.Append('
');
htmlStr.Append('');
htmlStr.Append('');
htmlStr.Append('
');
htmlStr.Append('
');
return htmlStr.ToString();
}
function waitElement(selector, times, interval, flag=true){
var _times = times || -1,
_interval = interval || 1,
_selector = selector,
_iIntervalID,
_flag = flag;
return new Promise(function(resolve, reject){
_iIntervalID = setInterval(function() {
if(!_times) {
clearInterval(_iIntervalID);
reject();
}
_times <= 0 || _times--;
var _self = $(_selector);
if( (_flag && _self.length) || (!_flag && !_self.length) ) {
clearInterval(_iIntervalID);
resolve(_iIntervalID);
}
}, _interval);
});
}
function addChild(fatherNode, childNode, innerHtmlStr, type) {
childNode.innerHTML = innerHtmlStr;
if (type) {
fatherNode.appendChild(childNode);
}else {
fatherNode.appendChild(childNode.childNodes[0]);
}
}
function addChildDiv(fatherNode, innerHtmlStr) {
addChild(fatherNode, document.createElement("div"), innerHtmlStr);
}
function addChildScript(fatherNode, scriptStr) {
addChild(fatherNode, document.createElement("script"), scriptStr, 'script');
}
function addChildStyle(fatherNode, styleStr) {
addChild(fatherNode, document.createElement("style"), styleStr, 'style');
}
function initLiveContainer(liveContainerSelector, liveList) {
waitElement(liveContainerSelector).then(function() {
var othersLiveContainer = document.querySelector(liveContainerSelector);
//console.log(liveList);
liveList.forEach(data => {
addChildDiv(othersLiveContainer, createLiveListItemHtmlStr(data));
});
});
}
function replaceText(selector, newText) {
waitElement(selector).then(function() {document.querySelector(selector).innerText = newText;});
}
function removeNode(selector) {
waitElement(selector).then(function() {document.querySelector(selector).style.display = 'none';});
}
function confirmMoreLive(selector) {
const msg = '确定跳转AC直播大屏幕吗?你将可能进入未曾关注过的直播间。';
waitElement(selector).then(function() {
const moreLiveNodes = document.querySelectorAll(selector);
moreLiveNodes.forEach(node => {
node.setAttribute('href', 'javascript:if(confirm("' + msg + '")) window.open("/");');
node.removeAttribute('target');
});
});
}
replaceText('title', '我的关注直播间');
//replaceText('.recmd-live-title', '我的关注直播间');
//removeNode('.player-outer-wrapper');
//removeNode('.recmd-live-container');
confirmMoreLive('.more-live');
confirmMoreLive('.live-page-title');
confirmMoreLive('a[href="/"].live');
$.ajax({
url: '/api/channel/list?count=' + config.maxLiveSize + '&pcursor=&filters=[%7B%22filterType%22:3,+%22filterId%22:0%7D]',
type: 'get',
success: function (res) {
//console.log(res);
const liveList = res.liveList;
replaceText('.recmd-live-title', '我的关注直播间 (' + liveList.length + ')');
let loveUps = Object.keys(config.love.ups) ?? [];
waitElement('.recommend-live-wrapper').then(function() {
const recommendLiveWrapperNode =document.querySelector('.recommend-live-wrapper');
addChildDiv(recommendLiveWrapperNode,
'');
addChildDiv(recommendLiveWrapperNode,
'');
});
waitElement('head').then(function() {
const headNode = document.querySelector('head');
addChildStyle(headNode,
'.live-check-cover {color: #fff;position: absolute;right: 4px;bottom: 5px;border-radius: 3px;text-align: center;width: auto;height: 19px;z-index: 996;} .live-check-cover-desc {font-size: 12px;line-height: 17px;height: 18px;display: inline-block;vertical-align: top;width: 58px;}');
if (lsLoveOpen) {
addChildStyle(headNode,
'#loveLiveContainer .live-list-item .list-content-top .list-content-data {background: linear-gradient(180deg,transparent,rgb(254 129 141 / 83%));} .list-container {min-height: 500px;}');
}
if (config.egg.open) {
addChildScript(headNode,
'function danmakuMaskTrigger(selector0, selector1){document.querySelector(selector0).setAttribute("style", "display: block;");document.querySelector(selector1).setAttribute("style", "display: none;");}');
}
});
if (!lsLoveOpen || loveUps.length ===0) {
initLiveContainer('#othersLiveContainer', liveList);
}else {
const loveLiveList = liveList.filter((e) => loveUps.some((uid) => uid == e.authorId));
initLiveContainer('#loveLiveContainer', loveLiveList);
const othersLiveList = liveList.filter((e) => !loveUps.some((uid) => uid == e.authorId));
initLiveContainer('#othersLiveContainer', othersLiveList);
}
removeNode('.loading');
// var _interval = 200;
// var _times = 50;
// var _iIntervalID;
// _iIntervalID = setInterval(function() {
// if(!_times) {
// clearInterval(_iIntervalID);
// }
// removeNode('.loading');
// _times <= 0 || _times--;
// }, _interval);
}
});
window.aikaCut = function aikaCut() {
const btn = document.querySelector('#aika-cut');
$.ajax({
url: 'https://id.app.acfun.cn/rest/web/token/get',
type: 'post',
data: {'sid': 'acfun.midground.api'},
xhrFields: {
withCredentials: true
},
success: function (res) {
//console.log(res);
const aikaText = document.getElementById('aika-text');
const aikaTestValue = aikaText.value.trim();
var aikaCutUrl;
if (/https:\/\/onvideo.kuaishou.com\/vangogh\/editor\/(\d+)\?source=ac/g.test(aikaTestValue)) {
aikaCutUrl = 'https://onvideoapi.kuaishou.com/rest/infra/sts?sid=acfun.midground.api&authToken=' + res['acfun.midground.api.at'] + '&followUrl=' + encodeURI(aikaTestValue);
}
else if (/^\d+$/.test(aikaTestValue)) {
aikaCutUrl = 'https://onvideoapi.kuaishou.com/rest/infra/sts?sid=acfun.midground.api&authToken=' + res['acfun.midground.api.at'] + '&followUrl=' + encodeURI('https://onvideo.kuaishou.com/vangogh/editor/' + aikaTestValue + '?source=ac');
}
else {
aikaCutUrl = '#';
}
console.log(aikaCutUrl);
const aikaA = document.createElement('a');
aikaA.href = aikaCutUrl;
aikaA.target = '_blank';
aikaA.click();
aikaA.remove();
},
beforeSend: function() {
btn.disabled = true;
btn.style['background-color'] = 'rgb(0 0 0 / 45%)';
btn.innerText = '跳转中…';
},
complete: function() {
btn.disabled = false;
btn.style['background-color'] = '#fd4c5d';
btn.innerText = '爱咔剪辑';
}
});
}
window.checkAika = function checkAika() {
const btn = document.querySelector('#aika-find');
$.ajax({
url: 'https://id.app.acfun.cn/rest/web/token/get',
type: 'post',
data: {'sid': 'acfun.midground.api'},
xhrFields: {
withCredentials: true
},
success: function (res) {
const aikaA = document.createElement('a');
aikaA.href = 'https://onvideoapi.kuaishou.com/rest/infra/sts?sid=acfun.midground.api&authToken=' + res['acfun.midground.api.at'] + '&followUrl=' + encodeURI('https://onvideo.kuaishou.com/vangogh/editor/0.0?source=ac');
aikaA.target = '_blank';
aikaA.click();
aikaA.remove();
},
beforeSend: function() {
btn.disabled = true;
btn.innerText = '跳转中…';
},
complete: function() {
btn.disabled = false;
btn.innerText = '爱咔号查询>';
}
});
}
window.triggerLove = function triggerLove() {
const loveStyle = document.querySelector('#loveStyle');
const loveStyleChecked = loveStyle.checked;
if(confirm(`即将刷新页面,确定${loveStyleChecked ? '打开' : '关闭'}喜爱模式吗?`)) {
window.localStorage.setItem('ls_love_open', loveStyleChecked);;
window.location.reload();
}else {
loveStyle.checked = !loveStyleChecked;
}
}
window.configTrigger = function configTrigger() {
const configContainerNode = document.querySelector('#configContainer');
const configTriggerNode = document.querySelector('#configTrigger');
if(configContainerNode.style.display === 'none') {
configContainerNode.style.display = 'block';
configTriggerNode.innerText = '收起配置';
const loveUpshtmlStringBuffer = new StringBuffer();
const copyAllUidTextStringBuffer = new StringBuffer();
if (loveUpsUids.length > 0) {
loveUpsUids.forEach(uid => {
loveUpshtmlStringBuffer.Append(`