[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 11/13] Fix language selector to work on Chrome
From: |
Thomas Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH 11/13] Fix language selector to work on Chrome |
Date: |
Thu, 5 Aug 2010 16:56:24 +0200 |
Signed-off-by: Thomas Petazzoni <address@hidden>
---
www/media/map_rendering_form.js | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/www/media/map_rendering_form.js b/www/media/map_rendering_form.js
index 220d100..57e53c6 100644
--- a/www/media/map_rendering_form.js
+++ b/www/media/map_rendering_form.js
@@ -98,17 +98,29 @@ function preparePaperSizePanel()
* the location to render. */
var selectedCountry;
+/** Variable in which the HTML code of the language list is saved so
+ * that we can remove items from this list and still be able to
+ * repopulate with all items later. This is due to the unfortunate
+ * fact that many browsers to do support .hide() and .show() on
+ * <option> elements. */
+var savedLanguageList;
+
+/* Filter the set of available languages according to the country in
+ * which the administrative boundary is. There is no filtering done
+ * when the area is given by bounding box. */
function prepareLanguagePanel()
{
var seen = false;
+
+ $('#id_map_language').html(savedLanguageList);
+
$('#id_map_language').children('option').each(function() {
if (! ($(this).val().match('.._' + selectedCountry.toUpperCase() +
'\..*') != null
|| $(this).val() == 'C'))
- {
- $(this).hide();
- }
- else {
- $(this).show();
+ {
+ $(this).remove();
+ }
+ else {
if (! seen) {
$(this).attr("selected", "selected");
seen = true;
@@ -451,6 +463,8 @@ $(document).ready(function() {
$('#id_mode_0').bind('click', function(e) { switchToAdminMode(); });
$('#id_mode_1').bind('click', function(e) { switchToBBoxMode(); });
+ savedLanguageList = $('#id_map_language').html();
+
suggest('#id_administrative_city', '#suggest',
'#id_administrative_osmid',
{ selectedClass: 'selected',
--
1.7.0.4
- [Maposmatic-dev] [PATCH 01/13] Extend MapRenderingJob with stylesheet, papersize and layout, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 03/13] Add a get_bbox_from_osm_id() helper, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 11/13] Fix language selector to work on Chrome,
Thomas Petazzoni <=
- [Maposmatic-dev] [PATCH 07/13] Fix maptitle handling in MapRenderingJobForm, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 04/13] Add layout, stylesheet and papersize to MapRenderingForm, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 13/13] Improve the slippy map notifier usage to show when the area is too big, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 12/13] Move Ajax service to the /apis/ directory, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 10/13] Update licence years, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 02/13] Implement a skeleton /papersize/ service, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 06/13] Implement a brand new wizard for map creation, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 08/13] Add link and form to search maps on the front page, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 09/13] Add licence boilerplate in map_rendering_form.css, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 05/13] Upgrade jquery to 1.4.2, Thomas Petazzoni, 2010/08/05