<commit_before>var holidayNames = {
    "Australia":["newYear","australiaDay","canberraDay","goodFriday","easterSaturday","easterMondayAus","anzacDay","queensBirthday",
                "labourDayAus","christmas","boxingDay"],
    "Canada" : ["newYear","familyDayBc","familyDay","goodFriday","easterMondayCanada","victoriaDay","canadaDay",
                "civicHoliday","labourDayCanada","thanksgivingCanada","remembranceDay","christmas","boxingDayCanada"],
    "UK" : ["newYear","goodFriday","easterMondayUk","mayDayHoliday","springBankHoliday","summerBankHolidayFirst","summerBankHolidayLast",
           "halloween","guyFawkesDay","christmas","boxingDay"],
    "USA" : ["newYear","mlkDay","washingtonDay","memorialDayUsa","independenceDayUsa","laborDayUsa","columbusDay","veteransDay",
            "thanksgivingUsa","christmas"]
    },
    countryData = {};
var $ = function(id) {
  return document.getElementById(id);  
};
document.addEventListener('DOMContentLoaded', function() {
    init();
});

function init(){
    var options = [], 
        index = 0, 
        selectedCountry = localStorage.selectedCountry || "USA", 
        counter =0,
        countrySelect = $("countrySelect");
    for(var country in holidayNames){
        options.push("<option value='"+country+"'>"+country+"</option>");
        countryData[country] = new LongWeekend(holidayNames[country]);
        if( country == selectedCountry){
         index = counter;   
        }
        counter++;
    }
    countrySelect.innerHTML = options.join('');
    countrySelect.selectedIndex = index;
    countrySelect.onchange=onCountryChange;
    $("upcomingBtn").onclick = switchTabs;
    $("previousBtn").onclick = switchTabs;
    $("viewAll").onclick = function(){switchTabs(true);swapView("nlwWrapper","tableWrapper");};
    $("listBackBtn").onclick = function(){swapView("tableWrapper","nlwWrapper");};
    showLongWeekendForCountry(selectedCountry);
}

function swapView(currentView, newView){
 $(currentView).style.display = 'none';
 $(newView).style.display = 'block';
}

function switchTabs(reset){ 
    if(reset!=undefined && reset==true){
        var upcoming = $("upcomingBtn"), previous = $("previousBtn");
        upcoming.classList.remove("inactive-tab");
        upcoming.classList.add("active-tab");
        previous.classList.add("inactive-tab");
        previous.classList.remove("active-tab");
        loadListData('upcoming');
    }else{
        if(this.classList.contains("inactive-tab")){
        this.classList.remove("inactive-tab");
        this.classList.add("active-tab");
        var otherTab = $(this.id=="upcomingBtn"?"previousBtn":"upcomingBtn");
        otherTab.classList.remove("active-tab");
        otherTab.classList.add("inactive-tab");
        }
    }
}

function onCountryChange(){
    var selectedCountry = getSelectedCountry();
    localStorage.selectedCountry = selectedCountry;
    showLongWeekendForCountry(selectedCountry);
}

function getSelectedCountry(){
    return $("countrySelect").options[$("countrySelect").selectedIndex].innerHTML;
}

function loadListData(listType){
 var selectedCountry = getSelectedCountry(),
     listTable = $("holidayTable"),
     listData = listType=='upcoming'? countryData[selectedCountry].getUpcomingHolidays.call(countryData[selectedCountry])
                :countryData[selectedCountry].getPreviousHolidays.call(countryData[selectedCountry]);
    for(var i=0;i<listTable.rows.length;i++){
     if(listData[i] === undefined){
         listTable.rows[i].style.display = 'none';
     }else{
         listTable.rows[i].style.display = 'block';
         $("monthHeader"+i).innerHTML = listData[i].date.toString('MMM');
         $("dateHeader"+i).innerHTML = listData[i].date.toString('dd');
         $("yearHeader"+i).innerHTML = listData[i].date.toString('yyyy');
         $("holidayDescr"+i).innerHTML = listData[i].description;
     }
    }

}

function showLongWeekendForCountry(country){
    var nlw = countryData[country].getNextLongWeekend.call(countryData[country]),
        holidayDate = nlw.date,
        daysToGo = getDaysToGo(holidayDate);
    $("holidayName").innerHTML = nlw.holidayName;
    $("nlwDescription").innerHTML = nlw.description;<commit_msg>Load lists<commit_after>var holidayNames = {
    "Australia":["newYear","australiaDay","canberraDay","goodFriday","easterSaturday","easterMondayAus","anzacDay","queensBirthday",
                "labourDayAus","christmas","boxingDay"],
    "Canada" : ["newYear","familyDayBc","familyDay","goodFriday","easterMondayCanada","victoriaDay","canadaDay",
                "civicHoliday","labourDayCanada","thanksgivingCanada","remembranceDay","christmas","boxingDayCanada"],
    "UK" : ["newYear","goodFriday","easterMondayUk","mayDayHoliday","springBankHoliday","summerBankHolidayFirst","summerBankHolidayLast",
           "halloween","guyFawkesDay","christmas","boxingDay"],
    "USA" : ["newYear","mlkDay","washingtonDay","memorialDayUsa","independenceDayUsa","laborDayUsa","columbusDay","veteransDay",
            "thanksgivingUsa","christmas"]
    },
    countryData = {};
var $ = function(id) {
  return document.getElementById(id);  
};
document.addEventListener('DOMContentLoaded', function() {
    init();
});

function init(){
    var options = [], 
        index = 0, 
        selectedCountry = localStorage.selectedCountry || "USA", 
        counter =0,
        countrySelect = $("countrySelect");
    for(var country in holidayNames){
        options.push("<option value='"+country+"'>"+country+"</option>");
        countryData[country] = new LongWeekend(holidayNames[country]);
        if( country == selectedCountry){
         index = counter;   
        }
        counter++;
    }
    countrySelect.innerHTML = options.join('');
    countrySelect.selectedIndex = index;
    countrySelect.onchange=onCountryChange;
    $("upcomingBtn").onclick = switchTabs;
    $("previousBtn").onclick = switchTabs;
    $("viewAll").onclick = function(){switchTabs(true);swapView("nlwWrapper","tableWrapper");};
    $("listBackBtn").onclick = function(){swapView("tableWrapper","nlwWrapper");};
    showLongWeekendForCountry(selectedCountry);
}

function swapView(currentView, newView){
 $(currentView).style.display = 'none';
 $(newView).style.display = 'block';
}

function switchTabs(reset){ 
    var activeTab = reset==true?$("upcomingBtn"):this,
        inactiveTab = reset==true?$("previousBtn"):$(this.id=="upcomingBtn"?"previousBtn":"upcomingBtn");
    activeTab.classList.remove("inactive-tab");
    activeTab.classList.add("active-tab");
    inactiveTab.classList.add("inactive-tab");
    inactiveTab.classList.remove("active-tab");
    loadListData();
}

function onCountryChange(){
    var selectedCountry = getSelectedCountry();
    localStorage.selectedCountry = selectedCountry;
    showLongWeekendForCountry(selectedCountry);
}

function getSelectedCountry(){
    return $("countrySelect").options[$("countrySelect").selectedIndex].innerHTML;
}

function loadListData(){
 var selectedCountry = getSelectedCountry(),
     listTable = $("holidayTable"),
     listData = $("upcomingBtn").classList.contains("active-tab")
                ?countryData[selectedCountry].getUpcomingHolidays.call(countryData[selectedCountry])
                :countryData[selectedCountry].getPreviousHolidays.call(countryData[selectedCountry]);
    for(var i=0;i<listTable.rows.length;i++){
     if(listData[i] === undefined){
         listTable.rows[i].style.display = 'none';
     }else{
         listTable.rows[i].style.display = 'block';
         $("monthHeader"+i).innerHTML = listData[i].date.toString('MMM');
         $("dateHeader"+i).innerHTML = listData[i].date.toString('dd');
         $("yearHeader"+i).innerHTML = listData[i].date.toString('yyyy');
         $("holidayDescr"+i).innerHTML = listData[i].description;
     }
    }

}

function showLongWeekendForCountry(country){
    var nlw = countryData[country].getNextLongWeekend.call(countryData[country]),
        holidayDate = nlw.date,
        daysToGo = getDaysToGo(holidayDate);
    $("holidayName").innerHTML = nlw.holidayName;
    $("nlwDescription").innerHTML = nlw.description;
{'fraction_non_alphanumeric': 0.16666666666666666, 'fraction_numerical': 0.0007358351729212656, 'mean_word_length': 4.55139550714772, 'pattern_counts': {'":': 4, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4514994', 'n_tokens_mistral': 2428, 'n_tokens_neox': 2371, 'n_words': 281}