Skip to content

Commit

Permalink
separate History Ornaments
Browse files Browse the repository at this point in the history
removed code for the highlighter
using own namespace
  • Loading branch information
MysticJay committed Mar 17, 2021
1 parent 491b18d commit b13d4e1
Showing 1 changed file with 4 additions and 86 deletions.
90 changes: 4 additions & 86 deletions plugins/portal-history-ornaments.js
Original file line number Diff line number Diff line change
@@ -1,95 +1,13 @@
// @author Johtaja
// @name Portal History&Ornaments
// @name Portal Histroy Ornaments
// @category Highlighter
// @version 0.2.0
// @description Display portal history as highlighters, ornaments
// @description Display portal history as ornaments


// use own namespace for plugin
var portalsHistory = {};
window.plugin.portalHighlighterPortalsHistory = portalsHistory;

portalsHistory.styles = {
common: {
fillOpacity: 1
},
marked: {
fillColor: 'red'
},
semiMarked: {
fillColor: 'yellow'
},
commonOther: {
// no action by default
}
};

portalsHistory.setStyle = function (data, name) {
data.portal.setStyle(portalsHistory.styles[name]);
};

portalsHistory.visited = function (data) {
var history = data.portal.options.data.history;
if (!history) {
return;
}
var s = portalsHistory.styles;
if (history.captured) {
data.portal.setStyle(s.captured);
} else if (history.visited) {
data.portal.setStyle(s.visited);
} else if (!$.isEmptyObject(s.otherVC)) {
data.portal.setStyle(s.otherVC);
}
};

portalsHistory.notVisited = function (data) {
var history = data.portal.options.data.history;
if (!history) {
return;
}
var s = portalsHistory.styles;
if (!history.visited) {
data.portal.setStyle(s.visitTarget);
} else if (!history.captured) {
data.portal.setStyle(s.captureTarget);
} else if (!$.isEmptyObject(s.otherNotVC)) {
data.portal.setStyle(s.otherNotVC);
}
};

portalsHistory.scoutControlled = function (data) {
var history = data.portal.options.data.history;
if (!history) {
return;
}
var s = portalsHistory.styles;
if (history.scoutControlled) {
data.portal.setStyle(s.scoutControlled);
} else if (!$.isEmptyObject(s.otherScout)) {
data.portal.setStyle(s.otherScout);
}
};

portalsHistory.notScoutControlled = function (data) {
var history = data.portal.options.data.history;
if (!history) {
return;
}
var s = portalsHistory.styles;
if (!history.scoutControlled) {
data.portal.setStyle(s.scoutControllTarget);
} else if (!$.isEmptyObject(s.otherNotScout)) {
data.portal.setStyle(s.otherNotScout);
}
};

function inherit (parentName, childNames) {
var styles = portalsHistory.styles;
childNames.forEach(function (name) {
styles[name] = L.extend(L.Util.create(styles[parentName]), styles[name]);
});
}
window.plugin.portalPortalsHistoryOrnaments = portalsHistory;

// History Ornaments
portalsHistory.layers = {};
Expand Down Expand Up @@ -178,7 +96,7 @@ portalsHistory.onportalAdded = function(data) {
}
};

/*
/* WIP
portalsHistory.onportalRemoved = function(data) {
// data = {portal: p, data: p.options.data }
Expand Down

0 comments on commit b13d4e1

Please sign in to comment.