```portal-tooltip.user.js
// ==UserScript==
// @id portal-tooltip
// @name IITC plugin: Portal tooltip
// @category Info
// @version 0.1
// @namespace https://github.com/IITC-CE/ingress-intel-total-conversion
// @updateURL none
// @downloadURL none
// @description Show tooltip with portal name on mouse hover
// @include https://intel.ingress.com/*
// @grant none
// ==/UserScript==
function wrapper(plugin_info) {
// ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function') window.plugin = function() {};
// PLUGIN START ////////////////////////////////////////////////////////
function tooltip (data) {
var title = data.portal.options.data.title;
if (title) { data.portal.bindTooltip(title); }
}
function setup () {
window.addHook('portalAdded', tooltip);
window.addHook('portalDetailsUpdated', tooltip);
}
// PLUGIN END //////////////////////////////////////////////////////////
setup.info = plugin_info; //add the script info data to the function as a property
if(!window.bootPlugins) window.bootPlugins = [];
window.bootPlugins.push(setup);
// if IITC has already booted, immediately run the 'setup' function
if(window.iitcLoaded && typeof setup === 'function') setup();
} // wrapper end
// inject code into site context
var script = document.createElement('script');
var info = {};
if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description };
script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');'));
(document.body || document.head || document.documentElement).appendChild(script);
```
Questions are:
Should we implement something similar in core? (IMHO plugin is enough)
How better style portal tooltips? (propose your css)
What if style'd depend on faction (or anything else)?
Works well as plain tooltip, using it just as you posted it above. Styling is also ok for my use - but in case you go for styling by faction, make it simple - color the text maybe?
Here is concept:
Questions are:
Edit: consider using https://github.com/makinacorpus/Leaflet.OverIntent