Greasy Fork is available in English.

leetcode show total and remain unlocked questions

Show Total and Remain Unlocked on Leetcode, also Hide the locked Questions

04.04.2017 itibariyledir. En son verisyonu görün.

  1. // ==UserScript==
  2. // @name leetcode show total and remain unlocked questions
  3. // @description:en Show Total and Remain Unlocked Problems on Leetcode
  4. // @namespace https://greatest.deepsurf.us/en/users/22079-hntee
  5. // @version 0.1
  6. // @author hntee
  7. // @match https://leetcode.com/*
  8. // @description Show Total and Remain Unlocked on Leetcode, also Hide the locked Questions
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. observeDomChange();
  14. })();
  15.  
  16. function observeDomChange() {
  17. var MutationObserver = window.MutationObserver;
  18. var myObserver = new MutationObserver (mutationHandler);
  19. var obsConfig = {
  20. childList: true, attributes: true,
  21. subtree: true, attributeFilter: ['list-group']
  22. };
  23. myObserver.observe(document, obsConfig);
  24. function mutationHandler (mutationRecords) {
  25. var locked = "div > i.fa-lock";
  26. var num_locked = $(locked).length;
  27. $(locked).parent().parent().parent().hide();
  28. if ($('#welcome strong').length == 1) {
  29. info = $('#welcome strong').text();
  30. num_finished = Number(info.split('/')[0]);
  31. num_questions = Number(info.split('/')[1]);
  32. num_unlocked = num_questions - num_locked;
  33. $('#welcome').append(' (Locked: ' + num_locked + ')<br />You have solved: <strong>' + num_finished + "/" + num_unlocked + ' (' + (num_unlocked - num_finished) + ')</strong> remain');
  34. }
  35. }
  36. }