Add Server Button Adder For minecraftpocket-servers.com

A description.

目前為 2019-05-08 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Add Server Button Adder For minecraftpocket-servers.com
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.2
  5. // @description A description.
  6. // @author Armağan#2448
  7. // @match https://minecraftpocket-servers.com/servers/*
  8. // @match https://minecraftpocket-servers.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. //Created By Armağan#2448;
  16. //Add Server Button Adder For minecraftpocket-servers.com
  17. var ipadresses = [];
  18. Array.from(document.getElementsByClassName("btn btn-secondary btn-sm clipboard")).forEach((item, index, array)=>{
  19. ipadresses.push(array[index].getAttribute("data-clipboard-text"));
  20. })
  21. console.log(ipadresses);
  22. var htmlblocks = [];
  23. Array.from(document.getElementsByTagName("td")).forEach((item, index, array)=>{
  24. if (!item.getAttribute("class")){
  25. htmlblocks.push(Array.from(Array.from(item.children)[1].children)[0]);
  26. }
  27. })
  28. console.log(htmlblocks)
  29. htmlblocks.forEach((item, index, array)=>{
  30. var usefullip = "minecraft://?addExternalServer="+Math.random().toString(9).substring(2, 15)+"|"+ipadresses[index];
  31. if (ipadresses[index]) {
  32. item.innerHTML += `<div class="d-inline-block mt-2"><button type="button" role="button" class="btn btn-secondary btn-sm"><a href="`+usefullip+`" style="color: white; text-decoration: none;">Add Server</a></button></div>`
  33. }
  34. });
  35. })();