💯 懒人专用系列 ——— 全网音乐下载

⭕网易云音乐、QQ音乐、酷狗、酷我、喜马拉雅等网站音乐和有声书音频免客户端下载。⭕喜马拉雅批量下载。⭕可自由修改图标位置、大小、透明度。❌拒绝收费。⭕持续更新。

// ==UserScript==
// @name         💯 懒人专用系列 ——— 全网音乐下载
// @namespace    lr-toolbox-Musicdownload
// @version      1.0.9
// @description  ⭕网易云音乐、QQ音乐、酷狗、酷我、喜马拉雅等网站音乐和有声书音频免客户端下载。⭕喜马拉雅批量下载。⭕可自由修改图标位置、大小、透明度。❌拒绝收费。⭕持续更新。
// @author       lanhaha
// @icon         https://s1.music.126.net/style/favicon.ico
// @match        *://music.163.com/*
// @match        *://y.qq.com/*
// @match        *://*.kugou.com/*
// @match        *://*.kuwo.cn/*
// @match        *://*.ximalaya.com/*
// @require      https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/crypto-js/4.1.1/crypto-js.min.js
// @grant        GM_registerMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @grant        GM_download
// @grant        GM_setClipboard
// @connect      api.typechrome.com
// @connect      gitlab.com
// ==/UserScript==

/*
***********************************************************
应Greasyfork.org网站规则要求,
懒人脚本将视频解析、音乐下载、视频下载等功能拆分为多个脚本:
https://greasyfork.org/zh-CN/scripts/467776
https://greasyfork.org/zh-CN/scripts/469604
https://greasyfork.org/zh-CN/scripts/469689
https://greasyfork.org/zh-CN/scripts/468015
https://greasyfork.org/zh-CN/scripts/469521
可自行分别安装。
***********************************************************
*/

(function() {
    'use strict';

    //GM_deleteValue('iconTop');return;
    //禁止iframe内加载脚本,如:网易云
    if(self.frameElement && self.frameElement.tagName == "IFRAME"){

        return;
    }

     /*--config--*/
    var Config ={

        couponUrl:window.location.href,

        couponHost:window.location.host,

        webUrl:'http://music.liuzhijin.cn/',

        isMobile:/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent),

        iconVipTop:360,

        iconVipPosition : 'left',

        iconVipWidth : 40,

        couponTimerNum : 100,//100次等于10秒

        couponWaitTime : 100,

        iconWaitTime : 100,

        iconVipOpacity:100,

        selectedLeft:'selected',

        selectedRight:'',

        qqMusicDownload:GM_getValue('qqMusicDownload',22),

        netEaseMusicDownload:GM_getValue('netEaseMusicDownload',22),

        kugouMusicDownload:GM_getValue('kugouMusicDownload',22),

        kuwoMusicDownload:GM_getValue('kuwoMusicDownload',22),

        ximalayaMusicDownload:GM_getValue('ximalayaMusicDownload',22),

     }
    var {couponUrl,
         couponHost,
         webUrl,
         isMobile,
         iconVipTop,
         iconVipPosition,
         iconVipWidth,
         iconVipOpacity,
         couponTimerNum,
         couponWaitTime,
         iconWaitTime,
         selectedLeft,
         selectedRight,
         qqMusicDownload,
         netEaseMusicDownload,
         kugouMusicDownload,
         kuwoMusicDownload,
         ximalayaMusicDownload
        } = Config;
    /*--lang--*/
    var lang = {
        set:'设置',
        iconPosition:'图标设置',
        playVideo:'音乐解析',
        playMusic:'音乐下载',
        iconHeight:'图标高度',
        iconWidth:'图标大小',
        iconLine:'水平位置',
        iconWaitTime:'等待时间',
        iconLeft:'靠左',
        iconRight:'靠右',
        tipIconHeight:'默认360,建议1~500',
        tipIconWidth:'默认40,建议20~50',
        tipIconOpacity:'请填写0-100的整数',
        tipErrorIconHeight:'<图标位置>中的<图标高度>应为1000以内正整数,建议1~500',
        tipErrorIconWidth:'<图标位置>中的<图标大小>应为100以内正整数,建议20~50',
        tipErrorIconOpacity:'填写数字不正确',
        musicDownload:'音乐下载',
        qqMusicDownload:'QQ音乐',
        netEaseMusicDownload:'网易云',
        kugouMusicDownload:'酷狗',
        kuwoMusicDownload:'酷我',
        ximalayaMusicDownload:'喜马拉雅',
        scriptsinstall:'脚本安装',
        scriptsuse:'使用方法',
        question:'常见问题',
        tggroup:'Telegram'
    };

    var musicDownload = [
            {funcName:"playMusic",name:'netease',match:/^https?:\/\/music\.163\.com/,tip:'请在音乐单曲页点击图标下载',isOpen:netEaseMusicDownload},

            {funcName:"playMusic",name:'qq',match:/^https?:\/\/y\.qq\.com/,tip:'请点击播放需要下载的歌曲,在播放页点击图标下载',isOpen:qqMusicDownload},

            {funcName:"playMusic",name:'kugou',match:/kugou\.com/,tip:'请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"',isOpen:kugouMusicDownload},

            {funcName:"playMusic",name:'kuwo',match:/kuwo\.cn/,tip:'请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"',isOpen:kuwoMusicDownload},

            {funcName:"playMusic",name:'ximalaya',match:/^https?:\/\/www\.ximalaya\.com/,tip:'请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"',isOpen: ximalayaMusicDownload}
        ];

    /*--create style--*/

    var domHead = document.getElementsByTagName('head')[0];

    var domStyle = document.createElement('style');

    domStyle.type = 'text/css';

    domStyle.rel = 'stylesheet';

    class BaseClass{

        constructor(){

            if(GM_getValue('iconPositionSetPage') != 0){

                iconVipTop = GM_getValue('iconTop') || GM_getValue('iconTop') == 0?GM_getValue('iconTop'):iconVipTop;

                iconVipPosition = GM_getValue('iconPosition')?GM_getValue('iconPosition'):iconVipPosition;

                selectedLeft = iconVipPosition=='left'?'selected':'';

                selectedRight = iconVipPosition=='right'?'selected':'';

                iconVipWidth = GM_getValue('iconWidth')?GM_getValue('iconWidth'):iconVipWidth;

                iconWaitTime = GM_getValue('iconWaitTime')?GM_getValue('iconWaitTime')*1000:iconWaitTime;

                iconVipOpacity = GM_getValue('iconOpacity') || GM_getValue('iconOpacity') == 0?GM_getValue('iconOpacity'):iconVipOpacity;

            }

            GM_registerMenuCommand("设置", () => this.menuSet());

            this.setStyle();

        }
        setStyle(){
            let menuSetStyle = `
                        .zhmMask{
                            z-index:999999999;
                            background-color:#000;
                            position: fixed;top: 0;right: 0;bottom: 0;left: 0;
                            opacity:0.8;
                        }
                        .wrap-box{
                            z-index:1000000000;
                            position:fixed;;top: 50%;left: 50%;transform: translate(-50%, -200px);
                            width: 300px;
                            color: #555;
                            background-color: #fff;
                            border-radius: 5px;
                            overflow:hidden;
                            font:16px numFont,PingFangSC-Regular,Tahoma,Microsoft Yahei,sans-serif !important;
                            font-weight:400 !important;
                        }
                        .setWrapHead{
                            background-color:#f24443;height:40px;color:#fff;text-align:center;line-height:40px;
                        }
                        .setWrapLi{
                            margin:0px;padding:0px;
                        }
                        .setWrapLi li{
                            background-color: #fff;
                            border-bottom:1px solid #eee;
                            margin:0px !important;
                            padding:12px 20px;
                            display: flex;
                            justify-content: space-between;align-items: center;
                            list-style: none;
                        }

                        .setWrapLiContent{
                            display: flex;justify-content: space-between;align-items: center;
                        }
                        .setWrapSave{
                            position:absolute;top:-2px;right:10px;font-size:24px;cursor:pointer
                        }
                        .iconSetFoot{
                            position:absolute;bottom:0px;padding:10px 20px;width:100%;
                        z-index:1000000009;background:#fef9ef;
                        }
                        .iconSetFootLi{
                            margin:0px;padding:0px;
                        }

                        .iconSetFootLi li{
                            display: inline-flex;
                            padding:0px 2px;
                            justify-content: space-between;align-items: center;
                            font-size: 12px;
                        }
                        .iconSetFootLi li a{
                            color:#555;
                        }
                        .iconSetFootLi a:hover {
                            color:#fe6d73;
                        }
                        .iconSetPage{
                            z-index:1000000001;
                            position:absolute;top:0px;left:300px;
                            background:#fff;
                            width:300px;
                            height:100%;
                        }
                        .iconSetUlHead{
                        padding:0px;
                        margin:0px;
                        }
                        .iconSetPageHead{
                            border-bottom:1px solid #ccc;
                            height:40px;
                            line-height:40px;
                            display: flex;
                            justify-content: space-between;
                            align-items: center;
                            background-color:#fe6d73;
                            color:#fff;
                            font-size: 15px;
                        }
                        .iconSetPageLi{
                            margin:0px;padding:0px;
                        }
                        .iconSetPageLi li{
                            list-style: none;
                            padding:8px 20px;
                            border-bottom:1px solid #eee;
                        }
                        .zhihuSetPage{
                            z-index:1000000002;position:absolute;top:0px;left:300px;background:#fff;width:300px;height:100%;
                        }
                        .iconSetPageInput{
                            display: flex !important;justify-content: space-between;align-items: center;
                        }
                        .zhihuSetPageLi{
                            margin:0px;padding:0px;
                            height:258px;
                            overflow-y: scroll;
                        }

                        .zhihuSetPageContent{
                            display: flex !important;justify-content: space-between;align-items: center;
                        }

                        .zhm_circular{
                            width: 40px;height: 20px;border-radius: 16px;transition: .3s;cursor: pointer;box-shadow: 0 0 3px #999 inset;
                        }
                        .round-button{
                            width: 20px;height: 20px;;border-radius: 50%;box-shadow: 0 1px 5px rgba(0,0,0,.5);transition: .3s;position: relative;
                        }
                        .zhm_back{
                            border: solid #FFF; border-width: 0 3px 3px 0; display: inline-block; padding: 3px;transform: rotate(135deg);  -webkit-transform: rotate(135deg);margin-left:10px;cursor:pointer;
                        }
                        .to-right{
                            margin-left:20px; display: inline-block; padding: 3px;transform: rotate(-45deg); -webkit-transform: rotate(-45deg);cursor:pointer;

                        }
                        .iconSetSave{
                            font-size:24px;cursor:pointer;margin-right:5px;margin-bottom:4px;color:#FFF;
                        }
                        .zhm_set_page{
                            z-index:1000000003;
                            position:absolute;
                            top:0px;left:300px;
                            background:#fff;
                            width:300px;
                            height:100%;
                        }
                        .zhm_set_page_header{
                            border-bottom:1px solid #ccc;
                            height:40px;
                            line-height:40px;
                            display: flex;
                            justify-content: space-between;
                            align-items: center;
                            background-color:#fe6d73;
                            color:#fff;
                            font-size: 15px;
                        }
                        .zhm_set_page_content{
                            display: flex !important;justify-content: space-between;align-items: center;
                        }
                        .zhm_set_page_list{
                            margin:0px;padding:0px;
                            height: 220px;
                            overflow-y: scroll;
                        }

                        .zhm_set_page_list::-webkit-scrollbar {
                            /*滚动条整体样式*/
                            width : 0px;  /*高宽分别对应横竖滚动条的尺寸*/
                            height: 1px;
                        }
                        .zhm_set_page_list::-webkit-scrollbar-thumb {
                            /*滚动条里面小方块*/
                            border-radius   : 2px;
                            background-color: #fe6d73;
                        }
                        .zhm_set_page_list::-webkit-scrollbar-track {
                            /*滚动条里面轨道*/
                            box-shadow   : inset 0 0 5px rgba(0, 0, 0, 0.2);
                            background   : #ededed;
                            border-radius: 10px;
                        }
                        .zhm_set_page_list li{
                            /*border-bottom:1px solid #ccc;*/
                            padding:12px 20px;
                            display:block;
                            border-bottom:1px solid #eee;
                        }
                        li:last-child{
                            border-bottom:none;
                        }
                        .zhm_scroll{
                        overflow-y: scroll !important;
                        }
                        .zhm_scroll::-webkit-scrollbar {
                            /*滚动条整体样式*/
                            width : 0px;  /*高宽分别对应横竖滚动条的尺寸*/
                            height: 1px;
                        }
                        .zhm_scroll::-webkit-scrollbar-thumb {
                            /*滚动条里面小方块*/
                            border-radius   : 2px;
                            background-color: #fe6d73;
                        }
                        .zhm_scroll::-webkit-scrollbar-track {
                            /*滚动条里面轨道*/
                            box-shadow   : inset 0 0 5px rgba(0, 0, 0, 0.2);
                            background   : #ededed;
                            border-radius: 10px;
                        }
                        /*-form-*/
                        :root {
                            --base-color: #434a56;
                            --white-color-primary: #f7f8f8;
                            --white-color-secondary: #fefefe;
                            --gray-color-primary: #c2c2c2;
                            --gray-color-secondary: #c2c2c2;
                            --gray-color-tertiary: #676f79;
                            --active-color: #227c9d;
                            --valid-color: #c2c2c2;
                            --invalid-color: #f72f47;
                            --invalid-icon: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M13.41%2012l4.3-4.29a1%201%200%201%200-1.42-1.42L12%2010.59l-4.29-4.3a1%201%200%200%200-1.42%201.42l4.3%204.29-4.3%204.29a1%201%200%200%200%200%201.42%201%201%200%200%200%201.42%200l4.29-4.3%204.29%204.3a1%201%200%200%200%201.42%200%201%201%200%200%200%200-1.42z%22%20fill%3D%22%23f72f47%22%20%2F%3E%3C%2Fsvg%3E");
                        }
                        .text-input {
                            font-size: 16px;
                            position: relative;
                            right:0px;
                            z-index: 0;
                        }
                        .text-input__body {
                            -webkit-appearance: none;
                            -moz-appearance: none;
                            appearance: none;
                            background-color: transparent;
                            border: 1px solid var(--gray-color-primary);
                            border-radius: 3px;
                            height: 1.7em;
                            line-height: 1.7;
                            overflow: hidden;
                            padding: 2px 1em;
                            text-overflow: ellipsis;
                            transition: background-color 0.3s;
                            width:55%;
                            font-size:14px;
                            box-sizing: initial;
                        }
                        .text-input__body:-ms-input-placeholder {
                            color: var(--gray-color-secondary);
                        }
                        .text-input__body::-moz-placeholder {
                            color: var(--gray-color-secondary);
                        }
                        .text-input__body::placeholder {
                            color: var(--gray-color-secondary);
                        }

                        .text-input__body[data-is-valid] {
                            padding-right: 1em;

                        }
                        .text-input__body[data-is-valid=true] {
                            border-color: var(--valid-color);
                        }
                        .text-input__body[data-is-valid=false] {
                            border-color: var(--invalid-color);
                            box-shadow: inset 0 0 0 1px var(--invalid-color);
                        }
                        .text-input__body:focus {
                            border-color: var(--active-color);
                            box-shadow: inset 0 0 0 1px var(--active-color);
                            outline: none;
                        }
                        .text-input__body:-webkit-autofill {
                            transition-delay: 9999s;
                            -webkit-transition-property: background-color;
                            transition-property: background-color;
                        }
                        .text-input__validator {
                            background-position: right 0.5em center;
                            background-repeat: no-repeat;
                            background-size: 1.5em;
                            display: inline-block;
                            height: 100%;
                            left: 0;
                            position: absolute;
                            top: 0;
                            width: 100%;
                            z-index: -1;
                        }
                        .text-input__body[data-is-valid=false] + .text-input__validator {
                            background-image: var(--invalid-icon);
                        }
                        .select-box {
                            box-sizing: inherit;
                            font-size: 16px;
                            position: relative;
                            transition: background-color 0.5s ease-out;
                            width:90px;
                        }
                        .select-box::after {
                            border-color: var(--gray-color-secondary) transparent transparent transparent;
                            border-style: solid;
                            border-width: 6px 4px 0;
                            bottom: 0;
                            content: "";
                            display: inline-block;
                            height: 0;
                            margin: auto 0;
                            pointer-events: none;
                            position: absolute;
                            right: -72px;
                            top: 0;
                            width: 0;
                            z-index: 1;
                        }
                        .select-box__body {
                            box-sizing: initial;
                            -webkit-appearance: none;
                            -moz-appearance: none;
                            appearance: none;
                            background-color: transparent;
                            border: 1px solid var(--gray-color-primary);
                            border-radius: 3px;
                            cursor: pointer;
                            height: 1.7em;
                            line-height: 1.7;
                            padding-left: 1em;
                            padding-right: calc(1em + 16px);
                            width: 140%;
                            font-size:14px;
                            padding-top:2px;
                            padding-bottom:2px;
                        }
                        .select-box__body[data-is-valid=true] {
                            border-color: var(--valid-color);
                            box-shadow: inset 0 0 0 1px var(--valid-color);
                        }
                        .select-box__body[data-is-valid=false] {
                            border-color: var(--invalid-color);
                            box-shadow: inset 0 0 0 1px var(--invalid-color);
                        }
                        .select-box__body.focus-visible {
                            border-color: var(--active-color);
                            box-shadow: inset 0 0 0 1px var(--active-color);
                            outline: none;
                        }
                        .select-box__body:-webkit-autofill {
                            transition-delay: 9999s;
                            -webkit-transition-property: background-color;
                            transition-property: background-color;
                        }
                        .textarea__body {
                            -webkit-appearance: none;
                            -moz-appearance: none;
                            appearance: none;
                            background-color: transparent;
                            border: 1px solid var(--gray-color-primary);
                            border-radius: 0;
                            box-sizing: initial;
                            font: inherit;
                            left: 0;
                            letter-spacing: inherit;
                            overflow: hidden;
                            padding: 1em;
                            position: absolute;
                            resize: none;
                            top: 0;
                            transition: background-color 0.5s ease-out;
                            width: 100%;
                            }
                        .textarea__body:only-child {
                            position: relative;
                            resize: vertical;
                        }
                        .textarea__body:focus {
                            border-color: var(--active-color);
                            box-shadow: inset 0 0 0 1px var(--active-color);
                            outline: none;
                        }
                        .textarea__body[data-is-valid=true] {
                            border-color: var(--valid-color);
                            box-shadow: inset 0 0 0 1px var(--valid-color);
                        }
                        .textarea__body[data-is-valid=false] {
                            border-color: var(--invalid-color);
                            box-shadow: inset 0 0 0 1px var(--invalid-color);
                        }

                        .textarea ._dummy-box {
                            border: 1px solid;
                            box-sizing: border-box;
                            min-height: 240px;
                            overflow: hidden;
                            overflow-wrap: break-word;
                            padding: 1em;
                            visibility: hidden;
                            white-space: pre-wrap;
                            word-wrap: break-word;
                        }
                        .toLeftMove{
                            nimation:moveToLeft 0.5s infinite;
                            -webkit-animation:moveToLeft 0.5s infinite; /*Safari and Chrome*/
                            animation-iteration-count:1;
                            animation-fill-mode: forwards;
                        }

                        @keyframes moveToLeft{
                            from {left:200px;}
                            to {left:0px;}
                        }

                        @-webkit-keyframes moveToLeft /*Safari and Chrome*/{
                            from {left:200px;}
                            to {left:0px;}
                        }

                        .toRightMove{
                            nimation:moveToRight 2s infinite;
                            -webkit-animation:moveToRight 2s infinite; /*Safari and Chrome*/
                            animation-iteration-count:1;
                            animation-fill-mode: forwards;
                        }
                        @keyframes moveToRight{
                            from {left:0px;}
                            to {left:2000px;}
                        }

                        @-webkit-keyframes moveToRight /*Safari and Chrome*/{
                            from {left:0px;}
                            to {left:200px;}
                        }

                    `;

            domStyle .appendChild(document.createTextNode(menuSetStyle));

            domHead.appendChild(domStyle);
        }
        menuSet(){

            var _this = this;

            var setListJson= [
                {'listName':lang.iconPosition,'setListID':'iconPositionSetPage','setPageID':'movieIconSetPage','takePlace':'0px'},
                {'listName':lang.playMusic,'setListID':'musicList','setPageID':'musicSetPage','takePlace':'0px'},
            ];

            var musicListJson = [
                {'optionName':lang.qqMusicDownload,'optionID':'qqMusicDownload','default':qqMusicDownload},
                {'optionName':lang.netEaseMusicDownload,'optionID':'netEaseMusicDownload','default':netEaseMusicDownload},
                {'optionName':lang.kugouMusicDownload,'optionID':'kugouMusicDownload','default':kugouMusicDownload},
                {'optionName':lang.kuwoMusicDownload,'optionID':'kuwoMusicDownload','default':kuwoMusicDownload},
                {'optionName':lang.ximalayaMusicDownload,'optionID':'ximalayaMusicDownload','default':ximalayaMusicDownload},
            ];

            var setHtml = "<div id='setMask' class='zhmMask'></div>";

                setHtml +="<div class='wrap-box' id='setWrap'>";

                setHtml +="<div class='iconSetPage' id='movieIconSetPage'>";

                setHtml +="<ul class='iconSetUlHead'><li class='iconSetPageHead'><span class='zhm_back'></span><span>"+lang.iconPosition+"</span><span class='iconSetSave'>×</span></li></ul>";

                setHtml +="<ul class='iconSetPageLi'>";

                setHtml +="<li>"+lang.iconHeight+":<span class='text-input'><input class='text-input__body' id='iconTop' value='"+GM_getValue('iconTop',360)+"' placeholder='"+lang.tipIconHeight+"'><span class='text-input__validator'></span></span></li>";

                setHtml += "<li  style='display: inline-flex;'><span style='padding-top:4px;'>"+lang.iconLine+":</span><div class='select-box'><select class='select-box__body' id='iconPosition'>";

                setHtml +="<option value='left' "+selectedLeft+">"+lang.iconLeft+"</option><option value='right' "+selectedRight+">"+lang.iconRight+"</option>";

                setHtml +="</select></div></li>"

                setHtml +="<li>"+lang.iconWidth+":<span class='text-input'><input class='text-input__body' id='iconWidth' value='"+iconVipWidth+"' placeholder='"+lang.tipIconWidth+"'><span class='text-input__validator'></span></span></li>";

                setHtml += "<li  style='display: inline-flex;'><span style='padding-top:4px;'>"+lang.iconWaitTime+":</span><div class='select-box'><select class='select-box__body' id='iconWaitTime'>";

                for(let i =1;i<=8;i++){

                    let iconSelected = GM_getValue('iconWaitTime')==i/2?'selected':'';

                    setHtml +="<option value="+i/2+" "+iconSelected+">"+i/2+"秒</option>";

                }

                setHtml +="</select></div></li>";

                setHtml +="<li>透 明 度 :<span class='text-input'><input class='text-input__body' id='iconOpacity' value='"+iconVipOpacity+"' placeholder='"+lang.tipIconOpacity+"'></span></li>";

                setHtml +="</ul></div>";

                setHtml +="<div class='zhm_set_page' id='musicSetPage'>";

                setHtml +="<ul class='iconSetUlHead'><li class='zhm_set_page_header'><span class='zhm_back'></span><span>"+lang.musicDownload+"</span><span  class='iconSetSave'>×</li></ul>";

                setHtml +="<ul class='zhm_set_page_list'>";

                for(let i=0;i<musicListJson.length;i++){

                    let backColor,switchBackCorlor,display;

                    let optionValue = GM_getValue(musicListJson[i].optionID,musicListJson[i].default);

                    if(optionValue != '22'){

                        backColor = '#fff';

                        switchBackCorlor = '#FFF';

                        display = 'none';

                    }else{

                        backColor = '#fe6d73';

                        switchBackCorlor = '#FFE5E5';

                        display = 'block';

                    }

                    setHtml +="<li>";

                    setHtml +="<div class='zhm_set_page_content'>";

                    setHtml += "<span>"+musicListJson[i].optionName+"</span>";

                    setHtml +="<div class='zhm_circular' style='background-color:"+switchBackCorlor+"' id='"+musicListJson[i].optionID+"'>";

                    setHtml +="<div class='round-button' style='background: "+backColor+"; left: "+optionValue+"px;'></div>";

                    setHtml += "</div></div>";

                    setHtml += "</li>";

                }

                setHtml +="</ul>"

                setHtml +="</div>"

                setHtml +="<ul class='iconSetUlHead'><li class='iconSetPageHead'><span></span><span>"+lang.set+"</span><span class='iconSetSave'>×</span></li></ul>";

                setHtml +="<ul class='setWrapLi'>";

                for(var setN=0;setN<setListJson.length;setN++){

                    var listValue = GM_getValue(setListJson[setN].setListID,'22');

                    let backColor,arrowColor,switchBackCorlor;

                    if(listValue != 22){
                        backColor = '#fff';
                        arrowColor= '#EEE';
                        switchBackCorlor = '#FFF';

                    }else{
                        backColor = '#fe6d73';
                        arrowColor = '#CCC';
                        switchBackCorlor = '#FFE5E5';
                    }

                    if(setListJson[setN].setPageID == ''){
                        arrowColor = '#EEE';
                    };
                    setHtml +="<li><span>"+setListJson[setN].listName+"</span>";

                    setHtml +="<div class='setWrapLiContent'>";

                    setHtml +="<div class='zhm_circular' id='"+setListJson[setN].setListID+"' style='background-color: "+switchBackCorlor+";'><div class='round-button' style='background: "+backColor+";left: "+listValue+"px'></div></div>";

                    setHtml +="<span class='to-right' data='"+setListJson[setN].setPageID+"' takePlace='"+setListJson[setN].takePlace+"' style='border: solid "+arrowColor+"; border-width: 0 3px 3px 0;'></span></div></li>";
                }

                setHtml +="</ul>";

                setHtml +="<div style='height:40px;' id='zhmTakePlace'></div>";

                setHtml +="<div class='iconSetFoot' style=''>";

                setHtml +="<ul class='iconSetFootLi'>";

                setHtml +="<li><a href='https://gitlab.com/lanhaha/lanrenjiaoben#%E5%AE%89%E8%A3%85tm' target='_blank'>"+lang.scriptsinstall+"</a></li>・<li><a href='https://gitlab.com/lanhaha/lanrenjiaoben#%E4%BD%BF%E7%94%A8' target='_blank'>"+lang.scriptsuse+"</a></li>・<li><a href='https://gitlab.com/lanhaha/lanrenjiaoben#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98' target='_blank'>"+lang.question+"</a></li>・<li><a href='https://t.me/+sGo6ZZvy54wzYTll' target='_blank'>"+lang.tggroup+"</a></li>";

                setHtml +='</ul>';

                setHtml +='</div>';

                setHtml += "</div>";

            if(document.querySelector('#setMask')) return;

            this.createElement('div','zhmMenu');

            let zhmMenu = document.getElementById('zhmMenu');

            zhmMenu.innerHTML = setHtml;

            let timerZhmIcon = setInterval(function(){

                if (document.querySelector('#zhmMenu')){

                    clearInterval(timerZhmIcon); // 取消定时器

                    let circular = document.querySelectorAll('.zhm_circular');

                    circular.forEach(function(item){

                        item.addEventListener('click', function(_e){

                            let buttonStyle = item.children[0].style;

                            let left = buttonStyle.left;

                            left = parseInt(left);

                            let listLeftValue;

                            if(left==0){

                                buttonStyle.left = '22px';

                                buttonStyle.background = '#fe6d73';

                                item.style.background='#ffE5E5';

                                if(item.nextSibling && item.nextSibling.getAttribute('data')){

                                    item.nextSibling.setAttribute('style','border: solid #ccc;border-width: 0 3px 3px 0;')
                                }

                                listLeftValue = 22;

                            }else{

                                buttonStyle.left = '0px';

                                buttonStyle.background = '#fff';

                                item.style.background='#fff';

                                if(item.nextSibling){

                                    item.nextSibling.setAttribute('style','border: solid #EEE;border-width: 0 3px 3px 0;')

                                }

                                listLeftValue = 0;
                            }

                            let setListID = item.id;

                            GM_setValue(setListID,listLeftValue);

                        })

                    });

                    let toRight = document.querySelectorAll('.to-right');

                    toRight.forEach(function(item){

                        item.addEventListener('click', function(e){

                            let left = item.previousSibling.children[0].style.left;

                            left = parseInt(left);

                            if(left != 22) return;

                            let setPageID = item.getAttribute('data');

                            let pageId = document.getElementById(setPageID);

                            pageId.className='iconSetPage toLeftMove';

                            //实时图标高度
                            if(setPageID == 'movieIconSetPage'){

                                //document.querySelector('#iconTop').value=document.querySelector("#zhmlogo").offsetTop;

                                document.querySelector('#zhmTakePlace').style="height:200px";


                            }

                            if(setPageID == 'musicSetPage'){

                                document.querySelector('#zhmTakePlace').style="height:200px";
                            }

                            console.log(setPageID);

                        })

                    })

                    let toBack = document.querySelectorAll('.zhm_back');

                    toBack.forEach(function(item){

                        item.addEventListener('click', function(e){

                            let parentDom = item.parentNode.parentNode.parentNode;

                            parentDom.className='iconSetPage toRightMove';

                            document.querySelector('#zhmTakePlace').style='height:40px;'

                        })

                    })

                    let setSave = document.querySelectorAll('.iconSetSave');

                    setSave.forEach(function(item){

                        item.addEventListener('click',()=>{

                            let iconTop = document.getElementById('iconTop').value;

                            let iconOpacity=document.getElementById('iconOpacity').value;

                            let iconPosition = document.getElementById('iconPosition').value;

                            let iconWidth = document.getElementById('iconWidth').value;

                            let iconWaitTime = document.getElementById('iconWaitTime').value;

                            if(iconTop != ''){

                                if(!(/(^[0-9][0-9]{0,2}$)/.test(iconTop))){

                                    alert(lang.tipErrorIconHeight);

                                    return false;
                                }

                                //_this.setCookie('iconTop',iconTop,30);

                                GM_setValue('iconTop',iconTop);
                            }

                            if(iconOpacity != ''){

                                if(!(/^(?:0|[1-9][0-9]?|100)$/.test(iconOpacity))){

                                    alert(lang.tipErrorIconOpacity);

                                    return false;
                                }

                                //_this.setCookie('iconTop',iconTop,30);
                                //alert(iconOpacity);return;
                                GM_setValue('iconOpacity',iconOpacity);
                            }

                            if(iconPosition != ''){

                                //_this.setCookie('iconPosition',iconPosition,30);

                                GM_setValue('iconPosition',iconPosition);
                            }

                            if(iconWaitTime != ''){

                                GM_setValue('iconWaitTime',iconWaitTime);
                            }

                            if(iconWidth !=''){

                                if(!(/(^([1-9][0-9]?)$)/.test(iconWidth))){

                                    alert(lang.tipErrorIconWidth);

                                    return false;
                                }

                                //_this.setCookie('iconWidth',iconWidth,30);

                                GM_setValue('iconWidth',iconWidth);
                            }

                            history.go(0);
                        })
                    })

                    document.getElementById('iconTop').addEventListener('change',function(){

                        let iconTop = this.value;

                        if(!(/(^[1-9]\d*$)/.test(iconTop))){

                            this.setAttribute('data-is-valid','false')


                        }else{

                            this.setAttribute('data-is-valid','true')
                        }

                        return false;

                    })

                    document.getElementById('iconWidth').addEventListener('change',function(){

                        let iconWidth = this.value;

                        if(!(/(^[1-9]\d*$)/.test(iconWidth))){

                            this.setAttribute('data-is-valid','false')


                        }else{

                            this.setAttribute('data-is-valid','true')
                        }

                        return false;

                    })
                }

            })

        }

        createElement(dom,domId){

            var rootElement = document.body;

            var newElement = document.createElement(dom);

            newElement.id = domId;

            var newElementHtmlContent = document.createTextNode('');

            rootElement.appendChild(newElement);

            newElement.appendChild(newElementHtmlContent);

        }

        request(method,url,data,isCookie=''){

            let request = new XMLHttpRequest();

            return new Promise((resolve,reject)=>{

                request.onreadystatechange=function(){

                    if(request.readyState==4){

                        if(request.status==200){

                            resolve(request.responseText);

                        }else{

                            reject(request.status);
                        }

                    }
                }

                request.open(method,url);
                //request.withCredentials = true;
                if(isCookie){
                    request.withCredentials = true;
                }
                request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                request.send(data);

            })

        }

        setCookie(cname,cvalue,exdays){

            var d = new Date();

            d.setTime(d.getTime()+(exdays*24*60*60*1000));

            var expires = "expires="+d.toGMTString();

            document.cookie = cname+"="+cvalue+"; "+expires;
        }

        getCookie(cname){
            var name = cname + "=";
            var ca = document.cookie.split(';');
            for(var i=0; i<ca.length; i++) {
                var c = ca[i].trim();
                if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
            }
            return "";
        }

        getQueryString(e) {
            var t = new RegExp("(^|&)" + e + "=([^&]*)(&|$)");
            var a = window.location.search.substr(1).match(t);
            if (a != null) return a[2];
            return "";
        }

        getUrlParams(url){
            let reg = /([^?&+#]+)=([^?&+#]+)/g;
            let obj={};
            url.replace(reg,(res,$1,$2)=>{obj[$1]=$2});
            return obj;
        }

        static getElement(css,all=''){

            return new Promise((resolve,reject)=>{

                let num = 0;

                let timer = setInterval(function(){

                    num++

                    let dom;

                    if(all == false){

                        dom = document.querySelector(css);

                        if(dom){

                            clearInterval(timer);

                            resolve(dom);

                        }

                    }else{

                        dom = document.querySelectorAll(css);

                        if(dom.length>0){

                            clearInterval(timer);

                            resolve(dom);

                        }
                    }

                    if(num==20){
                        clearInterval(timer);
                        resolve(false);
                    }

                },300)

                })


        }

        static toast(msg,duration){

            duration=isNaN(duration)?3000:duration;

            let toastDom = document.createElement('div');

            toastDom.innerHTML = msg;

            //toastDom.style.cssText="width: 60%;min-width: 150px;opacity: 0.7;height: 30px;color: rgb(255, 255, 255);line-height: 30px;text-align: center;border-radius: 5px;position: fixed;top: 40%;left: 20%;z-index: 999999;background: rgb(0, 0, 0);font-size: 12px;";
            toastDom.style.cssText='padding:2px 15px;min-height: 36px;line-height: 36px;text-align: center;transform: translate(-50%);border-radius: 4px;color: rgb(255, 255, 255);position: fixed;top: 50%;left: 50%;z-index: 9999999;background: rgb(0, 0, 0);font-size: 16px;'

            document.body.appendChild(toastDom);

            setTimeout(function() {

                var d = 0.5;

                toastDom.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';

                toastDom.style.opacity = '0';

                setTimeout(function() { document.body.removeChild(toastDom) }, d * 1000);

            }, duration);

        }

        //create zhmLogoIcon
        zhmLogo(){

            var _this = this;

            let sortDiv = iconVipPosition=='left'?'row':'row-reverse';

            let playVideoStyle = `
               .zhm_play_vidoe_icon{
                  padding-top:2px;
                  cursor:pointer;
                  z-index:999999;
                  position:fixed;${iconVipPosition}:5px;top:${iconVipTop}px;
                  text-align:center;
                  overflow:visible;
                  display:flex;
                  flex-direction:${sortDiv};
                  width:auto;
               }
               .zhm_play_video_wrap{
                  z-index:9999999;
                  overflow: hidden;
                  width:300px;
               }
               .iconLogo{
               opacity:${iconVipOpacity/100};
               }
               .zhm_play_video_line{
                  width:320px;
                  height:316px;
                  overflow-y:scroll;
                  overflow-x:hidden;
               }
               .zhm_play_vide_line_ul{
                  width:300px;
                  display: flex;
                  justify-content: flex-start;
                  flex-flow: row wrap;
                  list-style: none;
                  padding:0px;
                  margin:0px;

               }
               .zhm_play_video_line_ul_li{
                  padding:4px 0px;
                  margin:2px;
                  width:30%;
                  color:#FFF;
                  text-align:center;
                  background-color:#f24443;
                  box-shadow:0px 0px 10px #fff;
                  font-size:14px;
               }
               .zhm_play_video_line_ul_li:hover{
                  color:#260033;
                  background-color:#fcc0c0
               }
               .zhm_line_selected{
                  color:#260033;
                  background-color:#fcc0c0
               }

               .zhm_play_video_jx{
                  width:100%;
                  height:100%;
                  z-index:999999;
                  position: absolute;top:0px;padding:0px;
               }
               `;

            domStyle .appendChild(document.createTextNode(playVideoStyle));

            domHead.appendChild(domStyle);

            let playWrapHtml = "<div href='javascript:void(0)' target='_blank' style='' class='playButton zhm_play_vidoe_icon' id='zhmlogo'>";

            playWrapHtml += "<img class='iconLogo' style='width:"+iconVipWidth+"px;height:"+iconVipWidth*1.5+"px' src='data:image/gif;base64,R0lGODlhZACWAPcAAPJEQ/v7+fnLyPjCwfRnZfnT0PJKSfjGxPv29PnY1/NbWvv18/aUk/rl4/rw7vnKyPaJiPrr6faamPRycfaLivv59/JJSPrv7fNVVPne3frt6/NQT/v6+PelpPagnvR3dvi6uPvz8fexr/nOzPegnvrk4vR1c/JGRfrq6PnQzvjCwPnS0PnZ1/vw7vna2feop/empfrc2vNUU/ixr/R4dvWJh/esqvJHRvvx7/ry8fNSUfNWVPjBwPV6efaMivnf3fi8uvWDgvv49vrp6Pry8PJPTvaYl/nT0fnW1PerqfRsa/RvbvWAf/V9fPnk4vi2tfRjYfRhX/vu7PNYV/JFRPnk4faHhfaXlvv39frh3/i7uvnNy/nOy/rs6verqvRgXvnd2/aGhPWRkPV/ffri4Prj4PiwrfnLyfaUkvRfXfJNTPjFw/eysfRlY/RxcPvv7fezsvi0svv28/abmveqqPepqPJMS/eysPWOjfNdXPRzcvv08vRubfro5veiofelo/NZWPnZ2PNpaPnU0vRfXvnHxfiurPjAv/nQzfrn5fnc2/e0svadnPe4t/aSkfNXVvRmZPetqvnY1vi8u/eioPitq/i/vfRwb/R1dPne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6l+hzxy4K8VIEQizQ5wHLaZBhQAAh/hVNYWRlIHdpdGggU2NyZWVuVG9HaWYAOw=='>"

            playWrapHtml += "<div>";

            _this.createElement('div','zhmIcon');

            let zhmPlay = document.getElementById('zhmIcon');

            zhmPlay.innerHTML = playWrapHtml;

        }
        //左键按下拖动
        //type:根据不同类型,处理图标单击事务
        zhmLogoDrag(type,web){

            var _this = this;

            var zhmLogoDrag=document.querySelector("#zhmlogo");

            var zhmLogoIcon = document.querySelector(".iconLogo");

            if(!zhmLogoDrag || !zhmLogoIcon)return;

            zhmLogoDrag.onmousedown = function(event){

                if(event.which==3)return false;//屏蔽右键

                let sedownTop = zhmLogoDrag.offsetTop;

                let zhmLogoIconHeight = zhmLogoIcon.offsetHeight;

                let bottomSpace = 10;

                if(event.target.className != 'iconLogo')return;

                //let shiftX = event.clientX - zhmLogoDrag.getBoundingClientRect().left;
                let shiftx = 5;

                let shiftY = event.clientY-zhmLogoDrag.getBoundingClientRect().top;

                zhmLogoDrag.style.position = 'fixed';

                zhmLogoDrag.style.zIndex = 9999999;

                document.body.append(zhmLogoDrag);

                function onMouseMove(event){

                    //zhmLogoDrag.style.left = pageX - shiftX + 'px';
                    zhmLogoDrag.style.left = '5px';

                    let height = window.innerHeight - zhmLogoIconHeight-bottomSpace;

                    let y = event.pageY-shiftY;

                    y = Math.min(Math.max(0, y), height);

                    zhmLogoDrag.style.top = y+'px';

                }
                //在mousemove事件上移动图标
                document.addEventListener('mousemove',onMouseMove);
                //松开事件
                document.onmouseup = function(e){

                    GM_setValue('iconTop',zhmLogoDrag.offsetTop);

                    document.removeEventListener('mousemove', onMouseMove);

                    zhmLogoDrag.onmouseup = null;

                    let height = zhmLogoDrag.offsetTop+zhmLogoIconHeight+bottomSpace;

                    if(zhmLogoDrag.offsetTop < 0){

                        zhmLogoDrag.style.top ='0px';
                    }

                    if(window.innerHeight < height){

                        zhmLogoDrag.style.top =window.innerHeight-zhmLogoIconHeight-bottomSpace+'px';

                    }
                    //click事件处理
                    switch(type){

                        case 'video':

                            if(zhmLogoDrag.offsetTop==sedownTop && web.length == 0 && zhmLogoDrag.offsetTop>0 && window.innerHeight > height){

                                BaseClass.toast('请在视频播放页点击图标');
                            }

                            break;
                        case 'music':

                            if(zhmLogoDrag.offsetTop==sedownTop && e.target.className == 'iconLogo'){

                                //document.removeEventListener('mousemove', onMouseMove);

                                //zhmLogoDrag.onmouseup = null;

                                let musicUrlData = [
                                    {match:/^https?:\/\/music\.163\.com\/#\/(?:song|dj)\?id/},
                                    {match:/^https?:\/\/y\.music\.163\.com\/m\/(?:song|dj)\?id/},
                                    {match:/^https?:\/\/music\.163\.com\/(?:song|dj)\?id/},
                                    {match:/^https?:\/\/y\.qq\.com\/n\/ryqq\/player/},
                                    {match:/kugou\.com/},
                                    {match:/kuwo\.cn/},
                                    {match:/^https?:\/\/www\.ximalaya\.com/},
                                ]

                                let musicUrl = musicUrlData.filter(function(item){

                                    return location.href.match(item.match);

                                })

                                if(musicUrl.length==0){

                                    BaseClass.toast(web[0].tip);

                                    return;
                                }

                                switch(web[0].name){
                                    case 'netease':
                                        neteaseFun();
                                        break;
                                    case 'qq':
                                        qqFun();
                                        break;
                                    case 'kugou':
                                        kugouFun();
                                        break;
                                    case 'kuwo':
                                        kuwoFun();
                                        break;
                                    case 'ximalaya':
                                        ximalayaFun();
                                        break;
                                }

                                function neteaseFun(){

                                    let urlParams = _this.getUrlParams(location.href);

                                    if(urlParams.id == undefined) return;

                                    let neteaseUrlEncode = encodeURIComponent('https://music.163.com/song?id='+urlParams.id);

                                    //let openUrl = webUrl+'?url='+neteaseUrlEncode;

                                    let openUrl = webUrl+"?id="+urlParams.id+"&type=netease"

                                    window.open(openUrl);

                                }

                                function qqFun(){

                                    let qqSongMatch;

                                    if(document.querySelector(".player_music__info")){

                                        qqSongMatch = document.querySelector(".player_music__info").childNodes[0].href.match(/songDetail\/(\S*)\?/);

                                    }else if(document.querySelector("#sim_song_info")){

                                        qqSongMatch = document.querySelector("#sim_song_info").childNodes[0].href.match(/song\/(\S*).html/);

                                    }else{

                                        qqSongMatch = '';
                                    }

                                    if(!qqSongMatch[1]){console.log('没有获取到歌曲ID'); return};

                                    let audioLink = encodeURIComponent(document.querySelector("audio").src);

                                    let openUrl = webUrl+'?id='+qqSongMatch[1]+'&type=qq&playUrl='+audioLink;

                                    window.open(openUrl);

                                }

                                function kugouFun(){

                                    let audioModule = document.querySelector('#audioModule');

                                    if(audioModule){

                                        document.querySelector('#audioModule').style='bottom:0px;';

                                        document.querySelector('#showHide_playbar').className = 'icon show-playbar-btn';

                                    }
                                    BaseClass.toast('请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"',2000)

                                    //alert('请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"。');

                                    /*

                                        let songKugouMatch = newUrl.match(jxMusicWeb[0].match);

                                        let audioSrc = encodeURIComponent(document.querySelector("audio").src);

                                        let openUrl = webUrl+'?id='+songKugouMatch[1]+'&type=kugou&playUrl='+audioSrc;

                                        window.open(openUrl);
                                        */
                                }

                                function kuwoFun(){

                                    document.querySelector('.playControl').style='bottom:0px';

                                    BaseClass.toast('请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"',2000)

                                    //alert('请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"。');

                                    /*
                                        let songKuwoMatch = newUrl.match(jxMusicWeb[0].match);

                                        let audioSrc = encodeURIComponent(document.querySelector("audio").src);

                                        let openUrl = webUrl+'?id='+songKuwoMatch[1]+'&type=kuwo&playUrl='+audioSrc;

                                        window.open(openUrl);
                                        */
                                }

                                function ximalayaFun(){

                                    document.querySelector('.xm-player').style='bottom:0px';

                                    BaseClass.toast('请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"',2000)

                                    //alert('请点击播放需要下载的歌曲,然后在网页下方播放器内点击"下载"。');

                                    /*
                                        let urlInfo = newUrl.match(jxMusicWeb[0].match);

                                        console.log(webUrl+'?id='+urlInfo[1]+'&type=ximalaya&playUrl='+encodeURIComponent(newUrl));

                                        if(urlInfo[1]){

                                            window.open(webUrl+'?id='+urlInfo[1]+'&type=ximalaya&playUrl='+encodeURIComponent(newUrl));

                                        }else{

                                            console.log('没有获取url参数');
                                        }
                                        */
                                }
                            }
                            break;
                        case 'youtube':



                            break;

                    }
                };

            };

            zhmLogoDrag.ondragstart = function(){
                return false;
            };
        }
        //下载
        static LR_download(url,filename){

            let ua = navigator.userAgent.toLowerCase();

            console.log(ua.match(/version\/([\d.]+).*safari/));

            if(ua.match(/version\/([\d.]+).*safari/)){

                window.open(url);

            }else{
                console.log(url);
                GM_download(url,filename);
            }


        }

    }

    class PlayMusicClass extends BaseClass{
        constructor(){
            super();
        }

        xmlyCreateCheckbox(){

            let soundListli = document.querySelectorAll('.sound-list ul li');

            soundListli.forEach(function(item){

                let checkboxed = item.querySelector('input');

                if(checkboxed){
                    return;
                }

                let title = item.querySelector('.text');

                if(!title){
                    return;
                };

                title.style = "width:360px";

                let src = title.querySelector('a').getAttribute('href');

                let firstDom = item.querySelector('.icon-wrapper');

                let inputDom = firstDom.cloneNode(true);

                inputDom.style= 'min-width: 0px;';

                inputDom.innerHTML = "<input type='checkbox' name='zhmCheckbox' value="+src+"  class='zhmCheckbox'>";

                firstDom.before(inputDom);

            })

        }
    }

    class VersionClass extends BaseClass{

        constructor(){

            super();

            this.versionUrl = 'https://gitlab.com/lanhaha/lanrenjiaoben/-/raw/main/README.md?ref_type=heads';

            this.renewVersionUrl = 'https://gitlab.com/lanhaha/lanrenjiaoben#%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97';

            let tipPageWrap = document.createElement('div');

            tipPageWrap.id='tipWrap';

            document.body.appendChild(tipPageWrap);

            var _this = this;

            (async function(){

                let resp = await _this.checkTime();

                if(!resp)return;

                _this.checkRunTime();

            })()

        }

        getVersion(mothed,url){

            return new Promise((resolve,reject)=>{

                GM_xmlhttpRequest({

                    method: mothed,

                    url: url,

                    data: '',

                    headers: {'Accept': 'text/plain, text/html,application/json'},

                    onload: function(res){

                        let resArray = res.responseText.split('\n');

                        let versionArray=[];

                        for(let i=0;i<resArray.length;i++){

                            if(resArray[i].match(/^([0-999]{1,3})\.?([0-999]{1,3})?\.?([0-999]{1,3})?$/)){

                                versionArray.push(resArray[i]);

                            }

                        }

                        resolve(versionArray);

                    },
                    onerror : function(err){
                        console.log(err);
                        //reject(err);
                    }
                });

            })

        }

        checkTime(){

            return new Promise((resolve,reject)=>{

                var _this = this;

                let installTime = GM_getValue('installTime',0);

                let date = new Date();

                let dateNowTime = date.getTime();

                let intervalTime = 86400*1000;

                let versionIntervalTime = 86400*1000;

                if(installTime){

                    if(dateNowTime-intervalTime>installTime){

                        let getVersionTime = GM_getValue('getVersionTime',0);

                        if(dateNowTime-versionIntervalTime > getVersionTime){

                            (async function(){

                                let date = new Date();

                                let nowTime = date.getTime();

                                let versionArr= await _this.getVersion('get',_this.versionUrl);

                                if(versionArr.length == 0){
                                    console.log('没有获取到版本号');
                                    return;

                                }

                                let versionObj=versionArr[0].split('.');

                                _this.versionOnline = [];

                                _this.versionOnline[0] = versionObj[0];

                                _this.versionOnline[1] = versionObj[1]?versionObj[1]:0;

                                _this.versionOnline[2] = versionObj[2]?versionObj[2]:0;

                                let versionNow = GM_info.script.version.split('.');

                                console.log(_this.versionOnline,versionNow);

                                let index;

                                for(let i=0;i<3;i++){

                                    if(parseInt(_this.versionOnline[i]) > parseInt(versionNow[i])){

                                        index=i;

                                        break;
                                    }

                                }

                                GM_setValue('getVersionTime',dateNowTime);

                                GM_setValue('vcodeResult',index);

                                GM_setValue('versionOnline',_this.versionOnline);

                                resolve(true);

                            })()

                        }else{

                            resolve(true);
                        }
                    }else{

                        resolve(false);
                    }

                }else{

                    GM_setValue('installTime',dateNowTime);

                    resolve(false);

                };

            })

        }

        checkRunTime(){

            var _this = this;

            let date = new Date();

            let dateNowTime = date.getTime();

            let runTipTime = GM_getValue('runTipTime',0);//弹框时间

            let vcodeResult = GM_getValue('vcodeResult');

            _this.versionOnline = GM_getValue('versionOnline');

            let tipIntervalTime = 60*1000;

            if(dateNowTime-runTipTime > tipIntervalTime && vcodeResult != 'undefined'){

                GM_setValue('runTipTime',dateNowTime);

                switch(vcodeResult){

                    case 0:
                        _this.showTipPage();
                        break;

                    case 1:
                        _this.showTipPage();
                        break;

                    case 2:
                        _this.showTipPage();
                        break;

                }

            }

        }

        showTipPage(){

            var _this = this;

            //let setHtml = "<div class='zhmMask'></div>";

            let setHtml ="<div class='wrap-box' style='top:auto;left:auto;bottom:5px;right:5px;transform:none;box-shadow: 0px 0px 5px #888;'>";

            setHtml +="<ul class='iconSetUlHead'><li class='iconSetPageHead' style='justify-content:center;'><span>发现新版本</span></li></ul>";

            setHtml +="<div style='height:80px; display:flex; justify-content:center; align-items:center;'>";

            setHtml +="<p style='width:240px;word-break:break-all;line-height:26px;'>新版本 <a href='"+this.renewVersionUrl+"' target='_blank' style='color:#fe6d73;'>v"+this.versionOnline.join('.')+"</a> 已发布。<p>";

            setHtml +="</div>";

            setHtml +="<div style='display:flex; justify-content:center; align-items:center;width:300px;height:40px;background: #fef9ef;font-size:14px;'>";

            setHtml +="<span id='tipRenew' style='width:50%;text-align:center;cursor: pointer;background-color:#fe6d73;color:#fff;height:40px;line-height:40px;'>查看更新</span>";

            setHtml +="<span id='tipBackOn' style='width:50%;text-align:center;cursor: pointer;'>忽略</span>";

            setHtml +='</div>';

            setHtml += "</div>";

            setTimeout(function(){

                let versionTipDom = document.querySelector('#tipWrap');

                if(!versionTipDom)return false;

                versionTipDom.innerHTML = setHtml;

                //document.body.appendChild(versionTipDom);

                document.querySelector('#tipBackOn').addEventListener('click',function(e){

                    GM_setValue('installTime',new Date().getTime());

                    document.querySelector('#tipWrap').style='display:none';
                })

                document.querySelector('#tipRenew').addEventListener('click',function(e){

                    GM_setValue('installTime',new Date().getTime());

                    document.querySelector('#tipWrap').style='display:none';

                    window.open(_this.renewVersionUrl);

                    //tipIconClose.click();
                })

            },5000);


        };

    }

    var nowWeb = [];

    for(let i=0;i<musicDownload.length;i++){

        if(location.href.match(musicDownload[i].match) && musicDownload[i].isOpen==22){

            nowWeb.push(musicDownload[i]);

            break;
        }

    }

    var baseClass = new BaseClass();

    if(GM_getValue('musicList','22') == 0){
        return false;
    }

    if(nowWeb.length != 1){

        console.log('没有匹配该网站或已关闭');return;

    }

    function playMusicFunc(){

        if(self.frameElement && self.frameElement.tagName == "IFRAME"){

            return;
        }

        var playMusicClass = new PlayMusicClass();

        var musicId = Math.ceil(Math.random()*100000000);

        //netease 路由两次,需重定义
        var newUrl = location.href;

        let jxMusicWeb = musicDownload.filter(function(item){

            return newUrl.match(item.match);

        })

        if(jxMusicWeb.length){

            let timerZhmIcon = setInterval(function(){

                if (document.querySelector('#zhmIcon')){

                    clearInterval(timerZhmIcon); // 取消定时器

                    if(jxMusicWeb[0].name=='kuwo' && kuwoMusicDownload==22){

                        setTimeout(function(){

                            let control = document.querySelector('.icon-bar_icon_download_');

                            let icon = control.cloneNode(true);

                            icon.className = '';

                            icon.style='margin-left:10px;';

                            icon.innerHTML = "<a style='font-size:10px;white-space: nowrap;cursor:pointer;color:#555;' id='kuwoDownload'>下载</a>";

                            let controls = document.querySelector('.col_r');

                            controls.before(icon);

                            document.querySelector('#kuwoDownload').addEventListener('click',function(){

                                let audioSrc = document.querySelector("audio").src;

                                let songName = document.querySelector('.control .song_name').title;

                                let artist = document.querySelector('.control .artist').title;

                                BaseClass.LR_download(audioSrc,songName+'-'+artist+'.mp3');

                            })

                        },2000)
                    }

                    if(jxMusicWeb[0].name=='ximalaya' && ximalayaMusicDownload==22){

                        setTimeout(function(){
                            //播放器创建下载icon
                            let xmControls = document.querySelector('.xm-player-oprations');

                            let control = xmControls.querySelector('a:nth-of-type(2)');

                            let icon = control.cloneNode(true);

                            icon.innerHTML = "<span style='font-size:10px;white-space: nowrap;cursor:pointer;color:#FFF;' id='ximaDownload'>下载</span>";

                            xmControls.style='position: relative;margin-left:-20px;';

                            document.querySelector('.xm-player-progress').style.width='450px';

                            document.querySelector('.xm-player-playtime').style='position: absolute;right:40px;';

                            xmControls.prepend(icon);
                            //播放器下载事件
                            document.querySelector('#ximaDownload').addEventListener('click',function(){

                                let fmTitle = document.querySelector('.fm-title');

                                let fmTitleMatch = fmTitle.href.match(/^https?:\/\/www\.ximalaya\.com\/sound\/(\S*)$/);

                                let url = 'https://mobile.ximalaya.com/mobile-playpage/track/v3/baseInfo/'+new Date().getTime()+'?device=web&trackId='+fmTitleMatch[1];

                                playMusicClass.request('get',url).then((result)=>{

                                    let data = JSON.parse(result);

                                    let playUrl = data.trackInfo.playUrlList[1].url;

                                    let str1 = playUrl.replaceAll('-','+');

                                    let str2 = str1.replaceAll('_','/');

                                    let num = str2.length%4;

                                    if(num){

                                        str2 += '===='.substr(num);
                                    }

                                    let decrypted = CryptoJS.AES.decrypt({

                                        ciphertext: CryptoJS.enc.Base64.parse(str2)

                                    }, CryptoJS.enc.Hex.parse("aaad3e4fd540b0f79dca95606e72bf93"), {

                                        mode: CryptoJS.mode.ECB,

                                        padding: CryptoJS.pad.Pkcs7

                                    }).toString(CryptoJS.enc.Utf8);

                                    console.log(decrypted);

                                    if(decrypted){

                                        BaseClass.LR_download(decrypted,data.trackInfo.title+'.mp3');

                                    }else{
                                        console.log('解密地址失败');
                                    }

                                })

                            })

                            //页面列表创建批量下载
                            let timer = setInterval(function(){

                                let urlMatch = location.href.match(/^https:\/\/www.ximalaya.com\/album\/[0-9]+/);

                                if(urlMatch){

                                    let soundList = document.querySelector('#anchor_sound_list');

                                    if(soundList){

                                        let soundListHead = soundList.querySelector('.head');

                                        let soundListHeadTitle = soundListHead.querySelector('.sort').lastChild;

                                        let batchDownloadDom = document.querySelector('#batchDownload');

                                        if(!batchDownloadDom){

                                            let data = [{name:'批量下载',id:'batchDownload'},{name:'重置',id:'reset'},{name:'全选',id:'selectAll'}];

                                            data.forEach(function(item){

                                                let control = soundListHeadTitle.cloneNode(true);

                                                control.setAttribute('id',item.id);

                                                control.innerText = item.name;

                                                soundListHeadTitle.after(control);

                                                control.before(" | ");

                                            });

                                            document.querySelector('#selectAll').addEventListener('click',function(){

                                                let zhmCheckbox = soundList.querySelectorAll("input[name='zhmCheckbox']");

                                                zhmCheckbox.forEach(function(item){

                                                    if(!item.checked){

                                                        item.checked=true;
                                                    }

                                                })

                                            });

                                            document.querySelector('#reset').addEventListener('click',function(){

                                                let zhmCheckbox = soundList.querySelectorAll("input[name='zhmCheckbox']");

                                                zhmCheckbox.forEach(function(item){

                                                    item.checked = false;

                                                })

                                            })
                                            //正序倒序事件
                                            soundListHead.querySelector('.sort').firstChild.addEventListener('click',function(){

                                                setTimeout(function(){

                                                    playMusicClass.xmlyCreateCheckbox();

                                                },2000)

                                            });

                                            soundListHeadTitle.addEventListener('click',function(){

                                                setTimeout(function(){

                                                    playMusicClass.xmlyCreateCheckbox();

                                                },2000)

                                            });

                                            document.querySelector('#batchDownload').addEventListener('click',function(){

                                                //BaseClass.toast('已下载,请稍候');

                                                let zhmCheckbox = soundList.querySelectorAll("input[name='zhmCheckbox']");

                                                zhmCheckbox.forEach(function(item){

                                                    if(item.checked){

                                                        let scrMatch = item.value.match(/\/sound\/([0-9]+)/);

                                                        let url = 'https://mobile.ximalaya.com/mobile-playpage/track/v3/baseInfo/'+new Date().getTime()+'?device=web&trackId='+scrMatch[1];

                                                        playMusicClass.request('get',url).then((result)=>{

                                                            let data = JSON.parse(result);

                                                            let playUrl = data.trackInfo.playUrlList[1].url;

                                                            let str1 = playUrl.replaceAll('-','+');

                                                            let str2 = str1.replaceAll('_','/');

                                                            let num = str2.length%4;

                                                            if(num){

                                                                str2 += '===='.substr(num);
                                                            }

                                                            let decrypted = CryptoJS.AES.decrypt({

                                                                ciphertext: CryptoJS.enc.Base64.parse(str2)

                                                            }, CryptoJS.enc.Hex.parse("aaad3e4fd540b0f79dca95606e72bf93"), {

                                                                mode: CryptoJS.mode.ECB,

                                                                padding: CryptoJS.pad.Pkcs7

                                                            }).toString(CryptoJS.enc.Utf8);

                                                            //console.log(decrypted);

                                                            if(decrypted){

                                                                BaseClass.LR_download(decrypted,data.trackInfo.title+'.mp3');

                                                            }else{
                                                                console.log('解密地址失败');
                                                            }

                                                        })

                                                    }

                                                })

                                            })
                                        }

                                        let zhmCheckbox= document.querySelectorAll('.zhmCheckbox');

                                        if(zhmCheckbox.length == 0){

                                            playMusicClass.xmlyCreateCheckbox();
                                        }

                                        //翻页事件

                                        let pageBar = document.querySelector('.pagination-page');

                                        if(pageBar){

                                            pageBar.addEventListener('click',function(){

                                                setTimeout(function(){

                                                    playMusicClass.xmlyCreateCheckbox();

                                                },2000)

                                            })

                                        }

                                        //跳页事件
                                        let pageLink = document.querySelector('button[type=submit]');

                                        if(pageLink){

                                            pageLink.addEventListener('click',function(){

                                                setTimeout(function(){

                                                    playMusicClass.xmlyCreateCheckbox();

                                                },1000)

                                            })
                                        }
                                    }
                                }else{
                                    console.log('未匹配到列表地址');
                                }

                            },500)

                            },1000);

                        //全局点击事件
                        document.addEventListener('click',function(e){

                            var objLink = {};

                            e.path.forEach(function(item){

                                if(item.href){

                                    objLink.href = item.href?item.href:'';

                                    objLink.target = item.target?item.target:'';

                                    return;
                                }

                            })

                            if(objLink.href && objLink.target != '_blank'){

                                location.href = objLink.href;

                                return;
                            }
                        })

                    }

                    if(jxMusicWeb[0].name=='kugou' && kugouMusicDownload==22){

                        let aDom = document.querySelectorAll('a');

                        aDom.forEach(function(item){

                            let dataObj = item.getAttribute('dataobj');

                            if(dataObj){

                                item.removeAttribute('dataobj');

                                item.setAttribute('target','_blank');
                                //console.log(dataObj);
                            }

                        })

                        if(couponUrl.indexOf('mixsong')!=-1 || couponUrl.indexOf('song') != -1 || couponUrl.indexOf('share') != -1){

                            setTimeout(function(){

                                let volumeDom = document.querySelector('#volume');

                                let downloadDom = volumeDom.cloneNode(true);

                                downloadDom.removeAttribute('id');

                                downloadDom.style='margin-top:30px';

                                downloadDom.innerHTML = "<a style='color:#fff;font-size:10px;white-space:nowrap;cursor:pointer;' id='kugouDownload' javascript:void(0);>下载</a>";

                                volumeDom.before(downloadDom);

                                volumeDom.style='left:50px;';

                                document.querySelector('#mode').style='margin-left:90px;';

                                document.querySelector('#pb_download').style='margin-left:130px;';

                                document.querySelector('#pb_share').style='margin-left:170px;';

                                document.querySelector('#list').style='right:-20px;';

                                document.querySelector('#kugouDownload').addEventListener('click',function(){

                                    let audio = document.querySelector('#myAudio');

                                    let audioSrc = audio.getAttribute('src');

                                    let singerName = document.querySelector('.singerName').title;

                                    let songName = document.querySelector('#songNameTemp').title;

                                    BaseClass.LR_download(audioSrc,songName+'-'+singerName.substr(0,singerName.length-1)+'.mp3');

                                })

                            },1000)
                        }
                        console.log(couponUrl);
                    }

                    if(jxMusicWeb[0].name=='netease' && location.href == 'https://music.163.com/st/download' &&netEaseMusicDownload==22){

                        return false;
                    }

                    let zhmPlay = document.getElementById('zhmIcon');

                    setTimeout(function(){

                        playMusicClass.zhmLogo();

                        playMusicClass.zhmLogoDrag('music',jxMusicWeb);

                    },iconWaitTime);

                }else{

                    playMusicClass.createElement('div','zhmIcon');
                }

            })

            }else{

                let zhmPlayDom = document.querySelector('#zhmIcon');

                if(zhmPlayDom){

                    zhmPlayDom.parentNode.removeChild(zhmPlayDom);

                }

                console.log('当前音频网址没有添加匹配或匹配错误');

            }

        }

    playMusicFunc();

    new VersionClass();

})();