YouTube Gaming link

Adds a YouTube Gaming link in the action button panel of a YouTube video

  1. // ==UserScript==
  2. // @name YouTube Gaming link
  3. // @namespace http://thepsionic.com
  4. // @version 0.1.3
  5. // @description Adds a YouTube Gaming link in the action button panel of a YouTube video
  6. // @author ThePsionic
  7. // @match https://www.youtube.com/watch*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. var id = getParameterByName("v");
  15. var actionlist = document.getElementById("watch8-secondary-actions");
  16. actionlist.innerHTML = actionlist.innerHTML + "<div class='yt-uix-menu' id='gaming-link'><button class='yt-uix-button yt-uix-button-size-default yt-uix-button-opacity yt-uix-tooltip' title='Watch on YouTube Gaming' data-tooltip-text='Watch on YouTube Gaming' onclick='location.href=\"https://gaming.youtube.com/watch?v=" + id + "\"'>YouTube Gaming</a></div>";
  17. })();
  18.  
  19. function getParameterByName(name, url) {
  20. if (!url) {
  21. url = window.location.href;
  22. }
  23. name = name.replace(/[\[\]]/g, "\\$&");
  24. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  25. results = regex.exec(url);
  26. if (!results) return null;
  27. if (!results[2]) return '';
  28. return decodeURIComponent(results[2].replace(/\+/g, " "));
  29. }