Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. // ==UserScript==
  2. // @name DuolingoMods
  3. // @version 1
  4. // @grant none
  5. // @include https://www.duolingo.com/*
  6. // ==/UserScript==
  7.  
  8. //Append css code into the head
  9. function insertCss(code)
  10. {
  11. var style = document.createElement('style');
  12. style.type = 'text/css';
  13. style.innerHTML = code;
  14. var gold = document.createElement('style');
  15. gold.id = "insertStyle";
  16. document.getElementsByTagName("head")[0].appendChild( style );
  17. document.getElementsByTagName("head")[0].appendChild( gold );
  18. }
  19.  
  20. //Injects css that hides Fluency tab and leaderboards tabs, I find them useless
  21. insertCss(`
  22. div[class='LN_aF _1E3L7']{
  23. display: none !important;
  24. }
  25. div[class='a5SW0']{
  26. display: none !important;
  27. }
  28. `);
  29.  
  30. //Create the show gold button and the stories link
  31. var x = document.getElementsByClassName("mAsUf");
  32. x[0].innerHTML += "<a data-test='lingot-store-button' class='_3LN9C _3QG2_ B1eV7 _1vaUe _3IS_q _1XnsG _1vaUe _3IS_q' id='toggleGold' href='#'><span>Show Gold</span></a>";
  33.  
  34. x = document.getElementsByClassName("zDDkq");
  35. x[0].innerHTML += "<li class='_2rS3d'><a data-test='labs-nav' class='_2QyU5' href='https://stories.duolingo.com/'>Stories</a></li>";
  36.  
  37. //Controls toggling the gold skill on and off
  38. button=document.getElementById("toggleGold");
  39. button.addEventListener("click", ToggleGold, false);
  40.  
  41. ToggleGold();
  42. function ToggleGold()
  43. {
  44. if (document.getElementById("insertStyle").innerHTML == "")
  45. {
  46. document.getElementById("insertStyle").innerHTML = `
  47. a[data-test='gold skill-tree-link']{
  48. display: none !important;
  49. }
  50. div[data-test='skill-tree'] > div > button[disabled]{
  51. display: none !important;
  52. }
  53. div[class='_1H-7I _2GJb6 _1--zr']{
  54. display: none !important;
  55. }
  56. `;
  57. button.innerHTML = "Show Gold";
  58. }
  59. else{
  60. document.getElementById("insertStyle").innerHTML = "";
  61. button.innerHTML = "Hide Gold";
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement