Greasy Fork is available in English.
Do horizontal folders bother you? What about those huge titles and wasted space?
当前为
// ==UserScript==
// @name Better Gallections
// @version 2.4.2
// @description Do horizontal folders bother you? What about those huge titles and wasted space?
// @author Valognir (https://www.deviantart.com/valognir)
// @namespace http://greasyfork.icu/en/scripts/404189-better-gallections
// @grant GM_addStyle
// @run-at document-start
// @match https://www.deviantart.com/*
// ==/UserScript==
let css = `
[data-hook="gallection_folder"], #sub-folder-gallery {
display: inline-block !important;
vertical-align: top !important;
}
[data-hook="gallection_folder"] {
overflow-y: scroll !important;
scrollbar-width: 5px;
scrollbar-color: rgba(155, 155, 155, 0.5) transparent;
height: calc(100vh - 600px) !important;
position: sticky;
top: 150px;
margin-right: 30px;
margin-top: 5px !important;
padding-bottom: 400px;
}
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background-color: rgba(155, 155, 155, 0.5);
border: transparent;
}
[data-hook="gallection_folder"]>div {
display: block;
height: auto;
}
[data-hook="gallection_folder"]>div>section {
margin-bottom: 10px;
}
[data-hook="gallection_folder"]>button {
display: none;
}
[data-hook^="gallection_folder_"] {
padding: 0;
}
[data-hook^="gallection_folder_"]>div:first-child,
[data-hook^="gallection_folder_"]>div:first-child>div>div[style],
[data-hook^="gallection_folder_"]>div:first-child>div>div[style]>img{
width: 248px !important;
height: 209px !important;
}
[data-hook^="gallection_folder_"]>div:last-child{
position: absolute;
padding: 0;
margin-top: -54px !important;
height: 54px !important;
width: 248px;
background-color: none;
}
[data-hook^="gallection_folder_"]>div:last-child>div{
margin: 0;
padding: 5px;
}
.theme-dark [data-hook^="gallection_folder_"]>div:last-child>div{
background: #161A1F;
}
.theme-light [data-hook^="gallection_folder_"]>div:last-child>div{
background: #fff;
}
.light-green [data-hook^="gallection_folder_"]>div:last-child>div{
background: #E7EDE4;
}
#sub-folder-gallery {
margin-top: -65px !important;
width: calc(100% - 310px);
min-height: 100vh !important;
}
[data-hook="gallection_folder"]+div {
margin-top: -65px !important;
width: calc(100% - 300px);
display: inline-block !important;
vertical-align: top !important;
}
[data-hook="gallection_folder"]+div+div{
width: calc(100% - 400px);
min-height: 100vh !important;
position: absolute;
top: 560px;
right: 50px;
}
#sub-folder-gallery>div:first-child>div:first-child>div:first-child>div:first-child {
margin-top: -1px;
}
/* sub galleries */
#sub-folder-gallery>div:first-child>div:first-child>div:first-child>div:nth-child(2) >div:nth-child(2)>div>div {
height: 120px !Important;
width: 100% !Important;
}
#sub-folder-gallery>div:first-child>div:first-child>div:first-child>div:nth-child(2) >div:nth-child(2)>div>div>div:first-child,
#sub-folder-gallery>div:first-child>div:first-child>div:first-child>div:nth-child(2) >div:nth-child(2)>div>div>div:first-child>div:first-child,
#sub-folder-gallery>div:first-child>div:first-child>div:first-child>div:nth-child(2) >div:nth-child(2)>div>div>div:first-child>div:first-child>img {
height: 100px !Important;
width: 140px !Important;
}
#sub-folder-gallery>div:first-child>div:first-child>div:first-child>div:nth-child(2) >div:nth-child(2)>div>div>div:first-child {
width: 140px;
justify-content: center;
margin-top: 10px;
margin-bottom: 0;
}
#sub-folder-gallery>div:first-child>div:first-child>div:first-child>div:nth-child(2) >div:nth-child(2)>div>div>div:first-child>div+div {
display:none;
}
#sub-folder-gallery>div:first-child>div:first-child>div:first-child>div:nth-child(2) >div:nth-child(2)>div>div>div:last-child {
width: 140px;
justify-content: center;
margin-top: -120px;
}
`;
let styleNode = document.createElement("style");
styleNode.appendChild(document.createTextNode(css));
(document.querySelector("head") || document.documentElement).appendChild(styleNode);
window.addEventListener('DOMContentLoaded', (event) => {
var folders = document.querySelectorAll('[data-hook="gallection_folder"] section>a');
Object.entries(folders).map(( object ) => {
object[1].addEventListener("click", function() {
window.scrollTo(0, 400);
});
});
});