Basic gmail gbar

Changes the Basic Gmail bar to 2012 Gmail

  1. // ==UserScript==
  2. // @name Basic gmail gbar
  3. // @version 0.7.1
  4. // @license MIT
  5. // @description Changes the Basic Gmail bar to 2012 Gmail
  6. // @author Ian Hiew
  7. // @match *://mail.google.com/*
  8. // @icon https://ssl.gstatic.com/ui/v1/icons/mail/rfr/gmail.ico
  9. // @grant none
  10. // @namespace https://greasyfork.org/users/782542
  11. // ==/UserScript==
  12.  
  13. const d = document;
  14.  
  15. // here's a better way to get the email
  16. // we get the innerHTML of gb4 before replacing it
  17. // its from the boring toolbar btw
  18.  
  19. var userEmail = d.getElementsByClassName('gb4')[0].innerHTML;
  20. console.log(userEmail); // if this shows its success :him:
  21.  
  22. // and do funny!!!
  23. // add css or die
  24. function changeDocumentHead(){
  25. var head = d.head;
  26. var link = d.createElement("link");
  27.  
  28. link.type = "text/css";
  29. link.rel = "stylesheet";
  30. link.href = "https://hiew.neocities.org/gbar.css"; // previous site got flagged damn D:
  31.  
  32. head.appendChild(link);
  33. }
  34. // You must disable csp to allow this, that means no full safari support. Sorry
  35. function createScriptElement(src)
  36. {
  37. // load the gbar js
  38. var shead = d.head;
  39. var script = d.createElement("script");
  40.  
  41. script.onload = function()
  42. {
  43. console.log("gbar.js loaded");
  44. }
  45. script.src = src;
  46. shead.appendChild(script);
  47. }
  48. window.setTimeout(changeDocumentHead,50);
  49. window.setTimeout(createScriptElement("https://hiew.neocities.org/gbar.js"),100)
  50. window.setTimeout(createScriptElement("https://hiew.neocities.org/gbar3.js"),100);
  51.  
  52. // now replaceHtml
  53. // we are funny and based
  54.  
  55. function replaceHtmlReal(){
  56. var tochange = d.getElementById('guser');
  57. tochange.innerHTML = `
  58. <div id="mngb">
  59. <div id="gb">
  60. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  61. window.gbar&&gbar.eli&&gbar.eli()
  62. </script>
  63. <div id="gbw">
  64. <div id="gbz">
  65. <span class="gbtcb"></span>
  66. <ol id="gbzc" class="gbtc">
  67. <li class="gbt">
  68. <a
  69. class="gbzt"
  70. id="gb_1"
  71. href="https://www.google.com.my/webhp?tab=ww&amp;authuser=0"
  72. ><span class="gbtb2"></span><span class="gbts">Search</span></a
  73. >
  74. </li>
  75. <li class="gbt">
  76. <a
  77. class="gbzt"
  78. id="gb_2"
  79. href="https://www.google.com.my/imghp?hl=en&amp;tab=wi&amp;authuser=0"
  80. ><span class="gbtb2"></span><span class="gbts">Images</span></a
  81. >
  82. </li>
  83. <li class="gbt">
  84. <a
  85. class="gbzt"
  86. id="gb_8"
  87. href="https://maps.google.com.my/maps?hl=en&amp;tab=wl&amp;authuser=0"
  88. ><span class="gbtb2"></span><span class="gbts">Maps</span></a
  89. >
  90. </li>
  91. <li class="gbt">
  92. <a
  93. class="gbzt"
  94. id="gb_78"
  95. href="https://play.google.com/?hl=en&amp;tab=w8&amp;authuser=0"
  96. ><span class="gbtb2"></span><span class="gbts">Play</span></a
  97. >
  98. </li>
  99. <li class="gbt">
  100. <a
  101. class="gbzt"
  102. id="gb_36"
  103. href="https://www.youtube.com/?gl=MY&amp;tab=w1&amp;authuser=0"
  104. ><span class="gbtb2"></span><span class="gbts">YouTube</span></a
  105. >
  106. </li>
  107. <li class="gbt">
  108. <a
  109. class="gbzt"
  110. id="gb_426"
  111. href="https://news.google.com/?tab=wn&amp;authuser=0"
  112. ><span class="gbtb2"></span><span class="gbts">News</span></a
  113. >
  114. </li>
  115. <li class="gbt">
  116. <a
  117. class="gbzt gbz0l gbp1"
  118. id="gb_23"
  119. href="https://mail.google.com/mail/?tab=wm&amp;authuser=0"
  120. ><span class="gbtb2"></span><span class="gbts">Gmail</span></a
  121. >
  122. </li>
  123. <li class="gbt">
  124. <a
  125. class="gbzt"
  126. id="gb_49"
  127. href="https://drive.google.com/?tab=wo&amp;authuser=0"
  128. ><span class="gbtb2"></span><span class="gbts">Drive</span></a
  129. >
  130. </li>
  131. <li class="gbt">
  132. <a
  133. class="gbgt"
  134. id="gbztm"
  135. href="https://www.google.com.my/intl/en/about/products?tab=wh"
  136. aria-haspopup="true"
  137. aria-owns="gbd"
  138. onclick="gbar.tg(event,this)"
  139. ><span class="gbtb2"></span
  140. ><span id="gbztms" class="gbts gbtsa"
  141. ><span id="gbztms1">More</span><span class="gbma"></span></span
  142. ></a>
  143. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  144. document.getElementById('gbztm').addEventListener('click', function clickHandler() { gbar.tg(event,this); });
  145. </script>
  146. <div class="gbm" id="gbd" aria-owner="gbztm" style="visibility: hidden;">
  147. <div id="gbmmb" class="gbmc gbsb gbsbis">
  148. <ol id="gbmm" class="gbmcc gbsbic" style="max-height: 829px;">
  149. <li class="gbmtc">
  150. <a
  151. class="gbmt"
  152. id="gb_24"
  153. href="https://calendar.google.com/calendar?tab=wc&amp;authuser=0"
  154. >Calendar</a
  155. >
  156. </li>
  157. <li class="gbmtc">
  158. <a
  159. class="gbmt"
  160. id="gb_51"
  161. href="https://translate.google.com.my/?hl=en&amp;tab=wT&amp;authuser=0"
  162. >Translate</a
  163. >
  164. </li>
  165. <li class="gbmtc">
  166. <a
  167. class="gbmt"
  168. id="gb_10"
  169. href="https://books.google.com.my/?hl=en&amp;tab=wp&amp;authuser=0"
  170. >Books</a
  171. >
  172. </li>
  173. <li class="gbmtc">
  174. <a
  175. class="gbmt"
  176. id="gb_6"
  177. href="https://www.google.com.my/shopping?hl=en&amp;source=og&amp;tab=wf&amp;authuser=0"
  178. >Shopping</a
  179. >
  180. </li>
  181. <li class="gbmtc">
  182. <a
  183. class="gbmt"
  184. id="gb_31"
  185. href="https://photos.google.com/?tab=wq&amp;authuser=0&amp;pageId=none"
  186. >Photos</a
  187. >
  188. </li>
  189. <li class="gbmtc">
  190. <a
  191. class="gbmt"
  192. id="gb_25"
  193. href="https://docs.google.com/document/?usp=docs_alc&amp;authuser=0"
  194. >Docs</a
  195. >
  196. </li>
  197. <li class="gbmtc"><div class="gbmt gbmh"></div></li>
  198. <li class="gbmtc">
  199. <a
  200. href="https://www.google.com.my/intl/en/about/products?tab=wh"
  201. class="gbmt"
  202. >Even more »</a
  203. >
  204. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  205. document.querySelector('li > a.gbmt').addEventListener('click', function clickHandler() { gbar.logger.il(1,{t:66});; });
  206. </script>
  207. </li>
  208. </ol>
  209. <div class="gbsbt" style="opacity: 0;"></div>
  210. <div class="gbsbb" style="opacity: 0;"></div>
  211. </div>
  212. </div>
  213. <iframe
  214. tabindex="-1"
  215. id="gbs"
  216. src="javascript:''"
  217. aria-hidden="true"
  218. title="empty"
  219. style="visibility: hidden;"
  220. frameborder="0"
  221. ></iframe>
  222. </li>
  223. </ol>
  224. </div>
  225. <div id="gbg">
  226. <h2 class="gbxx">Account Options</h2>
  227. <span class="gbtcb"></span>
  228. <ol class="gbtc">
  229. <li class="gbt">
  230. <a
  231. class="gbgt"
  232. id="gbg4"
  233. href="https://profiles.google.com/?hl=en&amp;tab=wX&amp;authuser=0"
  234. aria-haspopup="true"
  235. aria-owns="gbd4"
  236. onclick="gbar.tg(event,this);"
  237. ><span class="gbtb2"></span>
  238. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  239. document.getElementById('gbg4').addEventListener('click', function clickHandler(event) { gbar.logger.il(50); gbar.tg(event,this); });
  240. </script>
  241. <span id="gbgs4" class="gbts gbtsa"
  242. ><span id="gbi4"><span id="gbi4m1">${userEmail}</span
  243. ><span class="gbma"></span></span></span
  244. ></a>
  245. <div class="gbm" id="gbd4" aria-owner="gbg4" guidedhelpid="gbd4">
  246. <div class="gbmc">
  247. <div id="gbmpdv">
  248. <div class="gbpc">
  249. <span id="gbmpn" class="gbps">Ian Doe</span>
  250. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  251. document.getElementById('gbmpn').addEventListener('click', function clickHandler(event) { gbar.logger.il(10,{t:69}); });
  252. </script>
  253. <span class="gbps2">${userEmail}</span>
  254. <div class="gbmlbw">
  255. <a
  256. id="gb_150"
  257. href="https://myaccount.google.com/?utm_source=OGB&amp;tab=wk&amp;authuser=0"
  258. class="gbmlb"
  259. >Google Account</a
  260. >
  261. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  262. document.getElementById('gb_150').addEventListener('click', function clickHandler(event) { gbar.logger.il(10,{t:150}); });
  263. </script>
  264. –<a href="https://policies.google.com/privacy?hl=en" class="gbmlb"
  265. >Privacy</a
  266. >
  267. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  268. document.querySelector('div.gbmlbw > a.gbmlb').addEventListener('click', function clickHandler(event) { gbar.logger.il(10,{t:149}); });
  269. </script>
  270. </div>
  271. </div>
  272. </div>
  273. <div id="gbmps">
  274. <div id="gbmpasb" class="gbsb gbsbis">
  275. <div id="gbmpas" class="gbsbic">
  276. <div id="gbmpm_0" class="gbmtc gbp0">
  277. <a
  278. id="gbmpm_0_l"
  279. href="https://www.google.com/webhp?authuser=0"
  280. class="gbmt"
  281. ><span class="gbmpiaw"
  282. ><img
  283. class="gbmpia"
  284. data-asrc="https://lh3.googleusercontent.com/ogw/ADea4I7d7MFiPquiRH91IyG2Qoy3tlT63ffAsxnck8S1gg=s48-c-mo"
  285. alt="Jun Ian"
  286. src="https://lh3.googleusercontent.com/ogw/ADea4I7d7MFiPquiRH91IyG2Qoy3tlT63ffAsxnck8S1gg=s48-c-mo"
  287. width="48"
  288. height="48"
  289. /></span>
  290. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  291. document.querySelector('span.gbmpiaw.gbxv > img.gbmpia').addEventListener('error', function clickHandler() { window.gbar&&gbar.pae?gbar.pae(this):this.loadError=1; });
  292. </script>
  293. <span class="gbmpnw"
  294. ><span class="gbps">Place Holder</span
  295. ><span class="gbps2"
  296. ><span class="gbps3">placeholder@gmail.com</span>
  297. (default)</span
  298. ></span
  299. ></a
  300. >
  301. </div>
  302.  
  303. <div class="gbsbt" style="opacity: 0;"></div>
  304. <div class="gbsbb" style="opacity: 0;"></div>
  305. </div>
  306. <div id="gbmppc" class="gbxx gbmtc">
  307. <a class="gbmt" href="https://plus.google.com/u/0/dashboard"
  308. ><span class="gbmppci"></span>All your Google+ pages ›</a
  309. >
  310. </div>
  311. </div>
  312. <table id="gbmpal">
  313. <tbody>
  314. <tr>
  315. <td class="gbmpala">
  316. <a
  317. role="button"
  318. href="https://accounts.google.com/AddSession?hl=en&amp;continue=https://mail.google.com/mail/h"
  319. class="gbqfbb"
  320. >Add account</a
  321. >
  322. </td>
  323. <td class="gbmpalb">
  324. <a
  325. target="_top"
  326. role="button"
  327. id="gb_71"
  328. href="https://accounts.google.com/Logout?hl=en&amp;continue=https://www.google.com/&amp;timeStmp=1625789247&amp;secTok=.AG5fkS8DQaQI8UgxJx-Gc2wrqfC1V06ASQ&amp;ec=GAdAAQ"
  329. class="gbqfbb"
  330. >Sign out</a
  331. >
  332. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  333. document.getElementById('gb_71').addEventListener('click', function clickHandler(event) { gbar.logger.il(9,{l:'o'}); });
  334. </script>
  335. </td>
  336. </tr>
  337. </tbody>
  338. </table>
  339. </div>
  340. </div>
  341. </li>
  342. <li class="gbt gbtb"><span class="gbts"></span></li>
  343. <noscript
  344. ><li class="gbt">
  345. <a
  346. class="gbgt"
  347. href="https://accounts.google.com/Logout?hl=en&continue=https://www.google.com/&timeStmp=1625789247&secTok=.AG5fkS8DQaQI8UgxJx-Gc2wrqfC1V06ASQ&ec=GAdAAQ"
  348. ><span class="gbtb2"></span><span class="gbts">Sign out</span></a
  349. >
  350. </li>
  351. <li class="gbt gbtb"><span class="gbts"></span></li
  352. ></noscript>
  353. <li class="gbt">
  354. <a
  355. class="gbgt"
  356. id="gbg5"
  357. href="http://www.google.com.my/preferences?hl=en"
  358. title="Options"
  359. aria-haspopup="true"
  360. aria-owns="gbd5"
  361. onclick="gbar.tg(event,this);"
  362. ><span class="gbtb2"></span
  363. ><span id="gbgs5" class="gbts"><span id="gbi5"></span></span
  364. ></a>
  365. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  366. document.getElementById('gbg5').addEventListener('click', function clickHandler() { gbar.tg(event,this); });
  367. </script>
  368. <div class="gbm" id="gbd5" aria-owner="gbg5">
  369. <div class="gbmc">
  370. <ol id="gbom" class="gbmcc">
  371. <li class="gbkc gbmtc">
  372. <a class="gbmt" href="?&v=prg">Settings</a>
  373. </li>
  374. <li class="gbmtc"><div class="gbmt gbmh"></div></li>
  375. <li class="gbkp gbmtc">
  376. <a
  377. class="gbmt"
  378. href="/?nocheckbrowser=true"
  379. >Normal Gmail</a
  380. >
  381. </li>
  382. </ol>
  383. </div>
  384. </div>
  385. </li>
  386. </ol>
  387. </div>
  388. </div>
  389. <div id="gbx3"></div>
  390. <div id="gbx4"></div>
  391. <script nonce="rQKKL1czeZ9pyOU7fZDwWw==">
  392. window.gbar&&gbar.elp&&gbar.elp()
  393. </script>
  394. </div>
  395. </div>
  396.  
  397. `;
  398. };
  399. window.setTimeout(replaceHtmlReal,100);
  400.  
  401.  
  402. // additional circuitry for gbar dropdowns
  403.  
  404. /*
  405. var gbarObject = d.getElementById("gb-more");
  406. console.log(gbarObject);
  407.  
  408. // the replace stuff
  409. function gbarReplace(closeDown)
  410. {
  411. if (closeDown == true)
  412. {
  413. d.getElementById("gbd").removeAttribute("style");
  414. }
  415. }
  416. */