mobizen web app

try to take over the world!

  1. // ==UserScript==
  2. // @name mobizen web app
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description try to take over the world!
  6. // @author You
  7. // @match *www.mobizen.com/*
  8. // @icon https://www.google.com/s2/favicons?domain=www.mobizen.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. if (window.location.href.search("/home") == -1) {
  13.  
  14. function main() {
  15. var a = $("div.display-email");
  16. if (a.length == 0) {
  17. return;
  18. }
  19. clearInterval(loop);
  20. setTimeout(function() {
  21. a = a.text();
  22. if (a == "") {
  23. loop = setInterval(login, 100);
  24. } else {
  25. loop = setInterval(select_host, 100);
  26. }
  27. }, 100);
  28. }
  29.  
  30. function login() {
  31. var e = $("#signin-button");
  32. if (e.length == 1) {
  33. clearInterval(loop);
  34. setTimeout(function() {
  35. e.click();
  36. loop = setInterval(select_host, 100);
  37. }, 1000);
  38. }
  39. }
  40.  
  41. function select_host() {
  42. //$("#mobizen-main > div.block-connect > div > label").click();
  43. var e = $("#mobizen-main > div.device-list > div.devicelist-button.hostlist");
  44. if (e.length == 1) {
  45. clearInterval(loop);
  46. setTimeout(function() {
  47. e.click();
  48. //loop = setInterval(select_host, 100);
  49. }, 100);
  50. }
  51. }
  52.  
  53. var css = `
  54. #select-device {
  55. z-index: 100;
  56. top: 0;
  57. bottom: 0;
  58. left: 0;
  59. right: 0;
  60. margin: 0;
  61. margin-left: -60px;
  62. }
  63. `.replace(/;/g, " !important;");
  64. var style = document.createElement('style');
  65. style.innerHTML = css;
  66. document.getElementsByTagName('body')[0].appendChild(style);
  67.  
  68. var loop = setInterval(main, 100);
  69.  
  70. } else {
  71.  
  72. var css = `
  73. #contents {
  74. top: 0;
  75. }
  76. #dialog {
  77. left: 200px;
  78. }
  79. #apps,#widget,#header,#footer {
  80. display: none;
  81. }
  82. .device-button {
  83. border: 1px solid white;
  84. }
  85. #device [data-role="DEVICE_BODY"] {
  86. left: 0%;
  87. }
  88. `.replace(/;/g, " !important;");
  89. var style = document.createElement('style');
  90. style.innerHTML = css;
  91. document.getElementsByTagName('body')[0].appendChild(style);
  92.  
  93. function set_canvas() {
  94. var e = $(".d-default_screen");
  95. if (e.length == 0 || e.width() == 0 || e.height() == 0) {
  96. return;
  97. }
  98. clearInterval(loop);
  99. var width = e.width(), height = e.height();
  100. var css = `
  101. #contents .remote {
  102. margin: unset;
  103. width: ${width}px;
  104. height: ${height}px;
  105. }
  106. #device {
  107. transform: unset;
  108. width: ${width}px;
  109. height: ${height}px;
  110. left: 47%;
  111. }
  112. #rswp {
  113. width: ${width}px;
  114. height: ${height}px;
  115. margin-left: 0;
  116. margin-top: 0;
  117. transform: unset;
  118. }
  119. #rswp > canvas {
  120. width: ${width}px;
  121. height: ${height}px;
  122. }
  123. .d-default_screen {
  124. width: ${width}px;
  125. height: ${height}px;
  126. }
  127. `.replace(/;/g, " !important;");
  128. var style = document.createElement('style');
  129. style.innerHTML = css;
  130. document.getElementsByTagName('body')[0].appendChild(style);
  131. }
  132.  
  133. var loop = setInterval(set_canvas, 100);
  134.  
  135. }