From e67a53cce7a94fd057b58429268135b5b095d7f7 Mon Sep 17 00:00:00 2001 From: James Fournie Date: Mon, 24 Oct 2011 13:30:30 -0700 Subject: [PATCH] Locale selector, for whatever reason, continually calls onChange in Dojo 1.6 A simple check to see if it actually changes makes the OPAC load correctly with Dojo 1.6 Signed-off-by: James Fournie --- Open-ILS/web/opac/skin/default/xml/common/fonts.xml | 5 ++++- Open-ILS/web/opac/skin/default/xml/home/homesearch.xml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/opac/skin/default/xml/common/fonts.xml b/Open-ILS/web/opac/skin/default/xml/common/fonts.xml index c7ebef3801..d03c69d7f0 100644 --- a/Open-ILS/web/opac/skin/default/xml/common/fonts.xml +++ b/Open-ILS/web/opac/skin/default/xml/common/fonts.xml @@ -14,7 +14,10 @@ opacLocaleSelector.setValue(locale); dojo.connect(opacLocaleSelector, 'onChange', function () { - location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin'); + var locale = location.href.replace( /.+opac\/([^\/]+)\/skin.+/, '$1' ); + if(this.getValue() != locale){ + location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin'); + } } ); }); diff --git a/Open-ILS/web/opac/skin/default/xml/home/homesearch.xml b/Open-ILS/web/opac/skin/default/xml/home/homesearch.xml index 30ca9a3481..cb1c74ac7b 100644 --- a/Open-ILS/web/opac/skin/default/xml/home/homesearch.xml +++ b/Open-ILS/web/opac/skin/default/xml/home/homesearch.xml @@ -115,7 +115,10 @@ opacLocaleSelector.setValue(locale); dojo.connect(opacLocaleSelector, 'onChange', function () { - location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin'); + var locale = location.href.replace( /.+opac\/([^\/]+)\/skin.+/, '$1' ); + if(this.getValue() != locale){ + location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin'); + } } ); }); -- 2.11.0