Sleazy Fork is available in English.

Booru Revamped

This adds a couple of changes to the layout and behaviour of the site

"use strict";
// ==UserScript==
// @name         Booru Revamped
// @namespace    westerhold78
// @version      2.4
// @description  This adds a couple of changes to the layout and behaviour of the site
// @match        *://gelbooru.com/*
// @match        *://yande.re/*
// @match        *://danbooru.donmai.us/*
// @match        *://safebooru.org/*
// @match        *://konachan.com/*
// @match        *://konachan.net/*
// @match        *://rule34.paheal.net/*
// @match        *://rule34.xxx/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVgAAAF8CAYAAACKUaNgAAAABGdBTUEAALGPC/xhBQAACjppQ0NQUGhvdG9zaG9wIElDQyBwcm9maWxlAABIiZ2Wd1RU1xaHz713eqHNMBQpQ++9DSC9N6nSRGGYGWAoAw4zNLEhogIRRUQEFUGCIgaMhiKxIoqFgGDBHpAgoMRgFFFReTOyVnTl5b2Xl98fZ31rn733PWfvfda6AJC8/bm8dFgKgDSegB/i5UqPjIqmY/sBDPAAA8wAYLIyMwJCPcOASD4ebvRMkRP4IgiAN3fEKwA3jbyD6HTw/0malcEXiNIEidiCzclkibhQxKnZggyxfUbE1PgUMcMoMfNFBxSxvJgTF9nws88iO4uZncZji1h85gx2GlvMPSLemiXkiBjxF3FRFpeTLeJbItZMFaZxRfxWHJvGYWYCgCKJ7QIOK0nEpiIm8cNC3ES8FAAcKfErjv+KBZwcgfhSbukZuXxuYpKArsvSo5vZ2jLo3pzsVI5AYBTEZKUw+Wy6W3paBpOXC8DinT9LRlxbuqjI1ma21tZG5sZmXxXqv27+TYl7u0ivgj/3DKL1fbH9lV96PQCMWVFtdnyxxe8FoGMzAPL3v9g0DwIgKepb+8BX96GJ5yVJIMiwMzHJzs425nJYxuKC/qH/6fA39NX3jMXp/igP3Z2TwBSmCujiurHSU9OFfHpmBpPFoRv9eYj/ceBfn8MwhJPA4XN4oohw0ZRxeYmidvPYXAE3nUfn8v5TE/9h2J+0ONciURo+AWqsMZAaoALk1z6AohABEnNAtAP90Td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TYGcDvwF9SnQKzMIle3p55x92mFpFCS7SCsMniOa4+8yRsXY/Y6nxvBxgAeItRchChxhWtn/ucUksKLdgNwAjiYw19vOMr1uuu06YKNwXuRUG8RxWUm3vqXGqno2HexnCsGCDvB8lI2GATuX2lNdS4EGwP3QU4/nUR6jBB7qGrPv2jBssELwB8qNQDKk2A7CIuND+kSalvm463/WcJyqimFRDRYNngaeBhYm+GPHgJ+5+6XVv0d8yJYSbZtKe/0r0X/Ig1vrCd06TqSckZ7Djjp7meq/t3yJNiygKkm29oMxkz1tLuPKRwiI2+sA/YSSo1JHTF+kTDZ+nE9vStyKdgYrAMxm12rSyf3zHK1icqgu88qJKLJ/ugmbGTaFh+1NPsejdfyh42utc6tYGOQtgD/DfTqkskdl7k646+tqSLvwu0lnHq7LiZt5VtxRwjrrYcJW10TK2PlWrAxMJ3AK8CjukyaynS89T9LODVVE1RCtLpgy0S7K5YMujVsmTBHaJB+gTDjr1qqEO0q2LJs9ilCSzPVZpNlsUyog/EECiFEUQRbJtoewiLjg+h0hEYy1CHCLOkQoUmwTkwVouiCLRPtBuAwoT67QcNZkckymQ7q7CkhJNhqRdsB7Iui3aFh5QphZnQYuBSz00mFRQgJtlHZbo6iPUgxjqW5EkX600MTUkJIsFnIth/YCWyPj84Wf0mXgfH4kEyFkGBzJdztZbIdIJ+Nvq8AY/EWfzz+fdzdR3W5CiHBtpJwNxGOCt5M2C3WF7PctHpNzgIThN6nk4TF+1Nlf06pY78QEmwR5LsO2Ljkn3uA9VVKtJw5dx9XVIUoFv8f2/zRPBuJANkAAAAASUVORK5CYII=
// @copyright    2022, westerhold78
// @grant        GM_addStyle
// @grant        GM_xmlhttpRequest
// ==/UserScript==
const style=[],newTabForDetailPage=!0,zoomScale=2.5,zoomDelay=.4,imageTypes=["jpg","png","jpeg","gif"],movieExtensions=["mp4","webm"],rule34pahealSelectorImg="#image-list .shm-thumb-link img",rule34pahealSelectorVideo="#image-list .shm-thumb-link video",replaceMeString=">>[[REPLACEME]]<<",{hash,hostname,pathname,searchParams}=new URL(window.location.href);let anchorElement;const configuration={"yande.re":{pages:{list:{pathname:/^\/post$/},post:{pathname:/^\/post\/show\/.*$/}},selectors:{anchor:"#post-list-posts .inner .thumb",image:"#post-list-posts .inner .thumb img.preview"},sample:{type:"selector",selector:"#image"},original:{type:"selector",selector:"#highres"},postPageImageId:"image",maxHeight:"calc(100vh - 260px)",maxWidth:"calc(100vw - 310px)"},"gelbooru.com":{pages:{list:{searchParams:{page:"post",s:"list"}},post:{searchParams:{page:"post",s:"view"}}},selectors:{anchor:"#container main .thumbnail-container .thumbnail-preview a",image:"#container main .thumbnail-container .thumbnail-preview a img"},sample:{type:"selector",selector:"#image"},original:{type:"ogImage"},postPageImageId:"image",maxHeight:"calc(100vh - 285px)",maxWidth:"calc(100vw - 260px)"},"safebooru.org":{pages:{list:{searchParams:{page:"post",s:"list"}},post:{searchParams:{page:"post",s:"view"}}},selectors:{anchor:"#post-list .content .thumb a",image:"#post-list .content .thumb a img.preview"},sample:{type:"selector",selector:"#image"},original:{type:"ogImage"},postPageImageId:"image",maxHeight:"calc(100vh - 200px)",maxWidth:"calc(100vw - 260px)"},"danbooru.donmai.us":{pages:{list:{pathname:/^\/posts$/},post:{pathname:/^\/posts\/.*$/}},selectors:{anchor:"#posts .posts-container article .post-preview-link",image:"#posts .posts-container article .post-preview-link img.post-preview-image"},sample:{type:"ogImage"},original:{type:"selector",selector:"#image"},postPageImageId:"image",maxHeight:"calc(100vh - 200px)",maxWidth:"calc(100vw - 260px)"},"konachan.net":{pages:{list:{pathname:/^\/post$/},post:{pathname:/^\/post\/show\/.*$/}},selectors:{anchor:"#post-list-posts .inner .thumb",image:"#post-list-posts .inner .thumb img.preview"},sample:{type:"selector",selector:"#image"},original:{type:"selector",selector:"#highres"},postPageImageId:"image",maxHeight:"calc(100vh - 240px)",maxWidth:"calc(100vw - 280px)"},"konachan.com":{pages:{list:{pathname:/^\/post$/},post:{pathname:/^\/post\/show\/.*$/}},selectors:{anchor:"#post-list-posts .inner .thumb",image:"#post-list-posts .inner .thumb img.preview"},sample:{type:"ogImage"},original:{type:"selector",selector:"#image"},postPageImageId:"image",maxHeight:"calc(100vh - 240px)",maxWidth:"calc(100vw - 280px)"},"rule34.paheal.net":{pages:{list:{pathname:/^\/post\/list\/?.*$/},post:{pathname:/^\/post\/view\/.*$/}},selectors:{anchor:".shm-image-list .shm-thumb-link",image:".shm-image-list .shm-thumb-link img"},sample:{type:"ogImage"},original:{type:"selector",selector:"#main_image"},postPageImageId:"main_image",maxHeight:"calc(100vh - 345px)",maxWidth:"calc(100vw - 380px)"},"rule34.xxx":{pages:{list:{searchParams:{page:"post",s:"list"}},post:{searchParams:{page:"post",s:"view"}}},selectors:{anchor:"#post-list .content .image-list .thumb a",image:"#post-list .content .image-list .thumb a img"},sample:{type:"selector",selector:"#image"},original:{type:"ogImage",fallback:{type:"selector",selector:"#gelcomVideoPlayer"}},postPageImageId:"image",maxHeight:"calc(100vh - 220px)",maxWidth:"calc(100vw - 270px)"}},stylesArr={"yande.re":{overflowSelector:"#post-list-posts .inner",frameSelector:"#post-list .content .thumb video",scalingSelector:"#post-list .content .thumb *:is(img, video):hover",zIndexSelector:"#post-list .content .thumb *:is(img, video):hover"},"gelbooru.com":{scalingSelector:"article.thumbnail-preview *:is(img, video):hover",frameSelector:"article.thumbnail-preview video",zIndexSelector:"article.thumbnail-preview *:is(img, video):hover"},"danbooru.donmai.us":{scalingSelector:"a.post-preview-link *:is(img, video):hover",frameSelector:"a.post-preview-link video",zIndexSelector:"a.post-preview-link *:is(img, video):hover"},"safebooru.org":{scalingSelector:"#post-list .content .thumb a *:is(img, video):hover",zIndexSelector:"#post-list .content .thumb a *:is(img, video):hover"},"konachan.com":{overflowSelector:"#post-list-posts .inner",scalingSelector:"#post-list-posts .inner a.thumb *:is(img, video):hover",zIndexSelector:"#post-list-posts .inner a.thumb *:is(img, video):hover"},"konachan.net":{overflowSelector:"#post-list-posts .inner",scalingSelector:"#post-list-posts .inner a.thumb *:is(img, video):hover",zIndexSelector:"#post-list-posts .inner a.thumb *:is(img, video):hover"},"rule34.paheal.net":{scalingSelector:"#image-list .shm-image-list .shm-thumb-link *:is(img, video):hover",zIndexSelector:"#image-list .shm-image-list .shm-thumb-link *:is(img, video):hover"},"rule34.xxx":{scalingSelector:"#post-list .content .image-list .thumb a *:is(img, video):hover",zIndexSelector:"#post-list .content .image-list .thumb a *:is(img, video):hover"}},element=stylesArr[hostname],{scalingSelector,frameSelector,overflowSelector,zIndexSelector}=element||{};scalingSelector&&style.push(`${scalingSelector} {
      transform: scale(${2.5});
      -moz-transform: scale(${2.5});
      -webkit-transform: scale(${2.5});
      transition-delay: ${.4}s;
      transition-property: transform;
    }`),frameSelector&&style.push(`${element.frameSelector} {
      border: 3px solid #0000ff;
  }`),overflowSelector&&style.push(`${overflowSelector} {
      position: inherit;
      overflow: visible !important;
    }`),zIndexSelector&&style.push(`${zIndexSelector} {
      position: relative;
      z-index: 9001;
    }`),style.push(`[data-ext="mp4"] a video, [data-ext="webm"] a video {
    border: 3px solid #0000ff;
  }`),GM_addStyle(style.join(`
`));const onLoad=()=>{handlePaths()};document.readyState!=="loading"?onLoad():document.addEventListener("DOMContentLoaded",()=>{onLoad()});function handlePaths(){const e=Object.entries(configuration[hostname].pages).filter(([a,o])=>(o.pathname?.exec(pathname)?.length??0)>0)?.[0]?.[0],t=Object.entries(configuration[hostname].pages).filter(([a,o])=>{const s=Object.entries(o.searchParams||[]).filter(([i,r])=>r===searchParams.get(i)).length,n=Object.keys(o.searchParams??[]).length;return s===n&&s>0&&n>0})?.[0]?.[0];if(e==="list"||t==="list"||hostname==="danbooru.donmai.us"&&pathname==="/")openImageInNewTab(),document.querySelectorAll(configuration[hostname].selectors.image).forEach(async a=>{a.addEventListener("mouseover",async o=>await onImageMouseOver(o))});else if(e==="post"||t==="post"){const a=getUrl(document,"original"),o=document.getElementById(configuration[hostname].postPageImageId);o.onclick=null,o?.addEventListener("click",()=>{window.open(a,"_self")}),o.style.maxHeight=configuration[hostname].maxHeight,o.style.maxWidth=configuration[hostname].maxWidth,o.style.height="unset",o.style.width="unset",o?.scrollIntoView({behavior:"smooth",block:"end"})}}function openImageInNewTab(){{const e=document.querySelectorAll(configuration[hostname].selectors.anchor);Array.from(e).map(t=>t.setAttribute("target","_blank"))}}async function onImageMouseOver(e){const t=e.target;if(t.title="",!t.classList.contains("loaded")){const a=await getURLList(t);if(hostname==="rule34.paheal.net"){const n=t.parentElement?.parentElement?.children[2];a.original=n.href}await getType(t)==="video"?await swapVideo(t,a.original):await swapImageURLs(t,a)}}async function getType(e){switch(hostname){case"gelbooru.com":return movieExtensions.includes(e.classList[0])?"video":"image";case"danbooru.donmai.us":{const t=new URL((e.parentElement?.parentElement).href),a=await getDocFromURL(t.href);return getPostType(a)}case"rule34.paheal.net":{const t=(e.parentElement?.parentElement).dataset.ext;return movieExtensions.includes(t)?"video":"image"}case"rule34.xxx":{const t=new URL(e.parentElement.href),a=await getDocFromURL(t.href);return getPostType(a)}default:return null}}async function swapImageURLs(e,t){const{sample:a,original:o}=t;a!==void 0?setAsyncImage(e,a).then(s=>{o!==void 0&&setImage(e,o,e.width)}):o!==void 0&&setImage(e,o,e.width)}async function getURLList(e){switch(hostname){case"danbooru.donmai.us":{const t=(e?.parentElement?.parentElement).href;return await fetchImageURLGeneric(t)}default:{const t=(e?.parentElement).href;return await fetchImageURLGeneric(t)??{}}}}function swapVideo(e,t){const a=document.createElement("video");a.autoplay=!0,a.loop=!0,a.muted=!0,a.poster=e.src,a.height=e.height,a.width=e.width;const o=document.createElement("source");o.type="video/mp4",o.src=t,a.appendChild(o),e.replaceWith(a)}async function fetchImageURLGeneric(e){const t=await getDocFromURL(e),a=getUrl(t,"sample"),o=getUrl(t,"original");return{...o!==void 0&&o.length>0&&{original:o},...a!==void 0&&a!==o&&{sample:a}}}async function getDocFromURL(e){return await fetch(e).then(a=>a.text()).then(a=>new DOMParser().parseFromString(a,"text/html"))}function getUrl(e,t){const a=configuration[hostname][t];switch(a.type){case"ogImage":return e.querySelector("meta[property='og:image']").getAttribute("content");case"selector":{const o=e.querySelector(a.selector);return o?.src??o?.href??o?.getElementsByTagName("source")[0].src}default:return""}}function getPostType(e){const t=e.querySelector(configuration[hostname].original.selector)??e.querySelector(configuration[hostname].original.fallback.selector);return t instanceof HTMLVideoElement?"video":t instanceof HTMLImageElement?"image":null}function setImage(e,t,a){return new Promise((o,s)=>{e.onload=()=>o(),e.onerror=()=>s(),e.width=a,e.src=t,hostname==="danbooru.donmai.us"&&e.previousElementSibling?.remove()})}async function setAsyncImage(e,t){return new Promise((a,o)=>{setTimeout(async()=>{try{return t===void 0?void 0:(await setImage(e,t,e.width),t)}catch(s){console.error(s),o(s);return}finally{a(t)}})})}