Created
October 30, 2013 08:43
-
-
Save jdeerhake/7229145 to your computer and use it in GitHub Desktop.
An actual snipped from healthcare.gov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Needs to support x-domain requests */ | |
/* | |
$(function() { | |
//Fallback for IE | |
if($.browser.msie) { | |
$('.span1 a.btn-mini.btn-lang').removeClass('nodisplay'); | |
}else{ | |
// Add lang button if it exist | |
if('en' == 'es'){ | |
var url = window.location.href.replace('cuidadodesalud.gov','healthcare.gov').replace('/es/','/'); | |
$.ajax({ | |
url: url, | |
type: 'HEAD', | |
success: function(){ | |
$('.span1 a.btn-mini.btn-lang').removeClass('nodisplay').attr('href', url); | |
}, | |
error: function(){} | |
}); | |
} | |
if('en' == 'en'){ | |
if (''.length > 0) { | |
var url = window.location.href.replace('','/es'); | |
} else { | |
var url = window.location.origin + '/es' + window.location.pathname; | |
} | |
$.ajax({ | |
url: url, | |
type: 'HEAD', | |
success: function(){ | |
$('.span1 a.btn-mini.btn-lang').removeClass('nodisplay').attr('href', url); | |
}, | |
error: function(){} | |
}); | |
} | |
// Set language cookie whenever user manually switches | |
$('.btn-mini.btn-lang').click(function(e) { | |
var newLang = $(this).attr('data-lang'); | |
$.cookie('language', {lang:newLang}, { expires: 90, path: '/' }); | |
}); | |
} | |
}); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment