Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send2cgeo for opencaching.pl #1334

Closed
odl opened this issue Mar 25, 2012 · 1 comment
Closed

send2cgeo for opencaching.pl #1334

odl opened this issue Mar 25, 2012 · 1 comment
Labels
Feature Request A request for a new feature/function Send2cgeo Issues related to the send2cgeo function

Comments

@odl
Copy link

odl commented Mar 25, 2012

as in latest nightly version searching/storing OC caches started to work fine, I'd like to ask for adding opencaching.pl site to official send2cgeo script. I modified it already myself for my own use and it works.. however I'm not much familiar with js (I only read few articles for gaining enough knowledge to make this work with opencaching.pl) so I believe there is a better way to do it. this is just my (so far working for both services) example..:

// ==UserScript==
// @name           sendToCgeo
// @namespace      http://send2.cgeo.org/
// @description    Add Send to c:geo button to geocaching.com
// @include        http://opencaching.pl/*
// @include        http://www.geocaching.com/seek/cache_details*
// @include        http://www.geocaching.com/map/beta*
// @version        0.24
// ==/UserScript==

// Inserts javascript that will be called by the s2cgeo button
var s       = document.createElement('script');
s.type      = 'text/javascript';
s.innerHTML =  'function s2cgeo(code) {'
                + 'window.open(\'http://send2.cgeo.org/add.html?cache=\'+code,'
                + '\'cgeo\',\'height=50,width=50\'); }';
document.getElementsByTagName("head")[0].appendChild(s);

var map       = document.getElementById('cacheDetailsTemplate');
var d         = document.getElementById('Download');
var op        = document.getElementById('viewcache-baseinfo');

if( map != null )
{
    var html = 'Log Visit</span></a> <br /> '
             + '<a href="javascript:s2cgeo(\'${cache.gc}\');" '
             + 'class="lnk">'
             + '<img src="/images/sendtogps/sendtogps_icon.png" '
             + 'align="absmiddle" border="0"> '
             + '<span>Send to c:geo</span></a>';

    map.innerHTML = map.innerHTML.replace('Log Visit</span></a>', html);
}
else if( d != null )
{
    var m         = d.children;
    var last      = m.item(m.length-1);
    var GCElement = document.getElementById('ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode');
    var GCCode    = GCElement.innerHTML;

    var html = '| <input type="button" '
             + 'name="ctl00$ContentBody$btnSendTocgeo" '
             + 'value="Send to c:geo" '
             + 'onclick="s2cgeo(\''+GCCode+'\'); '
             + 'return false;" '
             + 'id="ctl00_ContentBody_btnSendTocgeo" />';

    last.innerHTML = last.innerHTML + html;
}
else if( op != null)
{
    var n         = op.children;
    var last      = n.item(n.length-1);
    var OPhtml    = op.innerHTML;
    var OPElement = OPhtml.match("wp=(.*?)&amp");
    var OPCode    = OPElement[1];

    var html = '<div class="send-to-gps"><input type="button" '
             + 'name="ctl00$ContentBody$btnSendTocgeo" '
             + 'value="Send to c:geo" '
             + 'onclick="s2cgeo(\''+OPCode+'\'); '
             + 'return false;" '
             + 'id="ctl00_ContentBody_btnSendTocgeo" style="BACKGROUND: rgb(234,239,247); '
             + 'BORDER-RIGHT: #005e9d 2px outset; BORDER-TOP: #000000 1px outset; '
             + 'FONT-WEIGHT: bold; FONT-SIZE: 8pt; PADDING-BOTTOM: 2px; '
             + 'BORDER-LEFT: #000000 1px outset; PADDING-TOP: 2px; '
             + 'BORDER-BOTTOM: #005e9d 2px outset; FONT-FAMILY: verdana" /></div>';

    last.innerHTML = last.innerHTML + html;
}
@Lineflyer
Copy link
Member

This issue was moved to cgeo/send2cgeo#13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request A request for a new feature/function Send2cgeo Issues related to the send2cgeo function
Projects
None yet
Development

No branches or pull requests

2 participants