Greasy Fork

Greasy Fork is available in English.

人人影视自动跳转编辑页面

try to take over the world!

当前为 2018-03-30 提交的版本,查看 最新版本

// ==UserScript==
// @name         人人影视自动跳转编辑页面
// @namespace    http://www.lujunzhao.cn/
// @version      0.3
// @description  try to take over the world!
// @author       aimei5544
// @match        http://www.zimuzu.tv/*
// @grant        none
// ==/UserScript==
//v0.2重复自动跳转通过if解决和匹配域名解决
//v0.3添加更新缓存按钮在编辑资源页面

(function aimei5544() {
    'use strict';

    //功能实现为访问资源页面后自动加载编辑页面
    //var str_test1="http://www.zimuzu.tv/resource/35989";
    var now_url=document.location.href;
    // 获取当前URL
    var url_=now_url.split("/");
    var url_yyets=url_[3];//判断元素
    var edit_url="http://www.zimuzu.tv/release/resource/app?rid="+url_[4];

    if (url_yyets == "resource"){
        //分割取第四个元素ID
        console.log("编辑url :"+edit_url);
        console.log("当前id为:"+url_[4]);
        window.location.href=edit_url;
    }
    if(url_[3]=="release"){ //跳转编辑页面添加按钮 更新缓存
        console.log("编辑页面");
        var get_edit_url=document.location.href;
        var edit_=get_edit_url.split("=");
        var edit_url_updata="http://www.zimuzu.tv/resource/updateCache?rid="+edit_[1];
        document.getElementsByTagName("table")[3].innerHTML="<td class='update_cache' style='height: 18px;line-height: 1.5;background: #2866bd;color: #fff;font-weight: bold;text-align: center;padding: 6px;border-radius: 5px;><a id='update_cache_a'>更新缓存</a></td>";
        //document.write("<script type='text\/javascript' src='http:\/\/js.zmzjstu.com\/js\/resource.js?v=2017103101'><\/script>");
        $(".update_cache").click(function(){
            $.ajax({
                url:edit_url_updata+"&sid="+Math.random(),
                type:'GET',
                dataType:'JSON',
                success: function(data){
                              GLOBAL.ShowMsg('成功刷新缓存');
                }
            });
        });
    }else{
        console.log("当前不会跳转");
        console.log("当前url_yyets为:"+url_[3]);
        console.log("当前id为:"+url_[4]);
        console.log("编辑url :"+edit_url);
    }


})();