2014 Google Neocities Part 7

Add custom Google menu item to Vanced YouTube page.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         2014 Google Neocities Part 7
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add custom Google menu item to Vanced YouTube page.
// @author       You
// @match        https://vanced-youtube.neocities.org/2013/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Create the new div element
    var customDiv = document.createElement('div');
    customDiv.setAttribute('class', 'gb_Q gb_R');

    // Create the new link element
    var customLink = document.createElement('a');
    customLink.setAttribute('class', 'gb_P');
    customLink.setAttribute('href', 'https://support.google.com/answer/2451065?hl=en');
    customLink.setAttribute('data-pid', '23');
    customLink.setAttribute('data-ved', '0CBQQwi4oAA');
    customLink.innerText = '+You';

    // Add the link to the div
    customDiv.appendChild(customLink);

    // Get the reference to the parent element of the existing div
    var parentElement = document.querySelector('div.gb_Q.gb_R');

    // Insert the custom div before the existing div
    parentElement.parentNode.insertBefore(customDiv, parentElement);
})();