// ==UserScript==
// @name 下载用户B站收藏夹中的音频
// @namespace crystal
// @version 1.0.0
// @description 通过脚本下载收藏夹里面的歌曲,实现免费听歌
// @author 奎里斯托
// @match https://space.bilibili.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function () {
// 变量前面加gl(global),表示当前变量是全局的
let GL_popup = null
let GL_favoriteList = []
let GL_lateOnList = []
// 获取收藏夹信息
function getFavoriteList() {
return new Promise((resolve, reject) => {
try {
ajax({
url: 'https://api.bilibili.com/x/v3/fav/folder/list4navigate',
}).then((res) => {
const result = res
const [myFavorite, lateOn] = result.data
GL_favoriteList = myFavorite.mediaListResponse.list
GL_lateOnList = lateOn.mediaListResponse.list
resolve(GL_favoriteList)
})
} catch (error) {
reject(error)
}
})
}
let GL_tableData = []
let GL_PageCount = 0
// 根据收藏夹信息获取单个收藏夹的详细信息
function getFavoriteDetail(searchParams) {
return new Promise((resolve, reject) => {
try {
const defaultParam = {
media_id: '',
pn: 1,
ps: 10,
keyword: '',
order: 'mtime',
type: 0,
tid: 0,
platform: 'web',
}
const params = {
...defaultParam,
...searchParams
}
ajax({
url: 'https://api.bilibili.com/x/v3/fav/resource/list',
params: params
}).then((res) => {
const result = res
const medias = result.data.medias
GL_PageCount = result.data.info.media_count
GL_tableData = medias
GL_pagePsPn.sumPn = Math.ceil(GL_PageCount / GL_pagePsPn.ps)
initPage(GL_pagePsPn.sumPn, GL_pagePsPn.pn)
resolve(medias)
})
} catch (error) {
reject(error)
}
})
}
// 获取单个视频的详细信息
function getVideoDetail(searchParams) {
return new Promise((resolve, reject) => {
const defaultParam = {
bvid: '',
cid: '',
fnval: 4048
}
try {
ajax({
url: 'https://api.bilibili.com/x/player/playurl',
params: {
...defaultParam,
...searchParams
}
}).then((res) => {
const result = res
const url = result.data.dash.audio[0].base_url
resolve(url)
})
} catch (error) {
reject(error)
}
})
}
// 下载音频
function downloadAudio(url, title) {
return new Promise((resolve, reject) => {
try {
ajax({
url: url,
responseType: 'blob',
credential: false
}).then((res) => {
const reader = new FileReader();
reader.readAsDataURL(res);
reader.onload = function (e) {
const a = document.createElement('a');
a.download = `${title}.mp3`
a.href = e.target.result;
document.documentElement.appendChild(a);
a.click();
a.remove();
audioState = false;
resolve(true)
}
})
} catch (error) {
reject(error)
}
})
}
// 基于promise和XMLHttpRequest封装ajax对象
function ajax(options) {
return new Promise((resolve, reject) => {
// 存储的是默认值
const defaults = {
type: 'get',
url: '',
data: {},
async: true,
header: {
'Content-Type': 'application/json'
},
responseType: 'json',
credential: true,
params: {},
};
// 使用options对象中的属性覆盖defaults对象中的属性
Object.assign(defaults, options);
// 先判断是否要拼接参数
const params = defaults.params
const paramsKey = Object.keys(params)
if (paramsKey.length > 0) {
const str = paramsKey.reduce((pre, cur) => {
pre = pre + `&${cur}=${params[cur]}`
return pre
}, '?')
defaults.url += str
}
const xhr = new XMLHttpRequest();
// 设置该值就可以自动获取到登录后的权限
if (defaults.credential) {
xhr.withCredentials = true;
}
xhr.responseType = defaults.responseType
xhr.open(defaults.type, defaults.url, defaults.async);
if (defaults.type === 'post') {
let contentType = defaults.header['Content-Type']
xhr.setRequestHeader('Content-Type', contentType);
if (contentType === 'application/json') {
xhr.send(JSON.stringify(defaults.data))
}
} else {
xhr.send()
}
xhr.onreadystatechange = function () {
if (xhr.readyState !== 4) return
const response = xhr.response;
if (xhr.status == 200) {
resolve(response)
} else {
reject(response)
}
}
})
}
// 增加操作界面
function addPanel() {
const domPanel = `
<div class="panel">
<div id="menu" class="mediate hideMenu"></div>
<div class="menu_list mediate">
<div data-index="1"></div>
<div data-index="2"></div>
<div data-index="3"></div>
</div>
</div>
`
const bodyDOm = document.body
const panelDiv = document.createElement('div')
panelDiv.innerHTML = domPanel
bodyDOm.appendChild(panelDiv)
// 这里必须提前添加好,否则会出现第一次点击时菜单不正常出现的问题
const menuListDom = document.querySelector('.menu_list')
const menuListClass = menuListDom.classList
menuListClass.add('hideMenu')
const childrenDom = menuListDom.children
Array.prototype.forEach.call(childrenDom, (ele, idx) => {
setStyle(ele, { transform: 'translate(0, 0)', opacity: 0 })
})
}
// 展开/隐藏菜单
function switchMenu() {
const menuListDom = document.querySelector('.menu_list')
const menuListClass = menuListDom.classList
const result = Array.prototype.includes.call(menuListClass, 'hideMenu')
if (result) {
// 执行展示
menuListClass.remove('hideMenu')
menuListClass.add('showMenu')
const childrenDom = menuListDom.children
const moveKeys = ['translate(0, -70px)', 'translate(0, -125px)', 'translate(0, -180px)']
Array.prototype.forEach.call(childrenDom, (ele, idx) => {
setStyle(ele, { transform: moveKeys[idx], opacity: 1 })
})
} else {
menuListClass.remove('showMenu')
menuListClass.add('hideMenu')
const childrenDom = menuListDom.children
Array.prototype.forEach.call(childrenDom, (ele) => {
setStyle(ele, { transform: 'translate(0, 0)', opacity: 0 })
})
}
}
// 初始化
function init() {
addPanel()
GL_popup = new Popup()
const menuDom = document.getElementById('menu')
menuDom.addEventListener('click', switchMenu);
const menuListDom = document.querySelector('.menu_list')
menuListDom.addEventListener('click', function (e) {
const index = e.target.dataset.index
if (index === '3') {
showFavoritePage()
} else {
alert('更多功能,尽情期待!!!!!!!!!!!!!!')
}
})
addComplexCss()
}
// 为了防止样式被重复添加,这里对于复杂的样式提前
function addComplexCss() {
//分页器的样式
const paginationCss = `
.pagination {
display: flex;
height: 35px;
margin: 0 auto;
position: absolute;
right: 0;
margin-bottom: 4px
}
.pagination span a {
box-sizing: border-box;
text-decoration: none;
color: black;
}
.pagination span {
text-align: center;
width: 40px;
height: 35px;
line-height: 35px;
margin: 0px 2px;
}
.pagination span i {
font-size: 10px;
font-weight: 100;
}
.pagination span img {
object-fit: cover;
height: 100%;
}
.pagination .pageStyle a {
display: block;
text-align: center;
width: 40px;
height: 35px;
line-height: 35px;
/* background-color: bisque; */
border: 1px solid #ccc;
border-radius: 5px;
}
.pagination .pageStyle a:hover {
border: 1px solid rgb(27, 129, 121);
}
.pagination .active {
background-color: rgba(251, 114, 153);
color:#fff;
}
`
// 表格样式
const tableCss = `
.favorite_detail table{
width:100%;
border: 1px solid #000;
border: 1px solid;
}
.favorite_detail table thead tr{
background-color: rgba(251, 114, 153);
color:#fff;
}
.favorite_detail table thead tr th {
border-bottom: 0 !important;
}
.favorite_detail table tbody tr:nth-child(2n){
background-color: rgba(251, 114, 153,0.5);
}
.favorite_detail table tbody tr:nth-child(2n+1){
background-color: #fff;
}
.favorite_detail table tr, th, td {
text-align: center;
}
.favorite_detail table tr td{
padding: 1px 1px;
line-height: 1rem;
}
.favorite_detail table tr td input{
width:95%;
line-height: 1rem;
}
`
// 操作面板的样式
const panelCss = `
.panel {
position: fixed;
top: 70%;
left: 30px;
width: 70px;
height: 70px;
border-radius: 50%;
box-sizing: border-box;
}
.mediate {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#menu {
width: 50px;
height: 50px;
border-radius: 10%;
background-size: cover;
background-repeat: no-repeat;
background-color: rgba(251, 114, 153);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAASsElEQVR4nO2djXHbyLKFuyMwNoKlIjAdwR1GYDqCpSIwFcElIzAdwYoRWIpggQhMR2AqAsMR6H5zYZVkWoK8mh5wSPZXderct/XKNacbhwShPxXHcZ7EC+I4PXhBHKcHL4jj9OAFcZwevCCO04MXxHF68II4Tg9eEMfpwQviOD14QRynBy+I4/TgBXGcHrwgjtODF8RxevCCOE4PXhDH6cEL4jg9eEEcpwcviOP0sPeC3N7eVthbNBKR+L/H6DHif6/QUGxQi3bZyr0aVd1KwfyL+VZojIailsfZSqfINfPd4HtD0eCwtJGIvEdBhl1KDrbSLXuphZSF+VbYX2gmhz/fFl2htarWMjCDFoTFjUTkv2gmx8ml7LEozLfC4gvPHFXo2Kilm28tAzFYQVjeFPsbVeiYadEFS7yUAWG+Y+wTGsnxs2C+Szw7irLD8v6LLeS0uGSJ53h2mO9MRD6gCp0KV+hcVVs8G4qywvLmWFzeKfKRBcb82WC+QUT+QadI9hchRdk48eXdca6ZbreY7xiL863Qq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XOdyeE8Tr9mHlP8oBikIBGWeSmn83lkrYZPrfo4oLmeayE/vvBvGKwgEZa5kON/J/nIhTDHB4GZVlgtZX9dJNtnsdwMWpAIC51J9925r9Cxca57eJVkphW2Qn+hEllq5tvNXAxekAgLHUn3reSlLvTf0qAZF8FW9ghzXUh579BrHeh2MweK9gYLDdL93qO36BBp0IILoJZCYKYj4UxSxovPWg+4HBFFe+fHUqdoJmXfS0e+oEsRuWL5WymUPc+0QUW9cLwURcXBcsdYhYJ0jKTTLmP0CqVwg7byKy3aoEj09lAXzjwrbPxDFRqjCj1kJP0/VBaJLw4t2iX+tw3aCg8MmNNWjgRFjuM8gRfEcXrwgjhOD14Qx+nBC+I4PXhBHKcHL4jj9OAFcZwevCCO04MXxHF68II4Tg9eEMfpwQviOD14QRynBy+I4/TgBXGcHrwgjtODF8RxevCCOE4PXhDH6eF/k8S+QdnH3yYAAAAASUVORK5CYII=);
position: relative;
z-index: 10;
}
.menu_list {
width: 50px;
height: 50px;
z-index: 9;
display: flex;
justify-content: center;
}
.menu_list div {
width: 42px;
height: 42px;
border-radius: 10%;
position: absolute;
background-color: rgba(251, 114, 153);
background-size: cover;
background-repeat: no-repeat;
opacity: 0;
transition: all 0.4s ease-in-out;
}
.menu_list div:nth-child(1) {
transform: translate(0, 0);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAGvJJREFUeF7tXQfUdUV13VuNBY2xG5Xi0ii2aAgWbNhADBgbdhSxgC2Cghg1NlCRiIo1UQFFsKL4WwAVBUR/FSyJDVGwi7F3VCxxu7bMZ14+vzd35t65791735y13nr/v76ZMzN7Zr9pZ84hqlQEKgJzEWDFpiJQEZiPQCVIHR0VgQgClSB1eFQEKkHqGKgItEOgziDtcKu5VgSBSpAV6ejazHYIVIK0w63mWhEEKkFWpKNrM9shUAnSDreaa0UQqARZkY6uzWyHQCVIO9xqrhVBoBJkwR0t6RIALglg3rdr9J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AAcFARwUBHBQEMBBQQAHBQEcFARwUBDAQUEABwUBHBQEcFAQwEFBAAcFARwUBHBQEMBBQQAHBQEcFARwUBDAQUEABwUBHBQEcFAQwEFBAAcFARzZBbm/v7/QGJvZSAG6aq0sQwhXmklZBVE5rjXGBvRHLMlE0xUUl8pRmNkXBeib0xDCyhw5BZmZ2ScF6Jt5CGFmjpyCLM3sgwL0zZUKMtWslFOQeAWXCtA3kxDC0hzJgkQqyVrjjQL0xZ3KMdJ05RZkaHrUb2bvFKDrbpWxClJaQlCyPRRlaEB3lTnFeBQUABUoCOCgIICDggAOCgI4KAjgoCCAg4IADgoCOCgI4KAggIOCAA4KAjgoCOCgIICDggCOfwHDoNbnKb2KXwAAAABJRU5ErkJggg==);
}
.menu_list div:nth-child(3) {
transform: translate(0, 0);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAL4ElEQVR4nO3d4VXbWBeF4XMqiKaCcSqIpoLYFQypYOQKhlQwpoJABdgVhFSAqCCmgjgVRFTA994xfJnJxEdXYBnL3s9ae51fsa+lu8GSgbiJyEYqiEhABREJqCAiARVEJKCCiARUEJGACiIS2GlB7u/v3zJGtk5SkoLUttaQJbl194bZG9ZSMN6QkhQkGdv3NSQrI6zlhilHyElvHjbh7+SEjO37RsyxJHMz+8QGXdkWsJ6RrddT2boYuRpSm9kVSetpmHIEeinIw0b8i1S2HbWZnbl7bU/Aesa2Xs/YtmNu6/WsTA7aVgvCRiwYH0hl/ajN7D0bc8lsxXpKRlrP2Poxt/V6GqYcoK0VhM14wrgkBenbjE15xvwp1pLW8CeZWf8aMnX3K6YcGCfPxoZMxahst5Zk4j989WYtBeOalGSXzlnLe6YckGcV5AU346OGTPzhLRfrKRlpPQV5CUsy8R9KK8P15IKwGQtG2owleUkNmZAkracgL2lJJq6SHAQnT0JBPjNK8hR3ZEn+aWRmv5KnaEhSkKf4Slb2byV5RZ5iSUF+Y8rAOemMclwyKuvmlsyNzxLY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kFmZvYXETk0Z+4+s0BOQeZm9gcROTQXFOSUuVFOQdIDfCAih2bq7nMLtBYkoSRLxhsicihuKUfJDOUWZGRc9ZvZWyIydDekoiAra+Ek20NRRiYyXKucYjxyIiIbqCAiARVEJKCCiARUEJGACiISUEFEAiqISEAFEQmoICIBFUQkoIKIBFQQkYAKIhJQQUQCKohI4H+H2M32Rkd1JAAAAABJRU5ErkJggg==);
}
`
const strCss = paginationCss + tableCss + panelCss
addStyle(strCss)
}
// 展示收藏夹弹窗
function showFavoritePage() {
const cssContent = `
.favorite_header{
min-height: 100px;
}
.favorite_btn{
display: flex;
justify-content: flex-start;
align-items: center;
}
.favorite_content{
display: flex;
justify-content: center;
width: 100%;
max-height:75vh;
margin-top:4px;
}
.favorite_list{
flex: 1 1 22%;
overflow-y:auto;
min-height:400px;
}
.favorite_list div{
color: white;
background-color: rgba(251, 114, 153);
border: 1px solid rgb(219, 66, 110);
margin: 5px 0;
padding: 2px 4px;
}
.favorite_list div:hover{
background-color: #fff;
color: rgba(251, 114, 153);
}
.favorite_detail{
flex: 1 1 78%;
padding: 5px;
overflow-y:auto;
position: relative;
}
.table_box{
max-height: 50vh;
overflow-y: auto;
}
.btn {
background-color: rgba(251, 114, 153);
border: 2px solid rgb(219, 66, 110);
border-radius: 6px;
color: white;
padding: 2px 8px;
text-align: center;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
text-decoration: none;
text-transform: uppercase;
user-select: none;
}
/* 悬停样式 */
.btn:hover {
background-color: #fff;
color: rgba(251, 114, 153);
}
`
const domContent = `
<div class="container">
<div class="favorite_header">
<div class="favorite_hint">
<p>1.请先选择你要查询的收藏夹,并点击查询。之后才能点击下载,下载当前表格展示的歌曲</p>
<p>2.默认情况下,文件名的格式为“视频名称.mp3”,你可以填入在文件名称一列输入当前自定义的文件名</p>
<p>3.默认情况下,点击下载将下载当页全部的格式。倘若在表格进行了勾选,那么只会下载勾选的歌曲</p>
<p>4.为了保证下载的稳定性,请下载完当前页的歌曲,在点击下一页进行下载</p>
</div>
<div class="favorite_btn">
<div class="btn" data-type="search">查询</div>
<div class="btn" data-type="download">下载</div>
</div>
</div>
<div class="favorite_content">
<div class="favorite_list"></div>
<div class="favorite_detail">
<div class="table_box"></div>
<div class="pagination"></div>
</div>
</div>
</div>
`
addStyle(cssContent)
GL_popup.dialog({
width: '70vw',
title: '收藏夹信息',
content: domContent,
onReady: function () {
// 监听单选框的改变
const favoriteListDom = document.querySelector('.favorite_list')
favoriteListDom.addEventListener('click', favoriteListChange)
getFavoriteList().then((value) => {
createFavoriteList(value)
})
//操作按钮绑定事件
const favoriteBtnDom = document.querySelector('.favorite_btn')
favoriteBtnDom.addEventListener('click', favoriteBtnChange)
// 创造表格
createTable()
// 监听全选框
const selectAllDom = document.getElementById('table_selectAll')
selectAllDom.addEventListener('click', selectAllOrCancel)
// 监听单个选择框
const tbody = document.getElementById('table_body')
tbody.addEventListener('click', selectSingle)
}
})
}
function createFavoriteList(list) {
const favoriteListDom = document.querySelector('.favorite_list')
let template = ''
list.forEach((item) => {
const tpl = `
<div>
<input type="radio" id="${item.id}" name="favoriteList" value="${item.id}" che>
<label for="${item.id}">${item.title}</label>
</div>
`
template += tpl
})
favoriteListDom.innerHTML = template
}
// 初始化表格
function createTable() {
const tableBoxDom = document.querySelector('.table_box')
const table = document.createElement('table')
const thead = document.createElement('thead')
const tbody = document.createElement('tbody')
tbody.id = 'table_body'
const headContent = `
<tr>
<th>
<input type="checkbox" name="check_sum" id="table_selectAll" />
</th>
<th>序号</th>
<th>视频名称</th>
<th>up主名称</th>
<th>文件名称</th>
</tr>
`
thead.innerHTML = headContent
table.appendChild(thead)
table.appendChild(tbody)
tableBoxDom.appendChild(table)
}
// 重绘表格
function resetTable(list) {
const tbody = document.getElementById('table_body')
let bodyContent = ''
list.forEach((ele, idx) => {
const tpl = `
<tr>
<td>
<input type="checkbox" name="check_item" data-index="${idx}"/>
</td>
<td>${(GL_pagePsPn.pn - 1) * GL_pagePsPn.ps + idx + 1}</td>
<td>${ele.title}</td>
<td>${ele.upper.name}</td>
<td>
<input type="text" name="fileName" />
</td>
</tr>
`
bodyContent += tpl
})
tbody.innerHTML = bodyContent
}
let GL_favoriteId = null
let GL_selectFavoriteId = null
// 分页记录
let GL_pagePsPn = {
ps: 10,
pn: 1,
sumPn: 0,
}
function initPage(sumPN, pn) {
const pageEle = document.querySelector(".pagination");
new PageClass(pageEle, sumPN, pn, function (page) {
GL_pagePsPn.pn = page
const params = {
pn: GL_pagePsPn.pn,
media_id: GL_favoriteId,
}
getFavoriteDetail(params).then((value) => {
resetTable(value)
})
});
}
// 监听收藏夹的修改
function favoriteListChange(e) {
// 过滤掉其他元素带来的干扰
if (e.target.localName !== 'input') return
GL_selectFavoriteId = e.target.value
}
// 监听查询/下载的按钮事件
function favoriteBtnChange(e) {
const type = e.target.dataset.type
if (type === 'search') {
search()
} else if (type === 'download') {
beforeDownload()
}
}
function search() {
if (!GL_selectFavoriteId) {
alert('请先选择收藏夹')
return
}
// 判断收藏夹是否发生了改变
if (GL_favoriteId !== GL_selectFavoriteId) {
GL_pagePsPn.pn = 1
}
GL_favoriteId = GL_selectFavoriteId
const params = {
media_id: GL_favoriteId,
pn: GL_pagePsPn.pn,
ps: GL_pagePsPn.ps,
}
getFavoriteDetail(params).then((value) => {
resetTable(value)
})
}
let GL_downloadTableData = []
function beforeDownload() {
if (GL_tableData.length <= 0) {
alert('请先查询出收藏夹信息')
return
}
// 先设置一次自定义文件名
setInfo()
const selectAllDom = document.getElementById('table_selectAll')
const checkList = document.getElementsByName('check_item')
const result = arrayMethod('every', checkList, (ele) => ele.checked)
// 表示全部下载
if (selectAllDom.checked || result) {
GL_downloadTableData = GL_tableData
} else {
GL_downloadTableData = GL_tableData.filter((ele, idx) => {
if (checkList[idx].checked) {
return ele
}
})
}
download()
}
async function download(index = 0) {
const value = GL_downloadTableData[index]
if (!value) return
const { bvid, title, ugc: { first_cid: cid }, fileName } = value
const url = await getVideoDetail({ bvid, cid })
let name = fileName ? fileName : title
downloadAudio(url, name).then((res) => {
if (res) {
// 通过递归调用,把歌曲全部下载完
index++
download(index)
}
})
}
// 设置自定义的文件名字
function setInfo() {
const fileNameDomList = document.getElementsByName('fileName')
const fileNameList = arrayMethod('map', fileNameDomList, (ele) => ele.value)
GL_tableData.forEach((ele, idx) => {
if (fileNameList[idx]) {
ele.fileName = fileNameList[idx]
}
})
}
// 全选和反选
function selectAllOrCancel() {
const selectAllDom = document.getElementById('table_selectAll')
const checkList = document.getElementsByName('check_item')
arrayMethod('forEach', checkList, (ele) => {
ele.checked = selectAllDom.checked
})
}
// 单选
function selectSingle(e) {
const selectAllDom = document.getElementById('table_selectAll')
const checkList = document.getElementsByName('check_item')
const result = arrayMethod('every', checkList, (ele) => { return ele.checked })
selectAllDom.checked = result
}
// 让类数组使用数组的方法
function arrayMethod(type, list, fn) {
return Array.prototype[type].call(list, fn)
}
// 增加样式
function addStyle(css) {
const myStyle = document.createElement('style');
myStyle.textContent = css
// 插入到head或者html标签中
const doc = document.head || document.documentElement;
doc.appendChild(myStyle);
}
// 增加样式方法2
function setStyle(ele, styleObj) {
for (let attr in styleObj) {
ele.style[attr] = styleObj[attr]
}
}
// 全局弹窗
class Popup {
_mask = null
_dialog = null
_dialogHeader = null
_dialogContent = null
_dialogTitle = null
_dialogclose = null
constructor() {
// 遮罩
this._mask = document.createElement('div')
this.setStyle(this._mask, {
"width": '100%',
"height": '100%',
"backgroundColor": 'rgba(0, 0, 0, .6)',
"position": 'fixed',
"left": "0px",
"top": "0px",
"bottom": "0px",
"right": "0px",
"z-index": "99999"
})
// 弹窗
this._dialog = document.createElement('div')
this.setStyle(this._dialog, {
"overflow": 'hidden',
"backgroundColor": '#fff',
"boxShadow": '0 0 2px #999',
"position": 'absolute',
"left": '50%',
"top": '50%',
"transform": 'translate(-50%,-50%)',
"borderRadius": '3px'
})
this._mask.appendChild(this._dialog)
// 弹窗头部
this._dialogHeader = document.createElement('div')
this.setStyle(this._dialogHeader, {
"width": '100%',
"height": '40px',
"lineHeight": '40px',
"boxSizing": 'border-box',
"background-color": 'rgba(251, 114, 153)',
"color": '#FFF',
"text-align": 'center',
"font-weight": "700",
"font-size": "16px"
})
this._dialog.appendChild(this._dialogHeader)
// 弹窗内容
this._dialogContent = document.createElement('div')
this.setStyle(this._dialogContent, {
"max-height": '70vh',
"overflow-y": 'auto',
"min-width": '400px',
"width": '50vw',
})
this._dialog.appendChild(this._dialogContent)
// 标题
this._dialogTitle = document.createElement('span')
this._dialogTitle.innerText = '全局弹窗'
this.setStyle(this._dialogTitle, {
"textDecoration": 'none',
"color": '#666',
"position": 'absolute',
"left": '10px',
"top": '0px',
"fontSize": '25px',
"color": '#FFF',
"display": "inline-block"
})
this._dialogHeader.appendChild(this._dialogTitle)
// 关闭按钮
this._dialogclose = document.createElement('span')
this._dialogclose.innerText = 'X'
this._dialogclose.onclick = () => this.close(clearGlobal)
// 设置样式
this.setStyle(this._dialogclose, {
"textDecoration": 'none',
"color": '#666',
"position": 'absolute',
"right": '10px',
"top": '0px',
"fontSize": '25px',
"color": '#FFF',
"display": "inline-block",
"cursor": "pointer"
})
this._dialogHeader.appendChild(this._dialogclose)
}
// 初始化dialog的内容区
initContent(content, title = "全局弹窗", width = '') {
// 置空,前后干扰
this._dialogContent.innerHTML = ''
this._dialogTitle.innerText = ''
this._dialogTitle.innerText = title
this._dialogContent.innerHTML = content
width && this.setStyle(this._dialogContent, {
"width": width
})
}
dialog(params) {
const { width, content, title, onReady } = params
this.initContent(content, title, width)
document.body.appendChild(this._mask)
// 在弹窗创造完成后,执行这个方法
if (onReady && typeof onReady === 'function') {
setTimeout(() => {
onReady(this)
})
}
}
close(fn) {
document.body.removeChild(this._mask)
if (typeof fn === 'function') {
// 这里可以在执行额外的函数,来处理一些东西
fn()
}
}
setStyle(ele, styleObj) {
for (let attr in styleObj) {
ele.style[attr] = styleObj[attr]
}
}
}
// 分页器
class PageClass { //定义一个分页器类
constructor(ele, pageNum, page, cb) { //需要传入4个参数,第一个容器元素,第二个页面总数,第三个当前页面数,第四个为回调函数
this.ele = ele; //定义属性
this.pageNum = pageNum;
this.page = page;
this.cb = cb;
this.renderPage(); //执行渲染的方法
this.operate(); //给实例化对象绑定各种操作的方法
}
renderPage() { //在类的原型上定义一个渲染的方法
let str = '';
if (this.pageNum > 5) { //判断当前分页的页面总数是否超过5页
if (this.page <= 4) { //如果页面总数大于5 ,再判断当前页是否小于或者等于第四页
for (let i = 0; i < 5; i++) { //如果当前页是小于等于4以内的页数 ,遍历1到5
if ((i + 1) == this.page) { //判断当前页是否等于 当前 索引值(索引值从0开始) + 1
str += `<span class="pageStyle" myPage="${i + 1}"><a href="javascript:;" class="active">${i + 1}</a></span>`;//等于的话说明渲染的是当前页,给当前页一个active的类名进行渲染
} else { //如果渲染的不是当前页
str += `<span class="pageStyle" myPage="${i + 1}"><a href="javascript:;">${i + 1}</a></span>`;//普通渲染就行了
}
}
str += `<span><i>•••</i></span><span class="pageStyle" myPage="${this.pageNum}"><a href="javascript:;">${this.pageNum}</a></span>`;//最后渲染一个最末尾页
} else if (this.page > 4 && this.page < this.pageNum - 3) { //判断当前页是否大于第四页,且小于最大页数减去 3
str += `<span class="pageStyle" myPage="1"><a href="javascript:;">1</a></span><span><i>•••</i></span>`; //渲染一个首页
for (let i = this.page - 3; i < this.page + 2; i++) {
if ((i + 1) == this.page) { //判断当前正在渲染的是否为当前页
str += `<span class="pageStyle" myPage="${i + 1}"><a href="javascript:;" class="active">${i + 1}</a></span>`;//如果是当前页,给一个active类名进行渲染
} else {
str += `<span class="pageStyle" myPage="${i + 1}"><a href="javascript:;">${i + 1}</a></span>`;//如果不是,普通渲染就行
}
}
str += `<span><i>•••</i></span><span class="pageStyle" myPage="${this.pageNum}"><a href="javascript:;">${this.pageNum}</a></span>`;//渲染一个尾页
} else if (this.page >= this.pageNum - 3) {//如果当前页数大于或者等于最大页数 - 3
str += `<span class="pageStyle" myPage="1"><a href="javascript:;">1</a></span><span><i>•••</i></span>`; //渲染一个首页
for (let i = this.pageNum - 5; i < this.pageNum; i++) {//从倒数第5页开始渲染
if ((i + 1) == this.page) { //如果渲染的是当前页
str += `<span class="pageStyle" myPage="${i + 1}"><a href="javascript:;" class="active">${i + 1}</a></span>`;//增加一个active类名,进行渲染
} else {
str += `<span class="pageStyle" myPage="${i + 1}"><a href="javascript:;">${i + 1}</a></span>`;//否则普通渲染
}
}
}
} else { //如果最大页数小于等于5
for (let i = 0; i < this.pageNum; i++) { //直接渲染到当前最大页数
if ((i + 1) == this.page) { //判断渲染的是否为当前页数
str += `<span class="pageStyle" myPage="${i + 1}"><a href="javascript:;" class="active">${i + 1}</a></span>`;//如果是增加一个active类名,进行渲染
} else {
str += `<span class="pageStyle" myPage="${i + 1}"><a href="javascript:;">${i + 1}</a></span>`;//否则普通渲染就行了
}
}
}
//将所有内容渲染到容器盒子里
//第一页
//上一页
//中间页面
//下一页
//最后一页
this.ele.innerHTML = `
<span class="first"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAGWUlEQVR4nO3WPY5cVRBA4Z6WnHsJ3gEsAVYCDhApSAQOTeYAsQGCWYqHnXgNkFhty+MuaWSNx923f95571Xde05UNy3pu6qbjZkdTSBmjQRi1kggZo0EYtZIIGaNBGLWSCBmjQRi1kggZo0EYtZIIGaNMCD3r25ffNztftqPNdpu/3321y93G+uq+9e3zzfvN89v3rx8twHCgHz4458fNp8+vd2PVfrz2d+/vt5YNwWOD//v3t7cbH+nPj+BWBd9wXG/+X5/HfwokOkJpJO+whEJBEkgHfQNjkggSAIp3kEckUCQBFK4ozgigSAJpGhNHJFAkARSsJM4IoEgCaRYZ+GIBIIkkEKdjSMSCJJAinQRjkggSAIp0MU4IoEgCSR5V+GIBIIkkMRdjSMSCJJAkjYJRyQQJIEkbDKOSCBIAkkWgiMSCJJAEoXhiASCJJAkoTgigSAJJEE4jkggSAJZuVlwRAJBEsiKzYYjEgiSQFZqVh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k4aJxHJlAgARyv+gARyYQIIHcLTrBkQkESCC3RUc4MoEACeSm6AxHJhAggfSJIxMI0OhAolMcmUCARgYSHePIBAI0KpDoHEcmEKARgcQAODKBAI0GJAbBkQkEaCQgMRCOTCBAowCJwXBkAgEaAUgMiCMTCFDvQGJQHJlAgHoGEgPjyAQC1CuQGBxHJhCgHoGEOP5LIEC9AQlxfEggQD0BCXHcSSBAvQAJcdxLIEA9AAlxPJhAgFoHEuI4mECAWgYS4igmEKBWgYQ4Hk0gQC0CCXEclUCAWgMS4jg6gQC1BCTEcVICAWoFSIjj5AQC1AKQEMdZCQSodiAhjrMTCFDNQEIcsxIIUK1AQhyzEwhQjUBCHEgCAaoNSIgDSyBANQEJcaAJBKgWICEOPIEA1QAkxLFIAgHaGkiIY7EEArQlkBDHogkEaCsgIY7FEwjQFkBCHKskEKC1gYQ4VksgQGsCCXGsmkCA1gIS4lg9gQCtASTEsUkCAVoaSIhjswQCtCSQEMemCQRoKSAhjs0TCNASQEIcVSQQIBpIiKOaBAJEAglxVJVAgCggIY7qEggQASTEUWUCAZoLJMRRbQIBmgMkxFF1AgE6F0iIo/oEAnQOkBBHEwkE6FQgIY5mEgjQKUBCHE0lEKBjgYQ4mksgQMcACXE0mUCAHgMS4mg2gQCVgIQ4mk4gQIeAhDiaTyBADwEJcXSRQIA+BRLi6CaBAH0MJMTRVQIBugVy8cfTZ5cvxdFPAgFKIBHXL3c/ffNysq4SCFBcvfnCV6PP8vLb/w6eT430dLf77eL1q7cTEAbErMcEYlZIIGaFBGJWSCBmhQRiVkggZoUEYlZIIGaFBGJWSCBmhQRiVuhfgsqYUOUlgdkAAAAASUVORK5CYII="></span>
`
}
operate() { //在类原型上定义一个operate的方法,给这个类绑定点击事件
const _that = this; //申明一个常量接收this
let firstEle = this.ele.querySelector(".first"); //获取第一页的元素
let lastEle = this.ele.querySelector(".last"); //获取最后一页的元素
let nextEle = this.ele.querySelector(".next"); //获取下一页的元素myPage.active
let prevEle = this.ele.querySelector(".prev"); //获取上一页的元素
let pageStyleEles = this.ele.querySelectorAll(".pageStyle"); //获取所有的中间页面的元素
firstEle.onclick = function () { //当点击第一页时
_that.page = 1; //让page属性重新赋值为1
_that.cb(_that.page); //并将page属性通过回调函数cb传递出去
}
lastEle.onclick = function () { //当点击最后一页时
_that.page = _that.pageNum; //让page属性重新赋值为页面最大值
_that.cb(_that.page); //并将page属性通过回调函数cb传递出去
}
nextEle.onclick = function () { //当点击下一页时
if (_that.page < _that.pageNum) { //先判断当前页是否小于最大页
_that.page = _that.page + 1; //如果没有超过,给page属性自增1
_that.cb(_that.page); //并将page属性通过回调函数cb传递出去
}
}
prevEle.onclick = function () { //当点击上一页时
if (_that.page > 1) { //先判断当前页是否大于第一页
_that.page = _that.page - 1; //如果是大于第一页的话,page属性自减1
_that.cb(_that.page); //并将page属性通过回调函数cb传递出去
}
}
pageStyleEles.forEach(function (pageStyleEle) { //遍历获取到中间页面的所有元素
pageStyleEle.onclick = function () { //当点击其中一页时
_that.page = parseInt(this.getAttribute("myPage")); //获取这个元素自定义属性,myPage,属性值是当前页 ,并将当前页赋值给page属性
_that.cb(_that.page); //将page属性通过回调函数cb传递出去
}
});
}
}
// 全局变量置空
function clearGlobal() {
GL_favoriteId = null
GL_selectFavoriteId = null
GL_downloadTableData = []
GL_favoriteList = []
GL_lateOnList = []
GL_PageCount = 0
GL_pagePsPn = {
ps: 10,
pn: 1,
sumPn: 0,
}
GL_tableData = []
}
setTimeout(() => {
init()
}, 500)
}())