diff options
author | Jochen Topf <jochen@topf.org> | 2015-03-10 07:08:43 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2015-03-10 07:08:43 +0100 |
commit | dfc378e99c74fade1421fad159e583989b96406e (patch) | |
tree | a5ac8689ccfecfd4540103c990314bd7dc704841 | |
parent | b6cf111b723d97d26f043788e04650468e227edb (diff) | |
download | taginfo-dfc378e99c74fade1421fad159e583989b96406e.tar taginfo-dfc378e99c74fade1421fad159e583989b96406e.tar.gz |
Fix Javascript problem that breaks pages without JOSM button on https.
-rw-r--r-- | web/public/js/taginfo.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index 21a8563..0ca72d9 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -744,21 +744,23 @@ function comparison_list_change(key, value) { /* ============================ */ function activate_josm_button() { - if (window.location.protocol == "https:") { - var url = jQuery('#josm_button')[0].href.replace('http://localhost:8111/', 'https://localhost:8112/'); - jQuery('#josm_button')[0].href = url; - } + if (jQuery('#josm_button')) { + if (window.location.protocol == "https:") { + var url = jQuery('#josm_button')[0].href.replace('http://localhost:8111/', 'https://localhost:8112/'); + jQuery('#josm_button')[0].href = url; + } - jQuery('#josm_button').bind('click', function() { - var url = jQuery('#josm_button')[0].href; - jQuery.get(url, function(data) { - if (data.substring(0, 2) != 'OK') { - alert("Problem contacting JOSM. Is it running? Is remote control activated?"); - console.log("Answer from JOSM: [" + data + "]"); - } + jQuery('#josm_button').bind('click', function() { + var url = jQuery('#josm_button')[0].href; + jQuery.get(url, function(data) { + if (data.substring(0, 2) != 'OK') { + alert("Problem contacting JOSM. Is it running? Is remote control activated?"); + console.log("Answer from JOSM: [" + data + "]"); + } + }); + return false; }); - return false; - }); + } } /* ============================ */ |