diff --git a/plugins/draw-resonators.user.js b/plugins/draw-resonators.user.js
index 0bf73ff7..e7e6fe14 100644
--- a/plugins/draw-resonators.user.js
+++ b/plugins/draw-resonators.user.js
@@ -2,11 +2,11 @@
// @id iitc-plugin-draw-resonators@xelio
// @name IITC plugin: Draw resonators
// @category Layer
-// @version 0.2.1.@@DATETIMEVERSION@@
+// @version 0.3.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
-// @description [@@BUILDNAME@@-@@BUILDDATE@@] Draw resonators on map.
+// @description [@@BUILDNAME@@-@@BUILDDATE@@] Draw resonators on map. With stylers to highlight resonators with specific criteria.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
@@ -58,6 +58,8 @@ window.plugin.drawResonators.Render = function(options) {
this.handleResonatorEntitiesAfterZoom = this.handleResonatorEntitiesAfterZoom.bind(this);
this.handleEnableZoomLevelChange = this.handleEnableZoomLevelChange.bind(this);
this.portalSelectionChange = this.portalSelectionChange.bind(this);
+ this.changeStyler = this.changeStyler.bind(this);
+ this.getStylersList = this.getStylersList.bind(this);
};
window.plugin.drawResonators.Render.prototype.registerHook = function() {
@@ -238,12 +240,21 @@ window.plugin.drawResonators.Render.prototype.getStylersList = function() {
}
window.plugin.drawResonators.Render.prototype.getStyler = function() {
- var stylerName = this.useStyler in this.stylers ? this.useStyler : 'default';
+ var stylerName = this.useStyler in this.stylers ? this.useStyler : 'Default';
return this.stylers[stylerName];
}
+// Change if styler need change, and redraw all resonators using new styler
window.plugin.drawResonators.Render.prototype.changeStyler = function(name) {
- // TODO: check whether styler has change, and update style of all resonators
+ if (name === this.useStyler) return;
+ for(stylerName in this.stylers) {
+ if(stylerName === name) {
+ this.useStyler = stylerName;
+ this.clearAllResonators();
+ this.drawAllResonators();
+ return;
+ }
+ }
}
window.plugin.drawResonators.Render.prototype.isResonatorsShow = function() {
@@ -262,7 +273,8 @@ window.plugin.drawResonators.Render.prototype.isResonatorsShowBeforeZoom = funct
window.plugin.drawResonators.Styler = function(options) {
options = options || {};
- this.name = options['name'] || 'default';
+ this.name = options['name'] || 'Default';
+ this.otherOptions = options['otherOptions'];
this.getResonatorStyle = options['resonatorStyleFunc'] || this.defaultResonatorStyle;
this.getConnectorStyle = options['connectorStyleFunc'] || this.defaultConnectorStyle;
}
@@ -391,8 +403,8 @@ window.plugin.drawResonators.Dialog.prototype.addLink = function() {
$('#toolbox').append('Resonators ');
}
-window.plugin.drawResonators.Dialog.prototype.addEntry = function(dialogEntry) {
- this._dialogEntries[dialogEntry.name] = dialogEntry;
+window.plugin.drawResonators.Dialog.prototype.addEntry = function(name, dialogEntry) {
+ this._dialogEntries[name] = dialogEntry;
}
@@ -412,7 +424,9 @@ window.plugin.drawResonators.Dialog.prototype.show = function() {
window.plugin.drawResonators.Dialog.prototype.getDialogHTML = function() {
var html = '
'
for(var name in this._dialogEntries) {
- html += this._dialogEntries[name].getHTML();
+ html += '
'
+ + this._dialogEntries[name].getHTML()
+ + '
';
}
html += '
';
return html;
@@ -441,12 +455,13 @@ window.plugin.drawResonators.ListDialogEntry.prototype.getHTML = function() {
+ ''
+ '