lanhuapp

try to take over the world!

  1. // ==UserScript==
  2. // @name lanhuapp
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author lbc
  7. // @email 1585638808@qq.com
  8. // @match https://lanhuapp.com/web/
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. window.curRemPanel = {}
  16. window.addRemPanel = function() {
  17. let a = window.dd.children[ window.dd.children.length - 1].cloneNode(true)
  18. let html = a.innerHTML.replace(/(\d*)px/g, function(match, a) {
  19. return `${a / 100}rem`
  20. })
  21. a.innerHTML = html
  22. window.dd.appendChild(a)
  23. window.curRemPanel = a
  24. }
  25.  
  26. window.onload = function() {
  27. setTimeout(() => {
  28. let aside = dd.parentElement.parentElement.parentElement
  29.  
  30. var mutationObserver = new MutationObserver(function(mutations) {
  31. mutations.forEach(function(mutation) {
  32. if (mutation.attributeName === 'class') {
  33. console.log(aside.className)
  34. if (aside.className.indexOf('open') > -1) {
  35. setTimeout(() => {
  36. window.addRemPanel()
  37. }, 1000)
  38. } else {
  39. window.curRemPanel.remove()
  40. }
  41. }
  42. });
  43. });
  44.  
  45. mutationObserver.observe(aside, {
  46. attributes: true,
  47.  
  48. childList: true,
  49. });
  50. }, 1000)
  51. }
  52.  
  53. })();