forked from IITC-CE/ingress-intel-total-conversion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iitc-project/ingress-intel-total-conversion#1113 Merge commit 'refs/pull/1113/head' of https://github.com/iitc-project/ingress-intel-total-conversion into new-plugins
- Loading branch information
Showing
1 changed file
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// ==UserScript== | ||
// @id iitc-plugin-showtheway@ariefwt | ||
// @name IITC plugin: Show the Way integration | ||
// @category Info | ||
// @version 1.0.0.@@DATETIMEVERSION@@ | ||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion | ||
// @updateURL @@UPDATEURL@@ | ||
// @downloadURL @@DOWNLOADURL@@ | ||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Share portal location that agents can actually use. One link to navigate with Waze, Google Maps, HERE Maps, Uber, Apple Maps, Bing Maps, and more. | ||
// @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== | ||
|
||
@@PLUGINSTART@@ | ||
|
||
// PLUGIN START //////////////////////////////////////////////////////// | ||
|
||
window.plugin.showtheway = { | ||
onIitcLoaded: function () { | ||
$('<style>') | ||
.attr('type', 'text/css') | ||
.html( | ||
'#showtheway-portal-div { text-align:center }' + | ||
'#showtheway-portal-div input { width:100% } ' | ||
) | ||
.appendTo('head'); | ||
|
||
$('<script>') | ||
.attr('type', 'text/javascript') | ||
.attr('src', 'https://showtheway.io/w.js') | ||
.appendTo('body'); | ||
|
||
$('<div>') | ||
.attr('id', 'showtheway-portal-div') | ||
.addClass('none') | ||
.append( | ||
$('<label>') | ||
.attr('for', 'showtheway-portal-link') | ||
.text('Show the Way portal link:') | ||
) | ||
.append( | ||
$('<input>') | ||
.attr('id', 'showtheway-portal-link') | ||
.attr('type', 'text') | ||
.attr('placeholder', 'Select a portal on the map first') | ||
.prop('readonly', true) | ||
.addClass('showtheway-portal-url') | ||
.click(function () { | ||
if (!$(this).hasClass('selected')) { | ||
$(this).select(); | ||
$(this).addClass('selected'); | ||
} | ||
}) | ||
.blur(function () { | ||
if ($(this).hasClass('selected')) { | ||
$(this).removeClass('selected'); | ||
} | ||
}) | ||
) | ||
.append( | ||
$('<div>') | ||
.addClass('showtheway') | ||
) | ||
.insertAfter('#portaldetails'); | ||
}, | ||
onPortalDetailsUpdated: function (data) { | ||
var ll = (data.portalData.latE6 / 1E6) + ',' + (data.portalData.lngE6 / 1E6); | ||
var name = data.portalData.title; | ||
$('input.showtheway-portal-url').val('https://showtheway.io/to/' + ll + '?' + $.param({'name': name})); | ||
$('.showtheway').each(function () { | ||
showtheway.initWidget(this, { | ||
ll: ll, | ||
name: name | ||
}); | ||
}); | ||
} | ||
}; | ||
|
||
var setup = function () { | ||
window.addHook('iitcLoaded', window.plugin.showtheway.onIitcLoaded); | ||
window.addHook('portalDetailsUpdated', window.plugin.showtheway.onPortalDetailsUpdated); | ||
}; | ||
|
||
// PLUGIN END ////////////////////////////////////////////////////////// | ||
|
||
@@PLUGINEND@@ |