Avgle Helper

Help you watch videos smoothly at Avgle

Από την 31/01/2018. Δείτε την τελευταία έκδοση.

// ==UserScript==
// @name         Avgle Helper
// @namespace    https://avgle.com
// @version      1.5.1
// @description  Help you watch videos smoothly at Avgle
// @author       Neal
// @match        https://avgle.com/*
// @grant        none
// ==/UserScript==

(() => {
    'use strict';

    function style(css) {
        const style = document.createElement('style');

        style.type = 'text/css';
        style.innerHTML = css;

        return style;
    }

    const href = document.location.href;
    const head = document.getElementsByTagName('head')[0];
    const body = document.getElementsByTagName('body')[0];

    if (href.match('https://avgle.com/embed/')) {
        head.appendChild(style('#aoverlay {display: none}'));
        head.appendChild(style('#player_3x2_container {display: none}'));
    } else if (href.match('https://avgle.com/video/')) {
        const embed = head.innerHTML.match('https://avgle.com/embed/[^"]+');

        head.appendChild(style('.at-expanding-share-button-toggle {display: none}'));
        body.style = 'background: black; padding: 0; text-align: center';
        body.innerHTML = '<iframe width="1280" height="640" src="' + embed + '" frameborder="0" allowfullscreen></iframe>';

        const tid = setTimeout(() => {}); for (let i = 0; i <= tid; ++i) clearTimeout(i);
        const vid = setInterval(() => {}); for (let i = 0; i <= vid; ++i) clearInterval(i);
    } else {
        head.appendChild(style('.top-nav {position: absolute}'));
        head.appendChild(style('.navbar-fixed-top {position: absolute}'));
    }
})();