Skip to content

Commit

Permalink
Merge pull request #1015 from AndreasK79/was_map_more_tweaks
Browse files Browse the repository at this point in the history
[WAS Map] Added JS from this fork https://github.com/kcaran/us-map to…
  • Loading branch information
magicbug authored May 2, 2021
2 parents 50d64af + 658641e commit 141f324
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 30 deletions.
14 changes: 8 additions & 6 deletions application/models/Logbook_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,14 @@ public function was_qso_details($state, $band){
$this->db->where('station_id', $station_id);
$this->db->where('COL_STATE', $state);
$this->db->where_in('COL_DXCC', ['291', '6', '110']);
if($band != "SAT") {
$this->db->where('COL_PROP_MODE !=', 'SAT');
$this->db->where('COL_BAND', $band);
} else {
$this->db->where('COL_PROP_MODE', "SAT");
}
if($band != 'All') {
if($band != "SAT") {
$this->db->where('COL_PROP_MODE !=', 'SAT');
$this->db->where('COL_BAND', $band);
} else {
$this->db->where('COL_PROP_MODE', "SAT");
}
}

return $this->db->get($this->config->item('table_name'));
}
Expand Down
114 changes: 90 additions & 24 deletions application/views/awards/was/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>US Map Demo</title>

<style>
#alert {
font-family: Arial, Helvetica, sans-serif;
Expand All @@ -13,18 +13,18 @@
font-weight: bold;
}
</style>

<script src="<?php echo base_url(); ?>assets/js/raphael.js"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery-3.3.1.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/color.jquery.js"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery.usmap.js"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery.usmap.min.js"></script>

<script>
$(document).ready(function() {
$('#map').usmap({
showLabels: false,
showLabels: true,
'stateStyles': {
fill: '#4ECDC4',
fill: '#4ECDC4',
"stroke-width": 1,
'stroke' : '#036'
},
Expand All @@ -34,7 +34,7 @@
'stateSpecificStyles': {
<?php foreach ($was_array as $was => $value) { ?>
'<?php echo $was; ?>' :
<?php
<?php
foreach ($value as $key) {
if($key != "") {
if (strpos($key, '>W<') !== false) {
Expand All @@ -54,31 +54,97 @@
}
?>
},
'stateSpecificHoverStyles': {
'HI' : {fill: '#ff0'}
},

'mouseoverState': {
'HI' : function(event, data) {
//return false;
}
},


// Show tooltip when hovering over state
mouseover: function(event, data) {
let nameList = {
"AL":"Alabama",
"AK":"Alaska",
"AZ":"Arizona",
"AR":"Arkansas",
"CA":"California",
"CO":"Colorado",
"CT":"Connecticut",
"DE":"Delaware",
"DC":"District Of Columbia",
"FL":"Florida",
"GA":"Georgia",
"HI":"Hawaii",
"ID":"Idaho",
"IL":"Illinois",
"IN":"Indiana",
"IA":"Iowa",
"KS":"Kansas",
"KY":"Kentucky",
"LA":"Louisiana",
"ME":"Maine",
"MD":"Maryland",
"MA":"Massachusetts",
"MI":"Michigan",
"MN":"Minnesota",
"MS":"Mississippi",
"MO":"Missouri",
"MT":"Montana",
"NE":"Nebraska",
"NV":"Nevada",
"NH":"New Hampshire",
"NJ":"New Jersey",
"NM":"New Mexico",
"NY":"New York",
"NC":"North Carolina",
"ND":"North Dakota",
"OH":"Ohio",
"OK":"Oklahoma",
"OR":"Oregon",
"PA":"Pennsylvania",
"RI":"Rhode Island",
"SC":"South Carolina",
"SD":"South Dakota",
"TN":"Tennessee",
"TX":"Texas",
"UT":"Utah",
"VT":"Vermont",
"VA":"Virginia",
"WA":"Washington",
"WV":"West Virginia",
"WI":"Wisconsin",
"WY":"Wyoming"
}

$('#tooltip').text(nameList[data.name]).show();
$('#map').mousemove(function(e){
var mouseX = e.pageX - 350;
var mouseY = e.pageY - 90;
$('#tooltip').css({
top:mouseY,
left:mouseX,
'position': 'absolute',
'border':'1px solid black',
'background': '#fff',
'color': '#000',
'font-size': '1.5 em',
'padding': '5px',
'opacity': '1',
'border-radius': '2px'
});
});
},
// Hide tooltip when not hovering over state
mouseout: function(event, data){
$('#tooltip').hide();
},


'click' : function(event, data) {
$('#alert')
.text('Click '+data.name+' on map 1')
.stop()
.css('backgroundColor', '#ff0')
.animate({backgroundColor: '#ddd'}, 1000);
displayWasContacts(data.name,$('#band2').val());
}
});

});
</script>
</head>
<body>
<div id="map" style="width: 930px; height: 630px;"></div>
<div id="tooltip2"></div>

<ul>
<li>Red - Not Worked</li>
Expand Down
1 change: 1 addition & 0 deletions assets/js/jquery.usmap.min.js

Large diffs are not rendered by default.

0 comments on commit 141f324

Please sign in to comment.