fix 'report issue' for places with single or double quotes in their names. Fixes #68

This commit is contained in:
Stefan Breunig 2013-02-10 14:08:35 +01:00
parent d5285ca26c
commit 63bdff0eb9
3 changed files with 8 additions and 9 deletions

View File

@ -70,7 +70,7 @@ window.renderPortalDetails = function(guid) {
+ '<div id="resodetails">'+getResonatorDetails(d)+'</div>' + '<div id="resodetails">'+getResonatorDetails(d)+'</div>'
+ '<div class="linkdetails">' + '<div class="linkdetails">'
+ '<aside><a href="'+perma+'">portal link</a></aside>' + '<aside><a href="'+perma+'">portal link</a></aside>'
+ '<aside><a onclick="window.reportPortalIssue(\''+getReportIssueInfoText(d)+'\')">report issue</a></aside>' + '<aside><a onclick="window.reportPortalIssue()">report issue</a></aside>'
+ '</div>' + '</div>'
); );
} }

View File

@ -78,14 +78,6 @@ window.getAvgResoDistText = function(d) {
return '⌀ res dist: ' + avgDist + 'm'; return '⌀ res dist: ' + avgDist + 'm';
} }
window.getReportIssueInfoText = function(d) {
return ('Your Nick: '+PLAYER.nickname+' '
+ 'Portal: '+d.portalV2.descriptiveText.TITLE+' '
+ 'Location: '+d.portalV2.descriptiveText.ADDRESS
+' (lat '+(d.locationE6.latE6/1E6)+'; lng '+(d.locationE6.lngE6/1E6)+')'
).replace(/['"]/, '');
}
window.getResonatorDetails = function(d) { window.getResonatorDetails = function(d) {
console.log('rendering reso details'); console.log('rendering reso details');
var resoDetails = ''; var resoDetails = '';

View File

@ -93,6 +93,13 @@ window.rangeLinkClick = function() {
window.reportPortalIssue = function(info) { window.reportPortalIssue = function(info) {
var t = 'Redirecting you to a Google Help Page. Once there, click on “Contact Us” in the upper right corner.\n\nThe text box contains all necessary information. Press CTRL+C to copy it.'; var t = 'Redirecting you to a Google Help Page. Once there, click on “Contact Us” in the upper right corner.\n\nThe text box contains all necessary information. Press CTRL+C to copy it.';
var d = window.portals[window.selectedPortal].options.details;
var info = 'Your Nick: ' + PLAYER.nickname + ' '
+ 'Portal: ' + d.portalV2.descriptiveText.TITLE + ' '
+ 'Location: ' + d.portalV2.descriptiveText.ADDRESS
+' (lat ' + (d.locationE6.latE6/1E6) + '; lng ' + (d.locationE6.lngE6/1E6) + ')';
//codename, approx addr, portalname //codename, approx addr, portalname
if(prompt(t, info) !== null) if(prompt(t, info) !== null)
location.href = 'https://support.google.com/ingress?hl=en'; location.href = 'https://support.google.com/ingress?hl=en';