diff --git a/chat/ImagePreview.vue b/chat/ImagePreview.vue index 85efc21..3311412 100644 --- a/chat/ImagePreview.vue +++ b/chat/ImagePreview.vue @@ -318,17 +318,18 @@ (event: Event) => { if (this.debug) console.log('ImagePreview did-finish-load', event); - - webview.getWebContents().session.on( - 'will-download', - (e: Event) => { - e.preventDefault(); - } - ); } ); + /* webview.getWebContents().session.on( + 'will-download', + (e: Event) => { + e.preventDefault(); + } + );*/ + + _.each( ['did-start-loading', 'load-commit', 'dom-ready', 'will-navigate', 'did-navigate', 'did-navigate-in-page', 'update-target-url'], (en: string) => { diff --git a/chat/image-preview-mutator.ts b/chat/image-preview-mutator.ts index f4df7d9..7034dae 100644 --- a/chat/image-preview-mutator.ts +++ b/chat/image-preview-mutator.ts @@ -123,7 +123,6 @@ export class ImagePreviewMutator { this.add('pornhub.com', this.getBaseJsMutatorScript(['.mainPlayerDiv video', '.photoImageSection img'])); this.add('sex.com', this.getBaseJsMutatorScript(['.image_frame video', '.image_frame img'])); this.add('redirect.media.tumblr.com', this.getBaseJsMutatorScript(['picture video', 'picture img'])); - this.add('i.imgur.com', this.getBaseJsMutatorScript(['video', 'img'])); this.add('postimg.cc', this.getBaseJsMutatorScript(['video', '#main-image'])); this.add('gifsauce.com', this.getBaseJsMutatorScript(['video'])); this.add('motherless.com', this.getBaseJsMutatorScript(['.content video', '.content img'])); @@ -132,6 +131,23 @@ export class ImagePreviewMutator { this.add(/^media[0-9]\.tenor\.com$/, this.getBaseJsMutatorScript(['#view .file video', '#view .file img'])); this.add('tenor.com', this.getBaseJsMutatorScript(['#view video', '#view img'])); + // tslint:disable max-line-length + this.add( + 'i.imgur.com', + ` + const imageCount = (new URL(window.location.href)).searchParams.get('flist_gallery_image_count'); + + ${this.getBaseJsMutatorScript(['video', 'img'])} + + if(imageCount > 1) { + ${this.injectHtmlJs('