`;
},
// We are returning the same thing as footer but empty only get called when there is no suggestion
empty: () => null,
}
},
{
name: 'popular_search',
source: popularSearchSource(popularSearchArray),
display: 'display',
templates: {
header: '
Popular Searches
',
suggestion: function (data) {
return `
${data.display}
`;
},
footer: function() {
return `
Browse the entire Learning Library
`;
}
}
}
);
// Custom submission method when user search
const submitForm = function (termUrl) {
// EDENG-3785: convert ampersand to ' and ' word to avoid missing info in URL
// TODO: if we DO run into some other character for which we need to do something like escaping,
// then we need to update to use escape/encode&decode way.
const updatedTerm = typeof(termUrl) === 'string' ? termUrl.replaceAll('&', ' and ') : termUrl;
window.location.href = '/resources/?q=' + updatedTerm;
}
//Add tracking for new taxonomy
const trackSearchTerm = function(searchTerm) {
if (searchTerm !== null && searchTerm !== ""){
let xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", `https://${window.location.hostname}/api/search-analytics/trackSearchTerm`);
xmlhttp.setRequestHeader("Content-Type", "application/json");
// Prepare request body
let requestBody = JSON.stringify({ searchTerm: searchTerm });
// Send request
xmlhttp.send(requestBody);
}
};
typeAheadInput.bind('keydown', function (e) {
// Typing should only be on letter keys
if (/^[A-Za-z0-9]$/.test(e.key)) {
clearTimeout(typingTimer);
}
if (e.key === "Enter") {
e.preventDefault();
var termFound = false;
$.each($('.tt-dataset-dataList p.tt-suggestion'), function (i, el) {
if (typeAheadInput.val() === $(el).data().display) {
submitForm($(el).data().term);
termFound = true;
}
});
$.each($('.tt-dataset-popular_search p.tt-suggestion'), function (i, el) {
// Don't ask me what is ttSelectebleObject, I don't know why but I saw it using console.log
const popularSuggestionObject = $(el).data().ttSelectableObject;
if (typeAheadInput.val() === popularSuggestionObject.display) {
submitForm(popularSuggestionObject.term);
termFound = true;
}
});
if (!termFound) {
// EDENG-3785: convert ampersand to ' and ' word to avoid missing info in URL
// TODO: if we DO run into some other character for which we need to do something like escaping,
// then we need to update to use escape/encode&decode way.
const updatedTerm = typeAheadInput.val().replaceAll('&', ' and ');
typeAheadInput.val(updatedTerm);
form.submit();
}
trackSearchTerm(typeAheadInput.val());
}
});
typeAheadInput.bind('typeahead:select', function (e, suggestion) {
submitForm(suggestion.term);
trackSearchTerm(suggestion.term);
});
typeAheadInput.on('focus', function (e) {
cancelButton.css('display', 'block');
});
header.on('click', function (e) {
/** VERY hacky way for "Search all resources" and "Browse entire Learning Library" links to work */
// When clicking on the searchAllBox div or its child, submit search
let parent = e.target.closest('.tt-suggestion.tt-selectable.searchAllBox');
if ($(e.target).hasClass('searchAllBox') || parent !== null) {
form.submit();
}
// When clicking on the browseAllLink div or its child, submit search
parent = e.target.closest('.tt-suggestion.tt-selectable.browseAllLink');
if ($(e.target).hasClass('browseAllLink') || parent !== null) {
form.submit();
}
});
//Prevent click event from bubbling up to search bar container and make it active
searchButton.on('click', function (e) {
e.stopPropagation();
});
// On keyup, start the countdown
typeAheadInput.on('keyup', function (e) {
// Typing should only be on letter keys
if (/^[A-Za-z0-9]$/.test(e.key)) {
clearTimeout(typingTimer);
typingTimer = setTimeout(doneTyping, doneTypingInterval);
}
});
// User is "finished typing," do something
function doneTyping () {
// Send request to api when no suggestion matched
if($('.tt-dataset-dataList p.tt-suggestion').size() === 0 && typeAheadInput.val().length !== 0){
let xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", `https://${window.location.hostname}/api/auto-complete/misspelled`);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send();
}
}
};
if($.fn.typeahead) {
onTypeaheadLoad();
}
else {
$(document).on('typeaheadLoaded', onTypeaheadLoad);
}
})(window.jQuery);
(function($) {
$(document).ready(function() {
var accountInfo = JSON.parse(window.localStorage.getItem('accountInfo') || '[]');
if (accountInfo.length > 1) {
$('li.my-accounts', '.user-menu').removeClass('hidden');
var my_accounts_modal = $("#my-accounts-modal").modal({
email: null,
showMyAccounts: function() {
this.populateAccounts();
this.show();
},
populateAccounts: function() {
var self = this;
var accounts = $('.accounts',this.el);
if (!$('.account').length) {
var userAccounts = JSON.parse(window.localStorage.getItem('accountInfo'));
var googleAccounts = [];
var facebookAccounts = [];
// Only show the first 5 accounts
userAccounts = userAccounts.slice(0, 5);
userAccounts.forEach(function(account) {
if(!('socialSignupTypes' in account)) {
account.socialSignupTypes = [];
}
if ('socialSignupType' in account && account.socialSignupTypes.indexOf(account.socialSignupType) === -1) {
account.socialSignupTypes.push(account.socialSignupType)
}
var accountContainer = $('
');
var accountDiv = $('
');
var email = $('
' + account.email + '
');
var label = '';
var userType = account.userType ? ' ' + account.userType : '';
if (account.membershipType === 'pro') {
label = $(
'
' +
'' +
'premium' + userType + '' +
'
'
);
} else {
label = $(
'
' +
'basic' + userType + '' +
'
'
);
}
var accountInfo = $('
');
email.appendTo(accountInfo);
label.appendTo(accountInfo);
var userIcon = $(
'
' +
'' +
'
'
);
userIcon.appendTo(accountDiv);
if (account.email === self.email) {
accountContainer.addClass('active');
$('
Logged in
').appendTo(accountInfo);
accountInfo.appendTo(accountDiv);
accountDiv.appendTo(accountContainer);
accountContainer.prependTo(accounts);
} else {
accountInfo.appendTo(accountDiv);
if (account.socialSignupTypes.length > 0) {
if (account.socialSignupTypes.indexOf('google')>-1) {
googleAccounts.push(accountDiv);
}
if (account.socialSignupTypes.indexOf('facebook')>-1) {
facebookAccounts.push(accountDiv);
}
} else {
accountDiv.appendTo(accountContainer);
accountContainer.appendTo(accounts);
}
}
});
var accountContainer;
if (facebookAccounts.length) {
accountContainer = $('
Facebook Accounts
')
accountContainer.append(facebookAccounts);
accountContainer.appendTo(accounts);
}
if (googleAccounts.length) {
accountContainer = $('
Google Accounts
')
accountContainer.append(googleAccounts);
accountContainer.appendTo(accounts);
}
}
},
switchAccounts: function(email) {
if (typeof email === 'undefined') email = null;
if (email) {
document.cookie = 'switchAccounts='+email+'; expires=1 Jan 2088 00:00:11 UTC; path=/';
if (window.Edu && window.Edu.trackEvent) {
var social = email === 'social' ? ' (social)' : '';
window.Edu.trackEvent('My accounts modal',{section: 'Responsive', method: 'switch accounts link clicked' + social},{
eventCategory: 'modal',
eventAction: 'Responsive my accounts modal: switch accounts link clicked' + social
});
}
} else {
// Clicked "log in with different email"
document.cookie = 'switchAccounts=0; expires=1 Jan 2088 00:00:11 UTC; path=/';
if (window.Edu && window.Edu.trackEvent) {
window.Edu.trackEvent('My accounts modal',{section: 'Responsive', method: 'log in with different email clicked'},{
eventCategory: 'modal',
eventAction: 'Responsive my accounts modal: log in with different email clicked'
});
}
}
window.location.href = '/?__logout';
}
});
$(document.body).on('click', '.my-accounts-link', function(e) {
e.preventDefault();
if (window.Edu && window.Edu.trackEvent) {
window.Edu.trackEvent('My accounts modal',{section: 'Responsive', method: 'opened'},{
eventCategory: 'modal',
eventAction: 'Responsive my accounts modal: opened'
});
}
my_accounts_modal.modal('showMyAccounts');
});
$('#my-accounts-modal').on('click', '.switch-accounts-link', function(e) {
e.preventDefault();
var email = $(this).data('email');
if ($(this).hasClass('account-container')) {
$(this).addClass('active');
}
if ($(this).hasClass('social-accounts')) {
email = 'social';
}
my_accounts_modal.modal('switchAccounts', email);
});
}
});
// EDENG-2704: Button to skip to the page's main content
$(document).ready(function() {
$('.skip-to-main-content').click(function(e) {
e.preventDefault();
const targetId = $(this).attr('href');
const $targetElement = $(targetId);
if ($targetElement.length) {
$targetElement.attr('tabindex', '-1').focus();
$targetElement.on('blur', function() {
$(this).removeAttr('tabindex').off('blur');
});
}
});
});
})(window.jQuery);
Review concepts and explore new topics with worksheets, hands-on activities, puzzles, games, and more–the options are endless! Access our library of 37,000+ resources today.
We've got a worksheet for anything your student is learning! Our printables make it easy to practice everything from handwriting to multiplication to sight words, and much more!
Transform study time into an adventure! Sharpen math fluency and learn letters with immersive games like Flipping Pancakes Fractions and Irregular Nouns Ski Race.
A premium membership gives you unlimited access to all of Education.com's resources and tools like playlists of guided lessons, progress insights for each student, and more!
Guided lessons
Follow our expertly-designed pathways of fun games that help learners practice and build upon skills in math, reading, writing, and typing!
Support for individual learners
Create assignments for individual learners, an entire household, or a classroom–with insights to celebrate each student's achievements and milestones
I love that it shows me the areas my child needs to improve on and directs me to resources to work with him on. It's easy to understand and navigate to each area I need to go.
Sarah H.,
parent and Education.com premium member
Education.com has multiple resources organized for any learning tool you might need as a teacher, parent, and student, and I love the ability to be able to sort by grade, subject, enrichment, or type!
Our comprehensive, standards-aligned supplemental program empowers school administrators and teachers to help students build essential skills in math, reading, writing, science, social studies, and more.