Skip to content

Commit

Permalink
version 2.0.1:
Browse files Browse the repository at this point in the history
Added: Cache icons missing (Geocaching HQ, Lost and Found, Block Party, Giga Event..)
Optimization and bug fix
  • Loading branch information
Surfoo committed Apr 23, 2014
1 parent 49611c0 commit 423ce4c
Show file tree
Hide file tree
Showing 30 changed files with 119 additions and 65 deletions.
10 changes: 8 additions & 2 deletions cache.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CACHE MANIFEST

# 2014-04-17
# date: 2014-04-24
# version: 2.0.1

CACHE:
gcgpxviewer.min.css
Expand Down Expand Up @@ -29,9 +30,14 @@ img/11.gif
img/12.gif
img/13.gif
img/137.gif
img/453.gif
img/1304.gif
img/1858.gif
img/453.gif
img/3653.gif
img/3773.gif
img/3774.gif
img/4738.gif
img/7005.gif
js/gcgpxviewer.min.js

NETWORK:
Expand Down
4 changes: 3 additions & 1 deletion css/design.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ input {
.infowindow dl dd,.infowindow h4 {
margin-bottom: 0.25em;
}

.infowindow dl dd {
overflow: hidden;
}
h1, h2, h3, h4, h5, h6, p, a, img, dl, dt, dd {
border: 0 none;
font-family: inherit;
Expand Down
81 changes: 52 additions & 29 deletions docs/gcgpxviewer.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gcgpxviewer.min.css

Large diffs are not rendered by default.

Binary file added img/3653.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/3773.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/3774.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/4738.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/7005.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct1304.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct137.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct1858.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct3653.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct3773.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct3774.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct453.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct4738.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct7005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ct9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 53 additions & 30 deletions js/gcgpxviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/*'use strict';*/
var typeCaches, sizeCaches, objOptionLabel, objOptionPerimeter, circleList, polylineList, markers,
map, parser, doc, circle, control;
var circleOpacity = 0.8, circleColor = '#c11414', circleFillOpacity = 0.25;
var unitType = ['o', 'Ko', 'Mo', 'Go'];

// Id and types of geocaches from geocaching.com
Expand All @@ -23,9 +24,15 @@
}, {
'id': 8,
'type': 'Unknown Cache'
}, {
'id': 9,
'type': 'Project APE Cache'
}, {
'id': 11,
'type': 'Webcam Cache'
}, {
'id': 12,
'type': 'Locationless (Reverse) Cache'
}, {
'id': 13,
'type': 'Cache In Trash Out Event'
Expand All @@ -41,6 +48,21 @@
}, {
'id': 1858,
'type': 'Wherigo Cache'
}, {
'id': 3653,
'type': 'Lost and Found Event Caches'
}, {
'id': 3773,
'type': 'Groundspeak HQ'
}, {
'id': 3774,
'type': 'Groundspeak Lost and Found Celebration'
}, {
'id': 4738,
'type': 'Groundspeak Block Party'
}, {
'id': 7005,
'type': 'Giga-Event Cache'
}];

// Size list geocaches
Expand Down Expand Up @@ -81,8 +103,8 @@
// Display geocaches on the map
var displayCaches = function(wpts) {
var icon, wpt, sym, latlng, oMarker, infoContent, i, nbWpts, j, nbTypeCaches, nbSizeCaches,
regexType = /[a-z]*?\|([a-z-\s]*)\|?/i,
grdspk, oName, oDifficulty, oTerrain, oOwner, oContainer, oDate, date, size, match;
regexType = /[a-z]*?\|([^<]*)\|?/i,
grdspk, elmName, elmDifficulty, elmTerrain, elmOwner, elmContainer, elmDate, elmSize, match;

// for each geocaches
for (i = 0, nbWpts = wpts.length; i < nbWpts; ++i) {
Expand All @@ -96,22 +118,23 @@
// Retrieve all informations in the waypoint
grdspk = wpt.getElementsByTagNameNS('*', 'cache');
/*console.log(grdspk[0].getAttribute('id'));*/
oName = grdspk[0].getElementsByTagNameNS('*', 'name');
oDifficulty = grdspk[0].getElementsByTagNameNS('*', 'difficulty');
oTerrain = grdspk[0].getElementsByTagNameNS('*', 'terrain');
oOwner = grdspk[0].getElementsByTagNameNS('*', 'owner');
oContainer = grdspk[0].getElementsByTagNameNS('*', 'container');
oDate = new Date(wpt.getElementsByTagName('time')[0].childNodes[0].nodeValue);
date = oDate.format('yyyy/mm/dd');
size = null;
elmName = grdspk[0].getElementsByTagNameNS('*', 'name');
elmDifficulty = grdspk[0].getElementsByTagNameNS('*', 'difficulty');
elmTerrain = grdspk[0].getElementsByTagNameNS('*', 'terrain');
elmOwner = grdspk[0].getElementsByTagNameNS('*', 'owner');
elmContainer = grdspk[0].getElementsByTagNameNS('*', 'container');
elmDate = new Date(wpt.getElementsByTagName('time')[0].childNodes[0].nodeValue);
elmDate = elmDate.format('yyyy/mm/dd');
elmSize = null;
match = wpt.getElementsByTagName('type')[0].childNodes[0].nodeValue.match(regexType);

if (match) {
for (j = 0, nbTypeCaches = typeCaches.length; j < nbTypeCaches; ++j) {
if (typeCaches[j].type === match[1]) {
icon = L.icon({
iconSize: [16, 16],
iconUrl: 'img/' + typeCaches[j].id + '.gif'
iconUrl: 'img/ct' + typeCaches[j].id + '.png',
iconPopin: 'img/' + typeCaches[j].id + '.gif'
});
break;
}
Expand All @@ -122,8 +145,8 @@
}

for (j = 0, nbSizeCaches = sizeCaches.length; j < nbSizeCaches; ++j) {
if (sizeCaches[j].id === oContainer[0].childNodes[0].nodeValue.toLowerCase()) {
size = sizeCaches[j].label;
if (sizeCaches[j].id === elmContainer[0].childNodes[0].nodeValue.toLowerCase()) {
elmSize = sizeCaches[j].label;
break;
}
}
Expand All @@ -143,24 +166,24 @@
infoContent = '<div class="infowindow">';
infoContent += '<div class="code">' + wpt.getElementsByTagName('name')[0].childNodes[0].nodeValue + '</div>';
infoContent += ' <h4>';
infoContent += ' <img src="' + icon.options.iconUrl + '">';
infoContent += ' <a href="http://coord.info/' + wpt.getElementsByTagName('name')[0].childNodes[0].nodeValue + '" onclick="window.open(this.href);return false;">' + oName[0].childNodes[0].nodeValue + '</a>';
infoContent += ' <img src="' + icon.options.iconPopin + '" width="16" alt="" />';
infoContent += ' <a href="http://coord.info/' + wpt.getElementsByTagName('name')[0].childNodes[0].nodeValue + '" onclick="window.open(this.href);return false;">' + elmName[0].childNodes[0].nodeValue + '</a>';
infoContent += ' </h4>';
infoContent += ' <dl style="float:left;margin-right:2em;width:50%;">';
if (oOwner[0].childNodes[0]) {
if (elmOwner[0].childNodes[0]) {
infoContent += ' <dt>Created by:</dt>';
infoContent += ' <dd>' + oOwner[0].childNodes[0].nodeValue + '</dd>';
infoContent += ' <dd title="' + elmOwner[0].childNodes[0].nodeValue + '">' + elmOwner[0].childNodes[0].nodeValue + '</dd>';
}
infoContent += ' <dt>Difficulty:</dt>';
infoContent += ' <dd>' + oDifficulty[0].childNodes[0].nodeValue + '</dd>';
infoContent += ' <dd>' + elmDifficulty[0].childNodes[0].nodeValue + '</dd>';
infoContent += ' <dt>Cache size:</dt>';
infoContent += ' <dd>' + size + '</dd>';
infoContent += ' <dd>' + elmSize + '</dd>';
infoContent += ' </dl>';
infoContent += ' <dl style="margin-left:50%">';
infoContent += ' <dt>Date Hidden:</dt>';
infoContent += ' <dd>' + date + '</dd>';
infoContent += ' <dd>' + elmDate + '</dd>';
infoContent += ' <dt>Terrain:</dt>';
infoContent += ' <dd>' + oTerrain[0].childNodes[0].nodeValue + '</dd>';
infoContent += ' <dd>' + elmTerrain[0].childNodes[0].nodeValue + '</dd>';
infoContent += ' </dl>';
infoContent += '</div>';

Expand All @@ -172,10 +195,10 @@
// Set perimeter
circle = new L.circle(latlng, 161, {
weight: 2,
color: '#c11414',
opacity: objOptionPerimeter.checked ? 0.8 : 0,
fillColor: objOptionPerimeter.checked ? "#c11414" : 'transparent',
fillOpacity: objOptionPerimeter.checked ? 0.25 : 0,
color: circleColor,
opacity: objOptionPerimeter.checked ? circleOpacity : 0,
fillColor: objOptionPerimeter.checked ? circleColor : 'transparent',
fillOpacity: objOptionPerimeter.checked ? circleFillOpacity : 0,
clickable: false
});
circle.addTo(map);
Expand All @@ -186,7 +209,7 @@
}
};

// Display tracks on the map
// Display tracks on the map
var displayTracks = function(wpts) {
var wpt, latlng, i = 0,
j, k,
Expand All @@ -213,7 +236,6 @@
polyline.addTo(map);
polylineList.push(polyline);
}
bounds.extend(latlng);
}

};
Expand Down Expand Up @@ -257,8 +279,9 @@
var togglePerimeters = function() {
_.each(markers, function(value, key) {
circleList[key].setStyle({
opacity: objOptionPerimeter.checked ? 0.8 : 0,
fillOpacity: objOptionPerimeter.checked ? 0.25 : 0
opacity: objOptionPerimeter.checked ? circleOpacity : 0,
fillColor: objOptionPerimeter.checked ? circleColor : 'transparent',
fillOpacity: objOptionPerimeter.checked ? circleFillOpacity : 0
});
});

Expand Down Expand Up @@ -548,4 +571,4 @@
}

window.onload = load();
})(_);
})(_);
4 changes: 2 additions & 2 deletions js/gcgpxviewer.min.js

Large diffs are not rendered by default.

0 comments on commit 423ce4c

Please sign in to comment.