unindented the wrapper function.

This commit is contained in:
boombuler 2013-02-25 20:34:25 +01:00
parent ca6fb9952b
commit a392c04469

View File

@ -10,33 +10,34 @@
// ==/UserScript== // ==/UserScript==
function wrapper() { function wrapper() {
// ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function') // ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function')
window.plugin = function() {}; window.plugin = function() {};
// PLUGIN START //////////////////////////////////////////////////////// // PLUGIN START ////////////////////////////////////////////////////////
// use own namespace for plugin // use own namespace for plugin
window.plugin.maxLinks = function() {}; window.plugin.maxLinks = function() {};
// const values // const values
window.plugin.maxLinks.MAX_DRAWN_LINKS = 400; window.plugin.maxLinks.MAX_DRAWN_LINKS = 400;
window.plugin.maxLinks.MAX_DRAWN_LINKS_INCREASED_LIMIT = 1000; window.plugin.maxLinks.MAX_DRAWN_LINKS_INCREASED_LIMIT = 1000;
window.plugin.maxLinks.STROKE_STYLE = { window.plugin.maxLinks.STROKE_STYLE = {
color: '#FF0000', color: '#FF0000',
opacity: 1, opacity: 1,
weight:2, weight:2,
clickable: false, clickable: false,
smoothFactor: 10 smoothFactor: 10
}; };
var delaunayScriptLocation = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/delaunay.js'; var delaunayScriptLocation = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/delaunay.js';
window.plugin.maxLinks.layer = null; window.plugin.maxLinks.layer = null;
var updating = false; var updating = false;
var renderLimitReached = false; var renderLimitReached = false;
window.plugin.maxLinks.updateLayer = function() { window.plugin.maxLinks.updateLayer = function() {
if (updating || window.plugin.maxLinks.layer === null || if (updating || window.plugin.maxLinks.layer === null ||
!window.map.hasLayer(window.plugin.maxLinks.layer)) !window.map.hasLayer(window.plugin.maxLinks.layer))
return; return;
@ -78,9 +79,9 @@ function wrapper() {
}); });
updating = false; updating = false;
window.renderUpdateStatus(); window.renderUpdateStatus();
} }
var setup = function() { var setup = function() {
load(delaunayScriptLocation).thenRun(function() { load(delaunayScriptLocation).thenRun(function() {
window.delaunay.Triangle.prototype.draw = function(layer, divX, divY) { window.delaunay.Triangle.prototype.draw = function(layer, divX, divY) {
@ -108,17 +109,18 @@ function wrapper() {
window.map.on('zoomend moveend', window.plugin.maxLinks.updateLayer); window.map.on('zoomend moveend', window.plugin.maxLinks.updateLayer);
window.layerChooser.addOverlay(window.plugin.maxLinks.layer, 'Maximum Links'); window.layerChooser.addOverlay(window.plugin.maxLinks.layer, 'Maximum Links');
}); });
} }
// PLUGIN END ////////////////////////////////////////////////////////// // PLUGIN END //////////////////////////////////////////////////////////
if(window.iitcLoaded && typeof setup === 'function') { if(window.iitcLoaded && typeof setup === 'function') {
setup(); setup();
} else { } else {
if(window.bootPlugins) if(window.bootPlugins)
window.bootPlugins.push(setup); window.bootPlugins.push(setup);
else else
window.bootPlugins = [setup]; window.bootPlugins = [setup];
} }
} // wrapper end } // wrapper end
// inject code into site context // inject code into site context