资源网链接跳转

OK资源网,最大资源网[kuyun] [m3u8]页面链接点击直接跳转.类型页面改进翻页功能

As of 2017-09-17. See the latest version.

// ==UserScript==
// @name         资源网链接跳转
// @namespace    https://greasyfork.org/zh-CN/users/104201
// @version      0.2
// @description  OK资源网,最大资源网[kuyun] [m3u8]页面链接点击直接跳转.类型页面改进翻页功能
// @author       黄盐
// @match        http://www.okokzy.com/?m=vod-*
// @match        http://www.zuidazy.com/?m=vod-*
// @grant        GM_addStyle
// run-at        document-end
// ==/UserScript==

(function() {
    'use strict';
    //适配详情页,http://*.com/?m=vod-detail-id-*.html
    if(location.search.indexOf("detail") != -1) {
        var lis=document.querySelectorAll("div.vodplayinfo li");//文档中0~end 是链接项目,渲染结束后是6~end是链接项目
        var tmp;
        for(var i in lis){
            console.log(lis[i]);
            tmp=lis[i].innerText;
            lis[i].innerHTML=lis[i].childNodes[0].outerHTML+'<a target="_blank" href="'+tmp.slice(tmp.indexOf("http"))+'">'+tmp+'</a>';
        }
    }
    //适配分类页,http://*.com/?m=vod-type-id-*.html 方便翻页
    if(location.search.indexOf("type") != -1) {
        GM_addStyle('.GM_page{position:fixed !important;bottom:0 !important; width:100% !important;}');
        var ms = function (){
            var evt = window.event || arguments[0];
            if(evt.pageY<(document.body.offsetHeight-window.innerHeight)){
                document.getElementsByClassName('pages')[0].className = "pages GM_page";
            }
            else {
                document.getElementsByClassName('pages')[0].className = "pages";
            }
        };

        //document.onmousemove = ms;
        document.onmousewheel = ms;
    }
})();