Greasy Fork

Greasy Fork is available in English.

Yinyuetai

免积分,免登录,既可观看、下载高清MV

当前为 2016-03-29 提交的版本,查看 最新版本

// ==UserScript==
// @name           Yinyuetai
// @author         hyk
// @namespace      [email protected]
// @description    免积分,免登录,既可观看、下载高清MV
// @version        0.0.2
// @create         2016-03-28
// @lastmodified   2016-03-29

// @include        http://v.yinyuetai.com/video/*
// @include        http://v.yinyuetai.com/playlist/*
// @copyright      2016+, hyk
// @require       http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js
// @grant          unsafeWindow
// @grant		GM_setClipboard
// @grant		GM_xmlhttpRequest
// @icon		
// ==/UserScript==
(function () {
    var dhost = location.hostname,
        Lc = location,
        lurl = Lc.href;
   
    var win = (typeof unsafeWindow == 'undefined') ? window : unsafeWindow;
    var _Q = function (d) {
            return document.querySelector(d)
        },
        _Qa = function (d) {
            return document.querySelectorAll(d)
        };
    var DM = function (m) {
        
        return lurl.toLowerCase().indexOf(m) > 0;
    };

    function Log(l) { //调试用
        console.log(l);
    }

//定义各大浏览器识别
    var OP = function () {
            return window.opera
        },
        GC = function () {
            return window.chrome
        },
        FF = function () {
            return window.sidebar
        };
    var $OP = function () {
        if (OP()) return $ = jQuery;
    }; //O下$修复


        
        // 参考源:plinfo.js,loader.js。By Yulei 2013.05.07
    function YYT() { //音悦台,免登录、积分、客户端
            if (!OP()) {
                var tbk = 'target="_blank"';
                $('div.pl_title.fl').after('<span  id="Ytai" ' +'><span style="background-color:#484848;height:38px;border-radius:5px;padding:5px;padding-bottom:6px;" class="ico download_ico ico20_pl_down"><a id="p1" ' + tbk + ' >标清</a><a id="p2" ' + tbk + '>高清</a><a id="p3" ' + tbk + '>超清</a></span></span><style>#Ytai a{margin:3px;color:white;}#Ytai a:hover{color:#669900;}#Ytai{position:relative;left:10px;}</style>');
                $('#Ytai').mouseenter(function () {
                   Yyt($('.videoinfobox').attr('videoid') || $('.play a').eq(0).attr('href').match(/\d+/)[0]);
                });
                
                function Yyt(Vid,index) {//此处修改自Music liker for beauty ByYulei
                  
                    GM_xmlhttpRequest({
                        url: 'http://www.yinyuetai.com/api/info/get-video-urls?videoId=' + Vid,
                        method: "get",
                        onload: function (y) {
                            var r = $.parseJSON(y.responseText);
                            if(DM('/playlist/')){
                                var oSpan=$("span.mv-quality-icon").eq(index);
                                r.hcVideoUrl ? oSpan.find("a.hc").attr('href', r.hcVideoUrl).show() : oSpan.find("a.hc").hide();
                                r.hdVideoUrl ? oSpan.find("a.hd").attr('href', r.hdVideoUrl).show() : oSpan.find("a.hd").hide();
                                r.heVideoUrl ? oSpan.find("a.he").attr('href', r.heVideoUrl).show() : oSpan.find("a.he").hide();
                               
                            }else{
                                
                                r.hcVideoUrl ? $('#p1').attr('href', r.hcVideoUrl).show() : $('#p1').hide();
                                r.hdVideoUrl ? $('#p2').attr('href', r.hdVideoUrl).show() : $('#p2').hide();
                                r.heVideoUrl ? $('#p3').attr('href', r.heVideoUrl).show() : $('#p3').hide();
                            }
                           
                           
                        }
                    })
                  
                }
                
            }
        if(DM('/playlist/')){
            var MVlist=_Qa(".mvbox_list .mv_picBox");
            Log(MVlist);
            $(".mvInfo_row01_left").after("<span id='ydList'>悦单列表地址</span><ul class='MV_List'></ul><style>span#ydList{cursor:pointer;padding:3px;font-size:16px;marging-left:20px;position:relative;left:20px;top:10px;color:white;background-color:#333}ul.MV_List{background-color:#333;width:300px;position:absolute;z-index:200;border-radius:5px;float:left}ul.MV_List li{display:inline-block;width:290px;list-style:none;float:left;height:40px;padding:5px;border-bottom:1px solid #404040;text-align:left;}ul.MV_List li span.mv-quality-icon{margin-left:22px;display:inline-block;}span.mv-quality-icon .mv-url{display:inline-block;padding-left:10px;padding-right:10px;margin-left:3px;}ul.MV_List li a{font-size:12px;color:white;text-align:left;margin-left:5px;}ul.MV_List span.mv-index{float:left;width:18px;height:18px;background-color:#f52f2f;padding-top:1px;padding-left:2px;color:white;border-radius:50%;display:inline-block}a.he{background-color:#1e65c6;}a.hd{background-color:#27d5bf;}a.hc{background-color:#e57834;}a.he:hover{background-color:#2b7ded}a.hd:hover{background-color:#35fce2}a.hc:hover{background-color:#f88843}p.mv-title{margin-left:25px;height:20px; color:white;font-size:12px;overflow:hidden}</style>");
           $("#ydList").mouseover(function(){
              $(this).css({"backgroundColor":"404040",color:"#27d5bf"});
           });
              $("#ydList").mouseout(function(){
              $(this).css({"backgroundColor":"#333",color:"white"});
           });
       
            $("#ydList").click(function(e){
              if($("ul.MV_List li").length==0){
                  
                $("ul.MV_List").css({"left":e.clientX+15,"top":e.clientY});
                for(var i=0;i<MVlist.length;i++){
                $("ul.MV_List").append("<li><span class='mv-index'>"+(i+1)+"</span><p  class='mv-title' title='"+MVlist[i].getAttribute('data-title')+"'>"+MVlist[i].getAttribute('data-title')+"</p><span class='mv-quality-icon'><a target='_blank' class='mv-url he'>he</a><a target='_blank' class='mv-url hd'>hd</a><a target='_blank' class='mv-url hc'>hc</a></span></li>");
              //  alert(MVlist[i].getAttribute('data-id'));//不要使用attr方法
                Yyt(MVlist[i].getAttribute('data-id'),i);   
            }
              }
                if($("ul.MV_List").is(":visible")){
                    $("ul.MV_List").hide();
                }else{
                    $("ul.MV_List").show();
                }
                  
                  
                
           });
          
            Log($("ul.MV_List a.mv_URL"));
        }
        }


  /*  if (!window.sidebar) {
        window.addEventListener('DOMContentLoaded', Yu, false);
    } else {
        YYT();
    };*/
YYT();
 

})();