mirror of
https://github.com/Neur0toxine/yt-normal-thumbnails.git
synced 2024-11-22 04:46:06 +03:00
smaller preview images in the search results
This commit is contained in:
parent
7b1a463bbf
commit
ccd8d5a194
15
index.ts
15
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user