Add Server Button Adder For minecraftpocket-servers.com

A description.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Add Server Button Adder For minecraftpocket-servers.com
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  A description.
// @author       Armağan#2448
// @match        https://minecraftpocket-servers.com/servers/*
// @match        https://minecraftpocket-servers.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

//Created By Armağan#2448;
//Add Server Button Adder For minecraftpocket-servers.com
var ipadresses = [];
Array.from(document.getElementsByClassName("btn btn-secondary btn-sm clipboard")).forEach((item, index, array)=>{
ipadresses.push(array[index].getAttribute("data-clipboard-text"));
})
console.log(ipadresses);
var htmlblocks = [];
Array.from(document.getElementsByTagName("td")).forEach((item, index, array)=>{
if (!item.getAttribute("class")){
htmlblocks.push(Array.from(Array.from(item.children)[1].children)[0]);
}
})
console.log(htmlblocks)
htmlblocks.forEach((item, index, array)=>{
var usefullip = "minecraft://?addExternalServer="+Math.random().toString(9).substring(2, 15)+"|"+ipadresses[index];
if (ipadresses[index]) {
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>`
}
});
})();