uniques: extract highlighter
This commit is contained in:
parent
2aecfefa7f
commit
1afebff122
@ -329,37 +329,38 @@ window.plugin.uniques.loadLocal = function(mapping) {
|
|||||||
/***************************************************************************************************************************************************************/
|
/***************************************************************************************************************************************************************/
|
||||||
/** HIGHLIGHTER ************************************************************************************************************************************************/
|
/** HIGHLIGHTER ************************************************************************************************************************************************/
|
||||||
/***************************************************************************************************************************************************************/
|
/***************************************************************************************************************************************************************/
|
||||||
window.plugin.uniques.highlight = function(data) {
|
window.plugin.uniques.highlighter = {
|
||||||
var guid = data.portal.options.ent[0];
|
highlight: function(data) {
|
||||||
var uniqueInfo = window.plugin.uniques.uniques[guid];
|
var guid = data.portal.options.ent[0];
|
||||||
|
var uniqueInfo = window.plugin.uniques.uniques[guid];
|
||||||
|
|
||||||
var style = {};
|
var style = {};
|
||||||
|
|
||||||
if (uniqueInfo) {
|
if (uniqueInfo) {
|
||||||
if (uniqueInfo.captured) {
|
if (uniqueInfo.captured) {
|
||||||
// captured (and, implied, visited too) - no highlights
|
// captured (and, implied, visited too) - no highlights
|
||||||
|
|
||||||
} else if (uniqueInfo.visited) {
|
} else if (uniqueInfo.visited) {
|
||||||
style.fillColor = 'yellow';
|
style.fillColor = 'yellow';
|
||||||
style.fillOpacity = 0.6;
|
style.fillOpacity = 0.6;
|
||||||
|
} else {
|
||||||
|
// we have an 'uniqueInfo' entry for the portal, but it's not set visited or captured?
|
||||||
|
// could be used to flag a portal you don't plan to visit, so use a less opaque red
|
||||||
|
style.fillColor = 'red';
|
||||||
|
style.fillOpacity = 0.5;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// we have an 'uniqueInfo' entry for the portal, but it's not set visited or captured?
|
// no visit data at all
|
||||||
// could be used to flag a portal you don't plan to visit, so use a less opaque red
|
|
||||||
style.fillColor = 'red';
|
style.fillColor = 'red';
|
||||||
style.fillOpacity = 0.5;
|
style.fillOpacity = 0.7;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// no visit data at all
|
data.portal.setStyle(style);
|
||||||
style.fillColor = 'red';
|
},
|
||||||
style.fillOpacity = 0.7;
|
|
||||||
|
setSelected: function(active) {
|
||||||
|
window.plugin.uniques.isHighlightActive = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.portal.setStyle(style);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called by IITC when the selected highlighter changes. Must not be renamed
|
|
||||||
window.plugin.uniques.setSelected = function(active) {
|
|
||||||
window.plugin.uniques.isHighlightActive = active;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -389,7 +390,7 @@ var setup = function() {
|
|||||||
window.addHook('portalDetailsUpdated', window.plugin.uniques.onPortalDetailsUpdated);
|
window.addHook('portalDetailsUpdated', window.plugin.uniques.onPortalDetailsUpdated);
|
||||||
window.addHook('publicChatDataAvailable', window.plugin.uniques.onPublicChatDataAvailable);
|
window.addHook('publicChatDataAvailable', window.plugin.uniques.onPublicChatDataAvailable);
|
||||||
window.addHook('iitcLoaded', window.plugin.uniques.registerFieldForSyncing);
|
window.addHook('iitcLoaded', window.plugin.uniques.registerFieldForSyncing);
|
||||||
window.addPortalHighlighter('Uniques', window.plugin.uniques);
|
window.addPortalHighlighter('Uniques', window.plugin.uniques.highlighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
//PLUGIN END //////////////////////////////////////////////////////////
|
//PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user