Skip to content

DeAnnoy New York Times [papo] by papo

Details

Authorpapo

LicenseCC BY-NC-SA 4.0

Categorynytimes

Created

Updated

Code size8.4 kB

Code checksumf99104b8

Statistics

Learn how we calculate statistics in the FAQ.

Failed to fetch stats.

Description

See @description in the Source Code.

Notes

Userstyle doesn't have notes.

Source code

/* ==UserStyle==
@name           DeAnnoy New York Times [papo] (headers, width)
@namespace      github.com/paponius/userstyles
@version        1.5.0
@description    Updated: 2025-04 [m] Notes and feedback: https://github.com/paponius/userstyles/. Removed distracting and annoying elements. Check what it does in style Options, or read @var descriptions on top of the code.
@author         Papo
@homepageURL    https://github.com/paponius/userstyles/
@supportURL     https://github.com/paponius/userstyles/
@license        CC BY-NC-SA 4.0
@preprocessor   less

# --- END: common block ---
@var checkbox UnstickHPSectionsMenuBar "Unstick header: on Homepage - menu bar with sections" 1
@var checkbox hideShareBar             "Unstick header: on standard Article page - bar with NYT Logo, Article title, share buttons" 1
#var checkbox UnstickHeader            'Unstick header: Article pages: "The New York Times" bar (it shows when the above is not shown)' 1
@var checkbox UnstickSecond            'Unstick header: on fullbleed Article page - more-ons' 1
@var checkbox unstickLiveBlogMenu      "Unstick header: on LiveBlog Article page - more-ons" 1
@var checkbox UnstickSecondEvents      "Unstick header: on Event pages (/news-event/) - navi bar" 1
@var select   WidthArticleMode         "Width of articles mode" [
  '0:Original',
  "1:Wider",
  "custom:Custom",
  "customWOCompanion:Custom and remove companion column (more precise margins, but companion content, if any, is hidden)"
]
#                                      [default, min, max, step, units] All items but the default value are optional. Use "null" to skip.
#var range    WidthArticle             "Width of Article (size of empty margins)" [500, 20, 2000, 10, "px"]
@var range    WidthArticle             'Width of Article (Width of articles mode above must be "Custom*")' [50, 20, 100, 5, "%"]
@var checkbox RemoveBottomDockMobile   'Hide: Bottom "dock" on mobile, staying on screen permamently' 1
@var checkbox RemoveMidHeaderMobile    "Hide: Middle header on mobile. With today's date, or a nag." 1
@var checkbox RemoveShareToolbar       'Hide: "Listen to..." and share toolbar in hero (below headline). The below Article bar remains, but W/O "Listen to"' 1
@var checkbox RemoveShareFloat         'Hide: Floating share button in right bottom corner.' 1

@var checkbox HideMidArticleAnnoy    "Hide mid-article subscription and unrelated annoyance boxes" 1
@var checkbox NoRecycle        'Distraction Free: Do not Recycle me (no More Stories, no Related, ...)' 0

#var checkbox showSideRecirc "Show Recirculation bar on right in article" 1
#var checkbox showFixedRecirc "Show Fixed Recirculation bar on bottom" 1
#var checkbox showBelowRecirc "Show Recirculation section bellow the article" 1
==/UserStyle== */
/* tpl: 1.2.2 24-11 */
@-moz-document domain("nytimes.com")
/* local file */
, regexp(".*%20-%20The%20New%20York%20Times%20\(.*")
{

/* hide empty div (Notes) */
main#site-content div:has(> #top-wrapper #top.place-ad:empty) {
	display: none;
}


& when (@hideShareBar = 1) {
	#in-story-masthead {
		display: none;
	}
}


/* masthead-container */
/* Note: not()
   On "interactive" page - i.e. horrible modern design,
   the main header is transparent BG, has position: absolute; and must not be set to position: relative

   body:not(:has(main#site-content section.interactive-content))
   does not work 2411, it's not on this "interactive" page and on contrary it can be on standard article page in:
   .StoryBodyCompanionColumn div[id*="_MAIN_CONTENT_"][data-testid="region"]

   it uses the same html classnames as ordinary article:
   <html lang="en" class="story nytapp-vi-article nytapp-vi-story story nytapp-vi-article " ...
   this is liveblog, something else again:
   <html lang="en" xmlns:og="http://opengraphprotocol.org/schema/" class="nytapp-vi-liveblog" ...
 */
/* todo 2411 works wrongly, the opposite as it should. hides bar on top, does not hide when page scrolled, (and secondary hidden)
https://www.nytimes.com/2024/11/25/business/trump-electric-vehicle-tax-credit.html */

/* for now hide always when hideShareBar is hidden. it would show when hideShareBar is hidden as it's behind it */
/* & when (@UnstickHeader = 1) { */
& when (@hideShareBar = 1) {

/* TODO: breaks "interactive" */
	@media (min-width: 1024px) {
		/* :has(masthead-bar-one) then it is not "fullbleed/transparent masthead" page */
  		html:not(.nytapp-vi-interactive.nytapp-vi-interactive-standard) [data-testid="masthead-container"]:not(:has(a[data-testid="masthead-mobile-logo"] svg[fill="#fff"])):has(#masthead-bar-one) {
			/* --was-position: fixed; */
			position: relative;
		}
		article#story {
			padding-top: 0;
			/* --was-padding-top: 40px; */
		}
	}
	
	/* not on /interactive/ */
	html:not(.nytapp-vi-interactive) #standalone-header {
		position: absolute !important;
	}
	
/* - on interactive article pages - a "The New your times" header is sticky */
	.interactive-masthead {
		position: absolute;
	}
}



/* storyline-menu-title */
& when (@UnstickSecond = 1) {
	article#story > div:first-of-type {
		position: relative;
	}
}



& when (@UnstickSecondEvents = 1) {
	main#site-content > div:has(p#storyline-menu-title):not(:has(> article)):not(.live-blog-above-main-content) {
		position: relative;
	}
}


@media (min-width: 1024px) {
	& when (@WidthArticleMode = custom) or (@WidthArticleMode = customWOCompanion) {
		.StoryBodyCompanionColumn {
	/* 		width: @WidthArticle; */
	/* 		width: calc(100% - @WidthArticle); */
			width: @WidthArticle;
			> div {
				margin: unset;
				width: unset;
				@media (min-width: 1440px) {
					max-width: unset;
					/* --was-max-width: 600px; */
				}
			}
			> [aria-label="companion column"] when (@WidthArticleMode = customWOCompanion) {
				display: none;
			}
		}
	}

	& when (@WidthArticleMode = '1') {
		@media (min-width: 1150px) {
			.StoryBodyCompanionColumn > [aria-label="companion column"] {
				/* as min-width: 1024px */
				width: 130px;
				/* width: 524px; */
			}
		}
	}
}


& when (@unstickLiveBlogMenu = 1) {
	.live-blog-above-main-content {
/* 		display: none; */
		position: relative;
	}
}



/* there are two identical header bar navigation elements. This one is sometimes floating. props are set in-line */
& when (@UnstickHPSectionsMenuBar = 1) {
	header > div:has(nav[data-testid="floating-desktop-nested-nav"]) {
		visibility: hidden !important;
		/* --was-visibility: visible; */
		transform: unset !important;
		/* --was-transform: translateY(-70px); */
	}
}



& when (@RemoveBottomDockMobile = 1) {
	#dock-container {
		display: none;
	}
}


& when (@RemoveMidHeaderMobile = 1) {

	/* remove also on HP (not just on article pages as below) */
	#masthead-bar-one {
		display: none;
	}

}
/* remove it always on non homepage pages, seems to be only a container for pay nag */
/* alt: html:not(.nytapp-vi-homepage) #masthead-bar-one { */
.story,
.nytapp-vi-article,
.nytapp-vi-story {
	#masthead-bar-one {
		display: none;
	}
}


& when (@HideMidArticleAnnoy = 1) {
	/* subscribe to spam, "Editors’ Picks", ...? */
	/* both props are there, let's see which is more durable */
	.StoryBodyCompanionColumn section[role="complementary"]
	, .StoryBodyCompanionColumn section[data-testid="NextBestAction"] {
		display: none;
	}

	/* "Behind the Journalism. Our business coverage. Times journalists are not allowed to have any direct financial stake in companies they cover." */
	.StoryBodyCompanionColumn div[id*="_MAIN_CONTENT_"][data-testid="region"] {
		display: none;
	}
	
	/* this is in uBlock origin, maybe better here? div[id*="_MAIN_CONTENT_"][data-testid="region"] */
	#NYT_ABOVE_MAIN_CONTENT_REGION {
		display: none;
	}
}


& when (@RemoveShareToolbar = 1) {
	#article-summary + div:has(#playIcon) {
		display: none;

	}
	#article-summary {
		border-bottom: 1px solid var(--color-stroke-quaternary,#DFDFDF);
	}
}


& when (@RemoveShareFloat = 1) {
	.meteredContent > [data-testid="floating-button"]:first-child {
		display: none;
	}
}

& when (@NoRecycle = 1) {
	#c-col-editors-picks,
	#newsletter-recirculation,
	#bottom-sheet-sensor
	{ display: none; }
}



/* === old 10/3/2018 === */
/* side More... links */
aside.css-14jsv4e {
	display: none unless showSideRecirc;
}
/* fixed overlay links */
.Ribbon-ribbon--3jG7Y {
    display: none unless showFixedRecirc;
}
.Recirculation-recirculation--2BQm- {
	display: none unless showBelowRecirc;
}

}

Reviews

No reviews yet.