Bitinfocharts Addnode Generator

Generates list for the addnode command to be used in most cryptocurrency clients

This script is marked as "external"
This script was commisioned by someone else, and I will not check if it works. If it breaks, contact me
Click here to install Browse More Scripts
// ==UserScript==
// @name         Bitinfocharts Addnode Generator
// @namespace    85d1046673739fd3ced72881acaef681108a71d4
// @version      0.3
// @description  Generates list for the addnode command to be used in most cryptocurrency clients
// @author       /u/AyrA_ch
// @match        https://bitinfocharts.com/*/nodes-active/*
// @match        https://bitinfocharts.com/*/nodes/*
// @grant        none
// @external     true
// ==/UserScript==

// CHANGELOG
// 0.3 - also run on /nodes/
// 0.2 - Automatically select text
// 0.1 - Initial Version

(function () {
	'use strict';
	//Get all nodes that are IP addresses
	var nodes = document.querySelectorAll("#container li a");
	//IF we have no nodes we are probably on another site
	if (nodes.length > 0) {
		//Extract all node addresses and convert into "addnode" format
		nodes = Array.prototype.map.call(nodes, function (v) {
				return "addnode " + v.textContent + " onetry";
			}).join("\n") + "\n";
		//Create textarea
		var field = document.createElement("textarea");
		//Add formatting and value
		field.setAttribute("readonly", "readonly");
		field.setAttribute("rows", "20");
		field.setAttribute("cols", "40");
		field.setAttribute("style", "height:unset;width:unset;max-width:unset;max-height:unset;");
		field.value = nodes;
		//Create div to left-align the textarea element
		var container = document.createElement("div");
		container.style.textAlign = "left";
		//Show div+textarea
		document.querySelector("#container").appendChild(container);
		container.appendChild(field);
		field.selectionStart = 0;
		field.selectionEnd = field.value.length;
		field.select();
		field.focus();
	}
})();

/*
LICENSE:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
The full license text can be found here: http://creativecommons.org/licenses/by-nc-sa/4.0/
The link has an easy to understand version of the license and the full license text.

DISCLAIMER:
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/

Copyright © 2018 by Kevin Gut 📧 | More services | Generated for 44.192.54.67