Skip to content

Instantly share code, notes, and snippets.

@ozero
Last active July 2, 2020 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozero/715204448038d390efdfd3150e19bb4d to your computer and use it in GitHub Desktop.
Save ozero/715204448038d390efdfd3150e19bb4d to your computer and use it in GitHub Desktop.
IITC-neutralized_marker_style.user.js

白ポータルを強調表示してくれるプラグイン

よくあるoverride芸です。青緑どちらでも展開OKです。

↓これをダウンロードなりなんなり(*1)してインストール。userインストール分のmiscカテゴリに入ります。 https://gist.github.com/ozero/715204448038d390efdfd3150e19bb4d/raw/01718b1899ed97f59b66c21a1adbb9d9a3a91bee/IITC-neutralized_marker_style.user.js

  • (*1): お使いのIITCの使い方説明に従ってインストールしてください
  • 他にも window.getMarkerStyleOptions を書き換えてるプラグインがあったら無効にしてね。たぶん競合して動かなくなるです。
// ==UserScript==
// @id IITC-neutralized_marker_style
// @name IITC: Neutralized marker style
// @author ozero
// @category Misc
// @version 0.25.1.20190426.01
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL none
// @downloadURL none
// @description neutralized marker style
// @include https://*.ingress.com/intel*
// @include http://*.ingress.com/intel*
// @match https://*.ingress.com/intel*
// @match http://*.ingress.com/intel*
// @include https://*.ingress.com/mission/*
// @include http://*.ingress.com/mission/*
// @match https://*.ingress.com/mission/*
// @match http://*.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() {};
/*
usage:
*/
// PLUGIN START ////////////////////////////////////////////////////////
// use own namespace for plugin
window.plugin.smallMarkerStyle = function() {};
window.plugin.smallMarkerStyle.setup = function() {
//Override window.portalMarkerScale to set portal marker resize setting
if (!window.L_PREFER_CANVAS) {
//portalMarkerScale doesn't work well on canvas rendering (Issue #311)
window.portalMarkerScale = function() {
var zoom = map.getZoom();
var scale = zoom >= 17 ? 1 : zoom >= 16 ? 0.7 : 0.5;
return scale;
}
}
//Override window.getMarkerStyleOptions to set portal marker radius/weight
window.getMarkerStyleOptions = function(details) {
var scale = window.portalMarkerScale();
var LEVEL_TO_WEIGHT = [];
var LEVEL_TO_RADIUS = [];
if (!window.L_PREFER_CANVAS) {
LEVEL_TO_WEIGHT = [2, 1, 1, 1, 1, 1, 1, 1, 1];
LEVEL_TO_RADIUS = [24, 7, 7, 7, 8, 8, 9, 10, 11];
}
else {
LEVEL_TO_WEIGHT = [2, 2, 2, 2, 2, 2, 2, 2, 2];
LEVEL_TO_RADIUS = [12, 6, 6, 6, 6, 6, 6, 7, 8];
}
var level = Math.floor(details.level || 0);
var lvlWeight = LEVEL_TO_WEIGHT[level] * Math.sqrt(scale);
var lvlRadius = LEVEL_TO_RADIUS[level] * scale;
var dashArray = null;
// thinner and dashed outline for placeholder portals
if (details.team != TEAM_NONE && level == 0) {
lvlWeight = 1;
dashArray = [1, 2];
}
var options = {
radius: lvlRadius,
stroke: true,
color: COLORS[details.team],
weight: lvlWeight,
opacity: 1,
fill: true,
fillColor: COLORS[details.team],
fillOpacity: 0.5,
dashArray: dashArray,
mod: 'yes' //mod
};
return options;
}
//Override L.LayerGroup.prototype.addLayer to set linkWeight=1
L.LayerGroup.prototype.addLayer = function(layer) {
var id = this.getLayerId(layer);
if (layer.options) {
if (!layer.options.radius) {
if (layer.options.weight) {
layer.options.weight = 1;
}
}
}
this._layers[id] = layer;
if (this._map) {
this._map.addLayer(layer);
}
return this;
}
}
var setup = function() {
window.addHook('iitcLoaded', window.plugin.smallMarkerStyle.setup);
}
// 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);
@ryantheleach
Copy link

Before:
image

After:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment