initiate copy on android instead of following links

This commit is contained in:
Stefan Breunig
2013-03-12 00:30:27 +01:00
parent 8f76951ca3
commit bc63c47d47
3 changed files with 10 additions and 2 deletions

View File

@ -67,7 +67,7 @@ window.renderPortalDetails = function(guid) {
+ '<div class="mods">'+getModDetails(d)+'</div>' + '<div class="mods">'+getModDetails(d)+'</div>'
+ randDetails + randDetails
+ resoDetails + resoDetails
+ '<div class="linkdetails">'+ '<aside><a href="'+perma+'">portal link</a></aside>' + '<div class="linkdetails"><aside><a href="'+perma+'" onclick="return androidCopy(this.href)" >portal link</a></aside>'
+ '<aside><a onclick="'+poslinks+'">poslinks</a></aside>' + '<aside><a onclick="'+poslinks+'">poslinks</a></aside>'
+ '<aside><a onclick="alert(\''+postcard+'\');">donate</a></aside>' + '<aside><a onclick="alert(\''+postcard+'\');">donate</a></aside>'
+ '<aside><a onclick="window.reportPortalIssue()">report issue</a></aside>' + '<aside><a onclick="window.reportPortalIssue()">report issue</a></aside>'

View File

@ -118,6 +118,14 @@ window.showPortalPosLinks = function(lat, lng) {
} }
} }
window.androidCopy = function(text) {
if(typeof android === 'undefined' || !android || !android.copy)
return true; // i.e. execute other actions
else
android.copy(text);
return false;
}
window.reportPortalIssue = function(info) { window.reportPortalIssue = function(info) {
var t = 'Redirecting you to a Google Help Page.\n\nThe text box contains all necessary information. Press CTRL+C to copy it.'; var t = 'Redirecting you to a Google Help Page.\n\nThe text box contains all necessary information. Press CTRL+C to copy it.';
var d = window.portals[window.selectedPortal].options.details; var d = window.portals[window.selectedPortal].options.details;

View File

@ -97,7 +97,7 @@ document.getElementsByTagName('body')[0].innerHTML = ''
+ ' <div id="portaldetails"></div>' + ' <div id="portaldetails"></div>'
+ ' <input id="redeem" placeholder="Redeem code…" type="text"/>' + ' <input id="redeem" placeholder="Redeem code…" type="text"/>'
+ ' <div id="toolbox">' + ' <div id="toolbox">'
+ ' <a onmouseover="setPermaLink(this)">permalink</a>' + ' <a onmouseover="setPermaLink(this)" onclick="setPermaLink(this);return androidCopy(this.href)" >permalink</a>'
+ ' <a href="https://github.com/breunigs/ingress-intel-total-conversion#readme" title="IITC = Ingress Intel Total Conversion.\n\nOn the scripts homepage you can:\n find updates\n get plugins\n report bugs\n and contribute." style="cursor: help">IITCs page</a></div>' + ' <a href="https://github.com/breunigs/ingress-intel-total-conversion#readme" title="IITC = Ingress Intel Total Conversion.\n\nOn the scripts homepage you can:\n find updates\n get plugins\n report bugs\n and contribute." style="cursor: help">IITCs page</a></div>'
+ ' </div>' + ' </div>'
+ '</div>' + '</div>'