NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description Userscript // @match https://leetcode.com/problems/* // @grant none // ==/UserScript== /* jshint -W097 */ 'use strict'; function remove(id,className){ if(className!==null && document.getElementsByClassName(className).length>0){ document.getElementsByClassName(className)[0].remove(); } if(id!==null && document.getElementById(id)!==null){ document.getElementById(id).remove(); } } function toggle(element){ if(element.style.display=='none' || element.style.display===''){ element.style.display='block'; }else if(element.style.display=='block'){ element.style.display='none'; } } function toggleEither(id,className){ if(className!==null && document.getElementsByClassName(className).length>0){ toggle(document.getElementsByClassName(className)[0]); } if(id!==null && document.getElementById(id)!==null){ toggle(document.getElementById(id)); } } function createButtonForToggle(id,buttonName){ if(document.getElementById(id)!==null){ document.getElementById(id).style.display='none'; }else if(document.getElementsByClassName(id).length!==0){ document.getElementsByClassName(id)[0].style.display='none'; } else return; // 1. Create the button var button = document.createElement("button"); button.innerHTML = buttonName; // 2. Append somewhere var body = document.getElementsByTagName("body")[0]; body.insertBefore(button, body.firstChild); // 3. Add event handler button.addEventListener ("click", function() { toggleEither(null,id); }); } remove(null,'navbar'); remove(null,'question-title'); remove(null,'mobile-status'); remove(null,'side-bar'); remove(null,'action-btn-base'); remove('interviewed-div',null); remove(null,'site-footer'); remove(null,'notepad-wrapper'); //remove(null,'tab-view'); remove(null,'theme-select'); remove(null,'reset-btn'); remove(null,'contribute-btn'); remove(null,'tab-line'); remove(null,'line'); //if(document.getElementsByName("lang").length>0){ // document.getElementsByName("lang")[0].selectedIndex=1; // document.getElementsByName("lang")[0].fireEvent("onchange"); // document.getElementsByName("lang")[0].style.display = 'none'; //} createButtonForToggle('action','action'); createButtonForToggle('CodeMirror ','editor'); createButtonForToggle('control-btn-bar','control'); createButtonForToggle('tab-content','tabcontent'); createButtonForToggle('tab-view','tab'); function createLink(buttonName,url){ // 1. Create the button var button = document.createElement("button"); button.innerHTML = buttonName; // 2. Append somewhere var body = document.getElementsByTagName("body")[0]; body.insertBefore(button, body.firstChild); // 3. Add event handler button.addEventListener ("click", function() { window.location=url; }); } createLink('home','https://leetcode.com/problemset/algorithms/'); document.title = "Google";