1 line
7.4 KiB
JavaScript
1 line
7.4 KiB
JavaScript
document.addEventListener("DOMContentLoaded",()=>{function a(){function a(){$.ajax({url:"/usr/themes/Joe/assets/json/joe.live.json",dataType:"json",success(a){const e=a[n.index];$(".joe_live__type-title .text").html(e.name);let t='<li class="item animated swing" data-gameId="">全部</li>';e.list.forEach(a=>t+=`<li class="item animated swing" data-gameId="${a.gameId}">${a.name}</li>`),$(".joe_live__type-list").html(t),$(".joe_live__type-list .item").first().click()}})}function e(){window.scrollTo({top:0,behavior:"smooth"}),n.isLoading=!0,$(".joe_live__list").html(""),$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"huya_list",page:n.page,gameId:n.gameId},success(a){if(1!==a.code)return;let e="";a.data.datas.forEach(a=>{e+=`\n <a target="_blank" rel="noopener noreferrer nofollow" class="joe_live__list-item animated bounceIn" href="${window.location.href+"?profileRoom="+a.profileRoom+"&title="+a.nick}">\n <div class="thumb">\n <i class="recommendTagName" style="display: ${a.recommendTagName?"":"none"}">${a.recommendTagName}</i>\n <img width="100%" height="100%" class="screenshot lazyload" src="${Joe.LAZY_LOAD}" data-src="${a.screenshot}" alt="${a.introduction}" />\n </div>\n <div class="description">\n <div class="avatar">\n <svg class="icon" viewBox="0 0 76 31" xmlns="http://www.w3.org/2000/svg"><path d="M57.7 11.4C56.3 10 55 8.5 53.6 7c-.2-.3-.5-.5-.8-.8l-.5-.5C48.6 2.2 43.5 0 38 0S27.4 2.2 23.6 5.7l-.5.5-.8.8c-1.4 1.5-2.7 3-4.1 4.4-5 5.1-11.7 6.1-18.3 6.3V31H76V17.6c-6.6-.2-13.3-1.1-18.3-6.2z"/></svg>\n <img width="25" height="25" class="lazyload" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="${a.avatar180}" alt="${a.nick}"/>\n </div>\n <div class="nick">${a.nick}</div>\n <p class="introduction">${a.introduction}</p>\n <div class="meta">\n <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="13" height="13"><path d="M859.91 609.925v45.6c-.68 2.22-1.51 4.435-1.964 6.705-4.66 24.1-7.285 48.83-14.316 72.22-20.85 69.02-59.92 126.54-114.694 173.5-42.245 36.25-89.786 62.366-144.135 75.22-17.87 4.236-36.194 6.73-54.32 10.036h-45.575c-2.22-.685-4.49-1.72-6.754-1.87-48.126-2.996-93.726-15.525-136.5-37.385-80.866-41.186-139.196-102.515-165.836-190.74-5.675-18.855-8.04-38.62-11.975-57.976v-43.51c1.715-10.69 3.2-21.474 5.22-32.16 8.62-46.685 29.366-88.025 56.84-126.19 25.915-35.92 53.44-70.704 78.016-107.535 26.569-39.95 39.424-84.294 31.89-132.915-1.485-9.605-2.875-19.21-4.336-28.764.98-.251 1.965-.45 2.95-.731 59.31 62.16 68.966 138.465 60.495 220.92 2.17-2.32 3.986-3.935 5.37-5.8 50.34-68.084 71.965-143.3 55.555-227.546-10.43-53.59-32.994-101.766-70.324-141.816C369.306 61.846 349.695 47.656 331.62 32h18.655c1.536.63 2.976 1.715 4.535 1.865 32.82 2.82 63.65 12.955 93.02 27.2C515 93.581 569.45 141.65 615 200.285c66.95 86.28 110.485 181.995 119.106 292.2 3.305 42.07-.986 82.956-12.2 123.29-4.236 15.275-10.21 30.045-15.68 45.95 21.725-9.251 38.24-23.39 50.995-41.716 38.04-54.775 48.675-115.855 40.055-183.38 2.8 3.25 4.236 4.535 5.215 6.145 22.914 36.2 40.055 74.814 49.005 116.784 3.554 16.612 5.619 33.607 8.414 50.367m-358.345-80.31c-.855.606-1.79 1.236-2.67 1.841-1.185 16.64-2.07 33.3-3.68 49.935-2.37 25.385-8.445 49.86-20.32 72.625-14.52 27.88-38.79 45.22-65.69 59.01-29.01 14.97-47.285 36.35-49.656 70.101-2.469 34.71 7.966 63.87 35.945 85.2 26.216 19.961 56.841 26.471 89.306 25.386 51.83-1.69 90.445-26.321 105.925-78.196 11.116-37.23 9.3-74.714 1.865-112.194-10.16-51.375-28.765-99.265-60.6-141.235-8.945-11.728-20.24-21.684-30.425-32.473" fill="#fc6528"/></svg>\n <span class="total">${i(a.totalCount)}</span>\n <span class="name">${a.gameFullName}</span>\n </div>\n </div>\n </a>\n `}),$(".joe_live__list").html(e),n.totalPage=a.data.totalPage,t()},complete:()=>n.isLoading=!1})}function t(){let a="";1!=n.page&&(a+=`\n \t\t<li class="joe_live__pagination-item" data-page="1">首页</li>\n \t\t<li class="joe_live__pagination-item" data-page="${n.page-1}">\n <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="12" height="12"><path d="M822.272 146.944l-396.8 396.8c-19.456 19.456-51.2 19.456-70.656 0-18.944-19.456-18.944-51.2 0-70.656l396.8-396.8c19.456-19.456 51.2-19.456 70.656 0 18.944 19.456 18.944 45.056 0 70.656z"/><path d="M745.472 940.544l-396.8-396.8c-19.456-19.456-19.456-51.2 0-70.656 19.456-19.456 51.2-19.456 70.656 0l403.456 390.144c19.456 25.6 19.456 51.2 0 76.8-26.112 19.968-51.712 19.968-77.312.512zm-564.224-63.488c0-3.584 0-7.68.512-11.264h-.512v-714.24h.512c-.512-3.584-.512-7.168-.512-11.264 0-43.008 21.504-78.336 48.128-78.336s48.128 34.816 48.128 78.336c0 3.584 0 7.68-.512 11.264h.512v714.24h-.512c.512 3.584.512 7.168.512 11.264 0 43.008-21.504 78.336-48.128 78.336s-48.128-35.328-48.128-78.336z"/></svg>\n \t\t</li>\n \t\t<li class="joe_live__pagination-item" data-page="${n.page-1}">${n.page-1}</li>\n \t`),a+=`<li class="joe_live__pagination-item active">${n.page}</li>`,n.page!=n.totalPage&&(a+=`\n \t\t<li class="joe_live__pagination-item" data-page="${n.page+1}">${n.page+1}</li>\n \t\t<li class="joe_live__pagination-item" data-page="${n.page+1}">\n <svg class="next" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="12" height="12"><path d="M822.272 146.944l-396.8 396.8c-19.456 19.456-51.2 19.456-70.656 0-18.944-19.456-18.944-51.2 0-70.656l396.8-396.8c19.456-19.456 51.2-19.456 70.656 0 18.944 19.456 18.944 45.056 0 70.656z"/><path d="M745.472 940.544l-396.8-396.8c-19.456-19.456-19.456-51.2 0-70.656 19.456-19.456 51.2-19.456 70.656 0l403.456 390.144c19.456 25.6 19.456 51.2 0 76.8-26.112 19.968-51.712 19.968-77.312.512zm-564.224-63.488c0-3.584 0-7.68.512-11.264h-.512v-714.24h.512c-.512-3.584-.512-7.168-.512-11.264 0-43.008 21.504-78.336 48.128-78.336s48.128 34.816 48.128 78.336c0 3.584 0 7.68-.512 11.264h.512v714.24h-.512c.512 3.584.512 7.168.512 11.264 0 43.008-21.504 78.336-48.128 78.336s-48.128-35.328-48.128-78.336z"/></svg>\n \t\t</li>\n \t`),n.page<n.totalPage&&(a+=`<li class="joe_live__pagination-item" data-page="${n.totalPage}">末页</li>`),$(".joe_live__pagination").html(a)}function i(a=0){return a>=1e4?Math.round(a/1e3)/10+"万":a}let n={page:1,gameId:"",index:0,isLoading:!1,totalPage:0};$(".joe_live__type-title .icon").on("click",function(){n.isLoading||(3===n.index&&(n.index=0),n.index++,a())}),$(".joe_live__type-list").on("click",".item",function(){n.isLoading||($(this).addClass("active").siblings().removeClass("active"),n.page=1,n.gameId=$(this).attr("data-gameId"),e())}),a(),$(".joe_live__pagination").on("click",".joe_live__pagination-item",function(){const a=$(this).attr("data-page");a&&!n.isLoading&&(n.page=Number(a),e())})}const e=new URLSearchParams(window.location.search);e.get("profileRoom")||a()}); |