From ccd8d5a194606dc1a9930d4da93cd478d8e0dd70 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Wed, 14 Jul 2021 22:09:31 +0300 Subject: [PATCH] smaller preview images in the search results --- index.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 5392d2e..9b6b004 100644 --- a/index.ts +++ b/index.ts @@ -1,7 +1,7 @@ // ==UserScript== // @name YouTube Normal Thumbnails // @namespace http://greasyfork.org -// @version 0.6.1 +// @version 0.7.0 // @description Restores normal thumbnails size // @author NeoCortex // @match *://www.youtube.com/* @@ -23,6 +23,12 @@ display: none !important; } `.trim(); + const commonStyles = ` + ytd-video-renderer[use-prominent-thumbs] ytd-thumbnail.ytd-video-renderer { + min-width: 120px !important; + max-width: 240px !important; + } + `.trim(); class YoutubeThumbnailsFixer { private oldPerRow?: number; @@ -36,6 +42,7 @@ constructor() { this.installContentObserver(); + this.installStyle(commonStyles); } private installContentObserver(): void { @@ -44,7 +51,7 @@ if (null !== this.target) { this.observer?.disconnect(); - this.installStyle(); + this.installStyle(styleContent); this.updateRowsCount(); this.installVideoGridObserver(); } @@ -89,9 +96,9 @@ } } - private installStyle(): void { + private installStyle(contents: string): void { let style = document.createElement('style'); - style.innerHTML = styleContent; + style.innerHTML = contents; document.body.appendChild(style); }