您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
稿定素材库 快速选择素材ID
当前为
// ==UserScript== // @name 素材在avalon打开 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 稿定素材库 快速选择素材ID // @author You // @match https://*.gaoding.com/* // @run-at document-start // @icon https://www.google.com/s2/favicons?domain=sspai.com // @grant none // ==/UserScript== ;(function () { 'use strict' document.addEventListener('DOMContentLoaded', () => { // 在素材详情页面 if (/gaoding.com\/material\/\d+/.test(window.location.href)) { const materialId = window.location.href.match( /gaoding.com\/material\/(\d+)/, )[1] document.addEventListener('click', (e) => { if (e.metaKey) { const avalon = window.open( `https://avalon.gaoding.com/c/content/materials/${materialId}`, ) } }) } }) // Your code here... document.addEventListener('DOMContentLoaded', () => { const selectedIdContainer = document.createElement('div') selectedIdContainer.style.cssText = ` position: fixed; width: 363px; height: 286px; border: 1px solid rgb(204, 204, 204); z-index: 100; top: 100px; left: 20px; background-color: rgb(238, 238, 238); resize: both; overflow: auto; padding: 10px; overflow-wrap: break-word; ` document.body.appendChild(selectedIdContainer) const ids = new Set() document.addEventListener('click', function (e) { if (!e.shiftKey) { return } if (e.target.tagName === 'IMG' || e.target.tagName === 'VIDEO') { const link = e.target.closest('a') if (link && /\/material\/\d+\b/.test(link.href)) { e.preventDefault() const id = link.href.match(/\b\d+\b/)[0] if (ids.has(id)) { // 删除 ids.delete(id) link.selectIcon.remove() } else { // 添加 ids.add(id) toggleSelect(e.target) } selectedIdContainer.innerHTML = [...ids].join(',') } } }) function toggleSelect(imageEle) { const selectIcon = document.createElement('div') selectIcon.style.cssText = ` position: absolute; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.3); text-align: center; padding: 20px; box-sizing: border-box; font-size: 120px; color: red; text-shadow: 1px 3px 2px #fff; pointer-events: none; z-index: 100; top: 0; left: 0; ` selectIcon.innerHTML = '✓' imageEle.closest('a').appendChild(selectIcon) imageEle.closest('a').selectIcon = selectIcon } }) })()