IITC-CE / ingress-intel-total-conversion

intel.ingress.com total conversion user script with some new features. Should allow easier extension of the intel map.
https://iitc.app
ISC License
290 stars 109 forks source link

Portal tooltip #195

Open johnd0e opened 5 years ago

johnd0e commented 5 years ago

image

Here is concept:

```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:

  1. Should we implement something similar in core? (IMHO plugin is enough)
  2. How better style portal tooltips? (propose your css)
  3. What if style'd depend on faction (or anything else)?

Edit: consider using https://github.com/makinacorpus/Leaflet.OverIntent

Tursaanpoika commented 5 years ago

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?