Planets.nu Explosion Ship Name (original client only)

Planets.nu Explosion Ship Name

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           Planets.nu Explosion Ship Name (original client only)
// @description    Planets.nu Explosion Ship Name
// @include        http://planets.nu/home
// @include        http://planets.nu/games/*
// @include        http://play.planets.nu/*
// @include 	   http://*.planets.nu/*
// @version        0.4
// @namespace https://greasyfork.org/users/2860
// ==/UserScript==
// 0.2 First working version
// 0.3 Updated code to play nicely with other mods.
// 0.4 Updated to work with new URLs

function wrapper () { // wrapper for injection
  


oldDrawExplosions = vgapMap.prototype.drawExplosions;


vgapMap.prototype.drawExplosions = function () {

oldDrawExplosions.apply(this, arguments);  
 for (var i = 0; i < vgap.messages.length; i++) {
            var message = vgap.messages[i];
            if (message.messagetype == 10) {
 		var attr = { stroke: "#ff00ff", "stroke-width": "2", "stroke-opacity": 0.5 };
                var x = message.x;
                var y = message.y;
              	this.drawText(x+20,y+14, message.body.substr(message.body.indexOf("the name of the ship was:")+"the name of the ship was:".length));

            }
        }
};


} //wrapper for injection

var script = document.createElement("script");
script.type = "application/javascript";
script.textContent = "(" + wrapper + ")();";

document.body.appendChild(script);