百度云跳转到文件

跳转到文件所在位置

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         百度云跳转到文件
// @namespace    http://tampermonkey.net/
// @version      0.2.2
// @description  跳转到文件所在位置
// @author       kiki
// @match        https://pan.baidu.com/disk/home*
// @grant        none
// @require      https://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    'use strict';
    $('[data-button-id="b33"]').parent().append("<span class='g-button'><span class='g-button-right' id='jump'>跳转</span></span>");
    $('#jump').on("click",function(){
        var top = $(".dir-small:last").offset().top;
        if(top>600 || top<0){
            $(".dir-small").parent().parent().parent().animate({
                scrollTop: top-$(".dir-small:first").offset().top+90
            }, 500);
        }else if(top<600 && top>0){
            $(".dir-small").parent().parent().parent().animate({
                scrollTop:  $(".dir-small:first").offset().top
            }, 500);
        }
    });
})();