From dd98da68d9adec8537befc7d6f01e5ce40dd083e Mon Sep 17 00:00:00 2001 From: bordoni Date: Sun, 3 Jul 2016 15:25:49 -0300 Subject: [PATCH] Improves Language selection JS to allow other folders (better logic moving forward) --- _includes/languages.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/_includes/languages.html b/_includes/languages.html index 9bb55f3e..2c44f118 100644 --- a/_includes/languages.html +++ b/_includes/languages.html @@ -25,11 +25,10 @@ count = opts.length; for ( var i = 0; i < count; i++ ){ - if ( -1 === opts[ i ].value.indexOf( window.location.pathname ) ) { - continue; + // Only happens if you have language path on the start of the location.pathname + if ( 0 === window.location.pathname.indexOf( opts[ i ].value ) ) { + opts[ i ].setAttribute( 'selected', 'selected' ); } - - opts[ i ].setAttribute( 'selected', 'selected' ); } } )();