42 lines
983 B
JavaScript
42 lines
983 B
JavaScript
/// PORTAL DATA TOOLS ///////////////////////////////////////////////////
|
|
// misc functions to get portal info
|
|
|
|
// search through the links data for all that link from or to a portal. returns an object with separate lists of in
|
|
// and out links. may or may not be as accurate as the portal details, depending on how much data the API returns
|
|
window.getPortalLinks = function(guid) {
|
|
|
|
var links = { in: [], out: [] };
|
|
|
|
$.each(window.links, function(g,l) {
|
|
var d = l.options.data;
|
|
|
|
if (d.oGuid == guid) {
|
|
links.out.push(g);
|
|
}
|
|
if (d.dGuid == guid) {
|
|
links.in.push(g);
|
|
}
|
|
});
|
|
|
|
return links;
|
|
}
|
|
|
|
|
|
// search through the fields for all that reference a portal
|
|
window.getPortalFields = function(guid) {
|
|
var fields = [];
|
|
|
|
$.each(window.fields, function(g,f) {
|
|
var d = f.options.data;
|
|
|
|
if ( d.points[0].guid == guid
|
|
|| d.points[1].guid == guid
|
|
|| d.points[2].guid == guid ) {
|
|
|
|
fields.push(g);
|
|
}
|
|
});
|
|
|
|
return fields;
|
|
}
|