您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
PikePak 为导航和文件夹添加一个新标签页打开按钮
当前为
// ==UserScript== // @name PikPak 新标签页打开 // @namespace https://gf.qytechs.cn/zh-CN/users/722555-vveishu // @version 2.0.0 // @description PikePak 为导航和文件夹添加一个新标签页打开按钮 // @author vvei // @match https://mypikpak.com/s/* // @icon http://mypikpak.com/favicon.ico // @grant none // @require https://code.jquery.com/jquery-3.7.1.slim.min.js // @run-at document-end // ==/UserScript== (function ($) { 'use strict'; // 添加 Material Symbols Outlined 样式表 $('head').append( $('<link>', { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=open_in_new' }) ); // 添加 CSS 样式 $('<style>').text(` .grid-operation{ display:block!important; .pp-link-button{ background-color: #fff7!important; .pp-icon{ color: #000!important; } } } .pp-link-button.moveL2D7R.moveL2D7R.moveL2D7R.moveL2D7R { top: 40px; } .folder-navigator .open_in_new{ font-size: 18px; height: 36px; min-width: 1em; margin-right: 8px; align-items: center; line-height: 36px; text-decoration: none; } .file-list > .grid .open_in_new { position: absolute; min-width: 24px; height: 24px; top: 8px; right: 8px; } `).appendTo('head'); // 执行时间 // 延迟执行 setTimeout(() => { // 初始化处理 processNav(); processLis(); // 监听导航列表变化 new MutationObserver(mutations => { mutations.forEach(m => m.type === 'childList' && processNav()); }).observe($('.folder-navigator > ul')[0], { childList: true }); // 循环执行 let checkCount = 0; const fileListInterval = setInterval(() => { processLis(); if (++checkCount >= 3) { //检查3次 clearInterval(fileListInterval); // 监听 file-list new MutationObserver(mutations => { mutations.forEach(m => { $(m.addedNodes).each((i, node) => { if ($(node).hasClass('grid')) processLis(); }); }); }).observe($('.file-list')[0], { childList: true }); } }, 1000); // 间隔1秒 }, 1500); // 延迟1.5秒 // 处理第一个 .folder-navigator > ul 内所有 .pp-link-button 元素 function processNav() { $('.folder-navigator > ul').first().find('.pp-link-button').each(function() { const $this = $(this); const $next = $this.next('.open_in_new'); // 判断有链接 if ($this.attr('href')){ // 下一个兄弟元素没有 open_in_new 类则添加按钮 if (!$next.length) navAddLink($this); } else //否则删除 .open_in_new 元素 $next.remove(); }); } // 在导航列表中添加按钮 function navAddLink($item) { $item.after( $('<a>', { href: $item.attr('href'), target: '_blank', class: 'open_in_new material-symbols-outlined', text: 'open_in_new' }) ); } // 处理文件列表 function processLis() { $('.file-list').first().find('.grid').each(function() { const $item = $(this); // 判断 .folder-cover 存在 if ($item.has('.folder-cover').first().length) { // .pp-link-button 添加 class (通过 css 下移) const $cppLink = $item.find('.pp-link-button').first(); if (!$cppLink.hasClass('moveL2D7R')) $cppLink.addClass('moveL2D7R'); const $gridOperation = $item.find('.grid-operation').first(); // 判断 .open_in_new 元素存在 if (!$gridOperation.has('> .open_in_new')[0]) listAddLink($gridOperation, $item.attr('id')); } }); } // 在文件列表中添加按钮 function listAddLink($gridOperation, id) { $gridOperation.append( $('<a>', { href: id, target: '_blank', class: 'open_in_new' }).append( $('<span>', { class: 'material-symbols-outlined', text: 'open_in_new' }) ) ); } })(jQuery);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址