Max_zhang / 一键VIP视频解析、去广告(全网),一站式音乐搜索下载,上学吧答案显示,百度云离线跳转,淘宝京东优惠券 2019-07-10 更新,报错请及时反馈

// ==UserScript==
// @name         一键VIP视频解析、去广告(全网),一站式音乐搜索下载,上学吧答案显示,百度云离线跳转,淘宝京东优惠券 2019-07-10 更新,报错请及时反馈
// @namespace    http://www.wandhi.com/
// @version      3.3.9
// @description  在视频播放页悬浮VIP按钮,可在线播放vip视频;支持优酷vip,腾讯vip,爱奇艺vip,芒果vip,乐视vip等常用视频...一站式音乐搜索解决方案,网易云音乐,QQ音乐,酷狗音乐,酷我音乐,虾米音乐,百度音乐,蜻蜓FM,荔枝FM,喜马拉雅,优惠券查询
// @author       Wandhi
// @icon         https://www.wandhi.com/favicon.ico
// @license MIT
// @include      *://m.youku.com/v*
// @include      *://m.youku.com/a*
// @include      *://v.youku.com/v_*
// @include      *://*.iqiyi.com/v_*
// @include      *://*.iqiyi.com/w_*
// @include      *://*.iqiyi.com/a_*
// @include      *://*.iqiyi.com/adv*
// @include      *://*.le.com/ptv/vplay/*
// @include      *v.qq.com/x/cover/*
// @include      *v.qq.com/x/page/*
// @include      *v.qq.com/play*
// @include      *v.qq.com/cover*
// @include      *://*.tudou.com/listplay/*
// @include      *://*.tudou.com/albumplay/*
// @include      *://*.tudou.com/programs/view/*
// @include      *://*.tudou.com/v*
// @include      *://*.mgtv.com/b/*
// @include      *://film.sohu.com/album/*
// @include      *://tv.sohu.com/v/*
// @include      *://*.acfun.cn/v/*
// @include      *://*.bilibili.com/video/*
// @include      *://*.bilibili.com/anime/*
// @include      *://*.bilibili.com/bangumi/play/*
// @include      *://*.pptv.com/show/*
// @include      *://*.baofeng.com/play/*
// @include      *://*.wasu.cn/Play/show*
// @include      *://v.yinyuetai.com/video/*
// @include      *://v.yinyuetai.com/playlist/*
// @include      *://*.wasu.cn/Play/show/*
// @include      *://music.taihe.com/song*
// @include      *://item.taobao.com/*
// @include      *://detail.tmall.com/*
// @include      *://detail.tmall.hk/*
// @include      *://item.jd.com/*
// @include      *://music.163.com/song*
// @include      *://music.163.com/m/song*
// @include      *://y.qq.com/*
// @include      *://*.kugou.com/*
// @include      *://*.kuwo.cn/*
// @include      *://*.xiami.com/*
// @include      *://music.taihe.com/*
// @include      *://*.1ting.com/player*
// @include      *://www.qingting.fm/*
// @include      *://www.lizhi.fm/*
// @include      *://music.migu.cn/*
// @include      *://www.shangxueba.com/ask/*.html
// @include      *://www.ximalaya.com/*
// @include      *://www.shangxueba.com/ask/*.html
// @include      *://pan.baidu.com/disk/home*
// @include      *://yun.baidu.com/disk/home*
// @include      *://pan.baidu.com/s/*
// @include      *://yun.baidu.com/s/*
// @include      *://pan.baidu.com/share/link*
// @include      *://yun.baidu.com/share/link*
// @exclude      *://*.wandhi.com/*
// @require      https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @require      https://greasyfork.org/scripts/373336-layer-wandhi/code/layer_wandhi.js?version=637587
// @grant        GM_setClipboard
// @run-at       document-end
// @connect      shangxueba365.com
// @grant        unsafeWindow
// @grant        GM_xmlhttpRequest
// @grant        GM_info
// @grant        GM.getValue
// @grant        GM.setValue
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_notification
// ==/UserScript==

(function () {
  'use strict';
  var currentUrl = window.location.href;
  var reBDY = /pan.baidu.com\/s/i;
  var reYk = /youku/i;
  var reAqy = /iqiyi/i;
  var reLS = /le.com/i;
  var reTX = /v.qq/i;
  var reTD = /tudou/i;
  var reMG = /mgtv/i;
  var reSH = /sohu/i;
  var reAF = /acfun/i;
  var reBL = /bilibili/i;
  var reYJ = /1905/i;
  var rePP = /pptv/i;
  var reYYT = /yinyuetai/i;
  var reTaoBao = /taobao.com/i;
  var reTmall = /tmall/i;
  var reJd = /jd/i;
  var reWY = /163(.*)song/i;
  var reQQ = /y.QQ(.*)song/i;
  var reKG = /kugou(.*)song/i;
  var reKW = /kuwo(.*)yinyue/i;
  var reXM = /xiami/i;
  var reBD = /taihe.com/i;
  var reQT = /qingting/i;
  var reLZ = /lizhi/i;
  var reMiGu = /migu/i;
  var reXMLY = /ximalaya/i;
  var reSXB = /shangxueba/i;
  var t = $.now();
  if (reWY.test(currentUrl) || reQQ.test(currentUrl) || reKG.test(currentUrl) || reKW.test(currentUrl) || reXM.test(currentUrl) || reBD.test(currentUrl) || reQT.test(currentUrl) || reLZ.test(currentUrl) || reMiGu.test(currentUrl) || reXMLY.test(currentUrl)) {
    var menus = [{
      title: '电影搜索',
      show: '电影<br>搜索',
      type: 'search'
    }, {
      title: '音乐下载',
      show: '音乐<br>下载',
      type: 'process'
    }, {
      title: '绝世好券',
      show: '绝世<br>好券',
      type: 'tb'
    }, {
      title: '京东好券',
      show: '京东<br>好券',
      type: 'jd'
    }];
    var f = function () {
      $('body').on('click', '[data-cat=process]', function () {
        InitCurrentUrl();
        if (reXMLY.test(currentUrl)) {
          if (__INITIAL_STATE__.SoundDetailPage != undefined) {
            window.open('http://music.wandhi.com/?id=' + __INITIAL_STATE__.SoundDetailPage.trackId + '&type=ximalaya');
          }
          else {
            layer.closeAll();
            var html = '<div style="padding:0px 50px 0px 50px;"><ul class="sound-list dOi2">';
            $.each(__INITIAL_STATE__.AlbumDetailTrackList.tracksInfo.tracks, function (index, item) {
              html += '<li class="dOi2"><a href="http://music.wandhi.com/?id=' + item.trackId + '&type=ximalaya" target="_blank">' + item.title + '</a></li>';
            });
            html += '</ul></div>';
            layer.open({
              type: 1,
              area: ['auto', '30%'],
              title: '为你找到了这些曲目解析……什么?我丑?以后再说吧',
              shade: 0.6,
              maxmin: false,
              anim: 2,
              content: html
            });
          }

        }
        else if (/taihe.com/i.test(currentUrl)) {
          window.open('http://music.wandhi.com/?url=' + encodeURIComponent(currentUrl.replace("taihe", "baidu")));
        }
        else {
          window.open('http://music.wandhi.com/?url=' + encodeURIComponent(currentUrl));
        }
      });
      $('body').on('click', '[data-cat=search]', function () {
        window.open('http://tv.wandhi.com/');
      });
      $('body').on('click', '[data-cat=tb]', function () {
        window.open('http://www3.huizhek.com/');
      });
      $('body').on('click', '[data-cat=jd]', function () {
        window.open('http://jd.huizhek.com');
      });
    };
    InitMenu(menus, f);
  }
  else if (reAqy.test(currentUrl) || reLS.test(currentUrl) || reTX.test(currentUrl) || reTD.test(currentUrl) || reMG.test(currentUrl) || reSH.test(currentUrl) || rePP.test(currentUrl) || reYk.test(currentUrl)) {
    var menus = [{
      title: '电影搜索',
      show: '电影<br>搜索',
      type: 'search'
    }, {
      title: '视频解析',
      show: '视频<br>解析',
      type: 'process'
    }, {
      title: '绝世好券',
      show: '绝世<br>好券',
      type: 'tb'
    }, {
      title: '京东好券',
      show: '京东<br>好券',
      type: 'jd'
    }];
    InitMenu(menus, function () {
      $('body').on('click', '[data-cat=process]', function () {
        window.open('http://tv.wandhi.com/go.html?url=' + encodeURIComponent(window.location.href));
      });
      $('body').on('click', '[data-cat=search]', function () {
        window.open('http://tv.wandhi.com/');
      });
      $('body').on('click', '[data-cat=tb]', function () {
        window.open('http://www3.huizhek.com/');
      });
      $('body').on('click', '[data-cat=jd]', function () {
        window.open('http://jd.huizhek.com');
      });
    })
  }
  else if (reTaoBao.test(currentUrl) || reTmall.test(currentUrl)) {
    loader();
    TINT();
  }
  else if (reJd.test(currentUrl)) {
    var keywords = $(".sku-name").text().trim();
    $("#choose-btns").prepend('<a href="javascript:;" class="btn-special1 btn-lg btn-yhj"><span class="">查询优惠券</span></a>');
    $(".btn-yhj").on('click', function () {
      window.open("http://jd.huizhek.com/?ah=total&kw=" + encodeURIComponent(keywords));
    });
  }
  else if (reSXB.test(currentUrl)) {
    var menus = [{
      title: '查看答案',
      show: '查看<br>答案',
      type: 'search'
    }, {
      title: '打赏作者',
      show: '打赏<br>作者',
      type: 'process'
    }, {
      title: '绝世好券',
      show: '绝世<br>好券',
      type: 'tb'
    }, {
      title: '京东好券',
      show: '京东<br>好券',
      type: 'jd'
    }];
    InitMenu(menus, function () {
      $('body').on('click', '[data-cat=process]', function () {
        layer.open({
          type: 1,
          title: '请我喝一杯',
          shadeClose: true,
          area: '800px',
          content: '<img src="https://i.loli.net/2019/05/14/5cda672add6f594934.jpg">'
        });
      });
      $('body').on('click', '[data-cat=search]', function () {
        SXB();
      });
      $('body').on('click', '[data-cat=tb]', function () {
        window.open('http://www3.huizhek.com/');
      });
      $('body').on('click', '[data-cat=jd]', function () {
        window.open('http://jd.huizhek.com');
      });
    });
  }
  else if (reBDY.test(currentUrl)) {
    var menus = [{
      title: '离线下载',
      show: '离线<br>下载',
      type: 'search'
    }, {
      title: '打赏作者',
      show: '打赏<br>作者',
      type: 'process'
    }, {
      title: '绝世好券',
      show: '绝世<br>好券',
      type: 'tb'
    }, {
      title: '京东好券',
      show: '京东<br>好券',
      type: 'jd'
    }];
    InitMenu(menus, function () {
      $('body').on('click', '[data-cat=process]', function () {
        layer.open({
          type: 1,
          title: '请我喝一杯',
          shadeClose: true,
          area: '800px',
          content: '<img src="http://i1.fuimg.com/500348/6717e02198116ae4s.png">'
        });
      });
      $('body').on('click', '[data-cat=search]', function () {
        window.location.href = window.location.href.replace('baidu.com', 'baiduwp.com');
      });
      $('body').on('click', '[data-cat=tb]', function () {
        window.open('https://link.zhihu.com/?target=https://api.wandhi.com/goto/DUVAFQgZTEEVFAQcDhYKSFkDDh9XCl8=');
      });
      $('body').on('click', '[data-cat=jd]', function () {
        window.open('https://link.zhihu.com/?target=https://api.wandhi.com/goto/DUVAFQgZTFwGTVhHDxkLV1pIBl5Z');
      });
    });
  }

  function loader() {
    $("body").append($('<script type="text/javascript" src="//lib.baomitu.com/jquery/1.12.4/jquery.min.js"></script>'));
  }

  function getPar(a) {
    var b = location.search.match(new RegExp("[\?\&]" + a + "=([^\&]+)", "i"));
    if (b == null || b.length < 1) {
      return "";
    }
    return b[1];
  }

  function appendCss(url) {
    $('head').append($('<link rel="stylesheet" href="' + url + '">'));
  }

  function TINT() {
    var h = 'https://api.wandhi.com';
    var bid = getPar('id');
    var api = '/api/tb/infos/' + bid;
    appendCss("//cdn.wandhi.com/style/extenstion/hui.style.css");
    var init = "<div id='wandhi_div'><table class='wandhi_tab' id='wandhi_table'><thead><tr><th><b onclick=window.open('https://link.zhihu.com/?target=http://www3.huizhek.com') style='cursor:pointer'>优惠券</b></th><th>券后</th><th>有 效 期</th><th>操作</th></tr></thead><tr><td colspan='4'>正在查询优惠信息,请稍候...</td></tr></table></div>";
    $('#J_LinkBasket').parent().parent().prepend(init);
    $('.J_LinkAdd').parent().parent().prepend(init);
    if (reTaoBao.test(currentUrl)) {
      $('#wandhi_table').addClass('wandhi_tab_taobao');
    }
    else {
      $('#wandhi_table').addClass('wandhi_tab_tmall');
    }
    $.getJSON(h + api, function (d) {
      $("#wandhi_table tbody tr").remove();
      var row = "";
      if (d.code) {
        d.data.forEach(e => {
          row += "<tr><td>" + e.quan_context + "</td><td>" + e.after_price + "</td><td>" + e.quan_time + "</td><td><b onclick=window.open(decodeURIComponent('" + e.quan_link + "')) style='cursor:pointer'>领取</b></td></tr>";
        });
      }
      else {
        row = "<tr><td colspan='4'>这个商品没有超值优惠券</td></tr>";
      }
      $("#wandhi_table tbody").append(row);
    });
  }
  var answer = "-1";

  function SXB() {
    var loading = layer.load(1, {
      shade: [0.8, '#393D49'],
      time: 10 * 1000
    });
    var h = 'https://api.wandhi.com';
    var id = $("#Hidd_id").val();
    if (!id) {
      Msg("数据异常请联系作者");
      return;
    }
    var api = '/api/tools/sxb/' + id;
    GM_xmlhttpRequest({
      headers: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      method: "POST",
      url: "http://www.shangxueba365.com/post.php",
      responseType: "JSON",
      data: "docinfo=" + encodeURIComponent("https://www.shangxueba.com/ask/" + id + ".html"),
      onload: function (res) {
        if (res.status == 200 && res.response.status) {
          showAnswer(res.response.msg);
        }
        else {
          Msg("未发现答案");
        }
        layer.close(loading);
      }
    });
  }

  function showAnswer(h) {
    layer.closeAll();
    layer.open({
      type: 1,
      title: '答案',
      area: ['400px', '300px'],
      shade: 0,
      offset: 'lb',
      maxmin: true,
      content: h
    });
  }

  function Msg(msg) {
    layer.closeAll();
    layer.msg(msg, {
      icon: 5
    });
  }

  function InitCurrentUrl() {
    currentUrl = window.location.href;
  }

  function InitMenu(obj, init) {
    var menusclass = ['first', 'second', 'third', 'fourth', 'fifth'];
    var str = "";
    $.each(obj, function (i, o) {
      str += '<a href="javascript:void(0)" title="' + o.title + '" data-cat="' + o.type + '" class="menu-item menu-line menu-' + menusclass[i] + '">' + o.show + '</a>';
    });
    var sidenav = '<svg width="0" height="0"><defs><filter id="goo"><feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur"></feGaussianBlur><feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 19 -9" result="goo"></feColorMatrix><feComposite in="SourceGraphic" in2="goo" operator="atop"></feComposite></filter></defs></svg><div class="aside-nav bounceInUp animated" id="aside-nav"><label for="" class="aside-menu" title="按住拖动">VIP</label>' + str + '</div>';
    $("body").append(sidenav).append($('<link rel="stylesheet" href="//cdn.wandhi.com/style/tv/asidenav.css">')).append($('<link rel="stylesheet" href="https://lib.baomitu.com/layer/3.1.1/theme/default/layer.css">'));
    var ua = navigator.userAgent;
    /Safari|iPhone/i.test(ua) && 0 == /chrome/i.test(ua) && $("#aside-nav").addClass("no-filter");
    var drags = {
        down: !1,
        x: 0,
        y: 0,
        winWid: 0,
        winHei: 0,
        clientX: 0,
        clientY: 0
      },
      asideNav = $("#aside-nav")[0],
      getCss = function (a, e) {
        return a.currentStyle ? a.currentStyle[e] : document.defaultView.getComputedStyle(a, !1)[e]
      };
    $("body").on("mousedown", "#aside-nav", function (a) {
      drags.down = !0, drags.clientX = a.clientX, drags.clientY = a.clientY, drags.x = getCss(this, "right"), drags.y = getCss(this, "top"), drags.winHei = $(window).height(), drags.winWid = $(window).width(), $(document).on("mousemove", function (a) {
        if (drags.winWid > 640 && (a.clientX < 120 || a.clientX > drags.winWid - 50))
          return !1;
        if (a.clientY < 180 || a.clientY > drags.winHei - 120)
          return !1;
        var e = a.clientX - drags.clientX,
          t = a.clientY - drags.clientY;
        asideNav.style.top = parseInt(drags.y) + t + "px";
        asideNav.style.right = parseInt(drags.x) - e + "px";
      })
    }).on("mouseup", "#aside-nav", function () {
      drags.down = !1, $(document).off("mousemove")
    });
    init();
  }
})();