YouTube Menu Adder

Gives YouTube menu back

  1. // ==UserScript==
  2. // @name YouTube Menu Adder
  3. // @namespace http://www.diamonddownload.weebly.com
  4. // @version 0.7
  5. // @description Gives YouTube menu back
  6. // @include *.youtube.*
  7. // @copyright 2014+, RGSoftware
  8. // @run-at document-body
  9. // @author R.F Geraci
  10. // @icon64 http://i.imgur.com/aITBfKE.png
  11. // ==/UserScript==
  12.  
  13. var SignedIn = true;
  14.  
  15. //=========================================================================================================CUSTOM SETTINGS=========================================================================================================================
  16.  
  17. var MyChannel = "https://www.youtube.com/user/youtube";
  18. var Videos = "https://www.youtube.com/my_videos";
  19. var Subscriptions = "https://www.youtube.com/feed/subscriptions";
  20. var YtSettings = "https://www.youtube.com/account";
  21. var AllMyChannels = "https://www.youtube.com/channel_switcher";
  22. var Page = "Put your google+ link here";
  23. var Googlep = "Put your google+ link here/stream";
  24. var Managers = "Put your google+ link here/pages/settings/admin";
  25. var Settings = "Put your google+ link here/pages/settings/plus";
  26. var SignOut = "https://www.youtube.com/logout";
  27. var SwitchAccount = "https://accounts.google.com/AddSession";
  28.  
  29. //==================================================================================================================================================================================================================================================
  30.  
  31.  
  32. var element = document.getElementById('yt-masthead-account-picker');
  33. if (element == undefined && element == null){
  34. SignedIn = false;
  35. }
  36.  
  37.  
  38. //------------------------------------------>
  39. var mDropDownItem1_Channel = "My Channel";
  40. var mDropDownItem2_VideoManager = "Video Manager";
  41. var mDropDownItem3_Subscriptions = "Subscriptions";
  42. var mDropDownItem4_YouTubeSettings = "YouTube settings";
  43. var mDropDownItem5_AllMyChannels = "All my channels";
  44.  
  45. var gDropDownItem1_Page = "Page";
  46. var gDropDownItem2_GoogleP = "Google+";
  47. var gDropDownItem3_Managers = "Managers";
  48. var gDropDownItem3_Settings = "Settings";
  49.  
  50. var xDropDownItem1_SignOut = "Sign out";
  51. var xDropDownItem2_SwitchAccount = "Switch account";
  52. //------------------------------------------>
  53.  
  54.  
  55. var bClicked = false;
  56. var myMenuRef = null;
  57.  
  58. var par = document.getElementById('appbar-onebar-upload-group');
  59.  
  60. function createSelectBox(){
  61. if (SignedIn == true){
  62. var menu = document.createElement('select');
  63. menu.setAttribute('id', 'myMenu');
  64. menu.setAttribute('class', 'yt-uix-button yt-uix-sessionlink yt-uix-button-default yt-uix-button-size-default');
  65. menu.setAttribute('style', 'border-left: none; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; width: 141px; padding-left: 10px; box-shadow: 0 1px 0 rgba(0,0,0,0.05);');
  66. var ubtn = document.getElementById('upload-btn');
  67. ubtn.style.borderTopRightRadius = "0px";
  68. ubtn.style.borderBottomRightRadius = "0px";
  69. //03 July, youTube added button border radius off 2px and moved the upload button 4px more away from the right. They also made the siderbar on videos 42px higher.
  70. // float: left; height: 28px; position: relative; right:18px; border: 1px solid #c9eeff; color: white; padding: 3px; background: #1ea9ea;'
  71. par.appendChild(menu);
  72. }
  73. }
  74.  
  75. createSelectBox();
  76.  
  77. myMenuRef = document.getElementById('myMenu');
  78.  
  79. function createOptionsElements(itmVar, OptInt){
  80. if (SignedIn == true){
  81. var opt = document.createElement('option');
  82. opt.setAttribute('value', itmVar);
  83. opt.innerHTML = itmVar;
  84. opt.setAttribute('id', OptInt);
  85. myMenuRef.appendChild(opt);
  86. }
  87. }
  88.  
  89. function goToUrl(url){
  90. if (SignedIn == true){
  91. window.location.href = url;
  92. }
  93. }
  94.  
  95. function OptionChanged(){
  96. if (SignedIn == true){
  97. var selval = myMenuRef.options[myMenuRef.selectedIndex].value;
  98. switch(selval){
  99. case mDropDownItem1_Channel:
  100. goToUrl(MyChannel);
  101. break;
  102. case mDropDownItem2_VideoManager:
  103. goToUrl(Videos);
  104. break;
  105. case mDropDownItem3_Subscriptions:
  106. goToUrl(Subscriptions);
  107. break;
  108. case mDropDownItem4_YouTubeSettings:
  109. goToUrl(YtSettings);
  110. break;
  111. case mDropDownItem5_AllMyChannels:
  112. goToUrl(AllMyChannels);
  113. break;
  114. case gDropDownItem1_Page:
  115. goToUrl(Page);
  116. break;
  117. case gDropDownItem2_GoogleP:
  118. goToUrl(Googlep);
  119. break;
  120. case gDropDownItem3_Managers:
  121. goToUrl(Managers);
  122. break;
  123. case gDropDownItem3_Settings:
  124. goToUrl(Settings);
  125. break;
  126. case xDropDownItem1_SignOut:
  127. goToUrl(SignOut);
  128. break;
  129. case xDropDownItem2_SwitchAccount:
  130. goToUrl(SwitchAccount);
  131. break;
  132. }
  133. }
  134. }
  135.  
  136. createOptionsElements("", "opt_blank0");
  137. createOptionsElements("YouTube Options", "Option_Select");
  138. createOptionsElements(mDropDownItem1_Channel, "Option1");
  139. createOptionsElements(mDropDownItem2_VideoManager, "Option2");
  140. createOptionsElements(mDropDownItem3_Subscriptions, "Option3");
  141. createOptionsElements(mDropDownItem4_YouTubeSettings, "Option4");
  142. createOptionsElements(mDropDownItem5_AllMyChannels, "Option5");
  143. createOptionsElements("", "opt_blank1");
  144. createOptionsElements(gDropDownItem1_Page, "Option6");
  145. createOptionsElements(gDropDownItem2_GoogleP, "Option7");
  146. createOptionsElements(gDropDownItem3_Managers, "Option8");
  147. createOptionsElements(gDropDownItem3_Settings, "Option9");
  148. createOptionsElements("", "opt_blank2");
  149. createOptionsElements(xDropDownItem1_SignOut, "Option10");
  150. createOptionsElements(xDropDownItem2_SwitchAccount, "Option11");
  151. createOptionsElements("", "opt_blank3");
  152.  
  153. document.getElementById("opt_blank3").disabled=true;
  154. document.getElementById("opt_blank2").disabled=true;
  155. document.getElementById("opt_blank1").disabled=true;
  156. document.getElementById("opt_blank0").disabled=true;
  157. var opt = document.getElementById("Option_Select");
  158. opt.style.display='none';
  159. opt.selected=true;
  160.  
  161. myMenuRef.onchange = function(){OptionChanged();};
  162.  
  163.  
  164. //===========================DEV===================================
  165.  
  166. //background: -moz-linear-gradient(top, #1ea9ea 0%, #4096ee 100%); \
  167. //background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1ea9ea), color-stop(100%,#4096ee)); \
  168. //background: -webkit-linear-gradient(top, #1ea9ea 0%,#4096ee 100%); \
  169. //background: -o-linear-gradient(top, #1ea9ea 0%,#4096ee 100%); \
  170. //background: -ms-linear-gradient(top, #1ea9ea 0%,#4096ee 100%); \
  171. //background: linear-gradient(to bottom, #1ea9ea 0%,#4096ee 100%);
  172.  
  173. //=================================================================