- added new zKillboard links for Corp/Ally/Char KBs, closed #650
- fixed JS error with keyboard shortcuts
This commit is contained in:
@@ -284,10 +284,12 @@ define([
|
||||
};
|
||||
|
||||
let evKeyUp = (e) => {
|
||||
let key = e.key.toUpperCase();
|
||||
if(e.key){
|
||||
let key = e.key.toUpperCase();
|
||||
|
||||
if(map.hasOwnProperty(key)){
|
||||
delete map[key];
|
||||
if(map.hasOwnProperty(key)){
|
||||
delete map[key];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -47,8 +47,6 @@ define([
|
||||
}),
|
||||
formatStatic: function(){
|
||||
return function(value, render){
|
||||
console.log(render(value));
|
||||
console.log(typeof render(value));
|
||||
let isStatic = render(value) === 'true';
|
||||
if(isStatic){
|
||||
return '<i class="fas fa-check"></i>';
|
||||
|
||||
@@ -372,7 +372,7 @@ define([
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log(systemData)
|
||||
|
||||
let moduleData = {
|
||||
system: systemData,
|
||||
static: staticsData,
|
||||
|
||||
@@ -24,6 +24,7 @@ define([
|
||||
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
|
||||
systemKillboardListImgChar: 'pf-system-killboard-img-char', // class for all character logos
|
||||
systemKillboardListImgAlly: 'pf-system-killboard-img-ally', // class for all alliance logos
|
||||
systemKillboardListImgCorp: 'pf-system-killboard-img-corp' // class for all corp logos
|
||||
};
|
||||
@@ -60,125 +61,59 @@ define([
|
||||
// change order (show right to left)
|
||||
killboardData.tableData.reverse();
|
||||
|
||||
for(let i = 0; i < killboardData.tableData.length; i++){
|
||||
let data = {
|
||||
tableData: killboardData.tableData,
|
||||
systemKillboardListClass: config.systemKillboardListClass,
|
||||
systemKillboardListEntryClass: config.systemKillboardListEntryClass,
|
||||
systemKillboardListImgShip: config.systemKillboardListImgShip,
|
||||
systemKillboardListImgChar: config.systemKillboardListImgChar,
|
||||
systemKillboardListImgAlly: config.systemKillboardListImgAlly,
|
||||
systemKillboardListImgCorp: config.systemKillboardListImgCorp,
|
||||
zKillboardUrl: 'https://zkillboard.com',
|
||||
ccpImageServerUrl: Init.url.ccpImageServer,
|
||||
|
||||
// check if killMails exist in this hour
|
||||
if(killboardData.tableData[i].killmails){
|
||||
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
|
||||
moduleElement.append( $('<h5>').text( i ? i + 'h ago' : 'recent'));
|
||||
|
||||
let killMailData = killboardData.tableData[i].killmails;
|
||||
|
||||
let listeElement = $('<ul>', {
|
||||
class: ['media-list', config.systemKillboardListClass].join(' ')
|
||||
});
|
||||
|
||||
for(let j = 0; j < killMailData.length; j++){
|
||||
dateFormat: () => {
|
||||
return (val, render) => {
|
||||
let killDate = Util.convertDateToUTC(new Date(render(val)));
|
||||
return Util.convertDateToString(killDate);
|
||||
};
|
||||
},
|
||||
iskFormat: () => {
|
||||
return (val, render) => {
|
||||
return Util.formatPrice(render(val));
|
||||
};
|
||||
},
|
||||
checkRender : () => {
|
||||
return (val, render) => {
|
||||
if(killMailCounter < killMailCounterMax){
|
||||
return render(val);
|
||||
}
|
||||
};
|
||||
},
|
||||
increaseCount : () => {
|
||||
return (val, render) => {
|
||||
killMailCounter++;
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
let killData = killMailData[j];
|
||||
requirejs(['text!templates/modules/killboard.html', 'mustache'], function(template, Mustache) {
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
let linkUrl = '//zkillboard.com/kill/' + killData.killmail_id + '/';
|
||||
let victimImageUrl = Init.url.ccpImageServer + '/Type/' + killData.victim.ship_type_id + '_64.png';
|
||||
let killDate = Util.convertDateToUTC(new Date(killData.killmail_time));
|
||||
let killDateString = Util.convertDateToString(killDate);
|
||||
let killLossValue = Util.formatPrice( killData.zkb.totalValue );
|
||||
moduleElement.append(content);
|
||||
|
||||
// check for ally
|
||||
let victimAllyLogoUrl = '';
|
||||
let displayAlly = 'none';
|
||||
if(killData.victim.alliance_id > 0){
|
||||
victimAllyLogoUrl = Init.url.ccpImageServer + '/Alliance/' + killData.victim.alliance_id + '_32.png';
|
||||
displayAlly = 'block';
|
||||
}
|
||||
|
||||
// check for corp
|
||||
let victimCorpLogoUrl = '';
|
||||
let displayCorp = 'none';
|
||||
if(killData.victim.corporation_id > 0){
|
||||
victimCorpLogoUrl = Init.url.ccpImageServer + '/Corporation/' + killData.victim.corporation_id + '_32.png';
|
||||
displayCorp = 'inline';
|
||||
}
|
||||
|
||||
let 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);
|
||||
// animate kill li-elements
|
||||
$('.' + config.systemKillboardListEntryClass).velocity('transition.expandIn', {
|
||||
stagger: 50,
|
||||
complete: function(){
|
||||
// init tooltips
|
||||
moduleElement.find('[title]').tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
moduleElement.append(listeElement);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// animate kill li-elements
|
||||
$('.' + config.systemKillboardListEntryClass).velocity('transition.expandIn', {
|
||||
stagger: 50,
|
||||
complete: function(){
|
||||
// init tooltips
|
||||
moduleElement.find('[title]').tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -284,10 +284,12 @@ define([
|
||||
};
|
||||
|
||||
let evKeyUp = (e) => {
|
||||
let key = e.key.toUpperCase();
|
||||
if(e.key){
|
||||
let key = e.key.toUpperCase();
|
||||
|
||||
if(map.hasOwnProperty(key)){
|
||||
delete map[key];
|
||||
if(map.hasOwnProperty(key)){
|
||||
delete map[key];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -47,8 +47,6 @@ define([
|
||||
}),
|
||||
formatStatic: function(){
|
||||
return function(value, render){
|
||||
console.log(render(value));
|
||||
console.log(typeof render(value));
|
||||
let isStatic = render(value) === 'true';
|
||||
if(isStatic){
|
||||
return '<i class="fas fa-check"></i>';
|
||||
|
||||
@@ -372,7 +372,7 @@ define([
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log(systemData)
|
||||
|
||||
let moduleData = {
|
||||
system: systemData,
|
||||
static: staticsData,
|
||||
|
||||
@@ -24,6 +24,7 @@ define([
|
||||
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
|
||||
systemKillboardListImgChar: 'pf-system-killboard-img-char', // class for all character logos
|
||||
systemKillboardListImgAlly: 'pf-system-killboard-img-ally', // class for all alliance logos
|
||||
systemKillboardListImgCorp: 'pf-system-killboard-img-corp' // class for all corp logos
|
||||
};
|
||||
@@ -60,125 +61,59 @@ define([
|
||||
// change order (show right to left)
|
||||
killboardData.tableData.reverse();
|
||||
|
||||
for(let i = 0; i < killboardData.tableData.length; i++){
|
||||
let data = {
|
||||
tableData: killboardData.tableData,
|
||||
systemKillboardListClass: config.systemKillboardListClass,
|
||||
systemKillboardListEntryClass: config.systemKillboardListEntryClass,
|
||||
systemKillboardListImgShip: config.systemKillboardListImgShip,
|
||||
systemKillboardListImgChar: config.systemKillboardListImgChar,
|
||||
systemKillboardListImgAlly: config.systemKillboardListImgAlly,
|
||||
systemKillboardListImgCorp: config.systemKillboardListImgCorp,
|
||||
zKillboardUrl: 'https://zkillboard.com',
|
||||
ccpImageServerUrl: Init.url.ccpImageServer,
|
||||
|
||||
// check if killMails exist in this hour
|
||||
if(killboardData.tableData[i].killmails){
|
||||
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
|
||||
moduleElement.append( $('<h5>').text( i ? i + 'h ago' : 'recent'));
|
||||
|
||||
let killMailData = killboardData.tableData[i].killmails;
|
||||
|
||||
let listeElement = $('<ul>', {
|
||||
class: ['media-list', config.systemKillboardListClass].join(' ')
|
||||
});
|
||||
|
||||
for(let j = 0; j < killMailData.length; j++){
|
||||
dateFormat: () => {
|
||||
return (val, render) => {
|
||||
let killDate = Util.convertDateToUTC(new Date(render(val)));
|
||||
return Util.convertDateToString(killDate);
|
||||
};
|
||||
},
|
||||
iskFormat: () => {
|
||||
return (val, render) => {
|
||||
return Util.formatPrice(render(val));
|
||||
};
|
||||
},
|
||||
checkRender : () => {
|
||||
return (val, render) => {
|
||||
if(killMailCounter < killMailCounterMax){
|
||||
return render(val);
|
||||
}
|
||||
};
|
||||
},
|
||||
increaseCount : () => {
|
||||
return (val, render) => {
|
||||
killMailCounter++;
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
let killData = killMailData[j];
|
||||
requirejs(['text!templates/modules/killboard.html', 'mustache'], function(template, Mustache) {
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
let linkUrl = '//zkillboard.com/kill/' + killData.killmail_id + '/';
|
||||
let victimImageUrl = Init.url.ccpImageServer + '/Type/' + killData.victim.ship_type_id + '_64.png';
|
||||
let killDate = Util.convertDateToUTC(new Date(killData.killmail_time));
|
||||
let killDateString = Util.convertDateToString(killDate);
|
||||
let killLossValue = Util.formatPrice( killData.zkb.totalValue );
|
||||
moduleElement.append(content);
|
||||
|
||||
// check for ally
|
||||
let victimAllyLogoUrl = '';
|
||||
let displayAlly = 'none';
|
||||
if(killData.victim.alliance_id > 0){
|
||||
victimAllyLogoUrl = Init.url.ccpImageServer + '/Alliance/' + killData.victim.alliance_id + '_32.png';
|
||||
displayAlly = 'block';
|
||||
}
|
||||
|
||||
// check for corp
|
||||
let victimCorpLogoUrl = '';
|
||||
let displayCorp = 'none';
|
||||
if(killData.victim.corporation_id > 0){
|
||||
victimCorpLogoUrl = Init.url.ccpImageServer + '/Corporation/' + killData.victim.corporation_id + '_32.png';
|
||||
displayCorp = 'inline';
|
||||
}
|
||||
|
||||
let 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);
|
||||
// animate kill li-elements
|
||||
$('.' + config.systemKillboardListEntryClass).velocity('transition.expandIn', {
|
||||
stagger: 50,
|
||||
complete: function(){
|
||||
// init tooltips
|
||||
moduleElement.find('[title]').tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
moduleElement.append(listeElement);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// animate kill li-elements
|
||||
$('.' + config.systemKillboardListEntryClass).velocity('transition.expandIn', {
|
||||
stagger: 50,
|
||||
complete: function(){
|
||||
// init tooltips
|
||||
moduleElement.find('[title]').tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
49
public/templates/modules/killboard.html
Normal file
49
public/templates/modules/killboard.html
Normal file
@@ -0,0 +1,49 @@
|
||||
{{#tableData}}
|
||||
{{#killmails.length}}
|
||||
{{#checkRender}}
|
||||
<h5>{{label}} ago</h5>
|
||||
|
||||
<ul class="media-list {{systemKillboardListClass}}">
|
||||
{{#killmails}}
|
||||
{{#checkRender}}
|
||||
<li class="media {{systemKillboardListEntryClass}}">
|
||||
<a href="{{{zKillboardUrl}}}/kill/{{killmail_id}}/" target="_blank" rel="noopener">
|
||||
<img src="{{{ccpImageServerUrl}}}/Type/{{victim.ship_type_id}}_64.png" class="media-object pull-left {{systemKillboardListImgShip}}" title="killmail">
|
||||
</a>
|
||||
|
||||
<a href="{{{zKillboardUrl}}}/character/{{victim.character_id}}/" target="_blank" rel="noopener">
|
||||
<img src="{{{ccpImageServerUrl}}}/Character/{{victim.character_id}}_32.jpg" class="media-object pull-left {{systemKillboardListImgChar}}" title="pilot KB">
|
||||
</a>
|
||||
|
||||
<div class="media-body pull-right text-right">
|
||||
<h5 class="media-heading">
|
||||
<small>{{#dateFormat}}{{killmail_time}}{{/dateFormat}}</small>
|
||||
</h5>
|
||||
<h3 class="media-heading">
|
||||
<small class="txt-color txt-color-green">{{#iskFormat}}{{zkb.totalValue}}{{/iskFormat}}</small>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="media-body">
|
||||
<h5 class="media-heading">
|
||||
<a href="{{{zKillboardUrl}}}/corporation/{{victim.corporation_id}}/" title="corporation KB" target="_blank" rel="noopener">
|
||||
<img src="{{{ccpImageServerUrl}}}/Corporation/{{victim.corporation_id}}_32.png" class="{{systemKillboardListImgCorp}}">
|
||||
</a>
|
||||
</h5>
|
||||
{{#victim.alliance_id}}
|
||||
<h5 class="media-heading">
|
||||
<a href="{{{zKillboardUrl}}}/alliance/{{victim.alliance_id}}/" title="alliance KB" target="_blank" rel="noopener">
|
||||
<img src="{{{ccpImageServerUrl}}}/Alliance/{{victim.alliance_id}}_32.png" class="{{systemKillboardListImgAlly}}">
|
||||
</a>
|
||||
</h5>
|
||||
{{/victim.alliance_id}}
|
||||
</div>
|
||||
</li>
|
||||
{{#increaseCount}}{{/increaseCount}}
|
||||
{{/checkRender}}
|
||||
{{/killmails}}
|
||||
</ul>
|
||||
{{/checkRender}}
|
||||
{{/killmails.length}}
|
||||
{{/tableData}}
|
||||
|
||||
@@ -171,7 +171,6 @@
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid $gray-darker;
|
||||
|
||||
|
||||
li{
|
||||
margin-left: 0;
|
||||
overflow: visible;
|
||||
@@ -190,19 +189,47 @@
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.pf-system-killboard-img-corp{
|
||||
.pf-system-killboard-img-char{
|
||||
display: inline;
|
||||
width: 32px;
|
||||
margin-top: 9px;
|
||||
margin-right: 10px;
|
||||
width: 16px;
|
||||
border: 1px solid $gray-darker;
|
||||
will-change: border-color;
|
||||
@include border-radius(50%);
|
||||
@include transition( border-color 0.12s ease-out);
|
||||
|
||||
&:hover{
|
||||
border-color: $teal-lighter;
|
||||
}
|
||||
}
|
||||
|
||||
.pf-system-killboard-img-corp,
|
||||
.pf-system-killboard-img-ally{
|
||||
display: inline;
|
||||
width: 20px;
|
||||
margin-right: 10px;
|
||||
border: 1px solid $gray-darker;
|
||||
will-change: border-color;
|
||||
@include border-radius(50%);
|
||||
@include transition( border-color 0.12s ease-out);
|
||||
|
||||
&:hover{
|
||||
border-color: $teal-lighter;
|
||||
}
|
||||
}
|
||||
|
||||
.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 border-radius(50%);
|
||||
@include transition( border-color 0.12s ease-out);
|
||||
|
||||
&:hover{
|
||||
border-color: $teal-lighter;
|
||||
}
|
||||
}
|
||||
|
||||
&:before{
|
||||
@@ -211,7 +238,7 @@
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
left: -25px;
|
||||
left: -18px;
|
||||
top: 15px;
|
||||
color: $teal;
|
||||
opacity: 0;
|
||||
@@ -220,15 +247,11 @@
|
||||
}
|
||||
|
||||
&:hover{
|
||||
margin-left: 20px;
|
||||
|
||||
.pf-system-killboard-img-ship{
|
||||
border-color: $teal-lighter;
|
||||
}
|
||||
margin-left: 10px;
|
||||
|
||||
&:before{
|
||||
opacity: 1;
|
||||
left: -20px;
|
||||
left: -15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user