Add Drive to Google

Adds Drive link to YouTube header menu

  1. // ==UserScript==
  2. // @name Add Drive to Google
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Adds Drive link to YouTube header menu
  6. // @author Your Name
  7. // @match https://vanced-youtube.neocities.org/2011/
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Create the new <li> element for Drive
  16. var driveNode = document.createElement('li');
  17. driveNode.className = 'gbt';
  18. 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>';
  19.  
  20. // Find the target nodes
  21. var gmailNode = document.querySelector('li.gbt a.gbzt#gb_23[href="http://mail.google.com/mail/?hl=en&tab=wm"]');
  22. var moreNode = document.querySelector('li.gbt a.gbgt#gbztm[href="http://www.google.com/intl/en/options/"]');
  23.  
  24. // Insert the Drive node under the Gmail node and before the More node
  25. if (gmailNode && moreNode) {
  26. var parent = moreNode.parentNode.parentNode;
  27. parent.insertBefore(driveNode, moreNode.parentNode);
  28. }
  29. })();