草榴社区

论坛式在线播放平台

// ==UserScript==
// @name         草榴社区
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  论坛式在线播放平台
// @author       You
// @match        https://caoliu1024.com/*
// @match        https://caoliu.sex/*
// @match        https://1024.fm/*
// @include      /^https://www.cl\S\S\S\S\S.com.+$/
// @include      /^https://www.cl\S\S\S\S\S.top.+$/
// @include      /^https://cl\S\S\S\S\S.com.+$/
// @include      /^https://cl\S\S\S\S\S.top.+$/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=cl3bd52.com
// @license MIT
// @grant        none
// ==/UserScript==

function admove(){
    let ad = document.getElementsByClassName('my_wrap')[0]
    if (ad){
        ad.remove()
    }
}

function TId(){
    let locUrl = location.href
    let baseUrl = location.origin
    let dom = document.getElementById('dplayer')
    let button = document.getElementsByClassName('b')[0]
    let PlayUrl = ''
    let mp3Url = app.music.url
    console.log(mp3Url)
    // 有声书---金钱限制----新用户50金钱
    if (button){
        let s = button.onclick.toString()
        let vr = s.match(/'([^']*)'/)[0].replaceAll("'", '')
        PlayUrl = baseUrl + '/' + vr
        console.log(PlayUrl)
        button.onclick = function() {
            //console.log(url)
            fetch(PlayUrl)
            window.location.reload()
        };
    }
    else if (/fid=57/.test(locUrl)){
       let ImgDom = document.getElementsByClassName('vv-box')
       for (let i of ImgDom){
           let myImage = i.getElementsByTagName('img')[0]
           let Vid = myImage.getAttribute('alt')
           PlayUrl = baseUrl + '/read.php?tid=' + Vid
           let myLink = document.createElement("a")
           myLink.href = PlayUrl
           myImage.parentNode.insertBefore(myLink, myImage);
           myLink.appendChild(myImage);
       }
    }
    else if (dom){
        PlayUrl = dp.options.video.url.replace('?t=3', '')
        console.log(PlayUrl)
        let play = new DPlayer({
            container: document.getElementById('dplayer'),
            video: {
                url: PlayUrl,
                type: 'hls',
            },})
    }
    //setTimeout(reply(locUrl), 3000)
}

function reply(locUrl){
    let replayArray = ['666', '回血回血', '泰裤辣','有人说我水经验,我上去就是一巴掌,不是废话么,不水怎么升级,以前不懂,看帖总是不回。一直没升级和增加经验,现在我明白了,反正回帖15字就可以升级,还可以有经验!']
    var randomNum = Math.floor(Math.random() * 4);
    let replyInput = document.getElementsByTagName('form')[1].getElementsByTagName('input')
    const formData = new FormData()
    formData.append('atc_rvrc', '0')
    formData.append('atc_title', replyInput.atc_title.value)
    formData.append('atc_usesign', '1')
    formData.append('atc_convert', '1')
    formData.append('atc_autourl', '1')
    formData.append('atc_content', replayArray[randomNum])
    formData.append('step', '2')
    formData.append('action', 'reply')
    formData.append('fid', replyInput.fid.value)
    formData.append('tid', replyInput.tid.value)
    formData.append('verify', replyInput.verify.value)
    formData.append('point_pid', '0')
    formData.append('point_id', '0')
    formData.append('reply_uid', '0')
    let replyUrl = locUrl + '/post.php?'
    fetch(replyUrl, {
        method: 'POST',
        body: formData,
        headers: {
            'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryEn6llAAsVBv6hene', // 设置Content-Type
            'Sec-Ch-Ua-Platform': "Windows",
            'Sec-Fetch-Dest': 'document',
            'Sec-Fetch-Mode': 'navigate',
        }
       }
    )
}



(function() {
    admove()
    // 激活
    let a = document.getElementsByClassName('activation_code')[0]
    if (a){
        a.value = 1
    }
    setTimeout(TId(), 2000)
})();