Twitter previews
This commit is contained in:
		
							parent
							
								
									1a33af73ea
								
							
						
					
					
						commit
						6ab1746929
					
				@ -1,7 +1,7 @@
 | 
			
		||||
# Changelog
 | 
			
		||||
 | 
			
		||||
## Canary
 | 
			
		||||
*   Fixed Gelbooru and Instagram previews
 | 
			
		||||
*   Fixed Gelbooru, Instagram, and Twitter previews
 | 
			
		||||
*   Moved database queries to a web worker to gain more responsive UI
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -80,7 +80,7 @@ const previewInitiationTime = Date.now();
 | 
			
		||||
                const scriptCount = document.scripts.length;
 | 
			
		||||
 | 
			
		||||
                for (let i = 0; i < scriptCount; i++) {
 | 
			
		||||
                    document.scripts[i].src = 'about:blank';
 | 
			
		||||
                    delete document.scripts[i].src;
 | 
			
		||||
                }
 | 
			
		||||
            } catch (e) {
 | 
			
		||||
                console.error('Script location', e);
 | 
			
		||||
 | 
			
		||||
@ -255,6 +255,64 @@ export class ImageDomMutator {
 | 
			
		||||
                return urlHelper.format(u);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        this.add(
 | 
			
		||||
            'twitter.com',
 | 
			
		||||
            `
 | 
			
		||||
            const finalizer = (counter) => {
 | 
			
		||||
                if (counter <= 0) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                setTimeout(
 | 
			
		||||
                    () => {
 | 
			
		||||
                        const e = document.querySelector('#flistWrapper img');
 | 
			
		||||
 | 
			
		||||
                        if (e) {
 | 
			
		||||
                            const src = e.getAttribute('src');
 | 
			
		||||
 | 
			
		||||
                            if (src) {
 | 
			
		||||
                                e.setAttribute('src', src.replace(/name\=[a-z0-9\-\_]+/, 'name=large'));
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        const v = document.querySelector('#flistWrapper video');
 | 
			
		||||
 | 
			
		||||
                        if (v) {
 | 
			
		||||
                            v.play();
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        finalizer(counter - 1);
 | 
			
		||||
                    },
 | 
			
		||||
                    100
 | 
			
		||||
                );
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            const scheduler = () => {
 | 
			
		||||
                setTimeout(
 | 
			
		||||
                    () => {
 | 
			
		||||
                        // skip content warning
 | 
			
		||||
                        document.querySelectorAll('article article div[tabindex="0"] *').forEach(e => e.click());
 | 
			
		||||
 | 
			
		||||
                        if (!document.querySelector('article video, div[aria-label="Image"] img')) {
 | 
			
		||||
                            console.log('NOT FOUND');
 | 
			
		||||
                            scheduler();
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        ${this.getBaseJsMutatorScript(['article video', 'div[aria-label=\'Image\'] img'])}
 | 
			
		||||
 | 
			
		||||
                        finalizer(25);
 | 
			
		||||
                    },
 | 
			
		||||
                    200
 | 
			
		||||
                );
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            scheduler();
 | 
			
		||||
            `
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -101,5 +101,18 @@
 | 
			
		||||
 | 
			
		||||
    [url=https://ibb.co/jMcYcPx]Imgbb[/url]
 | 
			
		||||
 | 
			
		||||
    [url=https://twitter.com/southernpuss/status/1352766456992292865]Twitter video[/url]
 | 
			
		||||
 | 
			
		||||
    [url=https://twitter.com/pornmansion4/status/1353000105452986369]Twitter sensitive marked video[/url]
 | 
			
		||||
 | 
			
		||||
    [url=https://twitter.com/Tweety_Feet/status/1352900711093309440]Twitter album[/url]
 | 
			
		||||
 | 
			
		||||
    [url=https://twitter.com/Cumkitten99/status/1352130180047900674]Twitter sensitive marked album[/url]
 | 
			
		||||
 | 
			
		||||
    [url=https://twitter.com/chinxxthegodess/status/1351992530485829633]Twitter single image[/url]
 | 
			
		||||
 | 
			
		||||
    [url=https://twitter.com/kittykushman2/status/1351824713094483970]Twitter single sensitive marked image[/url]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Broken
 | 
			
		||||
https://vimeo.com/265884960
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user