IITC plugin: Navigate to portal from waze

[local-2016-09-25-104955] Navigate to portal

Version vom 25.09.2016. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @id             iitc-plugin-waze-navigte
// @name           IITC plugin: Navigate to portal from waze
// @category       Controls
// @version        0.0.2.20160925.104955
// @namespace      waze
// @description    [local-2016-09-25-104955] Navigate to portal
// @include        https://www.ingress.com/intel*
// @include        http://www.ingress.com/intel*
// @match          https://www.ingress.com/intel*
// @match          http://www.ingress.com/intel*
// @include        https://www.ingress.com/mission/*
// @include        http://www.ingress.com/mission/*
// @match          https://www.ingress.com/mission/*
// @match          http://www.ingress.com/mission/*
// @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 AUTHORS: writing a plugin outside of the IITC build environment? if so, delete these lines!!
//(leaving them in place might break the 'About IITC' page or break update checks)
plugin_info.buildName = 'local';
plugin_info.dateTimeVersion = '20160925.104955';
plugin_info.pluginId = 'waze-navigate';
//END PLUGIN AUTHORS NOTE



// PLUGIN START ////////////////////////////////////////////////////////

// use own namespace for plugin
window.plugin.waze = function() {};

window.plugin.waze.addLink = function(d) {
  var portal = window.selectedPortal;
  if (window.portals[portal]) {
    var lat = window.portals[portal].options.data.latE6/1000000;
    var lng = window.portals[portal].options.data.lngE6/1000000;
    var $link = $('#waze-link');
    if ($link.length == 0) {
      $link = $('body').append('<a id="waze-link" title="Navigate"></a></aside>');
    }
    var url = 'waze://?ll=' + lat + ',' + lng + '&navigate=yes'
    $link.attr('href', url);
    if (window.useAndroidPanes()) {
      $link.click(function(){
        window.prompt('Вставьте в браузер', $(this).attr('href'));
      })
    }
  }
}

var setup = function () {
  addHook('portalSelected', window.plugin.waze.addLink);

  $('head').append('<style>' +
      '#waze-link {' +
        'position: fixed;' +
        'display: block;' +
        'right: 0;' +
        'background-image: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAQDAwQDAwQEAwQFBAQFBgoHBgYGBg0JCggKDw0QEA8NDw4RExgUERIXEg4PFRwVFxkZGxsbEBQdHx0aHxgaGxr/2wBDAQQFBQYFBgwHBwwaEQ8RGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhr/wAARCAA8ADwDASIAAhEBAxEB/8QAHQAAAgICAwEAAAAAAAAAAAAABwgFBgAEAgMJAf/EADkQAAEDAwIEAwYDBgcAAAAAAAECAwQFBhEABxIhMUEIE1EUFSIyYYFxkaEXIyRCUnJEU5KxsuHw/8QAFwEBAQEBAAAAAAAAAAAAAAAAAAECA//EABoRAQEBAQEBAQAAAAAAAAAAAAABEQIhIjH/2gAMAwEAAhEDEQA/AH91ms1H1qswqDTJdSq8pqFBiNKdffdVwpQgDJJOg3lLCe+omrXTR6CgLrdVg0xB6KlSUNA/6iNK/J3J3I8QtSkwtolKs6yWXC09cEhBD8jHXyx1H4JwR/MpOcan6F4PbFQsyrwk1e7qk5zekTZq0Bau5wghX5qV+OtYzo6UzcC1608GaRcdHqDpOAiNPacUfslROrElwK0vtV8H21VQYKItGl0p3HJ6JUHSpP1AcUpP6apU61d2PDyFVOya1I3Cs2P8Umjz8qkMNDqWzzOAO6MepQQM6gbrW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bHvCoynEqZgBRIyFYx2JClAHkcIJ1NkXOqmdznf2w7w2ftrRv4qBSpYqdfcRzQ0lH8hPY8JKfxdSOx04oGABoW7JbKU7Z+hvID5qtw1FQdqlTc5rfX14RnmEAk9eZJJPXkUtc7drrJkaNSmORGSplsuKHYaB+9xq1+bf1y2GYa21T2k+W5g4C0LS4kHHYlAB+h0fikHqM66lxGF/M0k/bUV5LtbXX9KcaoKramMhD2S84wUtjrzLnykcz0ydNDRNnLLi0SGxUbLjzZkeO226+tTqVPrCQFLwFADJyfvpwFUuIrqwg/bXD3RCP+HR+Wg8xr/2puK2rumT7Qt2Q/SJSiqMzHZW95AV1bIHxDB6H0xz66NfhXti49tkVmpVWmvMyax5SEsKGC2hBUcqHYkq6dRj66c8UmGDyjo/LXamnxkfKygfbQV6j3DNmqAfiqQD3I1aUnKQSMa+JaQj5UgfgNc9B/9k=);' +
        'background-size: contain;' +
        'bottom: 24px;' +
        'width: 30px;' +
        'z-index: 999999;' +
        'height: 30px;' +
    '}' +
    '</style>');
}


// 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);