Tampermonkey and Greasemonkey to your help when you are not satisfied

greasemonkeyWhen you use a web site or a web based system more or less everyday you find things that you would like to change in the design or some of the functionality. In that case Tampermonkey / Greasemonkey could be your friend if you also have some basic knowledge in javascript.


I recently started to play an old computer game called Planetarion. The last time I played was back in the late 90th/early 2000 and it still has the same look and feel. Of course it’s some of its charm but I could not resist to fix the most obvious flaws.

tampermonkeyTo make use of Tampermonkey/Greasemonkey you create a javascript file. Then you add the following code to configure the script to be activated only on the site game.planetarion.com and set up some basic includes like JQuery. This code begins the so called “user script”:

// ==UserScript==
// @name Planetarion style script
// @namespace https://www.hoyce.com/
// @version 1.1
// @description A user script that styles Planetarion
// @match http://game.planetarion.com/*
// @author Hoyce
// @require http://code.jquery.com/jquery-latest.js
// @grant none
// ==/UserScript==

In my case I wanted to fix the menu in the game and titles in the browser tabs. One of the things that irritated me the most was that you couldn’t see which page/section you were in based on the menu links. An easy fix for this is to highlight the active link with a distinct color and bold text. (see some javascript code below)

Another improvement was to shorten the title text which is shown in the browser tabs to get a good overview on which tab contains which page when you have several tabs open in your browser.


function setActiveLink(element) {
  var menuItem = $(element);
  menuItem.css('font-weight', 'bold').css('color', '#47b4fa');
function setTitle(title) {
  $('title').text('PA ' + title);

if(window.location.href.indexOf('fleets.pl') > 0) {
  setActiveLink('li#menu_fleets a');

Activate your script in your browser

To make use of your script you have to install the browser plugin which depends on the browser you use. Use Tampermonkey for Chrome/Opera/Safari and Greasemonkey for Firefox.

Then activate the the script you just created and make use of its extra functionality!

Get the code form GitHub: https://github.com/hoyce/planetarion-scripts     GitHub-Mark-120px-plus

Leave a Reply

Your email address will not be published. Required fields are marked *