IGB Header support implemented
This commit is contained in:
1
.idea/dictionaries/exodus4d.xml
generated
1
.idea/dictionaries/exodus4d.xml
generated
@@ -19,6 +19,7 @@
|
||||
<w>killboard</w>
|
||||
<w>killmail</w>
|
||||
<w>malihu</w>
|
||||
<w>minify</w>
|
||||
<w>mouseover</w>
|
||||
<w>nonblock</w>
|
||||
<w>onerror</w>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[globals]
|
||||
|
||||
; Verbosity level of the stack trace. Assign values between 0 to 3 for increasing verbosity levels
|
||||
DEBUG = 1
|
||||
DEBUG = 3
|
||||
|
||||
; If TRUE, the framework, after having logged stack trace and errors, stops execution (die without any status) when a non-fatal error is detected.
|
||||
HALT = FALSE
|
||||
|
||||
@@ -170,4 +170,5 @@ class AccessController extends Controller {
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -85,5 +85,44 @@ class Controller {
|
||||
$this->setTemplate('templates/view/login.html');
|
||||
}
|
||||
|
||||
/**
|
||||
* check weather the page is IGB trusted or not
|
||||
* @return mixed
|
||||
*/
|
||||
static function isIGBTrusted(){
|
||||
|
||||
$igbHeaderData = self::getIGBHeaderData();
|
||||
|
||||
return $igbHeaderData->trusted;
|
||||
}
|
||||
|
||||
/**
|
||||
* extract all eve IGB specific header data
|
||||
* @return object
|
||||
*/
|
||||
static function getIGBHeaderData(){
|
||||
$data = (object) [];
|
||||
$data->trusted = false;
|
||||
$data->values = [];
|
||||
$headerData = apache_request_headers();
|
||||
|
||||
foreach($headerData as $key => $value){
|
||||
if (strpos($key, 'EVE_') === 0) {
|
||||
$key = str_replace('EVE_', '', $key);
|
||||
$key = strtolower($key);
|
||||
|
||||
if (
|
||||
$key === 'trusted' &&
|
||||
$value === 'Yes'
|
||||
) {
|
||||
$data->trusted = true;
|
||||
}
|
||||
|
||||
$data->values[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace Controller;
|
||||
|
||||
class MapController extends Controller {
|
||||
class MapController extends \Controller\AccessController {
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
@@ -16,8 +16,11 @@ class MapController extends Controller {
|
||||
|
||||
|
||||
public function showMap() {
|
||||
$this->setTemplate('templates/view/map.html');
|
||||
|
||||
// set trust attribute to template
|
||||
$this->f3->set('trusted', (int)self::isIGBTrusted());
|
||||
|
||||
$this->setTemplate('templates/view/map.html');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -305,6 +305,9 @@ class Map extends \Controller\AccessController {
|
||||
// check if data for specific system is requested
|
||||
$systemData = (array)$f3->get('POST.systemData');
|
||||
|
||||
// update current location (IGB data)
|
||||
$user->updateCharacterLog();
|
||||
|
||||
$userData = (object) [];
|
||||
// data for the current user
|
||||
$userData->userData = $user->getData();
|
||||
|
||||
@@ -36,8 +36,9 @@ class CharacterLogModel extends BasicModel {
|
||||
$logData->system->name = $this->systemName;
|
||||
|
||||
$logData->ship = (object) [];
|
||||
$logData->ship->Id = $this->shipId;
|
||||
$logData->ship->id = $this->shipId;
|
||||
$logData->ship->name = $this->shipName;
|
||||
$logData->ship->typeName = $this->shipTypeName;
|
||||
|
||||
return $logData;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,7 @@ class CharacterModel extends BasicModel {
|
||||
protected $rel_ttl = 0;
|
||||
|
||||
protected $fieldConf = array(
|
||||
/* wirft fehler
|
||||
'characterId' => array(
|
||||
'has-one' => array('Model\CharacterLogModel', 'characterId')
|
||||
)
|
||||
*/
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -50,4 +46,20 @@ class CharacterModel extends BasicModel {
|
||||
return $characterData;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the character log entry for this character
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getLog(){
|
||||
$characterLog = self::getNew('CharacterLogModel');
|
||||
$characterLog->getByForeignKey('characterId', $this->characterId);
|
||||
|
||||
$characterLogReturn = false;
|
||||
if(! $characterLog->dry() ){
|
||||
$characterLogReturn = $characterLog;
|
||||
}
|
||||
|
||||
return $characterLogReturn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -341,7 +341,6 @@ class MapModel extends BasicModel{
|
||||
if(count($systemUserData->user) > 0){
|
||||
$mapUserData->data->systems[] = $systemUserData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $mapUserData;
|
||||
|
||||
@@ -119,9 +119,10 @@ class UserCharacterModel extends BasicModel {
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public function getLog(){
|
||||
$this->filter('log', array('active = ?', 1));
|
||||
//$this->filter('log', array('active = ?', 1));
|
||||
|
||||
$characterLog = false;
|
||||
|
||||
$characterLog = $this->characterId->getLog();
|
||||
if($this->log){
|
||||
$characterLog = $this->log;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
namespace Model;
|
||||
use Controller;
|
||||
|
||||
class UserModel extends BasicModel {
|
||||
|
||||
@@ -259,5 +260,40 @@ class UserModel extends BasicModel {
|
||||
return $activeUserCharacters;
|
||||
}
|
||||
|
||||
/**
|
||||
* updated the character log entry for a user character by IGB Header data
|
||||
*/
|
||||
public function updateCharacterLog(){
|
||||
$apiController = Controller\CcpApiController::getIGBHeaderData();
|
||||
|
||||
// check if IGB Data is available
|
||||
if(! empty($apiController->values)){
|
||||
$userCharacters = $this->getUserCharacters();
|
||||
|
||||
foreach($userCharacters as $userCharacter){
|
||||
if( $userCharacter->characterId->characterId == $apiController->values['charid']){
|
||||
|
||||
// check for existing character log entry
|
||||
$characterLog = self::getNew('CharacterLogModel');
|
||||
$characterLog->getByForeignKey('characterId', $apiController->values['charid']);
|
||||
|
||||
$characterLog->characterId = $apiController->values['charid'];
|
||||
$characterLog->systemId = $apiController->values['solarsystemid'];
|
||||
$characterLog->systemName = $apiController->values['solarsystemname'];
|
||||
$characterLog->shipId = $apiController->values['shiptypeid'];
|
||||
$characterLog->shipName = $apiController->values['shipname'];
|
||||
$characterLog->shipTypeName = $apiController->values['shiptypename'];
|
||||
|
||||
$characterLog->save();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,7 +4,40 @@
|
||||
|
||||
define(['jquery'], function($) {
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* checks weather the program URL is IGB trusted or not
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var isTrusted = function(){
|
||||
var isPageTrusted = false;
|
||||
|
||||
if(isInGameBrowser()){
|
||||
var trustedAttribute = $('body').attr('data-trusted');
|
||||
if(trustedAttribute === '1'){
|
||||
isPageTrusted = true;
|
||||
}
|
||||
}else{
|
||||
// out of game browser is always trusted
|
||||
isPageTrusted = true;
|
||||
}
|
||||
|
||||
return isPageTrusted;
|
||||
};
|
||||
|
||||
/**
|
||||
* show IGB trust message
|
||||
*/
|
||||
var requestTrust = function(){
|
||||
|
||||
if(
|
||||
isInGameBrowser() &&
|
||||
! isTrusted()
|
||||
){
|
||||
CCPEVE.requestTrust( location.protocol + '//' + location.host );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* in-game or out-of-game browser
|
||||
@@ -20,6 +53,8 @@ define(['jquery'], function($) {
|
||||
};
|
||||
|
||||
return {
|
||||
isInGameBrowser: isInGameBrowser
|
||||
isInGameBrowser: isInGameBrowser,
|
||||
isTrusted: isTrusted,
|
||||
requestTrust: requestTrust
|
||||
};
|
||||
});
|
||||
@@ -52,7 +52,8 @@ define(['jquery'], function($) {
|
||||
headerLink: 100, // links in head bar
|
||||
mapMoveSystem: 300, // system position has changed animation
|
||||
mapDeleteSystem: 200, // remove system from map
|
||||
mapModule: 200 // show/hide of an map module
|
||||
mapModule: 200, // show/hide of an map module
|
||||
dialogEvents: 180 // dialog events /slide/show/...
|
||||
},
|
||||
classes: {
|
||||
// log types
|
||||
|
||||
@@ -410,7 +410,6 @@ define([
|
||||
*/
|
||||
var init = function(){
|
||||
|
||||
|
||||
var maxEntries = 150;
|
||||
|
||||
// set global logging listener
|
||||
@@ -425,24 +424,13 @@ define([
|
||||
var logDescription = options.description;
|
||||
var logDuration = options.duration;
|
||||
|
||||
// add new row to log table (time and message)
|
||||
// var logRowData = ['', getLogTime(), '', logDescription, '', ''];
|
||||
|
||||
// check log type by duration
|
||||
var logType = getLogTypeByDuration(logKey, logDuration);
|
||||
|
||||
var typeClass = Util.getLogInfo( logType, 'class' );
|
||||
/*
|
||||
logRowData[0] = '<i class="fa fa-fw fa-circle txt-color ' + typeClass + '"></i>';
|
||||
|
||||
logRowData[2] = '<span class="txt-color ' + typeClass + '">' + logDuration + '<small>ms</small></span>';
|
||||
*/
|
||||
// update graph data
|
||||
updateLogGraph(logKey, logDuration);
|
||||
/*
|
||||
logRowData[4] = '123';
|
||||
logRowData[5] = logKey;
|
||||
*/
|
||||
|
||||
var logRowData = {
|
||||
type: '<i class="fa fa-fw fa-circle txt-color ' + typeClass + '"></i>',
|
||||
@@ -463,7 +451,6 @@ define([
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// delete old log entries from table ---------------------------------
|
||||
var rowCount = logData.length;
|
||||
|
||||
|
||||
692
js/app/main.js
692
js/app/main.js
@@ -23,686 +23,27 @@ define([
|
||||
};
|
||||
|
||||
|
||||
$(function() {
|
||||
//CCP.requestTrust();
|
||||
$(function(){
|
||||
// load page
|
||||
$('body').loadPageStructure();
|
||||
|
||||
// init logging
|
||||
Logging.init();
|
||||
|
||||
// load page
|
||||
$('body').loadPageStructure();
|
||||
|
||||
// Map init options
|
||||
var mapData = [];
|
||||
|
||||
|
||||
|
||||
// TEST =============================================
|
||||
|
||||
|
||||
/*
|
||||
* Lazy Line Painter - Path Object
|
||||
* Generated using 'SVG to Lazy Line Converter'
|
||||
*
|
||||
* http://lazylinepainter.info
|
||||
* Copyright 2013, Cam O'Connell
|
||||
*
|
||||
*/
|
||||
/*
|
||||
var pathObj = {
|
||||
"test-line": {
|
||||
"strokepath": [
|
||||
{
|
||||
"path": "M 393.7 195.2 442.6 649.1 643.6 756.3 394.1 195.6",
|
||||
"strokeColor": '#477372',
|
||||
"duration": 800
|
||||
},
|
||||
{
|
||||
"path": "M 87.1 750.5 201.1 629.8 366.3 632.7 87.9 750.6",
|
||||
"strokeColor": '#4f9e4f',
|
||||
"duration": 800
|
||||
},
|
||||
{
|
||||
"path": "M 389 632.7 275.8 683.1 614.2 753.9 389.7 632.7",
|
||||
"strokeColor": '#375959',
|
||||
"duration": 800
|
||||
},
|
||||
{
|
||||
"path": "M 404.5 404 84.7 736.7 383 181.2 404.5 403.1",
|
||||
"strokeColor": '#63676a',
|
||||
"duration": 800
|
||||
}
|
||||
],
|
||||
"dimensions": {
|
||||
"width": 745,
|
||||
"height": 1053
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#test-line').lazylinepainter(
|
||||
{
|
||||
"svgData": pathObj,
|
||||
"strokeWidth": 2,
|
||||
"drawSequential": false
|
||||
}).lazylinepainter('paint');
|
||||
});
|
||||
*/
|
||||
|
||||
/*
|
||||
var mapData =[{
|
||||
map: {},
|
||||
config: {
|
||||
id: 99,
|
||||
name: 'Polaris',
|
||||
scope: {
|
||||
id: 1,
|
||||
name: 'wh',
|
||||
label: 'w-space'
|
||||
},
|
||||
icon: 'fa-globe',
|
||||
type: {
|
||||
id: 1,
|
||||
name: 'alliance',
|
||||
label: 'Alliance'
|
||||
},
|
||||
updated: 1424545904
|
||||
},
|
||||
data: {
|
||||
systems: [
|
||||
{
|
||||
id: 2,
|
||||
systemId: 31002378,
|
||||
name: 'J150020',
|
||||
alias: 'Polaris',
|
||||
effect: 'magnetar',
|
||||
type: {
|
||||
id: 1,
|
||||
name: 'wh'
|
||||
},
|
||||
security: 'C6',
|
||||
trueSec: -1,
|
||||
region: {
|
||||
id: '11000030',
|
||||
name: 'F-R00030'
|
||||
},
|
||||
constellation: {
|
||||
id: '21000298',
|
||||
name: 'F-C00298'
|
||||
},
|
||||
status: {
|
||||
id: 2,
|
||||
name: 'friendly'
|
||||
},
|
||||
locked: 1,
|
||||
rally: 0,
|
||||
position: {
|
||||
x: 8,
|
||||
y: 300
|
||||
},
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 3,
|
||||
systemId: 31002375,
|
||||
name: 'J115844',
|
||||
alias: '',
|
||||
effect: 'wolfRyet',
|
||||
type: {
|
||||
id: 1,
|
||||
name: 'wh'
|
||||
},
|
||||
security: 'C6',
|
||||
trueSec: -1,
|
||||
region: {
|
||||
id: '11000030',
|
||||
name: 'F-R00030'
|
||||
},
|
||||
constellation: {
|
||||
id: '21000298',
|
||||
name: 'F-C00298'
|
||||
},
|
||||
status: {
|
||||
id: 5,
|
||||
name: 'empty'
|
||||
},
|
||||
position: {
|
||||
x: 25,
|
||||
y: 40
|
||||
},
|
||||
updated: 1420903681
|
||||
|
||||
},{
|
||||
id: 4,
|
||||
systemId: 31002402,
|
||||
name: 'J155207',
|
||||
alias: '',
|
||||
effect: 'wolfRyet',
|
||||
type: {
|
||||
id: 1,
|
||||
name: 'wh'
|
||||
},
|
||||
security: 'C6',
|
||||
trueSec: -1,
|
||||
region: {
|
||||
id: '11000030',
|
||||
name: 'F-R00030'
|
||||
},
|
||||
constellation: {
|
||||
id: '21000301',
|
||||
name: 'F-C00301'
|
||||
},
|
||||
status: {
|
||||
id: 1,
|
||||
name: 'unknown'
|
||||
},
|
||||
locked: '1',
|
||||
rally: '1',
|
||||
position: {
|
||||
x: 203,
|
||||
y: 60
|
||||
},
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 5,
|
||||
systemId: 31002416,
|
||||
name: 'J145510',
|
||||
alias: '',
|
||||
effect: 'pulsar',
|
||||
security: 'C3',
|
||||
trueSec: -1,
|
||||
region: {
|
||||
id: '11000030',
|
||||
name: 'F-R00030'
|
||||
},
|
||||
constellation: {
|
||||
id: '21000303',
|
||||
name: 'F-C00303'
|
||||
},
|
||||
type: {
|
||||
id: 1,
|
||||
name: 'wh'
|
||||
},
|
||||
status: {
|
||||
id: 4,
|
||||
name: 'hostile'
|
||||
},
|
||||
position: {
|
||||
x: 40,
|
||||
y: 160
|
||||
},
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 542,
|
||||
systemId: 30002979,
|
||||
name: 'Tararan',
|
||||
alias: '',
|
||||
effect: '',
|
||||
security: 'L',
|
||||
trueSec: 0.3,
|
||||
region: {
|
||||
id: 10000036,
|
||||
name: 'Devoid'
|
||||
},
|
||||
constellation: {
|
||||
id: 20000436,
|
||||
name: 'Jayai'
|
||||
},
|
||||
type: {
|
||||
id: 2,
|
||||
name: 'k-space'
|
||||
},
|
||||
status: {
|
||||
id: 1,
|
||||
name: 'unknown'
|
||||
},
|
||||
position: {
|
||||
x: 280,
|
||||
y: 250
|
||||
},
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 429,
|
||||
systemId: 30000142,
|
||||
name: 'Jita',
|
||||
alias: '',
|
||||
effect: '',
|
||||
security: 'H',
|
||||
trueSec: 0.9,
|
||||
region: {
|
||||
id: 10000002,
|
||||
name: 'The Forge'
|
||||
},
|
||||
constellation: {
|
||||
id: 20000020,
|
||||
name: 'Kimotoro'
|
||||
},
|
||||
type: {
|
||||
id: 2,
|
||||
name: 'k-space'
|
||||
},
|
||||
status: {
|
||||
id: 1,
|
||||
name: 'unknown'
|
||||
},
|
||||
position: {
|
||||
x: 400,
|
||||
y: 150
|
||||
},
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 876,
|
||||
systemId: 31000152,
|
||||
name: 'J121418',
|
||||
alias: '',
|
||||
effect: '',
|
||||
security: 'C1',
|
||||
trueSec: -1,
|
||||
region: {
|
||||
id: 11000002,
|
||||
name: 'A-R00002'
|
||||
},
|
||||
constellation: {
|
||||
id: 21000002,
|
||||
name: 'A-C00002'
|
||||
},
|
||||
type: {
|
||||
id: 1,
|
||||
name: 'wh'
|
||||
},
|
||||
status: {
|
||||
id: 3,
|
||||
name: 'occupied'
|
||||
},
|
||||
position: {
|
||||
x: 600,
|
||||
y: 75
|
||||
},
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 755,
|
||||
systemId: 30000144,
|
||||
name: 'Perimeter',
|
||||
alias: '',
|
||||
effect: '',
|
||||
security: 'H',
|
||||
trueSec: 0.9,
|
||||
region: {
|
||||
id: 10000002,
|
||||
name: 'The Forge'
|
||||
},
|
||||
constellation: {
|
||||
id: '20000020',
|
||||
name: 'Kimotoro'
|
||||
},
|
||||
type: {
|
||||
id: 2,
|
||||
name: 'k-space'
|
||||
},
|
||||
status: {
|
||||
id: 6,
|
||||
name: 'unscanned'
|
||||
},
|
||||
position: {
|
||||
x: 550,
|
||||
y: 200
|
||||
},
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 8555,
|
||||
systemId: 30001028,
|
||||
name: 'RMOC-W',
|
||||
alias: '',
|
||||
effect: '',
|
||||
security: '0.0',
|
||||
trueSec: -0.1,
|
||||
region: {
|
||||
id: 10000012,
|
||||
name: 'Curse'
|
||||
},
|
||||
constellation: {
|
||||
id: '20000150',
|
||||
name: 'Sound'
|
||||
},
|
||||
type: {
|
||||
id: 2,
|
||||
name: 'k-space'
|
||||
},
|
||||
status: {
|
||||
id: 1,
|
||||
name: 'unknown'
|
||||
},
|
||||
position: {
|
||||
x: 500,
|
||||
y: 300
|
||||
},
|
||||
updated: 1420903681
|
||||
}
|
||||
|
||||
],
|
||||
connections: [
|
||||
{
|
||||
id: 2,
|
||||
source: 2,
|
||||
target: 5,
|
||||
scope: 'wh',
|
||||
type: [
|
||||
'wh_reduced'
|
||||
],
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 3,
|
||||
source: 5,
|
||||
target: 4,
|
||||
scope: 'wh',
|
||||
type: [
|
||||
'wh_fresh',
|
||||
'frigate'
|
||||
],
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 5,
|
||||
source: 3,
|
||||
target: 4,
|
||||
scope: 'wh',
|
||||
type: [
|
||||
'wh_critical'
|
||||
],
|
||||
updated: 1420903681
|
||||
},
|
||||
{
|
||||
id: 77,
|
||||
source: 4,
|
||||
target: 542,
|
||||
scope: 'wh',
|
||||
type: [
|
||||
'wh_critical'
|
||||
],
|
||||
updated: 1420903681
|
||||
},
|
||||
{
|
||||
id: 95,
|
||||
source: 4,
|
||||
target: 429,
|
||||
scope: 'wh',
|
||||
type: [
|
||||
'wh_eol',
|
||||
'wh_reduced',
|
||||
'preserve_mass'
|
||||
],
|
||||
updated: 1420903681
|
||||
},
|
||||
{
|
||||
id: 96,
|
||||
source: 429,
|
||||
target: 755,
|
||||
scope: 'wh',
|
||||
type: [
|
||||
'wh_fresh'
|
||||
],
|
||||
updated: 1420903681
|
||||
},
|
||||
{
|
||||
id: 97,
|
||||
source: 429,
|
||||
target: 876,
|
||||
scope: 'stargate',
|
||||
type: [
|
||||
'stargate'
|
||||
],
|
||||
updated: 1420903681
|
||||
},
|
||||
{
|
||||
id: 98,
|
||||
source: 542,
|
||||
target: 8555,
|
||||
scope: 'jumpbridge',
|
||||
type: [
|
||||
'jumpbridge'
|
||||
],
|
||||
updated: 1420903681
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
map: {},
|
||||
config: {
|
||||
name: 'Providence',
|
||||
id: 2,
|
||||
scope: {
|
||||
id: 1,
|
||||
name: 'wh',
|
||||
label: 'w-space'
|
||||
},
|
||||
icon: 'fa-bookmark',
|
||||
type: {
|
||||
id: 3,
|
||||
name: 'global',
|
||||
label: 'global'
|
||||
},
|
||||
updated: 1424545903
|
||||
},
|
||||
data: {
|
||||
systems: [
|
||||
{
|
||||
id: 755,
|
||||
systemId: 30000144,
|
||||
name: 'Perimeter',
|
||||
alias: '',
|
||||
effect: '',
|
||||
security: 'H',
|
||||
trueSec: 0.9,
|
||||
region: {
|
||||
id: 10000002,
|
||||
name: 'The Forge'
|
||||
},
|
||||
constellation: {
|
||||
id: '20000020',
|
||||
name: 'Kimotoro'
|
||||
},
|
||||
type: {
|
||||
id: 2,
|
||||
name: 'k-space'
|
||||
},
|
||||
status: {
|
||||
id: 6,
|
||||
name: 'unscanned'
|
||||
},
|
||||
position: {
|
||||
x: 550,
|
||||
y: 200
|
||||
},
|
||||
updated: 1420903681
|
||||
},{
|
||||
id: 8555,
|
||||
systemId: 30001028,
|
||||
name: 'RMOC-W',
|
||||
alias: '',
|
||||
effect: '',
|
||||
security: '0.0',
|
||||
trueSec: -0.1,
|
||||
region: {
|
||||
id: 10000012,
|
||||
name: 'Curse'
|
||||
},
|
||||
constellation: {
|
||||
id: '20000150',
|
||||
name: 'Sound'
|
||||
},
|
||||
type: {
|
||||
id: 2,
|
||||
name: 'k-space'
|
||||
},
|
||||
status: {
|
||||
id: 1,
|
||||
name: 'unknown'
|
||||
},
|
||||
position: {
|
||||
x: 500,
|
||||
y: 300
|
||||
},
|
||||
updated: 1420903681
|
||||
}
|
||||
],
|
||||
connections: [{
|
||||
id: 23,
|
||||
source: 755,
|
||||
target: 8555,
|
||||
type: [
|
||||
'wh_fresh'
|
||||
],
|
||||
updated: 1420903681
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
map: {},
|
||||
config: {
|
||||
name: 'Exodus 4D',
|
||||
id: 3,
|
||||
scope: {
|
||||
id: 1,
|
||||
name: 'wh',
|
||||
label: 'w-space'
|
||||
},
|
||||
icon: 'fa-sitemap',
|
||||
type: {
|
||||
id: 2,
|
||||
name: 'private',
|
||||
label: 'private'
|
||||
},
|
||||
updated: 1424545903
|
||||
},
|
||||
data: {
|
||||
systems: [],
|
||||
connections: []
|
||||
}
|
||||
}];
|
||||
*/
|
||||
/*
|
||||
// current user Data for a map
|
||||
var tempUserData ={
|
||||
userData: {
|
||||
id: 1262,
|
||||
character: [{
|
||||
id: 12,
|
||||
characterId: 90581222,
|
||||
characterName: 'Exodus 3D Gidrine',
|
||||
corporationId: 423229765,
|
||||
corporationName: 'eXceed Inc.',
|
||||
allianceId: 99000210,
|
||||
allianceName: 'No Holes Barred',
|
||||
isMain: 0
|
||||
},{
|
||||
id: 9,
|
||||
characterId: 91301110,
|
||||
characterName: 'Exodus 2D Gidrine',
|
||||
isMain: 1
|
||||
},{
|
||||
id: 10,
|
||||
characterId: 94940499,
|
||||
characterName: 'Exodus 8D Gidrine',
|
||||
isMain: 0
|
||||
},{
|
||||
id: 11,
|
||||
characterId: 1946320202,
|
||||
characterName: 'Exodus 4D',
|
||||
isMain: 0
|
||||
}],
|
||||
ship: 'Legion',
|
||||
name: 'Exodus 4D',
|
||||
system: {
|
||||
name: 'J115844',
|
||||
id: 4
|
||||
}
|
||||
},
|
||||
mapUserData: [ // user Data for all maps
|
||||
{
|
||||
config: { // map config
|
||||
id: 99 // map id
|
||||
},
|
||||
data: {
|
||||
systems:[ // systems in map
|
||||
{
|
||||
id: 4, // system id
|
||||
user: [
|
||||
{
|
||||
id: 3,
|
||||
name: 'Exodus 4D',
|
||||
ship: {
|
||||
id: 55,
|
||||
name: 'Legion'
|
||||
},
|
||||
status: 'corp'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 5, // system id
|
||||
user: [
|
||||
{
|
||||
id: 4,
|
||||
name: 'Faye Fantastic',
|
||||
ship: {
|
||||
id: 56,
|
||||
name: 'Armageddon'
|
||||
},
|
||||
status: 'ally'
|
||||
},{
|
||||
id: 5,
|
||||
name: 'Sibasomos',
|
||||
ship: {
|
||||
id: 57,
|
||||
name: 'Proteus'
|
||||
},
|
||||
status: 'corp'
|
||||
},{
|
||||
id: 6,
|
||||
name: 'Xtrah',
|
||||
ship: {
|
||||
id: 58,
|
||||
name: 'Pod'
|
||||
},
|
||||
status: 'ally'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},{
|
||||
config: { // map config
|
||||
id: 128 // map id
|
||||
},
|
||||
data: {
|
||||
systems:[ // systems in map
|
||||
{
|
||||
id: 8597, // system id
|
||||
user: [
|
||||
{
|
||||
id: 6,
|
||||
name: 'Exodus 6D Gidrine',
|
||||
ship: {
|
||||
id: 69,
|
||||
name: 'Tengu'
|
||||
},
|
||||
status: 'corp'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]};
|
||||
*/
|
||||
// update map module ========================================
|
||||
// page initialized event ==============================================================
|
||||
$('#' + config.mapModuleId).on('pf:initModule', function(){
|
||||
|
||||
if(! CCP.isTrusted()){
|
||||
// show trust message
|
||||
$(document).trigger('pf:showTrustDialog');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var mapModule = $(this);
|
||||
|
||||
// map init load static data ==================================
|
||||
// map init load static data =======================================================
|
||||
$.getJSON( Init.path.initMap, function( initData ) {
|
||||
|
||||
Init.mapTypes = initData.mapTypes;
|
||||
@@ -717,7 +58,8 @@ define([
|
||||
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
Util.emergencyShutdown(reason);
|
||||
|
||||
$(document).trigger('pf:shutdown', {reason: reason});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -791,7 +133,7 @@ define([
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
|
||||
Util.emergencyShutdown(reason);
|
||||
$(document).trigger('pf:shutdown', {reason: reason});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -843,7 +185,7 @@ define([
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
|
||||
Util.emergencyShutdown(reason);
|
||||
$(document).trigger('pf:shutdown', {reason: reason});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@@ -163,12 +163,13 @@ define([
|
||||
data &&
|
||||
data.user
|
||||
){
|
||||
|
||||
var cacheArray = [];
|
||||
// loop all active pilots and build cache-key
|
||||
for(var i = 0; i < data.user.length; i++){
|
||||
userCounter++;
|
||||
var tempUserData = data.user[i];
|
||||
cacheArray.push(tempUserData.id + '_' + tempUserData.log.ship.name);
|
||||
cacheArray.push(tempUserData.id + '_' + tempUserData.log.ship.typeName);
|
||||
}
|
||||
var cacheKey = cacheArray.join('_');
|
||||
|
||||
@@ -192,7 +193,7 @@ define([
|
||||
class: config.systemBodyItemClass
|
||||
}).append(
|
||||
$('<span>', {
|
||||
text: userData.log.ship.name,
|
||||
text: userData.log.ship.typeName,
|
||||
class: config.systemBodyRightClass
|
||||
})
|
||||
).append(
|
||||
|
||||
@@ -191,8 +191,6 @@ define([
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
142
js/app/page.js
142
js/app/page.js
@@ -9,6 +9,8 @@ define([
|
||||
'app/render',
|
||||
'app/ccp',
|
||||
'app/logging',
|
||||
'dialog/shutdown',
|
||||
'dialog/trust',
|
||||
'dialog/map_info',
|
||||
'dialog/settings',
|
||||
'dialog/manual',
|
||||
@@ -42,6 +44,9 @@ define([
|
||||
headMapClass: 'pf-head-map', // class for page head map button (right)
|
||||
headUserCharacterClass: 'pf-head-user-character', // class for "user settings" link
|
||||
userCharacterImageClass: 'pf-head-user-character-image', // class for "current user image"
|
||||
|
||||
headUserShipClass: 'pf-head-user-ship', // class for "user settings" link
|
||||
userShipImageClass: 'pf-head-user-ship-image', // class for "current user ship image"
|
||||
headActiveUserClass: 'pf-head-active-user', // class for "active user" link
|
||||
headCurrentLocationClass: 'pf-head-current-location', // class for "show current location" link
|
||||
headProgramStatusClass: 'pf-head-program-status', // class for "program status" notification
|
||||
@@ -193,7 +198,9 @@ define([
|
||||
$('<i>',{
|
||||
class: 'fa fa-power-off fa-fw'
|
||||
})
|
||||
)
|
||||
).on('click', function(){
|
||||
$(document).triggerMenuEvent('Logout');
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
@@ -356,7 +363,9 @@ define([
|
||||
id: config.pageHeaderId,
|
||||
brandLogo: config.menuHeadMenuLogoClass,
|
||||
userCharacterClass: config.headUserCharacterClass,
|
||||
userCharacterImageClass: config.userCharacterImageClass
|
||||
userCharacterImageClass: config.userCharacterImageClass,
|
||||
userShipClass: config.headUserShipClass,
|
||||
userShipImageClass: config.userShipImageClass
|
||||
};
|
||||
|
||||
Render.showModule(moduleConfig, moduleData);
|
||||
@@ -509,6 +518,15 @@ define([
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('pf:menuLogout', function(e, data){
|
||||
// logout
|
||||
console.log('! LOGOUT !');
|
||||
return false;
|
||||
});
|
||||
|
||||
// END menu events =============================================================================
|
||||
|
||||
|
||||
// update header links with current map data
|
||||
$(document).on('pf:updateHeaderMapData', function(e, data){
|
||||
var activeMap = Util.getMapModule().getActiveMap();
|
||||
@@ -527,6 +545,32 @@ define([
|
||||
updateHeaderActiveUserCount(userCount);
|
||||
updateHeaderCurrentLocation(currentLocationData);
|
||||
});
|
||||
|
||||
$(document).on('pf:showTrustDialog', function(e){
|
||||
// show trust dialog
|
||||
$.fn.showTrustDialog();
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('pf:shutdown', function(e, data){
|
||||
// show shutdown dialog
|
||||
$.fn.showShutdownDialog(data);
|
||||
|
||||
$(document).setProgramStatus('offline');
|
||||
|
||||
Util.showNotify({title: 'Emergency shutdown', text: data.reason, type: 'error'}, false);
|
||||
|
||||
// remove map
|
||||
Util.getMapModule().velocity('fadeOut', {
|
||||
duration: 300,
|
||||
complete: function(){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -536,33 +580,99 @@ define([
|
||||
|
||||
var userData = Util.getCurrentUserData();
|
||||
|
||||
if(
|
||||
userData &&
|
||||
userData.character
|
||||
){
|
||||
var userInfoElement = $('.' + config.headUserCharacterClass);
|
||||
var currentCharacterId = userInfoElement.data('characterId');
|
||||
var newCharacterId = 0;
|
||||
var newCharacterName = '';
|
||||
|
||||
var userInfoElement = $('.' + config.headUserCharacterClass);
|
||||
var userShipElement = $('.' + config.headUserShipClass);
|
||||
var currentShipId = userShipElement.data('shipId');
|
||||
var newShipId = 0;
|
||||
var newShipName = '';
|
||||
|
||||
// hide element
|
||||
userInfoElement.velocity('stop').velocity({
|
||||
opacity: 0
|
||||
},{
|
||||
// function for header element toggle animation
|
||||
var animateHeaderElement = function(element, callback, triggerShow){
|
||||
|
||||
element.show().velocity('stop').velocity({
|
||||
opacity: 0
|
||||
},{
|
||||
visibility : 'hidden',
|
||||
duration: 500,
|
||||
complete: function(){
|
||||
// set new data
|
||||
userInfoElement.find('span').text(userData.character.name);
|
||||
userInfoElement.find('img').attr('src', Init.url.ccpImageServer + '/Character/' + userData.character.characterId + '_32.jpg' );
|
||||
complete: function(){
|
||||
|
||||
userInfoElement.velocity({
|
||||
// callback
|
||||
callback();
|
||||
|
||||
// show element
|
||||
if(triggerShow === true){
|
||||
element.velocity({
|
||||
opacity: 1
|
||||
}, {
|
||||
visibility : 'visible',
|
||||
duration: 500
|
||||
});
|
||||
}else{
|
||||
// hide element
|
||||
element.hide();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// check for changees
|
||||
if(
|
||||
userData &&
|
||||
userData.character
|
||||
){
|
||||
newCharacterId = userData.character.characterId;
|
||||
newCharacterName = userData.character.name;
|
||||
|
||||
if(userData.character.log){
|
||||
newShipId = userData.character.log.ship.id;
|
||||
newShipName = userData.character.log.ship.typeName;
|
||||
}
|
||||
}
|
||||
|
||||
// update user character data ---------------------------------------------------
|
||||
if(currentCharacterId !== newCharacterId){
|
||||
|
||||
var showCharacterElement = true;
|
||||
if(newCharacterId === 0){
|
||||
showCharacterElement = false;
|
||||
}
|
||||
|
||||
// toggle element
|
||||
animateHeaderElement(userInfoElement, function(){
|
||||
userInfoElement.find('span').text( newCharacterName );
|
||||
userInfoElement.find('img').attr('src', Init.url.ccpImageServer + 'Character/' + newCharacterId + '_32.jpg' );
|
||||
}, showCharacterElement);
|
||||
|
||||
// set new id for next check
|
||||
userInfoElement.data('characterId', newCharacterId);
|
||||
}
|
||||
|
||||
// update user ship data --------------------------------------------------------
|
||||
if(currentShipId !== newShipId){ console.log('update ship ');
|
||||
|
||||
var showShipElement = true;
|
||||
if(newShipId === 0){
|
||||
showShipElement = false;
|
||||
}
|
||||
|
||||
// toggle element
|
||||
animateHeaderElement(userShipElement, function(){
|
||||
userShipElement.find('span').text( newShipName );
|
||||
userShipElement.find('img').attr('src', Init.url.ccpImageServer + 'Render/' + newShipId + '_32.png' );
|
||||
}, showShipElement);
|
||||
|
||||
// set new id for next check
|
||||
userShipElement.data('shipId', newShipId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -144,13 +144,6 @@ define([
|
||||
// name
|
||||
tempData.push( tempSystemData.name );
|
||||
|
||||
// alias
|
||||
if( tempSystemData.name !== tempSystemData.alias){
|
||||
tempData.push( tempSystemData.alias );
|
||||
}else{
|
||||
tempData.push( '' );
|
||||
}
|
||||
|
||||
// status
|
||||
var systemStatusClass = Util.getStatusInfoForSystem(tempSystemData.status.id, 'class');
|
||||
if(systemStatusClass !== ''){
|
||||
@@ -219,10 +212,7 @@ define([
|
||||
title: 'type',
|
||||
width: '50px'
|
||||
},{
|
||||
title: 'system',
|
||||
width: '50px'
|
||||
},{
|
||||
title: 'alias'
|
||||
title: 'system'
|
||||
},{
|
||||
title: 'status',
|
||||
width: '30px',
|
||||
|
||||
93
js/app/ui/dialog/shutdown.js
Normal file
93
js/app/ui/dialog/shutdown.js
Normal file
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* error/shutdown dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
|
||||
// shutdown dialog
|
||||
shutdownDialogId: 'pf-shutdown-dialog' // id for "trust" dialog
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* show/animate dialog page content
|
||||
* @param pageElement
|
||||
*/
|
||||
var showPageContent = function(dialog){
|
||||
|
||||
dialog.find('h1').delay(300).velocity('transition.shrinkIn', {
|
||||
duration: 500
|
||||
}).delay(800)
|
||||
|
||||
dialog.find('h1').velocity({
|
||||
scale: 1.05
|
||||
}, {
|
||||
duration: 600,
|
||||
loop: 5
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* show "shutdown" dialog
|
||||
*/
|
||||
$.fn.showShutdownDialog = function(dialogData){
|
||||
|
||||
requirejs(['text!templates/dialog/shutdown.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
id: config.shutdownDialogId,
|
||||
reason: dialogData.reason
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
// show dialog
|
||||
var shutdownDialog = bootbox.dialog({
|
||||
title: 'Shutdown',
|
||||
message: content,
|
||||
buttons: {
|
||||
logout: {
|
||||
label: '<i class="fa fa-fw fa-power-off"></i> logout',
|
||||
className: ['btn-default', 'pull-left'].join(' '),
|
||||
callback: function() {
|
||||
|
||||
$(document).trigger('pf:menuLogout');
|
||||
}
|
||||
},
|
||||
refresh: {
|
||||
label: '<i class="fa fa-fw fa-repeat"></i> reload',
|
||||
className: ['btn-danger'].join(' '),
|
||||
callback: function(){
|
||||
// refresh page
|
||||
location.reload();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
shutdownDialog.on('shown.bs.modal', function(e) {
|
||||
// remove close button
|
||||
var dialog = $(this);
|
||||
|
||||
dialog.find('.bootbox-close-button').remove();
|
||||
dialog.find('button').blur();
|
||||
|
||||
// show error message
|
||||
showPageContent(dialog);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
138
js/app/ui/dialog/trust.js
Normal file
138
js/app/ui/dialog/trust.js
Normal file
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* set IGB trust dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/ccp'
|
||||
], function($, Init, Util, Render, bootbox, CCP) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
|
||||
// trust dialog
|
||||
trustDialogId: 'pf-trust-dialog', // id for "trust" dialog
|
||||
trustDialogFirstPageId: 'pf-trust-first-page', // id for first page
|
||||
trustDialogSecondPageId: 'pf-trust-second-page' // id for second page
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* show/animate dialog page content
|
||||
* @param pageElement
|
||||
*/
|
||||
var showPageContent = function(pageElement){
|
||||
|
||||
pageElement.find('h1').delay(300).velocity('transition.shrinkIn', {
|
||||
duration: 500
|
||||
}).delay(800)
|
||||
|
||||
pageElement.find('h1').velocity({
|
||||
scale: 1.05
|
||||
}, {
|
||||
duration: 600,
|
||||
loop: 5
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* show "trust" dialog
|
||||
*/
|
||||
$.fn.showTrustDialog = function(){
|
||||
|
||||
requirejs(['text!templates/dialog/trust.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
id: config.trustDialogId,
|
||||
firstPageId: config.trustDialogFirstPageId,
|
||||
secondPageId: config.trustDialogSecondPageId
|
||||
};
|
||||
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
|
||||
|
||||
// show dialog
|
||||
var trustDialog = bootbox.dialog({
|
||||
title: 'Trust Page',
|
||||
message: content,
|
||||
buttons: {
|
||||
logout: {
|
||||
label: '<i class="fa fa-fw fa-power-off"></i> logout',
|
||||
className: ['btn-default', 'pull-left'].join(' '),
|
||||
callback: function() {
|
||||
|
||||
$(document).trigger('pf:menuLogout');
|
||||
}
|
||||
},
|
||||
trust: {
|
||||
label: '<i class="fa fa-fw fa-lock"></i> trust',
|
||||
className: 'btn-primary',
|
||||
callback: function(){
|
||||
var dialog = $(this);
|
||||
|
||||
// request trust
|
||||
CCP.requestTrust();
|
||||
|
||||
var firstPageElement = dialog.find('#' + config.trustDialogFirstPageId);
|
||||
var secondPageElement = dialog.find('#' + config.trustDialogSecondPageId);
|
||||
|
||||
// toggle buttons
|
||||
dialog.find('.btn-primary').hide();
|
||||
dialog.find('.btn-success').removeClass('hide');
|
||||
|
||||
|
||||
// toggle pages
|
||||
firstPageElement.velocity('slideUp', {
|
||||
duration: Init.animationSpeed.dialogEvents,
|
||||
complete: function(){
|
||||
secondPageElement.velocity('slideDown', {
|
||||
duration: Init.animationSpeed.dialogEvents,
|
||||
display: 'block'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// show reload button
|
||||
showPageContent(secondPageElement);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
reload: {
|
||||
label: '<i class="fa fa-fw fa-repeat"></i> reload',
|
||||
className: ['btn-success', 'hide'].join(' '),
|
||||
callback: function(){
|
||||
// reload page
|
||||
location.reload();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
trustDialog.on('shown.bs.modal', function(e) {
|
||||
// remove close button
|
||||
var dialog = $(this);
|
||||
|
||||
dialog.find('.bootbox-close-button').remove();
|
||||
dialog.find('button').blur();
|
||||
|
||||
// show trust message
|
||||
var firstPageElement = dialog.find('#' + config.trustDialogFirstPageId);
|
||||
showPageContent(firstPageElement);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
@@ -55,7 +55,7 @@ define([
|
||||
selectElement.select2('destroy');
|
||||
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
Util.emergencyShutdown(reason);
|
||||
$(document).trigger('pf:shutdown', {reason: reason});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ define([
|
||||
addDescriptionButtonClass: 'pf-system-info-description-button', // class for "add description" button
|
||||
moduleElementToolbarClass: 'pf-table-tools', // class for "module toolbar" element
|
||||
moduleToolbarActionId: 'pf-system-info-collapse-container', // id for "module toolbar action" element
|
||||
descriptionTextareaElementClass: 'pf-system-info-description' // class for "description" textarea element (xEditable)
|
||||
descriptionTextareaElementClass: 'pf-system-info-description', // class for "description" textarea element (xEditable)
|
||||
descriptionTextareaTooltipClass: 'pf-system-info-description-tooltip' // class for "description" tooltip
|
||||
};
|
||||
|
||||
// disable Module update temporary (until. some requests/animations) are finished
|
||||
@@ -127,8 +128,8 @@ define([
|
||||
if(description !== systemData.description){
|
||||
// description changed
|
||||
|
||||
// toolbar element
|
||||
var toolbarElement = moduleElement.find('.' + config.moduleElementToolbarClass);
|
||||
// description button
|
||||
var descriptionButton = moduleElement.find('.' + config.addDescriptionButtonClass);
|
||||
|
||||
// set new value
|
||||
descriptionTextareaElement.editable('setValue', systemData.description);
|
||||
@@ -137,9 +138,7 @@ define([
|
||||
// show/activate description field
|
||||
|
||||
// show button if value is empty
|
||||
toolbarElement.velocity('slideDown',{
|
||||
duration: animationSpeedToolbar
|
||||
});
|
||||
descriptionButton.show();
|
||||
|
||||
|
||||
hideToolsActionElement();
|
||||
@@ -147,10 +146,8 @@ define([
|
||||
}else{
|
||||
// hide/disable description field
|
||||
|
||||
// hide tool buttons
|
||||
toolbarElement.velocity('slideUp',{
|
||||
duration: animationSpeedToolbar
|
||||
});
|
||||
// hide tool button
|
||||
descriptionButton.hide()
|
||||
|
||||
showToolsActionElement();
|
||||
}
|
||||
@@ -204,7 +201,7 @@ define([
|
||||
var descriptionButton = tempModuleElement.find('.' + config.addDescriptionButtonClass);
|
||||
|
||||
// toolbar element
|
||||
var toolbarElement = tempModuleElement.find('.' + config.moduleElementToolbarClass);
|
||||
//var toolbarElement = tempModuleElement.find('.' + config.moduleElementToolbarClass);
|
||||
|
||||
// description textarea element
|
||||
var descriptionTextareaElement = tempModuleElement.find('.' + config.descriptionTextareaElementClass);
|
||||
@@ -221,7 +218,7 @@ define([
|
||||
onblur: 'cancel',
|
||||
showbuttons: true,
|
||||
value: '', // value is set by trigger function updateSystemInfoModule()
|
||||
rows: 2,
|
||||
rows: 5,
|
||||
name: 'description',
|
||||
inputclass: config.descriptionTextareaElementClass,
|
||||
params: function(params){
|
||||
@@ -268,6 +265,9 @@ define([
|
||||
descriptionTextareaElement.on('shown', function(e){
|
||||
// disable module update until description field is open
|
||||
disableModuleUpdate = true;
|
||||
|
||||
// disable tooltip
|
||||
tempModuleElement.find('.' + config.descriptionTextareaTooltipClass).tooltip('disable');
|
||||
});
|
||||
|
||||
// on xEditable close
|
||||
@@ -275,13 +275,14 @@ define([
|
||||
var value = $(this).editable('getValue', true);
|
||||
|
||||
if(value.length === 0){
|
||||
// show button if value is empty
|
||||
|
||||
// show button if value is empty
|
||||
hideToolsActionElement();
|
||||
|
||||
toolbarElement.velocity('slideDown',{
|
||||
duration: animationSpeedToolbar
|
||||
});
|
||||
descriptionButton.show();
|
||||
}else{
|
||||
// enable tooltip
|
||||
tempModuleElement.find('.' + config.descriptionTextareaTooltipClass).tooltip('enable');
|
||||
}
|
||||
|
||||
// enable module update
|
||||
@@ -293,9 +294,7 @@ define([
|
||||
e.stopPropagation();
|
||||
|
||||
// hide tool buttons
|
||||
toolbarElement.velocity('slideUp',{
|
||||
duration: animationSpeedToolbar
|
||||
});
|
||||
descriptionButton.hide();
|
||||
|
||||
// show field *before* showing the element
|
||||
descriptionTextareaElement.editable('show');
|
||||
@@ -359,7 +358,8 @@ define([
|
||||
moduleToolbarClass: config.moduleElementToolbarClass,
|
||||
descriptionButtonClass: config.addDescriptionButtonClass,
|
||||
moduleToolbarActionId: config.moduleToolbarActionId,
|
||||
descriptionTextareaClass: config.descriptionTextareaElementClass
|
||||
descriptionTextareaClass: config.descriptionTextareaElementClass,
|
||||
descriptionTooltipClass: config.descriptionTextareaTooltipClass
|
||||
};
|
||||
|
||||
Render.showModule(moduleConfig, moduleData);
|
||||
|
||||
@@ -4,16 +4,25 @@ define([
|
||||
'app/util',
|
||||
'morris'
|
||||
], function($, Init, Util, Morris) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
// module info
|
||||
moduleClass: 'pf-module', // class for each module
|
||||
|
||||
// headline toolbar
|
||||
systemModuleHeadlineIcon: 'pf-module-icon-button', // class for toolbar icons in the head
|
||||
|
||||
// system killboard module
|
||||
systemKillboardModuleClass: 'pf-system-killboard-module', // module wrapper
|
||||
systemKillboardGraphsClass: 'pf-system-killboard-graphs', // wrapper for graph
|
||||
systemKillboardGraphKillsClass: 'pf-system-killboard-graph-kills' // class for system kill graph
|
||||
systemKillboardGraphKillsClass: 'pf-system-killboard-graph-kills', // class for system kill graph
|
||||
|
||||
// system killboard list
|
||||
systemKillboardListClass: 'pf-system-killboard-list', // class for a list with kill entries
|
||||
systemKillboardListEntryClass: 'pf-system-killboard-list-entry', // class for a list entry
|
||||
systemKillboardListImgShip: 'pf-system-killboard-img-ship', // class for all ship images
|
||||
systemKillboardListImgAlly: 'pf-system-killboard-img-ally', // class for all alliance logos
|
||||
systemKillboardListImgCorp: 'pf-system-killboard-img-corp' // class for all corp logos
|
||||
|
||||
};
|
||||
|
||||
@@ -34,19 +43,176 @@ define([
|
||||
return label;
|
||||
};
|
||||
|
||||
// show number of killmails
|
||||
var killMailCounterMax = 20;
|
||||
var killMailCounter = 0;
|
||||
|
||||
|
||||
var showKillmails = function(moduleElement, killboardData){
|
||||
console.log(killboardData)
|
||||
|
||||
// change order (show right to left)
|
||||
killboardData.tableData.reverse();
|
||||
|
||||
for(var i = 0; i < killboardData.tableData.length; i++){
|
||||
|
||||
// check if killMails exist in this hour
|
||||
if(killboardData.tableData[i].killmails){
|
||||
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
|
||||
moduleElement.append( $('<h5>').text(i + 'h ago'));
|
||||
|
||||
var killMailData = killboardData.tableData[i].killmails;
|
||||
|
||||
var listeElement = $('<ul>', {
|
||||
class: ['media-list', config.systemKillboardListClass].join(' ')
|
||||
});
|
||||
|
||||
for(var j = 0; j < killMailData.length; j++){
|
||||
killMailCounter++;
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
|
||||
var killData = killMailData[j];
|
||||
|
||||
var linkUrl = 'https://zkillboard.com/kill/' + killData.killID + '/';
|
||||
var victimImageUrl = 'https://image.eveonline.com/Type/' + killData.victim.shipTypeID + '_64.png';
|
||||
var killDate = getDateObjectByTimeString(killData.killTime);
|
||||
var killDateString = Util.convertDateToString(killDate);
|
||||
var killLossValue = Util.formatPrice( killData.zkb.totalValue );
|
||||
|
||||
// check for ally
|
||||
var victimAllyLogoUrl = '';
|
||||
var displayAlly = 'none';
|
||||
if(killData.victim.allianceID > 0){
|
||||
victimAllyLogoUrl = 'https://image.eveonline.com/Alliance/' + killData.victim.allianceID + '_32.png';
|
||||
displayAlly = 'block';
|
||||
}
|
||||
|
||||
// check for corp
|
||||
var victimCorpLogoUrl = '';
|
||||
var displayCorp = 'none';
|
||||
if(killData.victim.corporationID > 0){
|
||||
victimCorpLogoUrl = 'https://image.eveonline.com/Corporation/' + killData.victim.corporationID + '_32.png';
|
||||
displayCorp = 'inline';
|
||||
}
|
||||
|
||||
var liElement = $('<li>', {
|
||||
class: ['media', config.systemKillboardListEntryClass].join(' ')
|
||||
}).append(
|
||||
$('<a>', {
|
||||
href: linkUrl,
|
||||
target: '_blank'
|
||||
}).append(
|
||||
$('<img>', {
|
||||
src: victimImageUrl,
|
||||
class: ['media-object', 'pull-left', config.systemKillboardListImgShip].join(' ')
|
||||
})
|
||||
).append(
|
||||
$('<img>', {
|
||||
src: victimAllyLogoUrl,
|
||||
title: killData.victim.allianceName,
|
||||
class: ['pull-right', config.systemKillboardListImgAlly].join(' '),
|
||||
css: {display: displayAlly}
|
||||
}).attr('data-placement', 'left')
|
||||
).append(
|
||||
$('<div>', {
|
||||
class: 'media-body'
|
||||
}).append(
|
||||
$('<h5>', {
|
||||
class: 'media-heading',
|
||||
text: killData.victim.characterName
|
||||
}).prepend(
|
||||
$('<small>', {
|
||||
text: killDateString + ' - '
|
||||
})
|
||||
).prepend(
|
||||
$('<img>', {
|
||||
src: victimCorpLogoUrl,
|
||||
title: killData.victim.corporationName,
|
||||
class: [config.systemKillboardListImgCorp].join(' '),
|
||||
css: {display: displayCorp}
|
||||
})
|
||||
)
|
||||
).append(
|
||||
$('<h3>', {
|
||||
class: ['media-heading'].join(' ')
|
||||
}).append(
|
||||
$('<small>', {
|
||||
class: ['txt-color', 'txt-color-green', 'pull-right'].join(' '),
|
||||
text: killLossValue
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
listeElement.append(liElement);
|
||||
|
||||
}
|
||||
|
||||
moduleElement.append(listeElement);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// animate kill li-elements
|
||||
$('.' + config.systemKillboardListEntryClass).velocity('transition.expandIn', {
|
||||
stagger: 50,
|
||||
complete: function(){
|
||||
// init tooltips
|
||||
moduleElement.find('[title]').tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* updates the system info graph
|
||||
* @param systemId
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.updateSystemInfoGraphs = function(systemId){
|
||||
$.fn.updateSystemInfoGraphs = function(systemData){
|
||||
|
||||
var parentElement = $(this);
|
||||
var moduleElement = $(this);
|
||||
|
||||
var graphElement = $('<div>', {
|
||||
|
||||
// headline toolbar icons
|
||||
var headlineToolbar = $('<h5>', {
|
||||
class: 'pull-right'
|
||||
}).append(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-external-link ', config.systemModuleHeadlineIcon].join(' '),
|
||||
title: 'zkillboard.com'
|
||||
}).on('click', function(e){
|
||||
window.open(
|
||||
'https://zkillboard.com/system/' + systemData.systemId,
|
||||
'_blank'
|
||||
);
|
||||
}).attr('data-toggle', 'tooltip')
|
||||
);
|
||||
|
||||
moduleElement.append(headlineToolbar);
|
||||
|
||||
// headline
|
||||
var headline = $('<h5>', {
|
||||
text: 'Killboard'
|
||||
});
|
||||
|
||||
moduleElement.append(headline);
|
||||
|
||||
var killboardGraphElement = $('<div>', {
|
||||
class: config.systemKillboardGraphKillsClass
|
||||
});
|
||||
|
||||
parentElement.append(graphElement);
|
||||
moduleElement.append(killboardGraphElement);
|
||||
|
||||
var showHours = 24;
|
||||
var maxKillmailCount = 200; // limited by API
|
||||
@@ -54,25 +220,24 @@ define([
|
||||
var labelOptions = {
|
||||
align: 'center-block'
|
||||
};
|
||||
var label = '';
|
||||
|
||||
// private function draws a "system kills" graph
|
||||
var drawGraph = function(data){
|
||||
|
||||
var tableData = data.tableData;
|
||||
var label = '';
|
||||
|
||||
// change order (show right to left)
|
||||
tableData.reverse();
|
||||
|
||||
|
||||
|
||||
if(data.count === 0){
|
||||
labelOptions.type = 'label-success';
|
||||
label = getLabel( 'No kills found within 24h', labelOptions );
|
||||
graphElement.prepend( label );
|
||||
|
||||
// reduce height
|
||||
graphElement.velocity({
|
||||
height: '30px'
|
||||
},{
|
||||
duration: Init.animationSpeed.mapModule
|
||||
});
|
||||
killboardGraphElement.append( label );
|
||||
|
||||
minifyKillboardGraphElement(killboardGraphElement);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,7 +247,7 @@ define([
|
||||
|
||||
// draw chart
|
||||
Morris.Bar({
|
||||
element: graphElement,
|
||||
element: killboardGraphElement,
|
||||
resize: true,
|
||||
grid: true,
|
||||
gridStrokeWidth: 0.3,
|
||||
@@ -117,8 +282,8 @@ define([
|
||||
// show hint for recent kills
|
||||
if(tableData[tableData.length - 1].kills > 0){
|
||||
labelOptions.type = 'label-warning';
|
||||
label = getLabel( tableData[tableData.length - 1].kills + ' kills within the last hour!', labelOptions );
|
||||
graphElement.prepend( label );
|
||||
label = getLabel( tableData[tableData.length - 1].kills + ' kills within the last hour', labelOptions );
|
||||
killboardGraphElement.prepend( label );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -126,10 +291,15 @@ define([
|
||||
var localDate = new Date();
|
||||
|
||||
// cache result for 5min
|
||||
var cacheKey = systemId + '_' + localDate.getHours() + '_' + ( Math.ceil( localDate.getMinutes() / 5 ) * 5);
|
||||
var cacheKey = systemData.systemId + '_' + localDate.getHours() + '_' + ( Math.ceil( localDate.getMinutes() / 5 ) * 5);
|
||||
|
||||
if(cache.systemKillsGraphData.hasOwnProperty(cacheKey) ){
|
||||
// cached results
|
||||
|
||||
drawGraph( cache.systemKillsGraphData[cacheKey] );
|
||||
|
||||
// show killmail information
|
||||
showKillmails(moduleElement, cache.systemKillsGraphData[cacheKey]);
|
||||
}else{
|
||||
|
||||
// chart data
|
||||
@@ -144,31 +314,28 @@ define([
|
||||
chartData.push(tempData);
|
||||
}
|
||||
|
||||
// get kills within the last 24h
|
||||
var timeFrameInSeconds = 60 * 60 * 24;
|
||||
|
||||
// get current server time
|
||||
var serverDate= Util.getServerTime();
|
||||
|
||||
// get all kills until current server time
|
||||
var dateStringEnd = String( serverDate.getFullYear() );
|
||||
dateStringEnd += String( ('0' + (serverDate.getMonth() + 1)).slice(-2) );
|
||||
dateStringEnd += String( ('0' + serverDate.getDate()).slice(-2) );
|
||||
dateStringEnd += String( ('0' + serverDate.getHours()).slice(-2) );
|
||||
dateStringEnd += String( ('0' + serverDate.getMinutes()).slice(-2) );
|
||||
|
||||
// get start Date for kills API request (last 24h)
|
||||
var startDate = new Date( serverDate.getTime() );
|
||||
startDate.setDate( startDate.getDate() - 1);
|
||||
var dateStringStart = String( startDate.getFullYear() );
|
||||
dateStringStart += String( ('0' + (startDate.getMonth() + 1)).slice(-2) );
|
||||
dateStringStart += String( ('0' + startDate.getDate()).slice(-2) );
|
||||
dateStringStart += String( ('0' + startDate.getHours()).slice(-2) );
|
||||
dateStringStart += String( ('0' + startDate.getMinutes()).slice(-2) );
|
||||
// if system is w-space system -> add link modifier
|
||||
var wSpaceLinkModifier = '';
|
||||
if(systemData.type.id === 1){
|
||||
wSpaceLinkModifier = 'w-space/';
|
||||
}
|
||||
|
||||
var url = Init.url.zKillboard;
|
||||
url += '/no-items/no-attackers/solarSystemID/' + systemId + '/startTime/' + dateStringStart + '/endTime/' + dateStringEnd + '/';
|
||||
url += 'no-items/' + wSpaceLinkModifier + 'no-attackers/solarSystemID/' + systemData.systemId + '/pastSeconds/' + timeFrameInSeconds + '/';
|
||||
|
||||
graphElement.showLoadingAnimation();
|
||||
killboardGraphElement.showLoadingAnimation();
|
||||
|
||||
$.getJSON(url, function(kbData){
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
dataType: 'jsonp'
|
||||
}).done(function(kbData){
|
||||
|
||||
// the API wont return more than 200KMs ! - remember last bar block with complete KM information
|
||||
var lastCompleteDiffHourData = 0;
|
||||
@@ -176,8 +343,9 @@ define([
|
||||
|
||||
// loop kills and count kills by hour
|
||||
for(var i = 0; i < kbData.length; i++){
|
||||
var match = kbData[i].killTime.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);
|
||||
var killDate = new Date(match[1], match[2] - 1, match[3], match[4], match[5], match[6]);
|
||||
var killmailData = kbData[i];
|
||||
|
||||
var killDate = getDateObjectByTimeString(killmailData.killTime);
|
||||
|
||||
// get time diff
|
||||
var timeDiffMin = Math.round( ( serverDate - killDate ) / 1000 / 60 );
|
||||
@@ -187,6 +355,12 @@ define([
|
||||
if(chartData[timeDiffHour]){
|
||||
chartData[timeDiffHour].kills++;
|
||||
|
||||
// add kill mail data
|
||||
if(chartData[timeDiffHour].killmails === undefined){
|
||||
chartData[timeDiffHour].killmails = [];
|
||||
}
|
||||
chartData[timeDiffHour].killmails.push(killmailData);
|
||||
|
||||
if(timeDiffHour > lastCompleteDiffHourData){
|
||||
lastCompleteDiffHourData = timeDiffHour;
|
||||
}
|
||||
@@ -199,22 +373,65 @@ define([
|
||||
chartData = chartData.splice(0, lastCompleteDiffHourData + 1);
|
||||
}
|
||||
|
||||
// change order
|
||||
chartData.reverse();
|
||||
|
||||
// fill cache
|
||||
cache.systemKillsGraphData[cacheKey] = {};
|
||||
cache.systemKillsGraphData[cacheKey].tableData = chartData;
|
||||
cache.systemKillsGraphData[cacheKey].count = kbData.length;
|
||||
|
||||
// draw table
|
||||
drawGraph( cache.systemKillsGraphData[cacheKey] );
|
||||
|
||||
parentElement.hideLoadingAnimation();
|
||||
// show killmail information
|
||||
showKillmails(moduleElement, cache.systemKillsGraphData[cacheKey]);
|
||||
|
||||
killboardGraphElement.hideLoadingAnimation();
|
||||
}).error(function(e){
|
||||
|
||||
labelOptions.type = 'label-danger';
|
||||
label = getLabel( 'zKillboard is not responding', labelOptions );
|
||||
killboardGraphElement.prepend( label );
|
||||
|
||||
killboardGraphElement.hideLoadingAnimation();
|
||||
|
||||
minifyKillboardGraphElement(killboardGraphElement);
|
||||
|
||||
Util.showNotify({title: e.status + ': Get system kills', text: 'Loading failed', type: 'error'});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// init tooltips
|
||||
var tooltipElements = moduleElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* minify the killboard graph element e.g. if no kills where found, or on error
|
||||
* @param killboardGraphElement
|
||||
*/
|
||||
var minifyKillboardGraphElement = function(killboardGraphElement){
|
||||
killboardGraphElement.velocity({
|
||||
height: '20px',
|
||||
marginBottom: '0px'
|
||||
},{
|
||||
duration: Init.animationSpeed.mapModule
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* transform timestring
|
||||
* @param timeString
|
||||
* @returns {Date}
|
||||
*/
|
||||
var getDateObjectByTimeString = function(timeString){
|
||||
var match = timeString.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);
|
||||
var date = new Date(match[1], match[2] - 1, match[3], match[4], match[5], match[6]);
|
||||
|
||||
return date;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -230,22 +447,10 @@ define([
|
||||
css: {opacity: 0}
|
||||
});
|
||||
|
||||
// headline
|
||||
var headline = $('<h5>', {
|
||||
text: 'Killboard'
|
||||
});
|
||||
|
||||
// graph element
|
||||
var graphElement = $('<div>', {
|
||||
class: config.systemKillboardGraphsClass
|
||||
});
|
||||
|
||||
moduleElement.append(headline, graphElement);
|
||||
|
||||
parentElement.append(moduleElement);
|
||||
|
||||
// update graph
|
||||
graphElement.updateSystemInfoGraphs(systemData.systemId);
|
||||
moduleElement.updateSystemInfoGraphs(systemData);
|
||||
|
||||
return moduleElement;
|
||||
};
|
||||
|
||||
@@ -15,10 +15,10 @@ define([
|
||||
moduleClass: 'pf-module', // class for each module
|
||||
|
||||
// system route module
|
||||
systemRouteModuleClass: 'pf-system-route-module', // class for this module
|
||||
systemRouteModuleClass: 'pf-system-route-module', // class for this module
|
||||
|
||||
// tables
|
||||
tableToolsClass: 'pf-table-tools', // table toolbar
|
||||
// headline toolbar
|
||||
systemModuleHeadlineIcon: 'pf-module-icon-button', // class for toolbar icons in the head
|
||||
|
||||
systemSecurityClassPrefix: 'pf-system-security-', // prefix class for system security level (color)
|
||||
|
||||
@@ -30,11 +30,11 @@ define([
|
||||
|
||||
};
|
||||
|
||||
// cache for system routes
|
||||
var cache = {
|
||||
systemRoutes: {} // jump information between solar systems
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* callback function, adds new row to a dataTable with jump information for a route
|
||||
* @param context
|
||||
@@ -193,7 +193,7 @@ define([
|
||||
|
||||
systemSecClass += tempSystemSec.replace('.', '-');
|
||||
var system = '<i class="fa fa-square ' + systemSecClass + '" ';
|
||||
system += 'data-toggle="tooltip" data-placement="bottom" ';
|
||||
system += 'data-toggle="tooltip" data-placement="bottom" data-container="body" ';
|
||||
system += 'title="' + systemData.to.name + ' [' + systemSec + '] ' + systemData.to.region.name + '"></i>';
|
||||
jumpData.push( system );
|
||||
|
||||
@@ -217,6 +217,30 @@ define([
|
||||
class: [config.moduleClass, config.systemRouteModuleClass].join(' ')
|
||||
});
|
||||
|
||||
|
||||
// headline toolbar icons
|
||||
var headlineToolbar = $('<h5>', {
|
||||
class: 'pull-right'
|
||||
}).append(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-search', config.systemModuleHeadlineIcon].join(' '),
|
||||
title: 'find route'
|
||||
}).on('click', function(e){
|
||||
// show "find route" dialog
|
||||
|
||||
var dialogData = {
|
||||
moduleElement: moduleElement,
|
||||
systemFrom: systemFrom,
|
||||
dataTable: routesTable
|
||||
};
|
||||
|
||||
showFindRouteDialog(dialogData);
|
||||
}).attr('data-toggle', 'tooltip')
|
||||
);
|
||||
|
||||
moduleElement.append(headlineToolbar);
|
||||
|
||||
|
||||
// headline
|
||||
var headline = $('<h5>', {
|
||||
class: 'pull-left',
|
||||
@@ -225,6 +249,13 @@ define([
|
||||
|
||||
moduleElement.append(headline);
|
||||
|
||||
// init tooltips
|
||||
var tooltipElements = moduleElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
|
||||
var systemFrom = systemData.name;
|
||||
var systemsTo = ['Jita', 'Amarr', 'Rens', 'Dodixie'];
|
||||
|
||||
@@ -265,34 +296,6 @@ define([
|
||||
data: [] // will be added dynamic
|
||||
});
|
||||
|
||||
// add toolbar buttons for table -------------------------------------
|
||||
var tableToolbar = $('<div>', {
|
||||
class: [config.tableToolsClass, 'pull-right'].join(' ')
|
||||
}).append(
|
||||
$('<button>', {
|
||||
class: ['btn', 'btn-primary', 'btn-sm'].join(' '),
|
||||
text: ' search route',
|
||||
type: 'button'
|
||||
}).on('click', function(e){
|
||||
// show "find route" dialog
|
||||
|
||||
var dialogData = {
|
||||
moduleElement: moduleElement,
|
||||
systemFrom: systemFrom,
|
||||
dataTable: routesTable
|
||||
};
|
||||
|
||||
showFindRouteDialog(dialogData);
|
||||
}).prepend(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-search', 'fa-fw'].join(' ')
|
||||
})
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
headline.after(tableToolbar);
|
||||
|
||||
|
||||
// fill routesTable with data -------------------------------------------
|
||||
for(var i = 0; i < systemsTo.length; i++){
|
||||
|
||||
104
js/app/util.js
104
js/app/util.js
@@ -63,7 +63,16 @@ define([
|
||||
var getServerTime = function(){
|
||||
|
||||
// Server is running with GMT/UTC (EVE Time)
|
||||
var serverDate = new Date();
|
||||
var localDate = new Date();
|
||||
|
||||
var serverDate= new Date(
|
||||
localDate.getUTCFullYear(),
|
||||
localDate.getUTCMonth(),
|
||||
localDate.getUTCDate(),
|
||||
localDate.getUTCHours(),
|
||||
localDate.getUTCMinutes(),
|
||||
localDate.getUTCSeconds()
|
||||
);
|
||||
|
||||
return serverDate;
|
||||
};
|
||||
@@ -795,87 +804,15 @@ define([
|
||||
return areaId;
|
||||
};
|
||||
|
||||
/**
|
||||
* shut the software down e.g. on error
|
||||
* @param reason
|
||||
*/
|
||||
var emergencyShutdown = function(reason){
|
||||
|
||||
// close all open dialogs
|
||||
bootbox.hideAll();
|
||||
|
||||
var content = $('<div>');
|
||||
|
||||
content.append(
|
||||
$('<h2>', {
|
||||
text: 'Sorry! Under normal circumstances that should not happen.'
|
||||
})
|
||||
);
|
||||
|
||||
content.append(
|
||||
$('<p>', {
|
||||
text: reason
|
||||
})
|
||||
);
|
||||
|
||||
var systemDialog = bootbox.dialog({
|
||||
title: '<span class="txt-color txt-color-red"><i class="fa fa-fw fa-bolt"></i>Emergency shutdown</span>',
|
||||
message: content,
|
||||
buttons: {
|
||||
danger: {
|
||||
label: 'restart',
|
||||
className: 'btn-danger',
|
||||
callback: function () {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).setProgramStatus('offline');
|
||||
showNotify({title: 'Emergency shutdown', text: reason, type: 'error'}, false);
|
||||
|
||||
// remove map
|
||||
getMapModule().velocity('fadeOut', {
|
||||
duration: 300,
|
||||
complete: function(){
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* set currentUserData as "global" variable
|
||||
* @param userData
|
||||
*/
|
||||
var setCurrentUserData = function(userData){
|
||||
|
||||
var currentUserData = getCurrentUserData();
|
||||
|
||||
// check if userData has changed
|
||||
var changed = false;
|
||||
|
||||
if(
|
||||
currentUserData === undefined &&
|
||||
userData !== undefined
|
||||
){
|
||||
changed = true;
|
||||
}else if(userData.character
|
||||
){
|
||||
if(currentUserData.character === undefined){
|
||||
changed = true;
|
||||
}else if( userData.character.characterId !== currentUserData.character.characterId ){
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Init.currentUserData = userData;
|
||||
|
||||
// update head if user data has changed
|
||||
if(changed){
|
||||
$.fn.updateHeaderUserData();
|
||||
}
|
||||
$.fn.updateHeaderUserData();
|
||||
|
||||
return getCurrentUserData();
|
||||
};
|
||||
@@ -904,6 +841,20 @@ define([
|
||||
return Init.currentSystemData;
|
||||
};
|
||||
|
||||
/**
|
||||
* formats a price string into an ISK Price
|
||||
* @param price
|
||||
* @returns {string}
|
||||
*/
|
||||
var formatPrice = function(price){
|
||||
price = Number( price ).toFixed(2);
|
||||
|
||||
var parts = price.toString().split('.');
|
||||
price = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',') + (parts[1] ? '.' + parts[1] : '');
|
||||
|
||||
return price + ' ISK';
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Date as UTC
|
||||
* @param date
|
||||
@@ -1032,10 +983,11 @@ define([
|
||||
getAllSignatureNames: getAllSignatureNames,
|
||||
getSignatureTypeIdByName: getSignatureTypeIdByName,
|
||||
getAreaIdBySecurity: getAreaIdBySecurity,
|
||||
emergencyShutdown: emergencyShutdown,
|
||||
setCurrentUserData: setCurrentUserData,
|
||||
getCurrentUserData: getCurrentUserData,
|
||||
setCurrentSystemData: setCurrentSystemData,
|
||||
getCurrentSystemData: getCurrentSystemData
|
||||
getCurrentSystemData: getCurrentSystemData,
|
||||
convertDateToString: convertDateToString,
|
||||
formatPrice: formatPrice
|
||||
};
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
10
public/templates/dialog/shutdown.html
Normal file
10
public/templates/dialog/shutdown.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<div id="{{id}}" class="txt-center">
|
||||
|
||||
<h1 style="opacity: 0;" class="text-center txt-color txt-color-red">
|
||||
<strong>
|
||||
<i class="fa fa-bolt fa-fw"></i>Emergency shutdown
|
||||
</strong>
|
||||
</h1>
|
||||
<h5 class="text-center">Sorry! Under normal circumstances that should not happen</h5>
|
||||
<h5 class="text-center">{{reason}}</h5>
|
||||
</div>
|
||||
20
public/templates/dialog/trust.html
Normal file
20
public/templates/dialog/trust.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<div id="{{id}}" class="txt-center">
|
||||
<div id="{{firstPageId}}">
|
||||
<h1 style="opacity: 0;" class="text-center txt-color txt-color-orange">
|
||||
<strong>
|
||||
<i class="fa fa-unlock fa-fw"></i>Trust Page
|
||||
</strong>
|
||||
</h1>
|
||||
<h5 class="text-center">Please set trust for <em class="pf-brand">pathfinder</em></h5>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="{{secondPageId}}" style=" display: none;">
|
||||
<h1 style="opacity: 0;" class="text-center txt-color txt-color-green">
|
||||
<strong>
|
||||
<i class="fa fa-repeat fa-fw"></i>Refresh Page
|
||||
</strong>
|
||||
</h1>
|
||||
<h5 class="text-center">Please refresh this page so that the changes will take effect</h5>
|
||||
</div>
|
||||
</div>
|
||||
@@ -8,9 +8,13 @@
|
||||
<p class="navbar-text {{userCharacterClass}}" title="settings">
|
||||
<a href="javascript:void(0);">
|
||||
<img class="{{userCharacterImageClass}}" src=""/>
|
||||
<span>{{! will be filled with current user data }}</span>
|
||||
<span>{{! will be filled with current user name }}</span>
|
||||
</a>
|
||||
</p>
|
||||
<p class="navbar-text {{userShipClass}}">
|
||||
<img class="{{userShipImageClass}}" src=""/>
|
||||
<span>{{! will be filled with current user ship name }}</span>
|
||||
</p>
|
||||
<p class="navbar-text pf-head-active-user" title="active Pilots">
|
||||
<a href="javascript:void(0);">
|
||||
<i class="fa fa-plane fa-fw"></i>active <span class="badge txt-color"></span>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
{{#system.alias}}
|
||||
<h5 class="pull-right" style="display: inline-block">
|
||||
<span data-toggle="tooltip" data-placement="top" data-container="body" title="alias">
|
||||
{{system.alias}}
|
||||
</span>
|
||||
<h5 class="pull-right" data-toggle="tooltip" data-placement="top" data-container="body" title="system alias">
|
||||
{{system.alias}}
|
||||
</h5>
|
||||
{{/system.alias}}
|
||||
|
||||
@@ -24,22 +22,18 @@
|
||||
<a href="http://wh.pasta.gg/{{system.name}}" target="_blank">
|
||||
<div data-toggle="tooltip" data-placement="top" data-container="body" title="wormhol" class="pf-icon pf-icon-wormhol-es"></div>
|
||||
</a>
|
||||
<a href="https://zkillboard.com/system/{{system.systemId}}" target="_blank">
|
||||
<div data-toggle="tooltip" data-placement="top" data-container="body" title="zKillbaord" class="pf-icon pf-icon-zkillboard"></div>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
{{! info text ================================================================================================ }}
|
||||
<div class="col-xs-12 col-sm-7">
|
||||
<div class="pf-dynamic-area">
|
||||
<div class="{{moduleToolbarClass}}">
|
||||
<button class="btn btn-primary btn-sm {{descriptionButtonClass}}" type="button"><i class="fa fa-plus fa-fw"></i> add description</button>
|
||||
</div>
|
||||
<div class="pf-dynamic-area pf-system-info-description-area">
|
||||
<i class="fa fa-fw fa-lg fa-pencil pull-right pf-module-icon-button {{descriptionButtonClass}}" data-toggle="tooltip" data-container="body" title="edit description"></i>
|
||||
|
||||
<div id="{{moduleToolbarActionId}}" class="pf-table-tools-action">
|
||||
<span data-toggle="tooltip" data-placement="bottom" data-container="body" title="System description">
|
||||
<span class="{{descriptionTooltipClass}}" data-toggle="tooltip" data-placement="bottom" data-container="body" title="System description">
|
||||
<a style="width: 200px" href="#" class="{{descriptionTextareaClass}}" data-title="Enter username"></a>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,12 +41,13 @@
|
||||
|
||||
{{! info table ================================================================================================ }}
|
||||
<div class="col-xs-12 col-sm-5">
|
||||
|
||||
<span data-toggle="tooltip" data-placement="top" data-container="body" title="system status" data-status="{{systemStatusId}}" class="label center-block {{statusInfoClass}} {{systemStatusClass}}">
|
||||
{{systemStatusLabel}}
|
||||
</span>
|
||||
|
||||
|
||||
<div class="pf-dynamic-area">
|
||||
|
||||
<span data-status="{{systemStatusId}}" class="label center-block {{statusInfoClass}} {{systemStatusClass}}">
|
||||
{{systemStatusLabel}}
|
||||
</span>
|
||||
|
||||
<table class="table table-condensed {{tableClass}}">
|
||||
<colgroup>
|
||||
<col class="col-sm-1">
|
||||
|
||||
@@ -23,9 +23,14 @@
|
||||
<link rel="icon" type="image/png" href="favicons/favicon-32x32.png" sizes="32x32">
|
||||
<meta name="msapplication-TileColor" content="#2d89ef">
|
||||
<meta name="msapplication-TileImage" content="favicons/mstile-144x144.png">
|
||||
|
||||
<!--
|
||||
<meta http-equiv="Cache-Control" content="no-store" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
-->
|
||||
<!-- TEMP -->
|
||||
<meta http-equiv="no-cache">
|
||||
<meta http-equiv="Expires" content="-1">
|
||||
<meta http-equiv="Cache-Control" content="no-cache">
|
||||
|
||||
<meta name="description" content="eve-online wormhole mapping tool">
|
||||
<meta name="keywords" content="eve,wormhole,mapping,tool,mmo,space,game,igb">
|
||||
@@ -36,7 +41,7 @@
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="public/css/pathfinder.css">
|
||||
|
||||
</head>
|
||||
<body class="pf-body">
|
||||
<body class="pf-body" data-trusted="{{ @trusted }}">
|
||||
|
||||
<!-- Hey Bob! Where is all the magic? -->
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
background-color: $badge-bg;
|
||||
border-radius: $badge-border-radius;
|
||||
@include border-radius($badge-border-radius);
|
||||
|
||||
|
||||
// Empty badges collapse automatically (not available in IE8)
|
||||
&:empty {
|
||||
|
||||
@@ -77,17 +77,6 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
// icon buttons within a dialog
|
||||
.pf-dialog-icon-button{
|
||||
cursor: pointer;
|
||||
@include transition(color 0.15s ease-out);
|
||||
will-change: color, transition;
|
||||
|
||||
&:not(.collapsed), &:hover{
|
||||
color: $orange;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// settings dialog ======================================================================
|
||||
|
||||
@@ -16,12 +16,4 @@
|
||||
height: 17px;
|
||||
opacity: 0.8;
|
||||
margin: -5px 0px 0 10px;
|
||||
}
|
||||
|
||||
.pf-icon-zkillboard{
|
||||
background: inline-image("#{$base-url}/icons/zkillboard_logo.png");
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
opacity: 0.8;
|
||||
margin: -5px 0px 0 10px;
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,20 @@ body{
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.pf-body{
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
a{
|
||||
color: $teal-dark;
|
||||
will-change: color;
|
||||
text-decoration: none;
|
||||
@include transition( color 0.08s ease-out );
|
||||
|
||||
&:hover{
|
||||
color: $teal-light;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +53,26 @@ em{
|
||||
}
|
||||
}
|
||||
|
||||
// icon buttons =====================================================
|
||||
.pf-dialog-icon-button{
|
||||
cursor: pointer;
|
||||
@include transition(color 0.15s ease-out);
|
||||
|
||||
&:not(.collapsed), &:hover{
|
||||
color: $orange;
|
||||
}
|
||||
}
|
||||
|
||||
.pf-module-icon-button{
|
||||
cursor: pointer;
|
||||
@include transition(color 0.15s ease-out);
|
||||
|
||||
&:hover{
|
||||
color: $orange;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// table styles =====================================================
|
||||
|
||||
// table icon toolbar
|
||||
@@ -226,10 +252,14 @@ em{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
// all labels in a module
|
||||
.label{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
// dynamic areas as child of a module
|
||||
.pf-dynamic-area{
|
||||
background: rgba($gray-darker, 0.6);
|
||||
background: rgba($gray-darker, 0.4);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -592,7 +622,7 @@ em{
|
||||
// dynamic area (e.g. for loading animation =====================
|
||||
.pf-dynamic-area{
|
||||
padding: 10px;
|
||||
min-height: 105px;
|
||||
min-height: 100px;
|
||||
position: relative;
|
||||
background-color: $gray-dark;
|
||||
overflow: hidden;
|
||||
@@ -662,7 +692,7 @@ em{
|
||||
}
|
||||
|
||||
|
||||
.pf-head-user-character{
|
||||
.pf-head-user-character, .pf-head-user-ship{
|
||||
opacity: 0; // triggered by js
|
||||
visibility: 'hidden';
|
||||
}
|
||||
@@ -675,7 +705,7 @@ em{
|
||||
}
|
||||
}
|
||||
|
||||
.pf-head-user-character-image{
|
||||
.pf-head-user-character-image, .pf-head-user-ship-image{
|
||||
display: inline-block;
|
||||
margin-top: -6px;
|
||||
margin-bottom: -6px;
|
||||
@@ -709,7 +739,7 @@ em{
|
||||
background: rgba($gray, 0.3);
|
||||
|
||||
a{
|
||||
font-family: $font-family-serif;
|
||||
font-family: $font-family-bold;
|
||||
color: $teal-darker;
|
||||
|
||||
&:hover{
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
// textarea system description
|
||||
.pf-system-info-description{
|
||||
width: 300px;
|
||||
}
|
||||
// dynamic area specific for the description field
|
||||
.pf-system-info-description-area{
|
||||
min-height: 123px;
|
||||
|
||||
.pf-system-info-table{
|
||||
margin-top: 5px;
|
||||
// textarea system description
|
||||
.pf-system-info-description{
|
||||
width: 330px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -129,14 +130,81 @@
|
||||
// killboard module ======================================================
|
||||
.pf-system-killboard-module{
|
||||
|
||||
.pf-system-killboard-graphs{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pf-system-killboard-graph-kills{
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
position: relative;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.pf-system-killboard-list{
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid $gray-darker;
|
||||
|
||||
|
||||
li{
|
||||
margin-left: 0;
|
||||
overflow: visible;
|
||||
min-height: 50px;
|
||||
will-change: margin-left;
|
||||
@include transition( margin-left 0.12s cubic-bezier(0.30, 0.80, 0.80, 1.70));
|
||||
|
||||
// character headline
|
||||
h5{
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
// ISK headline
|
||||
h3{
|
||||
width: 120px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.pf-system-killboard-img-corp{
|
||||
margin-right: 10px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.pf-system-killboard-img-ship{
|
||||
width: 50px;
|
||||
margin-right: 10px;
|
||||
border: 1px solid $gray-darker;
|
||||
transform: translateZ(1px);
|
||||
will-change: border-color;
|
||||
@include border-radius(25px);
|
||||
@include transition( border-color 0.12s ease-out);
|
||||
}
|
||||
|
||||
&:before{
|
||||
content: "\f054";
|
||||
font-family: FontAwesome;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
left: -25px;
|
||||
top: 15px;
|
||||
color: $teal-dark;
|
||||
opacity: 0;
|
||||
will-change: opacity, left;
|
||||
@include transition(all 0.12s ease-out);
|
||||
}
|
||||
|
||||
&:hover{
|
||||
margin-left: 20px;
|
||||
|
||||
.pf-system-killboard-img-ship{
|
||||
border-color: $teal;
|
||||
}
|
||||
|
||||
&:before{
|
||||
opacity: 1;
|
||||
left: -20px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user