Skip to content

Youtube 首页样式 by VisJoker

Details

AuthorVisJoker

LicenseNo License

Categorywww.youtube.com

Created

Updated

Size8.0 kB

Statistics

Learn how we calculate statistics in the FAQ.

Failed to fetch stats.

Description

Youtube 小缩略图

Notes

Userstyle doesn't have notes.

Source code

/* ==UserStyle==
@name           Youtube 首页样式
@namespace      youtube.com
@version        0.1
@description    Youtube 小缩略图
@author         VisJoker
@preprocessor 	stylus

@var number rowsHomePag 		'列数' [6, 1, 12, 1]
@var number horizontalM			'水平边距列' [8, 0, 200, 1, 'px']
@var number verticalM			'垂直边距行' [10, 0, 200, 1, 'px']
@var number fontSizeT 			'标题字体大小' [1.4, 1, 6, 0.1, 'rem']
@var number fontSizeM 			'元数据字体大小' [1.3, 1, 6, 0.1, 'rem']
@var number fontWeightT 		'标题字体权重' [500, 100, 900, 100]
@var number fontWeightM 		'元数据字体权重' [400, 100, 900, 100]
@var number thumbSizeS			'搜索页缩略图尺寸' [240, 50, 900, 1, 'px']

@var checkbox searchTwoColumns	'搜索页双列' 0
        
@var checkbox videoP			'鼠标悬停缩略图时隐藏视频预览' 0
        
@var select viewedVideo 		'观看视频模式' ['None', '灰度', '移除']
@var select viewedGrayS 		'观看视频灰度样式' ['Default', 'Thumbnail', 'Slider', 'ThumbSlider:Thumb+Slider']
@var range viewedGray			'观看视频灰度' [80, 0, 100, 1, '%']
        
@var range widthContH			'主页视频容器宽度' [100, 0, 100, 1, '%']
        
@var checkbox bloatH			'移除主页冗余内容(短片、横幅、调查等)' 0
@var checkbox mixPlaylist 		'移除混合播放列表' 0
@var checkbox recommendedVideos '搜索页移除推荐视频' 0

==/UserStyle== */
@-moz-document domain("youtube.com") {

	i=!important;

	/* Set columns */
	html {
		--ytd-rich-grid-item-margin: horizontalM i;
		--ytd-rich-grid-item-margin-row: verticalM i;
	}
	ytd-rich-grid-renderer, ytd-grid-video-renderer, ytd-grid-playlist-renderer.yt-horizontal-list-renderer {
		--ytd-rich-grid-items-per-row: rowsHomePag i;
	}
	ytd-grid-video-renderer, ytd-grid-playlist-renderer.yt-horizontal-list-renderer {
		--ytd-grid-video-width: calc(100% / var(--ytd-rich-grid-items-per-row) - var(--ytd-rich-grid-item-margin)) i;
		width: calc(100% / var(--ytd-rich-grid-items-per-row) - var(--ytd-rich-grid-item-margin)) i;
		
		& ytd-thumbnail, & ytd-playlist-thumbnail {
			width: 100% i;
			height: max-content i;
/* 			aspect-ratio: 16/9 i; */
			
			&::before {
				display: none i;
			}
			
			& #thumbnail, & #playlist-thumbnails, & ytd-playlist-video-thumbnail-renderer {
				position: relative i;
			}
		}
	}
	#scroll-container {
		width: 100% i;
		
		#items {
			width: 100% i;
		}
	}
	#contents.ytd-rich-grid-renderer {
		column-gap: var(--ytd-rich-grid-item-margin) i;
		row-gap: var(--ytd-rich-grid-item-margin-row) i;
		display: flex i;
	}
	ytd-rich-grid-row.style-scope.ytd-rich-grid-renderer,
	ytd-rich-grid-row.style-scope.ytd-rich-grid-renderer > #contents {
		display: contents i;
	}
	ytd-rich-grid-row ytd-rich-item-renderer {
		margin: 0 i;
		width: calc(100% / var(--ytd-rich-grid-items-per-row) - var(--ytd-rich-grid-item-margin)) i;
	}
	ytd-browse[page-subtype="home"] ytd-rich-grid-renderer {
		margin: 0 24px;
	}
	ytd-browse[page-subtype="home"] ytd-rich-section-renderer > #content {
		margin-inline: 0 i;
	}
	ytd-feed-filter-chip-bar-renderer[fluid-width] #chips-content.ytd-feed-filter-chip-bar-renderer {
		padding: 0;
	}
	/* VIDEOS CONTAINER HOME PAGE */
	ytd-two-column-browse-results-rendererv {
		width: widthContH i;
	}
	/* TITLE */
	#video-title.ytd-rich-grid-media,
	#video-title.ytd-radio-renderer,
	#video-title.ytd-video-renderer,
	#channel-title.ytd-channel-renderer,
	#video-title.ytd-playlist-renderer,
	#video-title.ytd-compact-video-renderer,
	#video-title.ytd-playlist-panel-video-renderer,
	ytd-grid-video-renderer #video-title.yt-simple-endpoint.ytd-grid-video-renderer {
		font-size: fontSizeT i;
		font-weight: fontWeightT i;
	}
	/* DETAILS */
	ytd-video-meta-block[rich-meta] #byline-container.ytd-video-meta-block,
	ytd-video-meta-block:not([inline-badges]) #metadata-line.ytd-video-meta-block span.ytd-video-meta-block,
	#contents #text.ytd-channel-name:has(a),
	#metadata-line,
	.metadata-snippet-container-one-line.ytd-video-renderer,
	.metadata-snippet-container.ytd-video-renderer,
	#metadata.ytd-channel-renderer,
	#description.ytd-channel-renderer,
	#video-title.ytd-child-video-renderer,
	#length.ytd-child-video-renderer,
	#channel-name.long-byline.ytd-video-meta-block,
	#byline.ytd-playlist-panel-video-renderer {
		font-size: fontSizeM i;
		font-weight: fontWeightM i;
	}
	/* SIZE THUMB VIDEOS SEARCH PAGE */
	ytd-radio-renderer {
		--ytd-thumbnail-max-width: 240px i;
		--ytd-thumbnail-min-width 240px i;
	}
	ytd-search :is(ytd-video-renderer[use-search-ui] ytd-thumbnail.ytd-video-renderer,
	ytd-playlist-renderer[is-search] ytd-playlist-thumbnail.ytd-playlist-renderer,
	#avatar-section.ytd-channel-renderer,
	ytd-video-renderer:not([use-search-ui]) ytd-thumbnail.ytd-video-renderer,
	ytd-thumbnail.ytd-radio-renderer,
	ytd-playlist-thumbnail.ytd-radio-renderer) {
		max-width: thumbSizeS i;
		min-width: thumbSizeS i;
	}
	/* TWO COLUMNS IN SEARCH PAGE */
	if searchTwoColumns {
		ytd-item-section-renderer.ytd-section-list-renderer > #contents.ytd-item-section-renderer,
		ytd-vertical-list-renderer.ytd-shelf-renderer > #items.ytd-vertical-list-renderer {
			display: flex i;
			flex-wrap: wrap i;
			gap: var(--ytd-item-section-item-margin, 16px) i;

			& > ytd-video-renderer,
			& > ytd-radio-renderer,
			& > ytd-playlist-renderer {
				flex: 1 0 calc((100% - var(--ytd-item-section-item-margin, 16px)) / 2) i;
				margin: 0 i;
				max-width: calc((100% - var(--ytd-item-section-item-margin, 16px)) / 2);
			}
			& > ytd-reel-shelf-renderer {
				max-width: 100%;
			}
		}
		ytd-vertical-list-renderer.ytd-shelf-renderer > #items.ytd-vertical-list-renderer {
			display: flex i;
			flex-wrap: wrap i;
			gap: var(--ytd-item-section-item-margin, 16px) i;

			& > ytd-video-renderer {
				flex: 1 0 calc((100% - var(--ytd-item-section-item-margin, 16px)) / 2) i;
				margin: 0 i;
			}
		}
	}
	/* VIDEO PREVIEW THUMBNAIL */
	if videoP {
		#video-preview.ytd-app {
			display: none i;
		}
	}
	if viewedVideo=='Grayscale' {
		/* VIEWED VIDEOS */
		if viewedGrayS=='Default' {
			/* CONTAINER VIDEO ITEM */
			:is(ytd-rich-item-renderer.style-scope.ytd-rich-grid-row, ytd-compact-video-renderer, ytd-playlist-panel-video-renderer, ytd-video-renderer):has(ytd-thumbnail-overlay-resume-playback-renderer) {
				filter: grayscale(viewedGray) i;
			}
		}
		if viewedGrayS=='Thumbnail' {
			/* THUMBNAIL */
			:is(ytd-rich-item-renderer.style-scope.ytd-rich-grid-row, ytd-compact-video-renderer, ytd-playlist-panel-video-renderer, ytd-video-renderer):has(ytd-thumbnail-overlay-resume-playback-renderer) yt-image.style-scope.ytd-thumbnail {
				filter: grayscale(viewedGray) i;
			}
		}
		if viewedGrayS=='Slider' {
			/* VIDEO VIEWED SLIDER */
			ytd-thumbnail-overlay-resume-playback-renderer {
				filter: grayscale(viewedGray) i;
			}
		}
		if viewedGrayS=='ThumbSlider' {
			/* CONTAINER THUMBNAIL */
			:is(ytd-rich-item-renderer.style-scope.ytd-rich-grid-row, ytd-compact-video-renderer, ytd-playlist-panel-video-renderer, ytd-video-renderer):has(ytd-thumbnail-overlay-resume-playback-renderer) #thumbnail {
				filter: grayscale(viewedGray) i;
			}
		}
	}
	if viewedVideo=='Remove' {
		:is(ytd-rich-item-renderer.style-scope.ytd-rich-grid-row, ytd-compact-video-renderer, ytd-playlist-panel-video-renderer, ytd-video-renderer):has(ytd-thumbnail-overlay-resume-playback-renderer) {
			display: none i;
		}
	}
	if bloatH {
		ytd-rich-grid-renderer > #contents.ytd-rich-grid-renderer > *:not(ytd-rich-item-renderer.style-scope.ytd-rich-grid-row, ytd-rich-grid-row, ytd-continuation-item-renderer),
		#big-yoodle {
			display: none i;
		}
	}
	/* RENIVE MIX PLAYLISTS */
	if mixPlaylist {
		ytd-radio-renderer {
			display: none i;
		}
	}
	/* REMOVE RECOMMENDED VIDEOS IN SEARCH PAGE */
	if recommendedVideos {
		ytd-item-section-renderer.ytd-section-list-renderer > #contents.ytd-item-section-renderer > ytd-shelf-renderer {
			display: none i;
		}
	}
}

Reviews

No reviews yet.