// ==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 = $('")
.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 = $("