Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name DuolingoMods
- // @version 1
- // @grant none
- // @include https://www.duolingo.com/*
- // ==/UserScript==
- //Append css code into the head
- function insertCss(code)
- {
- var style = document.createElement('style');
- style.type = 'text/css';
- style.innerHTML = code;
- var gold = document.createElement('style');
- gold.id = "insertStyle";
- document.getElementsByTagName("head")[0].appendChild( style );
- document.getElementsByTagName("head")[0].appendChild( gold );
- }
- //Injects css that hides Fluency tab and leaderboards tabs, I find them useless
- insertCss(`
- div[class='LN_aF _1E3L7']{
- display: none !important;
- }
- div[class='a5SW0']{
- display: none !important;
- }
- `);
- //Create the show gold button and the stories link
- var x = document.getElementsByClassName("mAsUf");
- 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>";
- x = document.getElementsByClassName("zDDkq");
- x[0].innerHTML += "<li class='_2rS3d'><a data-test='labs-nav' class='_2QyU5' href='https://stories.duolingo.com/'>Stories</a></li>";
- //Controls toggling the gold skill on and off
- button=document.getElementById("toggleGold");
- button.addEventListener("click", ToggleGold, false);
- ToggleGold();
- function ToggleGold()
- {
- if (document.getElementById("insertStyle").innerHTML == "")
- {
- document.getElementById("insertStyle").innerHTML = `
- a[data-test='gold skill-tree-link']{
- display: none !important;
- }
- div[data-test='skill-tree'] > div > button[disabled]{
- display: none !important;
- }
- div[class='_1H-7I _2GJb6 _1--zr']{
- display: none !important;
- }
- `;
- button.innerHTML = "Show Gold";
- }
- else{
- document.getElementById("insertStyle").innerHTML = "";
- button.innerHTML = "Hide Gold";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement