Script Summary: Prevents the shifting of the action icons if no spy icon available and removes the IPM and spy icons if not applicable
Version: 2.02
The "action icons" (the icons for spying, messaging, buddy requesting and IPMing in the rightmost column of the Galaxy view) in the redesign are rather annoying. For instance, when you run out of spy probes (or flight slots) the icon for spying not only disappears, but the other icons shift to the left, so that the icon for sending a message appears at the position where the icon for spying was. So, if you're just browsing the galaxy, clicking on the "spy" icon (e.g., when farming inactives) and you run out of spy probes, you suddenly find yourself clicking on the icon for sending messages, which is annoying.
In addition, while the icon for spying is removed from the planets belonging to players under the noob protection, the icon for IPM attacks is not removed from such planets. Also, neither the icon for spying, nor the one for IPM attacks is removed from the planets belonging to players in vacation mode. Of course, you can neither spy nor IPM such planets and if you try, you get a stupid error message. Why not just remove the non-working icons in the first place?!
This script fixes these design flaws. If a planet is not spyable, the icon for spying just disappears without causing a shift of the other icons. Similarly, if a planet is not IPM-able (is this a word?), the icon for IPM attacks disappears for the planet.
The script should work not only in Firefox+GreaseMonkey but also in Opera and in IE+IEPro, although I haven't tested it there. It should work even in Google Chrome, but the galaxy view in Google Chrome looks so bad that you are unlikely to bother with cosmetic improvements like this script.
Change log:
Version 1.01. Modified the code to use a DOMNodeInserted event handler in all browsers that support it (which is everything but IE, sigh...). This is faster than the original method and the icons no longer "jump" one second after the Galaxy view page is loaded.
Version 1.02. Now the "espionage" icon behaves like in the old design. If you run out of spy probes or fleet slots and switch to a new Galaxy page, the espionage icon doesn't disappear (well, it does, but the script puts it back). This allows you to just wait a bit until the probes have returned and send the next probe by clicking on the icon, instead of having to refresh the Galaxy first (which costs Deuterium).
Version 1.03. In version 1.2 of the redesign, the "espionage" icon does not appear on the Galaxy page if the planet the player is currently on has no spy probes. This is stupid - the spy probes might be in flight and due to arrive soon. It is much better to always display the "espionage" icon and show an error message if the player tries to spy but there are no spy probes (or fleet slots) available. This version of the script fixes this stupidity.
Version 1.04. Modified the code so that the script now works also in the old universes that are converted to the redesgin.
Version 1.05. Added support for version 1.3 of the redesign. Now the icons for planet relocation in the Galaxy view look inactive, if the player does not have at least 240.000 Dark Matter. Instead of "Relocate", they have tooltips that say "Dark Matter < 240.000" (the exact wording depends on the language of the server). Although the icon looks inactive, it can still be clicked - but instead of initiating the planet relocation process, which would ultimately end with an error message (because of the insufficient Dark Matter), the player is taken to the Dark Matter purchasing page.
Version 1.06. Replaced the "ghostly" images of the moons in Galaxy view with their proper pictures (as they appear on the fleet movement page). Strictly speaking, this isn't an "action icon" but I didn't feel like repeating the whole parsing of the Galaxy structure in a separate script when just a few additional lines in this one would do the job.
Version 1.07. I had forgotten to replace the moon image in the pop-up menu for that moon. Fixed. Also, if you don't like the fact that the script is replacing the moon pictures, set the constant moonPics near the beginning of the script to false.
Version 1.08. Made a small change to reflect the Christmas price reduction of the planet relocation (from 240.000 to 160.000 between 20th and 22nd of December, 2010).
Version 1.09. The script was not removing the espionage icons from the planets, belonging to players that were too strong ("reverse-noob" protection). Fixed. Also, the script now removes the unnecessary menu items from the menus that pop up when hovering with the mouse over planets and moons belonging to players under noob protection ("Missile Attack") and players in vacation mode (all menu items - "Espionage", "Attack", "Missile Attack", "Transport").
Version 1.10. The script now removes the espionage icons from planets that are too far away from the current one - so that they cannot be spied from the Galaxy view anyway, because the spy probes can't hold enough fuel for the trip. (Such planets have to be spied from the Fleet Dispatch pages, by sending the probes at speeds lower than 100%.) "Too far away" is defined as "either more than two galaxies away from the current planet, or exactly two galaxies away with the game settings set to send single probes only".
Version 1.11. Bugfix. The script wasn't determining correctly the configured number of probes to send and was hiding espionage icons that it shouldn't have. Fixed.
Version 1.12. The script now shows the activity of the player's own planets on the Galaxy page - just like the game shows it for the planets that belong to other players. Note, however, that the script will show only the activity of the planets. If you have one or more moons in a system, cause activity on those moons but not on their planets, when you view the Galaxy page for that system, only the activity of the planets will be shown. This is because the game provides no information about the activity information about one's own moons on the Galaxy page.
Version 1.13. There was an obscure bug - if you were viewing the Galaxy page while standing on a moon, all positions in the same system higher than the one where your moon was, were not processed correctly. That is, the moons weren't replaced with pictures, the activity was not shown, the non-working menu items and action icons were not removed and so on. Since this occurred only when standing on a moon, only in the system where the moon was and only for positions higher than that moon, it is unlikely that you have encountered this bug. Anyway, it is fixed now.
Version 1.14. Version 2.2.8 of the game changed the format of the Galaxy view (the activity is now in a separate field in the tooltip of the planet, instead of in its header) and broke my script (badly). Fixed. At least now it works in version 2.2.8. I hope I didn't break anything for those who are still stuck with an earlier version of the game, but I have no means of testing the script there.
Version 1.15. Had forgotten that version 2.2.8 of the game also changes the format of the Dark Matter box (from where the script gets the text "Dark Matter" in a language-independent way, to be used in the tooltip of the planet relocation icon in Galaxy view). Fixed. Also, the script is now accounting for the cheaper planet relocation price between 2011-Aug-25 and 2011-Aug-26.
Version 1.16. The script was made compatible with version 2.3.0 of OGame (i.e., with the idiotic changes of all URLs of all images, scripts and styles in it).
Version 1.17. Apparently, version 2.3.0 made some additional changes to the contents of the Galaxy page - changes, which prevented the script from working correctly. Fixed now, hopefully.
Version 1.18. Added the "envelope" that indicates new messages on the Galaxy page, since the other script of mine that was doing it ("OGame Redesign: Alliance icon opens the message box") is now obsolete and shouldn't be used since the game itself (since version 3.0.0) provides its other functionality.
Fixed the code that checks the version of OGame, since it was broken. Sorry about that.
Improved the code to handle the slightly different format of some elements on the Galaxy page in version 3.0.0 of the game.
Version 1.19. I had forgotten to fix all the incompatibilities with OGame version 3.0.0 - for instance, the script didn't work if the Galaxy view contained planets belonging to players in vacation mode. Hopefully, it is all fixed now. In addition, I changed how the script is activated once the Galaxy page is redrawn by the AJAX crap. Hopefully, it is now more compatible with the various browsers and would work correctly in Opera too. Unfortunately, the side-effect is that now I cannot change the cluetip on the icon for relocating the planet, if the player has less than the necessary amount of Dark Matter. :-( If anybody could figure out why the title changing no longer changes the cluetip and, more importantly, how to fix it - I'm open to suggestions.
Version 1.20. Thanks to Black Cat who told me how to do it, the tooltips of the planet relocation icons are now set correctly.
Version 1.21. Made a minor change to make the script more compatible with idiotic scripts that change the Galaxy page layout completely. I should probably write the whole thing in jQuery. Maybe some day...
Version 1.22. Made the script compatible with OGame version 3.1.2.
Version 1.23. In version 4.* of OGame, Gameforge changed the algorithm for deciding which moon picture to use. Before the moon picture depended only on the system number (i.e., all moons in the same system had the same picture). Now it depends both on the system and on the position numbers. Modified the script to reflect this.
Version 1.24. In a recent version of OGame, Gameforge introduced a nice feature. When the player spies a planet from the Galaxy view, the number of available spy probes and used fleet slots at the top of the system changes dynamically. Unfortunately, like most new things introduced by Gameforge, the feature is buggy. If the number of used fleet slots reaches the maximum number of available fleet slots, that number doesn't turn red until the Galaxy view is refreshed. Similarly, if the number is red (e.g., because 10 of 10 available slots were used), the player waits a bit for some of the spy probes to return (e.g., the number of available flight slots to drop to 8/10) and then launches another spy probe (so that the number becomes 9/10), the number will remain red until the view is refreshed. The bug is really trivial to fix (basically, the code that updates the numbers should also update the class of the proper element in the table) but I got tired waiting for Gameforge to fix it, so I decided to fix it on my own in this script.
Version 2.00. This is a complete rewrite, in order to make the script work in OGame version 5.x (where the structure of the Galaxy page has changed significantly). Unfortunately, as a consequence the script will no longer work in earlier versions of the game - but that shouldn't be a problem; all the game servers have updated by now. I also used the opportunity to rewrite the script using jQuery, making it much more compact. Some functionality has been removed from it, because it was related to fixing bugs in the game (like removing the icons and the menu items for spying and IPM attacks of players in vacation mode or under noob protection), since Gameforge has finally fixed these bugs and I don't have to do it for them.
Version 2.01. The picture of the moon on which the player was currently standing was incorrect. Fixed.
Version 2.02. An obscure and very rare (but occurring unpredictably) bug could cause the Espionage mission to be sent to the moon instead of to the planet. Sorry about that - I hope nobody got banned because of it. Fixed. Also fixed a bug in OGame version 5.1.1 - the opened tooltips were not closed when browsing to a new galaxy/system.



