[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 5/5] Fix language selector to work on Chrome
From: |
Thomas Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH 5/5] Fix language selector to work on Chrome |
Date: |
Thu, 5 Aug 2010 09:32:54 +0200 |
Signed-off-by: Thomas Petazzoni <address@hidden>
---
www/media/map_rendering_form.js | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/www/media/map_rendering_form.js b/www/media/map_rendering_form.js
index af0ff89..5447371 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();
+ $(this).remove();
}
else {
- $(this).show();
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
- Re: [Maposmatic-dev] [PATCH 4/6] Add layout, stylesheet and papersize to MapRenderingForm, (continued)
- [Maposmatic-dev] [PATCH 6/6] Implement a brand new wizard for map creation, Thomas Petazzoni, 2010/08/04
- [Maposmatic-dev] [PATCH 5/6] Upgrade jquery to 1.4.2, Thomas Petazzoni, 2010/08/04
- Re: [Maposmatic-dev] [PATCH 1/6] Extend MapRenderingJob with stylesheet, papersize and layout, Maxime Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 4/5] Update licence years, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 2/5] Add link and form to search maps on the front page, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 1/5] Fix maptitle handling in MapRenderingJobForm, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 3/5] Add licence boilerplate in map_rendering_form.css, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 5/5] Fix language selector to work on Chrome,
Thomas Petazzoni <=