diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-17 13:30:07 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-08-03 10:36:50 +0100 |
commit | 82350c8df0cb088e5d1eaf26833f9880700b496d (patch) | |
tree | 93891e67ed5bfd8e6e46430462cc0133ded28370 | |
parent | 26b71d818cf023968e2ee9afd1c4934f57c9111f (diff) |
Use standard JS translation for show/hide pins.
-rw-r--r-- | templates/web/base/js/translation_strings.html | 3 | ||||
-rw-r--r-- | web/js/map-OpenLayers.js | 25 | ||||
-rw-r--r-- | web/js/map-google.js | 27 |
3 files changed, 20 insertions, 35 deletions
diff --git a/templates/web/base/js/translation_strings.html b/templates/web/base/js/translation_strings.html index 428a250a3..bc2f013ff 100644 --- a/templates/web/base/js/translation_strings.html +++ b/templates/web/base/js/translation_strings.html @@ -51,6 +51,9 @@ permalink: '[% loc('Permalink') | replace("'", "\\'") %]', + show_pins: '[% loc('Show pins') | replace("'", "\\'") %]', + hide_pins: '[% loc('Hide pins') | replace("'", "\\'") %]', + upload_max_files_exceeded: '[% loc ('Whoa there Testino! Three photos are enough.') | replace("'", "\\'") %]', upload_default_message: '[% loc ('Drag and drop photos here or <u>click to upload</u>') | replace("'", "\\'") %]', upload_cancel_confirmation: '[% loc ('Are you sure you want to cancel this upload?') | replace("'", "\\'") %]', diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 549da6ebe..97507ea4a 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -566,23 +566,14 @@ var fixmystreet = fixmystreet || {}; $('#hide_pins_link').click(function(e) { e.preventDefault(); - var showhide = [ - 'Show pins', 'Hide pins', - 'Dangos pinnau', 'Cuddio pinnau', - "Vis nåler", "Skjul nåler", - "Zeige Stecknadeln", "Stecknadeln ausblenden", - 'Visa kartnålar', 'Göm kartnålar' - ]; - for (var i=0; i<showhide.length; i+=2) { - if (this.innerHTML == showhide[i]) { - fixmystreet.markers.setVisibility(true); - fixmystreet.select_feature.activate(); - this.innerHTML = showhide[i+1]; - } else if (this.innerHTML == showhide[i+1]) { - fixmystreet.markers.setVisibility(false); - fixmystreet.select_feature.deactivate(); - this.innerHTML = showhide[i]; - } + if (this.innerHTML == translation_strings.show_pins) { + fixmystreet.markers.setVisibility(true); + fixmystreet.select_feature.activate(); + this.innerHTML = translation_strings.hide_pins; + } else if (this.innerHTML == translation_strings.hide_pins) { + fixmystreet.markers.setVisibility(false); + fixmystreet.select_feature.deactivate(); + this.innerHTML = translation_strings.show_pins; } }); diff --git a/web/js/map-google.js b/web/js/map-google.js index 7155a372e..8819697eb 100644 --- a/web/js/map-google.js +++ b/web/js/map-google.js @@ -214,25 +214,16 @@ fixmystreet.maps = {}; $('#hide_pins_link').click(function(e) { var i, m; e.preventDefault(); - var showhide = [ - 'Show pins', 'Hide pins', - 'Dangos pinnau', 'Cuddio pinnau', - "Vis nåler", "Gjem nåler", - "Zeige Stecknadeln", "Stecknadeln ausblenden", - 'Visa kartnålar', 'Göm kartnålar' - ]; - for (i=0; i<showhide.length; i+=2) { - if (this.innerHTML == showhide[i]) { - for (m=0; m<fixmystreet.markers.length; m++) { - fixmystreet.markers[m].setMap(fixmystreet.map); - } - this.innerHTML = showhide[i+1]; - } else if (this.innerHTML == showhide[i+1]) { - for (m=0; m<fixmystreet.markers.length; m++) { - fixmystreet.markers[m].setMap(null); - } - this.innerHTML = showhide[i]; + if (this.innerHTML == translation_strings.show_pins) { + for (m=0; m<fixmystreet.markers.length; m++) { + fixmystreet.markers[m].setMap(fixmystreet.map); + } + this.innerHTML = translation_strings.hide_pins; + } else if (this.innerHTML == translation_strings.hide_pins) { + for (m=0; m<fixmystreet.markers.length; m++) { + fixmystreet.markers[m].setMap(null); } + this.innerHTML = translation_strings.show_pins; } }); |