优酷VIP站外解析

替换页内播放器并可以点击vip转跳外部网站播放

目前為 2021-01-02 提交的版本,檢視 最新版本

// ==UserScript==
// @name         优酷VIP站外解析
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  替换页内播放器并可以点击vip转跳外部网站播放
// @author       You
// @include      *://m.youku.com/v*
// @include      *://m.youku.com/a*
// @include      *://v.youku.com/v_*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  function insterAfter(newElement, targetElement){
    var parent = targetElement.parentNode;
    if(parent.lastChild == targetElement){
      parent.appendChild(newElement);
    }
    else{
      parent.insertBefore(newElement, targetElement.nextSibling);
    }
  }

  // 替换内video 失败 不能全屏
  let time = setInterval(() => {
    if (document.querySelector(".vip_info").innerHTML.trim() != '') {
      let parent = document.querySelector("#ykPlayer")
      let child = parent.querySelector(".youku-film-player")
      let child2 = parent.querySelector(".preplay-layer")
      let child3 = parent.querySelector(".top_area")
      parent.removeChild(child)
      parent.removeChild(child2)

      let para = document.createElement("iframe")
      para.style.width = "100%"
      para.style.height = "100%"
      para.style.border = "0"
      para.src = "https://jx.618g.com/?url=" + window.location.href

      parent.insertBefore(para, child3)
      window.clearInterval(time)
    }
  }, 1000)

  // 替换内按钮 失败 乱了
  // let parent = document.querySelector(".anthology-content-scroll .anthology-content")
  // // let child = document.querySelector(".anthology-content-scroll .anthology-content a:nth-child(" + index + 1 + ")")

  // let as = document.querySelectorAll(".anthology-content-scroll .anthology-content a")
  // let arr = []
  // as.forEach((element, index) => {
  //   arr.push(element)
  // })

  // arr.forEach((element, index) => {
  //   let el = document.createElement("a")
  //   el.target = "_blank"
  //   el.className = "box-item"
  //   el.href = "https://jx.618g.com/?url=" + element.getAttribute("href")
  //   el.innerHTML = index + 1 + "&"

  //   parent.insertBefore(el, element)
  // })


  let proc = function () {
    let title = document.querySelector(".thesis-wrap .title-link")
    // title.style.padding = "0 5px"
    // title.style.borderRadius = "3px"
    // title.style.backgroundColor = "#00b350"
    // title.style.boxShadow = "rgb(0, 179, 80) 0px 0px 20px"
    // title.href = "https://jx.618g.com/?url=" + window.location.href
    // title.innerHTML += " 解析"
    // title.onmouseover = function(){
    //   this.style.color = "white"
    // }

    let el = document.createElement("a")
    el.target = "_blank"
    el.href = "https://jx.618g.com/?url=" + window.location.href
    el.innerHTML = "解析"
    el.style.padding = "3px 5px"
    el.style.borderRadius = "3px"
    el.style.backgroundColor = "#00b350"
    el.onmouseover = function(){
      this.style.color = "white"
    }
    insterAfter(el, title)


    let as = document.querySelectorAll(".anthology-content-scroll .anthology-content a")
    let arr = []
    as.forEach((element, index) => {
      arr.push(element)
      // console.log(element)
    })

    arr.forEach((element, index) => {
      let markBox = element.querySelector(".mark-text-wrap")
      let mark = element.querySelector(".mark-text")
      // console.log(mark)

      if (mark && mark.innerHTML == "VIP") {
        if (markBox) {
          markBox.style.padding = "0"
          markBox.style.backgroundColor = "#00b350"
          // markBox.style.boxShadow = "rgb(0, 179, 80) 0px 0px 20px"
        }

        let el = document.createElement("a")
        el.target = "_blank"
        el.href = "https://jx.618g.com/?url=" + element.getAttribute("href")
        el.innerHTML = "解析"
        el.style.padding = "3px"
        el.onmouseover = function(){
          this.style.color = "white"
        }

        mark.innerHTML = ""
        mark.appendChild(el)
      }
    })
  }
  proc()

  let btn = document.querySelectorAll(".paged-wrap a")
  btn.forEach((element, index) => {
    element.onclick = function(e){
      // console.log(e)
      setTimeout(() => {
        proc()
      }, 300)
    }
  })
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址