Skip to content

Instantly share code, notes, and snippets.

@MarkKoz
Last active February 27, 2022 05:07
Show Gist options
  • Save MarkKoz/460ae2d4200c8c65b8481af4934cf57c to your computer and use it in GitHub Desktop.
Save MarkKoz/460ae2d4200c8c65b8481af4934cf57c to your computer and use it in GitHub Desktop.
A stylesheet that de-clutters fandom.com and makes it nicer to read in large windows.
.fandom-sticky-header {
/* Make the thin header always visible. */
transform: translateY(100%) !important;
/* Remove space left by hiding global navigation. */
left: 0px !important;
}
/* Make space for the sticky header including the original page margin. */
.page {
margin-top: calc(46px + 12px) !important;
}
/* Add a radius to the right side since the right rail is always hidden. */
.page__main {
border-radius: 3px !important;
}
/* Remove space left by hiding global navigation. */
.main-container {
margin-left: 0px !important;
width: 100% !important;
}
/* Remove space left by hiding global navigation. */
.search-modal::before {
left: 0 !important;
}
/* Hide a bunch of elements. */
#WikiaBar,
#mixed-content-footer,
.wds-global-footer,
.global-footer,
.top-ads-container,
.bottom-ads-container,
.community-header-wrapper,
.global-navigation,
.page__right-rail,
.fandom-community-header__background {
display: none !important;
}
/* Simulate page always being expanded. */
@media only screen and (min-width: 1280px) {
/* Make space for the sticky header without the original page margin. */
.page {
margin-top: 46px !important;
}
.resizable-container {
max-width: none !important;
width: calc(100% - 240px) !important;
margin: 0 0 0 240px !important;
}
.page__main,
.sticky-toc.toc {
border-radius: 0 !important;
}
}
/* Make the maint content use the entire height */
@media only screen and (min-width: 1280px) {
.page {
display: flex !important;
}
.resizable-container,
.page,
.page__main {
flex: 1 !important;
}
html,
body,
.main-container {
height: 100% !important;
}
}
/* ---------------------------------------------------------- */
/* Permanently show the sticky ToC as a left rail/sidebar. */
@media only screen and (min-width: 1280px) {
/* Reset ToC containers */
.page-side-tools__wrapper {
height: unset !important;
padding: unset !important;
position: unset !important;
left: unset !important;
top: unset !important;
transform: unset !important;
}
.page-side-tools {
position: unset !important;
top: unset !important;
}
.sticky-toc-wrapper {
position: unset !important;
}
.sticky-toc.toc {
width: unset !important;
max-width: unset !important;
margin: unset !important;
position: unset !important;
left: unset !important;
box-shadow: unset !important;
}
.sticky-toc.toc > ul {
max-height: unset !important;
}
/* ---------------------------------------------------------- */
/* Necessary for the ul to have a scrollbar. */
.page-side-tools,
.sticky-toc-wrapper,
.sticky-toc.toc {
height: 100% !important;
}
.page-side-tools__wrapper {
position: fixed !important;
left: 0px !important;
/* Make space for the sticky header. */
top: 46px !important;
width: 240px !important;
/* Account for sticky header's height. */
height: calc(100% - 46px) !important;
border-right: 1px solid var(--theme-border-color);
/*
.sticky-toc.toc sets this too, but that element loads slowly upon refresh.
Also, it may not always exist.
*/
background: var(--theme-page-background-color--secondary);
}
.page-side-tool /* Hide tool buttons on the left side. */,
.sticky-toc-close /* Hide close button for sticky ToC. */,
#toc /* Hide the body's ToC cause the sticky one is shown. */ {
display: none !important;
}
/* For proper overflow (https://stackoverflow.com/a/61844861) */
.sticky-toc.toc {
/* Always show the ToC. */
display: flex !important;
flex-direction: column;
}
.sticky-toc.toc > :not(ul) {
flex-shrink: 0;
}
.sticky-toc.toc > ul {
flex-grow: 1;
overflow: auto !important;
/*
Disable the background. It's meant to add a shadow to the
top and bottom edges, but it's broken for the bottom when
the list is not the full height of the container.
*/
background: none !important;
}
}
/* ---------------------------------------------------------- */
.unified-search__layout {
grid-template-areas: "left left main main main main main main main main main main" !important;
}
.unified-search__layout__right-rail {
display: none !important;
}
@media only screen and (min-width: 1280px) {
.unified-search__layout__left-rail {
position: fixed !important;
z-index: 200;
left: 0px !important;
/* Make space for the sticky header. */
top: 46px !important;
width: 240px !important;
/* Account for sticky header's height. */
height: calc(100% - 46px) !important;
}
.unified-search__layout {
grid-template-areas: "main main main main main main main main main main main main" !important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment