// ==UserScript==
// @name Desu X - Enhancement Script for Desuarchive.org
// @version 2.5
// @description Combines infinite scrolling, media preview on hover, download functionality, Fappe Tyme™ and gallery mode for desuarchive.org. Alt+G to activate gallery mode. 'F' to toggle fappe tyme. Press 'S' while hovering over a thumbnail or in gallery mode to download media with the original filename.
// @author kpganon
// @license MIT
// @namespace https://github.com/kpg-anon/scripts
// @match https://desuarchive.org/*
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant GM_addElement
// ==/UserScript==
(function() {
'use strict';
GM_addStyle(`
@import url('https://fonts.googleapis.com/css?family=Roboto');
* {
font-family: 'Roboto', sans-serif !important;
}
.desux-search-page .paginate {
display: none !important;
}
.desux-search-page article.thread {
padding: 0 !important;
border-top: none !important;
}
.hidden-by-desux {
visibility: hidden;
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
white-space: nowrap;
}
[data-hidden="true"] {
opacity: 0;
pointer-events: none;
user-select: none;
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0,0,0,0);
clip-path: inset(100%);
}
#hover-preview {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 100;
pointer-events: none;
max-width: 100vw;
max-height: 100vh;
}
#hover-preview img,
#hover-preview video {
width: auto;
height: auto;
max-width: 100vw;
max-height: 100vh;
object-fit: contain;
}
#ig-galleryContainer {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.8);
z-index: 99999;
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 80px;
}
#ig-galleryImage {
max-width: 90%;
max-height: calc(100% - 80px - 20px);
transition: all 0.3s ease;
}
#ig-imageCounter {
position: absolute;
top: 10px;
left: 10px;
color: white;
font-size: 20px;
background-color: rgba(0, 0, 0, 0.6);
padding: 5px 10px;
border-radius: 5px;
z-index: 100000;
}
.ig-close-button {
position: fixed;
top: 0;
right: 0;
padding: 0;
background-color: transparent;
border: none;
}
.ig-close-button:hover {
background-color: rgba(0, 0, 0, 0.7);
filter: brightness(85%);
}
.ig-nav-button {
position: fixed;
background-color: transparent;
border: none;
padding: 0;
width: auto;
height: auto;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 10001;
top: 50%;
transform: translateY(-50%);
}
.ig-nav-button:hover {
background-color: rgba(0, 0, 0, 0.7);
filter: brightness(85%);
}
.ig-nav-button:active {
background-color: transparent;
}
.ig-nav-button.ig-prev-button {
left: -5px;
top: 50%;
transform: translateY(-50%);
}
.ig-nav-button.ig-prev-button:active .button-icon {
transform: scale(0.95);
}
.ig-nav-button.ig-next-button {
right: -5px;
top: 50%;
transform: translateY(-50%);
}
.ig-nav-button.ig-next-button:active .button-icon {
transform: scale(0.95);
}
#ig-thumbnailBar {
position: fixed;
bottom: 0;
left: 50%;
right: 0;
height: 75px;
transform: translateX(-50%);
display: flex;
overflow-x: scroll;
overflow-y: hidden;
background-color: rgba(0, 0, 0, 0.6);
padding: 10px 0;
white-space: nowrap;
scrollbar-width: thin;
scrollbar-color: #444 #282A36;
}
#ig-thumbnailBar::-webkit-scrollbar {
height: 12px;
background: #282A36;
}
#ig-thumbnailBar::-webkit-scrollbar-track {
background: #282A36;
}
#ig-thumbnailBar::-webkit-scrollbar-thumb {
background-color: #444;
border-radius: 10px;
border: 3px solid #282A36;
}
#ig-thumbnailBar::-webkit-scrollbar-thumb:hover {
background: #555;
}
.ig-thumbnail {
height: 60px;
object-fit: cover;
margin: 0 5px;
cursor: pointer;
transition: transform 0.3s ease, outline 0.3s ease;
}
.ig-thumbnail:hover {
opacity: 0.7;
}
.ig-thumbnail.ig-active {
transform: scale(1.05);
outline: 3px solid green;
}
.ig-download-button {
position: fixed;
top: 5px;
width: 40px;
height: 40px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
border: none;
padding: 0;
background-color: transparent;
transition: background-color 0.3s ease, transform 0.3s ease;
z-index: 10002;
}
.ig-download-button .button-icon {
width: 100%;
height: 100%;
transition: transform 0.3s ease, opacity 0.3s ease;
}
.ig-download-button:hover {
background-color: transparent;
box-shadow: none;
}
.ig-download-button:hover .button-icon {
transform: scale(1.05);
opacity: 0.7;
}
.ig-download-button:active .button-icon {
transform: scale(0.95);
`);
const prefix = 'ig-';
let hoveredMediaLink = null;
let hoveredMediaFilename = null;
let images = [];
let currentIndex = 0;
let galleryContainer, galleryImage, counter, thumbnailBar;
let loading = false;
const preview = document.createElement('div');
preview.id = 'hover-preview';
document.body.appendChild(preview);
function togglePostVisibility() {
const posts = document.querySelectorAll('.post_wrapper');
posts.forEach(post => {
const hasImage = post.querySelector('.post_file') !== null;
if (!hasImage) {
if(post.getAttribute('data-hidden') === 'true') {
post.removeAttribute('data-hidden');
} else {
post.setAttribute('data-hidden', 'true');
}
}
});
}
function addPageSpecificClass() {
const urlPath = window.location.pathname;
const bodyClass = document.body.classList;
if(urlPath.includes('/search/')) {
bodyClass.add('desux-search-page');
} else if(urlPath.match(/\/\w+\/thread\/\d+/)) {
bodyClass.add('desux-thread-page');
}
}
function attachHoverPreviewAndDownload() {
document.querySelectorAll('.thread .thread_image_link, .post_wrapper .thread_image_link').forEach(anchor => {
anchor.addEventListener('mouseover', function() {
const href = this.href;
const isVideo = href.endsWith('.webm') || href.endsWith('.mp4');
preview.innerHTML = '';
const media = isVideo ? document.createElement('video') : document.createElement('img');
media.src = href;
if (isVideo) {
media.autoplay = true;
media.loop = true;
media.muted = true;
}
preview.appendChild(media);
preview.style.display = 'block';
const postContainer = this.closest('.post_wrapper') || this.closest('.thread');
const filenameElement = postContainer.querySelector('.post_file_filename');
hoveredMediaLink = href;
hoveredMediaFilename = filenameElement ? (filenameElement.getAttribute('title') || filenameElement.textContent).trim() : getFilenameFromUrl(href);
});
anchor.addEventListener('mouseout', function() {
preview.innerHTML = '';
preview.style.display = 'none';
hoveredMediaLink = null;
hoveredMediaFilename = null;
});
});
}
function getFilenameFromUrl(url) {
return url.split('/').pop();
}
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7ge/s7IzvVEzRJycn1c6ogDdX8zPaAhkfH7exnfSznTStqqpKdnd3jdE3NzelrCzMByjzSwYB6evrk6urK0v79uwcLhkYl5cfkrm5OWPwk5MTx3cu7wZej35YuSy8tLQkhYUfuSzs/EFI8g0/JT18OFwhW1tblo7+9PwlR38WDrv1dk9PDlg77E7uAdeUZN2bT09PWxrv6OnpYbzDalbQGWiymcYzRdcHIYzw2ayjo+PV4HqcWw+5MrSagJqbm1+FvrKyIkVFZYxpJyp/oOjFsb2HvTlfTHijS7zPoR8eHkptbS1fxXnLNPDCwkJ8dubg4ECGh4eTfm/O1y2BJ+CBJ+CBB56AB56AB56AB56AB56AB56ABx54Ah54Ah54Ah54MoP/BYQ78LdAuACf4fF9AcId+DogXIBPS/ekqhsxMByGF9HrvL9U3bkDxGH4f/gN4LsAr1PrfVg9+A0Yh+F1as3/oH7xWRVV/VDdA5X4/gLrn4sNFnLRVwAAAABJRU5ErkJggg==';
function collectMediaItems() {
const mediaLinks = document.querySelectorAll('.thread .thread_image_link, .post_wrapper .thread_image_link');
mediaLinks.forEach((mediaLink) => {
const postWrapper = mediaLink.closest('.post_wrapper, .thread');
if (postWrapper) {
const isVideo = mediaLink.href.endsWith('.webm');
const thumbnail = mediaLink.querySelector('img').src;
const postLink = postWrapper.querySelector('a[data-function="quote"]');
const postId = postLink ? postLink.getAttribute('data-post') : postWrapper.id;
images.push({
src: mediaLink.href,
isVideo,
thumbnail,
postId
});
}
});
}
function getCurrentPageNumber() {
const matches = window.location.pathname.match(/page\/(\d+)/);
const pageNumber = matches ? parseInt(matches[1], 10) : 1;
// console.log('Current page number:', pageNumber);
return pageNumber;
}
let currentPageNumber = getCurrentPageNumber();
if (window.location.pathname.includes('/search/')) {
$('#footer').hide();
}
function loadMoreContent() {
if (loading || !window.location.pathname.includes('/search/')) return;
loading = true;
// console.log('Loading more content...');
const nextPageUrl = constructNextPageUrl(currentPageNumber);
// console.log('Next page URL:', nextPageUrl);
$.ajax({
url: nextPageUrl,
type: 'GET',
success: function(response) {
// console.log('Content loaded successfully');
const $response = $(response);
$response.find('article.backlink_container, section.section_title, h3.section_title, div.paginate').remove();
const newContent = $response.find('.thread').parent();
if (newContent.length === 0) {
// console.log('No more content to load');
$('#footer').show();
loading = false;
return;
}
$('.thread').last().parent().append(newContent.html());
attachHoverPreviewAndDownload();
collectMediaItems();
currentPageNumber++;
loading = false;
},
error: function(xhr, status, error) {
// console.error('Error loading content:', status, error);
loading = false;
}
});
}
function constructNextPageUrl(currentPageNumber) {
let basePath = window.location.href;
let nextPageNumber = currentPageNumber + 1;
// console.log('Constructing URL for page:', nextPageNumber);
if (basePath.includes('/page/')) {
basePath = basePath.replace(/\/page\/\d+/, `/page/${nextPageNumber}`);
} else {
if (!basePath.endsWith('/')) {
basePath += '/';
}
basePath += `page/${nextPageNumber}/`;
}
// console.log('Next page URL:', basePath);
return basePath;
}
function createGallery() {
if (galleryContainer) {
galleryContainer.remove();
galleryContainer = null;
return;
}
galleryContainer = GM_addElement(document.body, 'div', { id: prefix + 'galleryContainer' });
galleryImage = GM_addElement(galleryContainer, 'img', { id: prefix + 'galleryImage' });
counter = GM_addElement(galleryContainer, 'div', { id: prefix + 'imageCounter' });
const closeButton = createButton(closeImage, closeGallery, prefix + 'close-button');
const downloadButton = createButton(downloadImage, downloadCurrentMedia, prefix + 'download-button');
const nextButton = createButton(navigateRightImage, () => navigateGallery(1), prefix + 'nav-button', prefix + 'next-button');
const prevButton = createButton(navigateLeftImage, () => navigateGallery(-1), prefix + 'nav-button', prefix + 'prev-button');
thumbnailBar = GM_addElement(galleryContainer, 'div', { id: prefix + 'thumbnailBar' });
images.forEach((media, index) => {
const thumb = GM_addElement(thumbnailBar, 'img', {
src: media.thumbnail,
class: prefix + 'thumbnail'
});
thumb.addEventListener('click', () => {
currentIndex = index;
updateGallery();
});
});
galleryContainer.append(counter, closeButton, downloadButton, nextButton, prevButton, thumbnailBar);
updateGallery();
}
function createButton(base64Image, onClick, ...classes) {
const button = GM_addElement(document.body, 'button', { class: classes.join(' ') });
button.addEventListener('click', onClick);
GM_addElement(button, 'img', {
src: base64Image,
class: 'button-icon'
});
return button;
}
function navigateGallery(direction) {
const totalImages = images.length;
currentIndex = (currentIndex + direction + totalImages) % totalImages;
updateGallery();
}
function closeGallery() {
if (galleryContainer) {
galleryContainer.remove();
galleryContainer = null;
}
}
function updateGallery() {
if (images.length > 0 && galleryContainer) {
const currentMedia = images[currentIndex];
if (galleryContainer.contains(galleryImage)) {
galleryContainer.removeChild(galleryImage);
}
galleryImage = currentMedia.isVideo ? GM_addElement(galleryContainer, 'video', { id: prefix + 'galleryImage', controls: true, autoplay: true, loop: true, muted: true }) : GM_addElement(galleryContainer, 'img', { id: prefix + 'galleryImage' });
galleryImage.src = currentMedia.src;
counter.textContent = `${currentIndex + 1}/${images.length}`;
updateThumbnails();
}
}
function updateThumbnails() {
const thumbnails = Array.from(thumbnailBar.children);
thumbnails.forEach((thumb, index) => {
thumb.classList.toggle(prefix + 'active', index === currentIndex);
});
const selectedThumbnail = thumbnails[currentIndex];
thumbnailBar.scrollLeft = selectedThumbnail.offsetLeft - thumbnailBar.offsetWidth / 2 + selectedThumbnail.offsetWidth / 2;
}
function getOriginalFilename(postId) {
let postElement = document.querySelector(`.thread[id="${postId}"]`);
let filenameLink;
if (postElement) {
filenameLink = postElement.querySelector('.post_file_filename');
} else {
postElement = document.querySelector(`.post_wrapper a[data-function="quote"][data-post="${postId}"]`);
const postWrapperParent = postElement ? postElement.closest('.post_wrapper') : null;
filenameLink = postWrapperParent ? postWrapperParent.querySelector('.post_file_filename') : null;
}
if (filenameLink) {
if (filenameLink.getAttribute('title')) {
return filenameLink.getAttribute('title').trim();
} else if (filenameLink.textContent) {
return filenameLink.textContent.trim();
}
}
const currentMedia = images.find(img => img.postId === postId);
if (currentMedia && currentMedia.src) {
const urlParts = currentMedia.src.split('.');
const ext = urlParts[urlParts.length - 1];
return `default-filename.${ext}`;
}
return "default-filename";
}
function downloadCurrentMedia() {
const currentMedia = images[currentIndex];
let postId = currentMedia.postId;
if (!postId || postId === document.querySelector('.thread').id) {
postId = document.querySelector('.thread').id;
}
const originalFilename = getOriginalFilename(postId);
GM_xmlhttpRequest({
method: 'GET',
url: currentMedia.src,
responseType: 'blob',
onload: function(response) {
saveBlob(response.response, originalFilename);
},
onerror: function(error) {
console.error('Error downloading file:', error);
}
});
}
function saveBlob(blob, filename) {
const a = GM_addElement(document.body, "a", { href: window.URL.createObjectURL(blob), download: filename });
a.click();
document.body.removeChild(a);
}
document.addEventListener('keydown', function(e) {
if (e.key.toLowerCase() === 's' && !/input|textarea/i.test(document.activeElement.tagName)) {
e.preventDefault();
if (galleryContainer && galleryContainer.style.display !== 'none') {
downloadCurrentMedia();
} else if (hoveredMediaLink) {
GM_xmlhttpRequest({
method: 'GET',
url: hoveredMediaLink,
responseType: 'blob',
onload: function(response) {
const blobUrl = URL.createObjectURL(response.response);
const downloadLink = document.createElement('a');
downloadLink.href = blobUrl;
downloadLink.download = hoveredMediaFilename || 'download';
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
URL.revokeObjectURL(blobUrl);
},
onerror: function() {
alert('Download failed.');
}
});
}
}
if (e.altKey && e.key.toLowerCase() === 'g') {
if (!images.length) collectMediaItems();
createGallery();
}
if (e.key === 'Escape' && galleryContainer && galleryContainer.style.display !== 'none') {
closeGallery();
}
if (galleryContainer && galleryContainer.style.display !== 'none') {
if (e.key === 'ArrowRight') {
navigateGallery(1);
} else if (e.key === 'ArrowLeft') {
navigateGallery(-1);
}
}
if ((e.key === 'F' || e.key === 'f') && !e.ctrlKey && !e.altKey && !e.metaKey && !e.shiftKey &&
e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' &&
/https:\/\/desuarchive\.org\/.*\/thread\/.*/.test(window.location.href)) {
togglePostVisibility();
e.preventDefault();
}
});
window.addEventListener('scroll', function() {
if (window.location.pathname.includes('/search/') && window.scrollY + window.innerHeight >= document.body.scrollHeight - 90) {
loadMoreContent();
}
});
addPageSpecificClass();
attachHoverPreviewAndDownload();
collectMediaItems();
})();