Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name On the rentry 3D
- // @version 0.1
- // @description Cross-reference Clip Studio Store links with a reference page
- // @match https://assets.clip-studio.com/*/*
- // ==/UserScript==
- (function() {
- 'use strict';
- // Define the URL of the reference page
- const referenceURL = 'https://rentry.org/CSP_3D';
- // Fetch the content of the reference page
- fetch(referenceURL)
- .then(response => response.text())
- .then(data => {
- // Extract the IDs and DL links from the reference page
- const rows = data.match(/<tr>[\s\S]*?<\/tr>/g);
- const idDLMap = {};
- rows.forEach(row => {
- const idMatch = row.match(/<a[^>]*>(\d+)<\/a>/);
- if (idMatch) {
- const id = idMatch[1];
- const dlMatch = row.match(/<a href="([^"]+)"[^>]*>DL<\/a>/);
- if (dlMatch) {
- const dlLink = dlMatch[1];
- idDLMap[id] = dlLink;
- }
- }
- });
- // Get the current URL's ID
- const currentURL = window.location.href;
- const currentID = currentURL.match(/detail\?id=(\d+)/)[1];
- // Check if the current ID is present in the reference IDs
- const isPresent = Object.keys(idDLMap).includes(currentID);
- // Modify the page content accordingly
- const contentIdElement = document.querySelector('.materialHeaderContentsId');
- if (isPresent) {
- const dlLink = idDLMap[currentID];
- contentIdElement.innerHTML += ` <a href="${dlLink}" target="_blank">✅ on the Rentry!</a>`;
- }
- })
- .catch(error => console.error('Error fetching data:', error));
- })();
Advertisement
Add Comment
Please, Sign In to add comment