Skip to content

Instantly share code, notes, and snippets.

@jdeerhake
Created October 30, 2013 08:43
Show Gist options
  • Save jdeerhake/7229145 to your computer and use it in GitHub Desktop.
Save jdeerhake/7229145 to your computer and use it in GitHub Desktop.
An actual snipped from healthcare.gov
/* 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