Avgle Helper

Help you watch videos smoothly at Avgle

2018-01-20 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

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

(() => {
    'use strict';

    function $(name) {
        let element = null;

        if (name.startsWith('#'))
            element = document.getElementById(name.slice(1));
        else if (name.toString().startsWith('.'))
            element = document.getElementsByClassName(name.slice(1));
        else
            element = document.getElementsByTagName(name);

        return element;
    }

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

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

        return style;
    }

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

    if (href.match('https://avgle.com/video/')) {
        const embed = head.innerHTML.match('https://avgle.com/embed/[^"]+')[0];

        head.appendChild(style('.at-expanding-share-button-toggle {display: none}'));
        body.style = 'background: black; padding: 0 30px';
        body.innerHTML = '<iframe width="1280" height="640" src="' + embed + '" frameborder="0" allowfullscreen></iframe>';
        body.appendChild(style('.at-expanding-share-button-toggle {display: none}'));
    } else if (href.match('https://avgle.com/embed/')) {
        head.appendChild(style('#aoverlay, #player_3x2_container {display: none}'));
        body.appendChild(style('#aoverlay, #player_3x2_container {display: none}'));
    } else {
        head.appendChild(style('.top-nav {position: absolute}'));
        body.appendChild(style('.top-nav {position: absolute}'));
        head.appendChild(style('.navbar-fixed-top {position: absolute}'));
        body.appendChild(style('.navbar-fixed-top {position: absolute}'));
    }
})();