| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| (function() { |
| 'use strict'; |
|
|
| |
| function createButton(id, text, color, topOffset) { |
| let button = document.createElement('button'); |
| button.id = id; |
| button.innerText = text; |
| button.style.position = 'fixed'; |
| button.style.top = `${topOffset}px`; |
| button.style.right = '10px'; |
| button.style.zIndex = 1000; |
| button.style.padding = '10px'; |
| button.style.backgroundColor = color; |
| button.style.color = '#fff'; |
| button.style.border = 'none'; |
| button.style.borderRadius = '5px'; |
| button.style.cursor = 'pointer'; |
| return button; |
| } |
|
|
| |
| let isScrolling = false; |
| let scrollInterval; |
|
|
| function startAutoScroll() { |
| if (!isScrolling) { |
| isScrolling = true; |
| scrollInterval = setInterval(() => { |
| window.scrollBy(0, 150); |
| }, 50); |
| } |
| } |
|
|
| function stopAutoScroll() { |
| if (isScrolling) { |
| isScrolling = false; |
| clearInterval(scrollInterval); |
| } |
| } |
|
|
| |
| const autoScrollButton = createButton('auto-scroll-button', 'Auto Scroll', '#4CAF50', 60); |
| document.body.appendChild(autoScrollButton); |
|
|
| |
| autoScrollButton.addEventListener('click', () => { |
| if (isScrolling) { |
| stopAutoScroll(); |
| autoScrollButton.innerText = 'Auto Scroll'; |
| autoScrollButton.style.backgroundColor = '#4CAF50'; |
| } else { |
| startAutoScroll(); |
| autoScrollButton.innerText = 'Stop Scroll'; |
| autoScrollButton.style.backgroundColor = '#f44336'; |
| } |
| }); |
|
|
| |
| if (window.location.href.includes('gelbooru.com')) { |
| let button = createButton('gelbooru-button', 'Extract Tags', '#ff5722', 10); |
| document.body.appendChild(button); |
|
|
| button.addEventListener('click', () => { |
| let images = document.querySelectorAll('img[title]'); |
| let tags = Array.from(images).map(img => img.getAttribute('title')); |
| let tagsString = tags.join('\n').replace(/ /g, ', '); |
| GM_setClipboard(tagsString); |
| alert('Tags have been copied to the clipboard!'); |
| }); |
| } else if (window.location.href.includes('danbooru.donmai.us')) { |
| let button = createButton('danbooru-button', 'Copy Tag Data', '#007bff', 10); |
| document.body.appendChild(button); |
|
|
| button.addEventListener('click', function() { |
| var articles = document.querySelectorAll('article.post-preview'); |
| var data = []; |
|
|
| articles.forEach(function(article) { |
| var tags = article.getAttribute('data-tags'); |
| var rating = article.getAttribute('data-rating'); |
|
|
| switch (rating) { |
| case 'e': |
| rating = 'explicit'; |
| break; |
| case 'q': |
| rating = 'questionable'; |
| break; |
| case 'g': |
| rating = 'general'; |
| break; |
| case 's': |
| rating = 'safe'; |
| break; |
| default: |
| rating = 'unknown'; |
| } |
|
|
| tags = tags.replace(/ /g, ', '); |
| data.push(`${tags}; ${rating}`); |
| }); |
|
|
| var dataStr = data.join('\n'); |
| GM_setClipboard(dataStr); |
| alert('Tag data copied to clipboard!'); |
| }); |
| } else if (window.location.href.includes('rule34.xxx')) { |
| let button = createButton('rule34-button', 'Copy Tags', '#ff4500', 10); |
| document.body.appendChild(button); |
|
|
| button.addEventListener('click', function() { |
| var thumbs = document.querySelectorAll('span.thumb'); |
| var data = []; |
|
|
| thumbs.forEach(function(thumb) { |
| var img = thumb.querySelector('img'); |
| if (img) { |
| var tags = img.getAttribute('title'); |
| if (tags) { |
| tags = tags.trim().replace(/ {2,}/g, ' ').replace(/ /g, ', '); |
| data.push(tags); |
| } |
| } |
| }); |
|
|
| var dataStr = data.join('\n'); |
| GM_setClipboard(dataStr); |
| alert('Tag data copied to clipboard!'); |
| }); |
| } |
| })(); |