Greasy Fork 支持简体中文。

PlugShareAnonymous

Allows using PlugShare without an account.

目前為 2025-01-22 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name PlugShareAnonymous
  3. // @namespace https://greasyfork.org/en/users/1365511-robosphinx
  4. // @version 2025.01.21.001
  5. // @description Allows using PlugShare without an account.
  6. // @author robosphinx_, callumhume
  7. // @match *://*.plugshare.com/*
  8. // @grant none
  9. // @license GPLv3
  10. // ==/UserScript==
  11.  
  12. (function main() {
  13. 'use strict';
  14.  
  15. const SCRIPT_LONG_NAME = GM_info.script.name;
  16. const SCRIPT_SHORT_NAME = "PSA";
  17. const SCRIPT_VERSION = GM_info.script.version;
  18.  
  19. const LOGIN_DIALOG_CLASS = '.md-dialog-container';
  20. const ANTI_CLICK_BACKGROUND_1_ID = '#toast-container';
  21. const ANTI_CLICK_BACKGROUND_2_ID = '.md-dialog-backdrop';
  22. const LOAD_MAP_BUTTON = '.load';
  23.  
  24. let successfulStartup = false;
  25.  
  26. function log(tag, message) {
  27. if (tag == "ERROR") {
  28. console.error(SCRIPT_SHORT_NAME + ": " + tag + ": " + message);
  29. }
  30. else {
  31. console.log(SCRIPT_SHORT_NAME + ": " + tag + ": " + message);
  32. }
  33. }
  34.  
  35. function removeLoginWindow() {
  36. // Heirarchy follows
  37. // ID layer-switcher-region
  38. // class layer-switcher
  39. // class menu
  40. // class scrollable
  41. // class list-unstyled togglers
  42. // class group
  43. // class md-dialog-container ng-scope
  44. try {
  45. log("INFO", "Looking for div ids to nuke...");
  46. let loginDialog = document.querySelector(LOGIN_DIALOG_CLASS); // Grab element by class name
  47. if (loginDialog != null) {
  48. log("INFO", "Found login dialog: " + loginDialog);
  49. loginDialog.remove();
  50. let toastContainer = document.querySelector(ANTI_CLICK_BACKGROUND_1_ID); // Grab element by ID
  51. if (toastContainer != null) {
  52. log("INFO", "Found toast container: " + toastContainer);
  53. toastContainer.remove();
  54. let dialogBackdrop = document.querySelector(ANTI_CLICK_BACKGROUND_2_ID); // Grab element by class
  55. if (dialogBackdrop != null) {
  56. log("INFO", "Found dialog backdrop: " + dialogBackdrop);
  57. dialogBackdrop.remove();
  58. let loadMapButton = document.querySelector(LOAD_MAP_BUTTON); // Grab element by class
  59. if (loadMapButton != null) {
  60. log("INFO", "Found map load button: " + loadMapButton);
  61. loadMapButton.click();
  62. successfulStartup = true;
  63. }
  64. else {
  65. log("ERROR", "Could not find element with class " + LOAD_MAP_BUTTON);
  66. successfulStartup = false;
  67. }
  68. }
  69. else {
  70. log("ERROR", "Could not find element with class " + ANTI_CLICK_BACKGROUND_2_ID);
  71. successfulStartup = false;
  72. }
  73. }
  74. else {
  75. log("ERROR", "Could not find element with class " + ANTI_CLICK_BACKGROUND_1_ID);
  76. successfulStartup = false;
  77. }
  78. }
  79. else {
  80. log("ERROR", "Could not find element with class " + LOGIN_DIALOG_CLASS);
  81. successfulStartup = false;
  82. }
  83. }
  84. catch (err) {
  85. log("ERROR", "Looking for div ids to nuke returned error " + err);
  86. successfulStartup = false;
  87. }
  88. };
  89.  
  90. function init() {
  91. log("INFO", SCRIPT_LONG_NAME + " " + SCRIPT_VERSION + " started");
  92. removeLoginWindow();
  93. if (successfulStartup) {
  94. log("INFO", SCRIPT_LONG_NAME + " initialized!");
  95. }
  96. else {
  97. log("ERROR", SCRIPT_LONG_NAME + " could not initialize.");
  98. }
  99. }
  100.  
  101. function bootstrap() {
  102. let loginDialog = document.querySelector(LOGIN_DIALOG_CLASS); // Grab element by class name
  103. if (loginDialog != null) {
  104. init();
  105. } else {
  106. setTimeout(bootstrap, 100);
  107. }
  108. }
  109.  
  110. bootstrap();
  111. })();