first update of sidebar for new data format: show the info available from the brief portal data
TODO: retrieve the full portal data and update to include that
This commit is contained in:
41
code/portal_data.js
Normal file
41
code/portal_data.js
Normal file
@ -0,0 +1,41 @@
|
||||
/// 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;
|
||||
}
|
Reference in New Issue
Block a user