Add Drive before more

Adds Drive link to YouTube header menu

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Add Drive before more
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds Drive link to YouTube header menu
// @author       harry
// @match        https://vanced-youtube.neocities.org/2011/
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Create the new <li> element for Drive
    var driveNode = document.createElement('li');
    driveNode.className = 'gbt';
    driveNode.innerHTML = '<a class="gbzt" id="gb_23" onclick="gbar.qs(this);gbar.logger.il(1,{t:23})" href="http://mail.google.com/mail/?hl=en&amp;tab=wm"><span class="gbtb2"></span><span class="gbts">Drive</span></a>';

    // Find the target <li> element
    var targetNode = document.querySelector('li.gbt a.gbzt#gbztm[href="http://www.google.com/intl/en/options/"]');

    // Insert the Drive node before the target node
    if (targetNode) {
        var parent = targetNode.parentNode.parentNode;
        parent.insertBefore(driveNode, targetNode.parentNode);
    }
})();