Add Drive to Google

Adds Drive link to YouTube header menu

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Add Drive to Google
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds Drive link to YouTube header menu
// @author       Your Name
// @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 nodes
    var gmailNode = document.querySelector('li.gbt a.gbzt#gb_23[href="http://mail.google.com/mail/?hl=en&tab=wm"]');
    var moreNode = document.querySelector('li.gbt a.gbgt#gbztm[href="http://www.google.com/intl/en/options/"]');

    // Insert the Drive node under the Gmail node and before the More node
    if (gmailNode && moreNode) {
        var parent = moreNode.parentNode.parentNode;
        parent.insertBefore(driveNode, moreNode.parentNode);
    }
})();