您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Export all fullsize file URLs from Shopify to clipboard and log them in console (bulk export with pagination)
当前为
- // ==UserScript==
- // @name Export Shopify Fullsize File URLs
- // @namespace http://tampermonkey.net/
- // @version 1.7
- // @description Export all fullsize file URLs from Shopify to clipboard and log them in console (bulk export with pagination)
- // @author sharmanhall
- // @match https://admin.shopify.com/store/*/content/files?limit=*&selectedView=all
- // @match https://admin.shopify.com/store/*/content/files*
- // @grant GM_setClipboard
- // @grant GM_log
- // @run-at document-end
- // @license MIT
- // @icon https://www.google.com/s2/favicons?sz=64&domain=shopify.com
- // @compatible chrome
- // @compatible edge
- // @compatible firefox
- // @compatible safari
- // @compatible brave
- // ==/UserScript==
- (function() {
- 'use strict';
- let accumulatedUrls = [];
- // Function to extract file URLs
- function extractFileUrls() {
- // Select all elements that contain file URLs using the provided selector
- const fileElements = document.querySelectorAll('td._ThumbnailCell_b1ynd_1.Polaris-IndexTable__TableCell div > div > button > span img');
- // Extract URLs from the elements and convert to fullsize image URLs
- const fileUrls = Array.from(fileElements).map(el => el.src.replace('_60x60', ''));
- // Log the URLs to the console
- console.log('Fullsize File URLs:', fileUrls);
- // Copy URLs to clipboard
- GM_setClipboard(fileUrls.join('\n'));
- // Log success message
- GM_log('Fullsize file URLs copied to clipboard.');
- }
- // Function to accumulate file URLs and copy to clipboard
- function accumulateFileUrls() {
- // Select all elements that contain file URLs using the provided selector
- const fileElements = document.querySelectorAll('td._ThumbnailCell_b1ynd_1.Polaris-IndexTable__TableCell div > div > button > span img');
- // Extract URLs from the elements and convert to fullsize image URLs
- const fileUrls = Array.from(fileElements).map(el => el.src.replace('_60x60', ''));
- // Add to accumulated URLs
- accumulatedUrls = accumulatedUrls.concat(fileUrls);
- // Log the accumulated URLs to the console
- console.log('Accumulated Fullsize File URLs:', accumulatedUrls);
- // Copy accumulated URLs to clipboard
- GM_setClipboard(accumulatedUrls.join('\n'));
- // Log success message
- GM_log('Accumulated fullsize file URLs copied to clipboard.');
- }
- // Function to create a floating button for extracting URLs
- function createFloatingButton() {
- const button = document.createElement('button');
- button.innerText = 'Export File URLs';
- button.style.position = 'fixed';
- button.style.bottom = '10px';
- button.style.right = '10px';
- button.style.zIndex = '1000';
- button.style.padding = '10px';
- button.style.backgroundColor = '#008CBA';
- button.style.color = 'white';
- button.style.border = 'none';
- button.style.borderRadius = '5px';
- button.style.cursor = 'pointer';
- button.addEventListener('click', extractFileUrls);
- document.body.appendChild(button);
- }
- // Function to create a floating button for accumulating URLs
- function createAccumulateButton() {
- const button = document.createElement('button');
- button.innerText = 'Accumulate URLs';
- button.style.position = 'fixed';
- button.style.bottom = '10px';
- button.style.right = '150px';
- button.style.zIndex = '1000';
- button.style.padding = '10px';
- button.style.backgroundColor = '#FFA500';
- button.style.color = 'white';
- button.style.border = 'none';
- button.style.borderRadius = '5px';
- button.style.cursor = 'pointer';
- button.addEventListener('click', accumulateFileUrls);
- document.body.appendChild(button);
- }
- // Function to create a floating input area for changing the limit parameter
- function createLimitInput() {
- const container = document.createElement('div');
- container.style.position = 'fixed';
- container.style.bottom = '50px';
- container.style.right = '10px';
- container.style.zIndex = '1000';
- container.style.padding = '10px';
- container.style.backgroundColor = '#fff';
- container.style.border = '1px solid #ccc';
- container.style.borderRadius = '5px';
- const label = document.createElement('label');
- label.innerText = 'Set Limit: ';
- label.style.marginRight = '5px';
- const input = document.createElement('input');
- input.type = 'number';
- input.value = 10;
- input.style.marginRight = '5px';
- input.style.width = '50px';
- const setButton = document.createElement('button');
- setButton.innerText = 'Set';
- setButton.style.padding = '5px';
- setButton.style.backgroundColor = '#008CBA';
- setButton.style.color = 'white';
- setButton.style.border = 'none';
- setButton.style.borderRadius = '5px';
- setButton.style.cursor = 'pointer';
- setButton.addEventListener('click', () => {
- const limit = input.value;
- const currentUrl = new URL(window.location.href);
- currentUrl.searchParams.set('limit', limit);
- window.location.href = currentUrl.toString();
- });
- container.appendChild(label);
- container.appendChild(input);
- container.appendChild(setButton);
- document.body.appendChild(container);
- }
- // Function to create quick change buttons
- function createQuickChangeButtons() {
- const limits = [10, 50, 100, 200, 250];
- const container = document.createElement('div');
- container.style.position = 'fixed';
- container.style.bottom = '110px';
- container.style.right = '10px';
- container.style.zIndex = '1000';
- container.style.padding = '10px';
- container.style.backgroundColor = '#fff';
- container.style.border = '1px solid #ccc';
- container.style.borderRadius = '5px';
- container.style.display = 'flex';
- container.style.flexDirection = 'column';
- container.style.gap = '5px';
- limits.forEach(limit => {
- const button = document.createElement('button');
- button.innerText = `Set Limit ${limit}`;
- button.style.padding = '5px';
- button.style.backgroundColor = '#008CBA';
- button.style.color = 'white';
- button.style.border = 'none';
- button.style.borderRadius = '5px';
- button.style.cursor = 'pointer';
- button.addEventListener('click', () => {
- const currentUrl = new URL(window.location.href);
- currentUrl.searchParams.set('limit', limit);
- window.location.href = currentUrl.toString();
- });
- container.appendChild(button);
- });
- document.body.appendChild(container);
- }
- // Wait for the page to fully load
- window.addEventListener('load', () => {
- createFloatingButton();
- createAccumulateButton();
- createLimitInput();
- createQuickChangeButtons();
- });
- })();