// ==UserScript== // @name 【自用工具箱】整合好玩好用的各种功能,不定时持续更新中... // @version 1 // @author Paladin-M // @namespace Z3JlYXN5Zm9yaw== // @description 6月新增功能:支持大部分网站视频、音频、图片等资源的下载,并以缩略图形式展示,便于选择下载内容,节省时间和流量。部分加密视频无法下载,请知悉。欢迎留言增加新功能。 // @match *://*/* // @require https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js // @require https://cdn.bootcdn.net/ajax/libs/toastr.js/2.1.4/toastr.min.js // @license End-User License Agreement // @grant unsafeWindow // @grant GM_xmlhttpRequest // @grant GM_setClipboard // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_openInTab // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM.getValue // @grant GM.setValue // @grant GM_info // @grant GM_notification // @grant GM_getResourceText // @grant GM_openInTab // @grant GM_addStyle // @grant GM_download // @noframes // @downloadURL none // ==/UserScript== /* 食用方法: 安装插件成功后, 会在页面最左边的中间出现一个橙色小竖条, 鼠标移动到上面即可出现菜单页面 所有功能都会被整合到此菜单中 点击菜单即可享受 2023.06.12 第一个版本,支持大部分网站视频、音频、图片等资源的下载 并以缩略图形式展示,便于选择下载内容, 节省时间和流量。 部分加密视频无法下载, 请知悉。欢迎留言增加新功能 */ (function() { 'use strict'; var link = document.createElement('link'); link.href = 'https://cdn.bootcdn.net/ajax/libs/toastr.js/2.1.4/toastr.min.css'; link.rel = 'stylesheet'; link.type = 'text/css'; document.head.appendChild(link); var $menu = $('
'); $menu.css({ 'position': 'fixed', 'left': '0', 'top': '50%', 'transform': 'translateY(-50%)', 'z-index': '9999', 'cursor': 'pointer', 'background-color': '#ff9900', 'width': '3px', 'height': '60px', 'border-radius': '1px', 'transition': 'width .5s' }) .appendTo('body'); // Add the click and hover events to the menu $('body').on('click mouseenter',"#mytoolzxmenu",function(){ if ($("#mytoolzxmenuPage").is(':visible')) { $(this).animate({width: '3px'}, 300); $("#mytoolzxmenuPage").fadeOut(); }else{ $("#mytoolzxmenuPage").fadeIn(); $(this).animate({width: '2px'}, 300); } }); $('body').on('mouseleave',"#mytoolzxmenuPage",function(){ $("#mytoolzxmenu").animate({width: '3px'}, 300); $(this).fadeOut(); }); // Set up the menu items var Menuall = { download: { name: "常用功能", items: [ { name: "下载页面资源" ,val: "img-down"}, ] }, search: { name: "其他功能", items: [ { name: "待开发",val: "0" }, ] }, // recommend: { } }; // Set up the menu page var $menuPage = $('
'); $menuPage.css({ 'position': 'fixed', 'left': '0', 'top': '50%', 'transform': 'translateY(-50%)', 'z-index': '9998', 'padding': '20px', 'background-color': '#fff', 'width': '500px', 'height': '700px', 'border-radius': '0 5px 5px 0', 'box-shadow': '5px 0 15px rgba(0,0,0,0.3)', 'display': 'none', 'flex-direction': 'column', 'align-items': 'stretch', 'overflow-y': 'auto' }) .appendTo('body'); // Add the menu items to the menu page for (var key in Menuall) { var $menuItem = $(''); $menuItem.css({ 'display': 'flex', 'flex-wrap': 'wrap', 'align-items': 'center', 'justify-content': 'center', 'width': '100%', 'border-radius': '10px', 'margin-bottom': '10px', 'margin-top': '50px', 'cursor': 'pointer', 'transition': 'all .2s', 'position': 'relative' }) .appendTo($menuPage); var $categoryName = $('
'); $categoryName.text(Menuall[key].name); $categoryName.css({ 'color': '#ff9900', 'font-size': '16px', 'position': 'absolute', 'top': '-25px', 'left': '50%', 'transform': 'translateX(-50%)', }) .appendTo($menuItem); var totalHeight = 0; var subItemCount = Menuall[key].items.length; for (var i in Menuall[key].items) { var $subItem = $('
'); $subItem.text(Menuall[key].items[i].name); $subItem.css({ 'padding': '5px', 'border-radius': '5px', 'cursor': 'pointer', 'transition': 'all .2s', 'flex-grow': 1, 'min-width': '80px', 'max-width': '100px', 'font-size': '15px', 'font-weight': '500', 'justify-content': 'center', 'align-items': 'center', 'text-align': 'center', }) .attr("gotool", Menuall[key].items[i].val) .hover(function() { $(this).css({'background-color': '#ff9900', 'color': '#fff'}); if ($(this).index() == 0) { $(this).parent().find('.categoryName').css('visibility', 'visible'); } }, function() { $(this).css({'background-color': '#fff', 'color': '#000'}); if ($(this).index() == $(this).parent().children().length - 1) { $(this).parent().find('.categoryName').css('visibility', 'visible'); } }) .appendTo($menuItem); totalHeight += $subItem.outerHeight(true)-5; } // Set the height of menuItem to the total height of subItems plus 40px padding $menuItem.css('height', totalHeight + 40); // Calculate the border radius based on whether it's the first or last row if (subItemCount == 1) { $menuItem.css('border-radius', '10px'); } else if (key == 0) { $menuItem.css('border-top-left-radius', '10px'); $menuItem.css('border-top-right-radius', '10px'); } else if (key == Object.keys(Menuall).length - 1) { $menuItem.css('border-bottom-left-radius', '10px'); $menuItem.css('border-bottom-right-radius', '10px'); } } // Inject the CSS GM_addStyle('#mytoolzxmenuPage .menuItem:first-child { margin-top: 0; }'); GM_addStyle(` #mytoolzxmenuPage .menuItem { background-color: #fff; color: #000; font-size: 20px; font-weight: bold; box-shadow: 0 5px 15px rgba(0,0,0,0.3); } #mytoolzxmenuPage .subItem:hover { } `); var numselected=0; // create thumbnail container var thumbnailContainer = $("
") .css({ "position": "fixed", "top": "50%", "left": "50%", "transform": "translate(-50%, -50%)", "z-index": 999, "width": "80vw", "height": "80vh", "background-color": "#eee", "overflow": "auto", "text-align": "center" }) .hide() .attr("class", "data-down-ui") .appendTo($("body")); // create media type switch buttons var switchBtnContainer = $("
") .css({ "position": "absolute", "top": "0", "left": "0", "right": "0", "width": "100%", "background-color": "#fff", "padding": "10px", "text-align": "center", "box-shadow": "0 2px 5px rgba(0, 0, 0, 0.3)" }) .appendTo(thumbnailContainer); var switchBtnVideo = $("