IITC plugin: route planner

Route planner

Per 03-04-2020. Zie de nieuwste versie.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name        IITC plugin: route planner
// @version     0.0.1
// @author      Odrick
// @description Route planner
// @match       https://*.ingress.com/intel*
// @match       http://*.ingress.com/intel*
// @match       https://*.ingress.com/mission/*
// @match       http://*.ingress.com/mission/*
// @id          iitc-plugin-route-planner@odrick
// @category    Layer
// @license     MIT
// @include     https://*.ingress.com/intel*
// @include     http://*.ingress.com/intel*
// @include     https://*.ingress.com/mission/*
// @include     http://*.ingress.com/mission/*
// @grant       none
// @namespace https://greasyfork.org/users/410740
// ==/UserScript==

!function(n){var t={};function e(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=n,e.c=t,e.d=function(n,t,r){e.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:r})},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,t){if(1&t&&(n=e(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var o in n)e.d(r,o,function(t){return n[t]}.bind(null,o));return r},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="",e(e.s=2)}([function(n,t,e){var r=e(3);n.exports="string"==typeof r?r:r.toString()},function(n,t,e){var r=e(5);n.exports="string"==typeof r?r:r.toString()},function(n,t,e){n.exports=e(6)},function(n,t,e){(t=e(4)(!1)).push([n.i,"#routePlannerBox {\r\n\tdisplay: none;\r\n\tposition: absolute!important;\r\n\tz-index: 5002;\r\n\ttop: 50px;\r\n\tleft: 60px;\r\n\twidth: 300px;\r\n\toverflow: hidden;\r\n\tbackground: rgba(8, 48, 78, .9);\r\n\tborder: 1px solid #20a8b1;\r\n\tcolor: #ffffff;\r\n\tpadding: 8px;\r\n\tfont-size: 13px;\r\n\t-webkit-touch-callout: none;\r\n\t-webkit-user-select: none;\r\n\t-khtml-user-select: none;\r\n\t-moz-user-select: none;\r\n\t-ms-user-select: none;\r\n\tuser-select: none\r\n}\r\n\r\n#routePlannerBox a.btn {\r\n    color: #ffce00;\r\n}\r\n\r\n#routePlannerBox #routePlannerTopBar {\r\n\theight: 15px!important\r\n}\r\n\r\n#routePlannerBox #routePlannerTopBar * {\r\n\theight: 14px!important\r\n}\r\n\r\n#routePlannerBox .handle {\r\n\twidth: 89%;\r\n\ttext-align: center;\r\n\tcolor: #fff;\r\n\tline-height: 6px;\r\n\tcursor: move;\r\n\tfloat: right\r\n}\r\n\r\n#routePlannerBox #routePlannerTopBar .btn {\r\n\tdisplay: block;\r\n\twidth: 10%;\r\n\tcursor: pointer;\r\n\tcolor: #20a8b1;\r\n\tfont-weight: 700;\r\n\ttext-align: center;\r\n\tline-height: 13px;\r\n\tfont-size: 18px;\r\n\tborder: 1px solid #20a8b1;\r\n\tfloat: left\r\n}\r\n\r\n#routePlannerBox #routePlannerTopBar .btn:hover {\r\n\tcolor: #ffce00;\r\n\ttext-decoration: none\r\n}\r\n\r\n#routePlannerBox #routePlannerTitle {\r\n\tfont-size: 12px;\r\n\tpadding-top: 5px\r\n}\r\n\r\n#routePlannerToolBox {\r\n    clear: both;\r\n    padding: 2px;\r\n    text-align: right;\r\n}\r\n\r\n#routePlannerList {\r\n    width: 300px;\r\n    height: 350px;\r\n    margin: auto;\r\n    border: 1px solid #20a8b1;\r\n    overflow-x: hidden;\r\n    overflow-y: auto;\r\n    margin-top: 4px;\r\n    clear: both;\r\n}\r\n\r\n.routePlannerListItem {\r\n    cursor: pointer;\r\n}\r\n\r\n.routePlannerListItemTitle {\r\n    display: inline-block;\r\n    padding-left: 4px;\r\n    width: 250px;\r\n    overflow: hidden;\r\n    box-sizing: border-box;\r\n    white-space: nowrap;\r\n}\r\n\r\n.routePlannerListItemControls {\r\n    display: inline-block;\r\n    text-align: center;\r\n    width: 20px;\r\n    overflow: hidden;\r\n    white-space: nowrap;\r\n}\r\n\r\n#routePlannerLinks {\r\n    min-height: 10px;\r\n    padding-top: 8px;\r\n}",""]),n.exports=t},function(n,t,e){"use strict";n.exports=function(n){var t=[];return t.toString=function(){return this.map((function(t){var e=function(n,t){var e=n[1]||"",r=n[3];if(!r)return e;if(t&&"function"==typeof btoa){var o=(a=r,l=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),u="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(l),"/*# ".concat(u," */")),i=r.sources.map((function(n){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(n," */")}));return[e].concat(i).concat([o]).join("\n")}var a,l,u;return[e].join("\n")}(t,n);return t[2]?"@media ".concat(t[2]," {").concat(e,"}"):e})).join("")},t.i=function(n,e,r){"string"==typeof n&&(n=[[null,n,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(o[a]=!0)}for(var l=0;l<n.length;l++){var u=[].concat(n[l]);r&&o[u[0]]||(e&&(u[2]?u[2]="".concat(e," and ").concat(u[2]):u[2]=e),t.push(u))}},t}},function(n,t){n.exports='<div id="routePlannerBox">\r\n    <div id="routePlannerTopBar">\r\n        <a id="routePlannerMin" class="btn" onclick="window.plugin.routePlanner.hideBox();return false;" title="Minimize">-</a>\r\n        <div class="handle"><div id="routePlannerTitle" class="ui-dialog-title ui-dialog-title-active">Route planner</div></div>\r\n    </div>\r\n    <div id="routePlannerToolBox">\r\n        <a href="#" onclick="window.plugin.routePlanner.copy();return false;">Copy</a>\r\n        ::\r\n        <a href="#" onclick="window.plugin.routePlanner.clear();return false;">Clear</a>\r\n    </div>\r\n    <div id="routePlannerList"></div>\r\n    <div id="routePlannerLinks"></div>\r\n</div>'},function(n,t,e){"use strict";e.r(t);var r=e(0),o=e.n(r),i=e(1),a=e.n(i);function l(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}var u=function(){function n(){!function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n)}var t,e,r;return t=n,r=[{key:"ui",get:function(){return a.a}},{key:"css",get:function(){return o.a}}],(e=null)&&l(t.prototype,e),r&&l(t,r),n}();window.RoutePlannerPluginUtils=u;var c=document.createElement("script"),d={};"undefined"!=typeof GM_info&&GM_info&&GM_info.script&&(d.script={version:GM_info.script.version,name:GM_info.script.name,description:GM_info.script.description});var p=document.createTextNode("("+function(n){"function"!=typeof window.plugin&&(window.plugin=function(){}),n.buildName="Route planner",n.dateTimeVersion="20200402163000",n.pluginId="iitc-plugin-route-planner@odrick";var t=null,e=[],r=[],o=!1,i={},a=function(n){n.portal.on("click",l)},l=function(n){if(o&&!function(n){for(var t=0;t<e.length;t++){if(e[t].guid===n)return!0}return!1}(n.target.options.guid)){var t={guid:n.target.options.guid,title:n.target.options.data.title,lat:n.target.options.data.latE6/1e6,lng:n.target.options.data.lngE6/1e6};t.title||(t.title=t.lat+", "+t.lng),e.push(t),u(t),s(),c()}},u=function(n){var t=document.createElement("div");t.addEventListener("click",(function(){window.map.setView({lat:n.lat,lng:n.lng},window.map.getZoom())})),t.guid=n.guid,t.className="routePlannerListItem",$(t).append('<div class="routePlannerListItemTitle">'.concat(n.title,"</div>")),$(t).append('<div class="routePlannerListItemControls"><a href="#" onclick="window.plugin.routePlanner.removePoint(\''.concat(n.guid,"')\">X</a></div>")),$("#routePlannerList").append(t)},c=function(){t.clearLayers();for(var n=[],r=0;r<e.length;r++){var o=e[r];L.circleMarker(new L.LatLng(o.lat,o.lng),{color:"#ee6666",opacity:1,weight:5,fill:!0,dashArray:"5, 5",interactive:!1,clickable:!1,radius:14}).addTo(t),n.push(new L.LatLng(o.lat,o.lng))}L.polyline(n,{color:"#ee6666",opacity:1,weight:2,fill:!1,interactive:!1,clickable:!1}).addTo(t),d()},d=function(){r=[];for(var n=[],t=0;t<e.length;t++){var o=e[t];if(0===t&&n.push(""),n.push(o.lat+","+o.lng),10===n.length||t>=e.length-1){var i="https://www.google.com/maps/dir/"+n.join("/");i+="/@"+(n[0]||n[1])+",18z/",r.push(i),n=[n[9]]}}$("#routePlannerLinks").html("");for(var a=0;a<r.length;a++){var l="Navigation";r.length>1&&(l+=a+1);var u='<a href="'+r[a]+'" target="_blank">'+l+"</a>";r.length>1&&a<r.length-1&&(u+=", "),$("#routePlannerLinks").append(u)}};i.removePoint=function(n){for(var t=0;t<e.length;t++){if(e[t].guid===n){e.splice(t,1);for(var r=document.querySelector("#routePlannerList"),o=0;o<r.children.length;o++){var i=r.children[o];i.guid===n&&r.removeChild(i)}return s(),void c()}}},i.showBox=function(){o=!0,$("#routePlannerBox").show()},i.hideBox=function(){o=!1,$("#routePlannerBox").hide()},i.clear=function(){e=[],$("#routePlannerList").html(""),s(),c()},i.copy=function(){var n=document.createElement("textarea");n.value=r.join("\n\n"),n.style.position="fixed",document.body.appendChild(n),n.focus(),n.select();try{if(document.execCommand("copy")){var t=document.createElement("div");t.innerHTML="Navigation copied",document.body.appendChild(t),t.style.position="fixed",t.style.display="block",t.style.left="50%",t.style.top="50%",t.style.transform="translate(-50%, -50%)",t.style.zIndex=100500,t.style.padding="4px",t.style.background="#fff",t.style.color="#000",setTimeout((function(){document.body.removeChild(t)}),1e3)}}catch(n){}document.body.removeChild(n)};var p=function(n,t){for(var r=t.item[0].guid,o=-1,i=0;i<e.length;i++){e[i].guid===r&&(o=i)}var a=t.item.index();if(o>=0){if(a===o)return;var l=e[o];e.splice(o,1),e.splice(a,0,l)}s(),c()},s=function(){localStorage.setItem("iitc-plugin-route-planner",JSON.stringify(e))};function f(){$("<style>").prop("type","text/css").html(window.RoutePlannerPluginUtils.css).appendTo("head"),$("body").append(window.RoutePlannerPluginUtils.ui),$("#routePlannerBox").draggable({handle:".handle",containment:"window"}),$("#routePlannerList").sortable({update:p}),$("#toolbox").append('<a onclick="window.plugin.routePlanner.showBox();return false;">Route planner</a>'),t=new L.LayerGroup,window.addLayerGroup("Route planner",t,!1),window.addHook("portalAdded",a),function(){var n=localStorage.getItem("iitc-plugin-route-planner");if(n)try{e=JSON.parse(n);for(var t=0;t<e.length;t++)u(e[t])}catch(n){e=[]}}(),c()}window.plugin.routePlanner=i,f.info=n,window.bootPlugins||(window.bootPlugins=[]),window.bootPlugins.push(f),window.iitcLoaded&&f()}+")("+JSON.stringify(d)+")");c.appendChild(p),(document.body||document.head||document.documentElement).appendChild(c)}]);