NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name ogamex-img-name // @namespace http://tampermonkey.net/ // @version 1.1 // @description Display the name of buildings, fleet, defenses, searches, on images for the game ogamex.net // @updateURL https://openuserjs.org/meta/jobijoba/ogamex-img-name.meta.js // @downloadURL https://openuserjs.org/install/jobijoba/ogamex-img-name.user.js // @copyright 2021, Jobijoba // @license MIT // @include *.ogamex.net/fleet* // @include *.ogamex.net/research* // @include *.ogamex.net/hangar* // @include *.ogamex.net/defense* // @include *.ogamex.net/building* // @include *.ogamex.net/officer* // @grant GM_addStyle //@require http://code.jquery.com/jquery-3.4.1.min.js // @copyright 2021, Jobijoba // ==/UserScript== (function() { 'use strict'; function capitalizeFirstLetter(string) { string = string.toLowerCase(); return string.charAt(0).toUpperCase() + string.slice(1); } var url = $(location).attr("href"); var u =url.split('/')[3]; u = u.split('?')[0]; console.log(u); var x = ''; var y = ''; var z = 22; if(u == 'hangar'){ x = 'hangar'; y = 'ship'; z = 0; } if(u == 'fleet'){ x = 'ship'; y = 'ship'; z = 0; } if(u == 'research'){ x = 'research'; y = 'research'; } if(u == 'defense'){ x = 'hangar'; y = 'defense'; z = 0; } if(u == 'building'){ x = 'building'; y = 'building'; } if(u == 'officer'){ x = 'officer'; y = 'officer'; } for(var i=0; i<30; i++){ var name = $('a.'+x+'-btn:eq('+i+')').attr('data-'+y+'-type'); $('a.'+x+'-btn:eq('+i+')').find('span').css('background-color','#000'); $('a.'+x+'-btn:eq('+i+')').find('span').css('color','#fff'); if(name == undefined){ break } $('<div id="name'+i+'" class="image-name">').appendTo('a.'+x+'-btn:eq('+i+')'); var idName = $('#name'+i); var nameTab = name.split('_'); name = ""; for (var a = 0; a < nameTab.length; a++){ nameTab[a] = capitalizeFirstLetter(nameTab[a]); name += nameTab[a]+' '; } idName.html(name); } GM_addStyle(` .image-name{ position:absolute; left: 0; width: 100%; z-index: 10; color: white; background-color: black; padding: 3px; text-align: center; font-size: 10px; line-height: 13px; border-bottom: 1px solid #999; border-top: 1px solid #999; } `); $('.image-name').css('top',z+'px'); })();