Last active
December 26, 2015 10:59
-
-
Save nickhudkins/7140599 to your computer and use it in GitHub Desktop.
JFC.
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
<script type="text/javascript"> | |
$(function() { | |
var langCode; | |
// Add lang button if it exist | |
if ('en' == 'es') { | |
langCode = 'es_MX'; | |
var url = window.location.href.replace('cuidadodesalud.gov','healthcare.gov').replace('/es/','/'); | |
$('.span1 a.btn-mini.btn-lang, #header .lang').removeClass('nodisplay').attr('href', url); | |
} | |
if ('en' == 'en') { | |
langCode = 'en_US'; | |
if (''.length > 0) { | |
var url = window.location.href.replace('','/es'); | |
} else { | |
var url = window.location.protocol + '//' + window.location.host + '/es' + window.location.pathname + window.location.hash; | |
} | |
$('.span1 a.btn-mini.btn-lang, #header .lang').removeClass('nodisplay').attr('href', url); | |
} | |
$.cookie('language', {lang:langCode}, { expires: 90, path: '/' }); | |
}); | |
/* 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: '/' }); | |
}); | |
} | |
}); | |
*/ | |
$('.dropdown .nav-btn .dropdown-menu').dropdown(); | |
$('.nav .dropdown.nav-btn').accessibleDropDown(); | |
$('#skip-nav').click(function () { | |
$($(this).attr('href')).focus(); | |
return false; | |
}); | |
$('#learn-nav a, #learn-nav input').focus(function(e) { | |
if (!$(this).closest('.dropdown').length) { | |
$('#learn-nav .dropdown').removeClass('hover open'); | |
} | |
}); | |
// for help menu dropdown | |
$('#wrapper a, #wrapper button, #wrapper input').focus(function(e) { | |
if (!$(this).closest('.dropdown').length) { | |
$('.nav.help-menu .dropdown').removeClass('hover open'); | |
} else if ($(this).is($('#content-start a'))) { | |
$('.nav.help-menu .dropdown').removeClass('hover open'); | |
} | |
}); | |
if(isMobileDevice.any()) { | |
$('#learn-nav .dropdown-menu').css('display','none'); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment