Last active
April 11, 2023 02:45
-
-
Save fredgido/0afc7645e9312f9e0b7af5ff0ced43a4 to your computer and use it in GitHub Desktop.
LITDIRT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name I see cute girls online | |
| // @namespace ISCG | |
| // @version 0.000000001 | |
| // @description ... | |
| // @author made by fredgy-kun | |
| // @match https://*.aibooru.online/posts* | |
| // @match https://*.aibooru.online/media_assets* | |
| // @match https://*.aibooru.online/ | |
| // @exclude https://*.aibooru.online/posts/* | |
| // @grant none | |
| // @run-at document-end | |
| // ==/UserScript== | |
| let tsize = localStorage.getItem(`tsize`)|0; | |
| tsize = tsize > 0 ? tsize : 483; | |
| let tcheck = localStorage.getItem(`tcheck`) !== `false`; | |
| let scheck = localStorage.getItem(`scheck`) !== `false`; | |
| const extWhitelist = new Set([`.png`, `.jpg`, `.gif`]); | |
| let thumbsParent =document.querySelectorAll('.posts-container, .media-assets-container ')[0]; | |
| let iscgControls; | |
| if (!document.getElementById(`iscgControls`)) { | |
| document.getElementById(`subnav-menu`).insertAdjacentHTML(`beforeend`, | |
| `<li id='iscgControls' style='--iscg-tsize-str:"";'> | |
| <input type='range' min='150' max='700' value='${tsize|0}' id='iscgSlider' style='width: 200px;'> | |
| <input type='checkbox' ${tcheck ? `checked` : ``} id='iscgCheckbox'> | |
| <input type='checkbox' ${scheck ? `checked` : ``} id='iscgSideBarCheckbox'> | |
| <span id='iscgOutput'></span> | |
| </li>`); | |
| document.head.insertAdjacentHTML(`beforeend`, | |
| `<style id='iscgStylesheet'> | |
| .post-gallery-grid.post-gallery-720 .posts-container { | |
| grid-template-columns: repeat(auto-fill, minmax(var(--iscg-tsize), 1fr))!important; | |
| } | |
| .media-asset-gallery.media-asset-gallery-720 .media-assets-container { | |
| grid-template-columns: repeat(auto-fill,minmax(var(--iscg-tsize), 1fr))!important; | |
| } | |
| .post-gallery-grid.post-gallery-720 .post-preview-container { | |
| height: var(--iscg-tsize)!important; | |
| max-width: var(--iscg-tsize)!important; | |
| } | |
| .media-asset-gallery-grid.media-assett-gallery-720 .media-asset-preview-container { | |
| height: var(--iscg-tsize)!important; | |
| max-width: var(--iscg-tsize)!important; | |
| } | |
| .post-preview-image { | |
| max-width: var(--iscg-tsize)!important; | |
| height: unset!important; | |
| width: unset!important; | |
| max-height: var(--iscg-tsize)!important; | |
| } | |
| .media-asset-preview-image { | |
| max-width: var(--iscg-tsize)!important; | |
| height: unset!important; | |
| width: unset!important; | |
| max-height: var(--iscg-tsize)!important; | |
| } | |
| #iscgOutput::before { | |
| content: var(--iscg-tsize-str); | |
| } | |
| </style>`); | |
| iscgControls = document.getElementById(`iscgControls`); | |
| } | |
| document.getElementById(`iscgSlider`).oninput = function () { | |
| tsize = this.value; | |
| if (tcheck){ | |
| applyTsize(); | |
| } | |
| localStorage.setItem(`tsize`, tsize); | |
| } | |
| document.getElementById(`iscgCheckbox`).onclick = function () { | |
| tsize = localStorage.getItem(`tsize`); | |
| tcheck = this.checked; | |
| if (!tcheck) { | |
| tsize = 150;} | |
| applyTsize(); | |
| localStorage.setItem(`tcheck`, tcheck); | |
| }; | |
| document.getElementById(`iscgCheckbox`).onclick = function () { | |
| scheck = !scheck; | |
| document.getElementById("iscgSideBarCheckbox").hidden = scheck; | |
| localStorage.setItem(`scheck`, scheck); | |
| }; | |
| function applyTsize() { | |
| thumbsParent.classList.toggle(`iscgEnabled`, tcheck); | |
| thumbsParent.style.setProperty(`--iscg-tsize`, `${tsize|0}px`); | |
| iscgControls.style.setProperty(`--iscg-tsize-str`, `'${tsize|0}px'`); | |
| } | |
| document.getElementById("iscgSideBarCheckbox").hidden = scheck; | |
| applyTsize(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment