2,664
edits
(Add A/B testing code) |
m (moved landing page code to bottom of file) |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
/********** Adobe A/B Testing javascript code added 2020-07-10 ****************/ | /********** Adobe A/B Testing javascript code added 2020-07-10 ****************/ | ||
Line 388: | Line 314: | ||
} | } | ||
})(); | })(); | ||
/* code for new landing page */ | |||
if (/Main_Page/.test(document.location.href)) { | |||
var el = document.querySelector('#firstHeading'); | |||
el.style.border = "0"; | |||
el.style.textAlign = "center"; | |||
// By wrapping the code block in $() we get the same behavior as using | |||
// document).ready(function () { } | |||
$(function () { | |||
// start off with hiding Countries and States | |||
hideCountries(); | |||
hideStates(); | |||
// https://api.jquery.com/category/selectors/ | |||
// attach to elements ending with _list | |||
$('[id$=_list]').click(function () { | |||
hideCountries(); | |||
$("#countries_list").hide(); | |||
hideStates(); | |||
// show the corresponding country | |||
var position = this.id.indexOf('_list'); | |||
var target = this.id.substring(0, position); | |||
var myId = '#' + target + '_countries'; | |||
$(myId).show(200); | |||
var thisExitMenu = "#exit_menu_" + target + '_countries'; | |||
//console.log("showing exit menu " + thisExitMenu); | |||
$(thisExitMenu).show(); | |||
}); | |||
// attach to elements ending with _list2 | |||
$('[id$=_list2]').click(function (e) { | |||
// show the corresponding states | |||
var position = this.id.indexOf('_list2'); | |||
var target = this.id.substring(0, position); | |||
var myId = '#' + target + '_states'; | |||
//console.log("You clicked a list2; showing " + myId) | |||
$(myId).show(200); | |||
// stop the bubble which would hide all states | |||
e.stopPropagation(); | |||
// since we stop the bubble, make sure countries_list is hidden | |||
$("#countries_list").hide(); | |||
}); | |||
// clicking any class="exit_menu" hides all states | |||
$('.exit_menu').click(function () { | |||
hideStates(); | |||
// let stateList = this.parentNode.parentNode.id; | |||
// console.log ('You clicked in ' + stateList); | |||
$("#all_countries_countries").hide(); | |||
}); | |||
// attach to any id with exit_menu at the start | |||
$('[id^=exit_menu]').click(function () { | |||
// hide the corresponding _countries | |||
var target = this.id.substring(10); | |||
var myId = '#' + target; | |||
//console.log("You clicked an exit_menu for " + this.id); | |||
//console.log("Hiding " + myId + " and showing the countries_list"); | |||
$(myId).hide(); | |||
// show the countries_list | |||
$("#countries_list").show(200); | |||
}); | |||
}); | |||
} | |||
function hideCountries() { | |||
$('[id$=_countries]').hide(); | |||
} | |||
function hideStates() { | |||
$('[id$=_states]').hide(); | |||
} | |||
/* end code for landing page*/ |
edits