amp-web-push-widget button.amp-subscribe { display: inline-flex; align-items: center; border-radius: 5px; border: 0; box-sizing: border-box; margin: 0; padding: 10px 15px; cursor: pointer; outline: none; font-size: 15px; font-weight: 500; background: #4A90E2; margin-top: 7px; color: white; box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.5); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .amp-logo amp-img{width:190px} .amp-menu input{display:none;}.amp-menu li.menu-item-has-children ul{display:none;}.amp-menu li{position:relative;display:block;}.amp-menu > li a{display:block;} /* Inline styles */ div.acss0f1bf{display:none;} .icon-widgets:before {content: "\e1bd";}.icon-search:before {content: "\e8b6";}.icon-shopping-cart:after {content: "\e8cc";}
Generate fictional university names with complete details including location,
founding year, enrollment, and more. Perfect for writers, game designers,
or anyone needing academic institution names.
// DOM elements const generateBtn = document.getElementById('generate-btn'); const saveBtn = document.getElementById('save-btn'); const collegeCard = document.getElementById('college-card'); const collegeLogo = document.getElementById('college-logo'); const collegeNameEl = document.getElementById('college-name'); const collegeMotto = document.getElementById('college-motto'); const collegeLocation = document.getElementById('college-location'); const collegeFounded = document.getElementById('college-founded'); const collegeEnrollment = document.getElementById('college-enrollment'); const collegeAcceptance = document.getElementById('college-acceptance'); const collegeType = document.getElementById('college-institution-type'); const collegeColors = document.getElementById('college-colors'); const collegeMascot = document.getElementById('college-mascot'); const collegePrograms = document.getElementById('college-programs'); const savedList = document.getElementById('saved-list');
// Generate a random number between min and max function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
// Get a random element from an array function getRandomElement(array) { return array[getRandomInt(0, array.length - 1)]; }
// Generate a college name based on type function generateCollegeName(type) { const usePrefix = Math.random() > 0.3; const useSuffix = type !== 'university';
let nameParts = [];
if (usePrefix) { nameParts.push(getRandomElement(collegeData.prefixes)); }
nameParts.push(getRandomElement(collegeData.names));
if (useSuffix) { if (type === 'university') { nameParts.push('University'); } else { nameParts.push(getRandomElement(collegeData.suffixes.filter(s => s.toLowerCase() === type))); } } else { nameParts.push('University'); }
return nameParts.join(' '); }
// Generate location based on selected region function generateLocation(region) { if (region === 'random') { const regions = Object.keys(collegeData.locations); region = regions[getRandomInt(0, regions.length - 1)]; } return getRandomElement(collegeData.locations[region]); }
// Generate founding year based on prestige function generateFoundedYear(prestige) { const currentYear = new Date().getFullYear(); switch (prestige) { case 'elite': return getRandomInt(1636, 1850); case 'selective': return getRandomInt(1851, 1950); case 'average': return getRandomInt(1951, 1990); case 'open': return getRandomInt(1991, currentYear - 5); } }
// Generate enrollment based on prestige function generateEnrollment(prestige) { switch (prestige) { case 'elite': return getRandomInt(5000, 30000); case 'selective': return getRandomInt(3000, 25000); case 'average': return getRandomInt(5000, 40000); case 'open': return getRandomInt(10000, 80000); } }
// Generate acceptance rate based on prestige function generateAcceptanceRate(prestige) { switch (prestige) { case 'elite': return getRandomInt(5, 15) + '%'; case 'selective': return getRandomInt(20, 50) + '%'; case 'average': return getRandomInt(55, 80) + '%'; case 'open': return getRandomInt(85, 100) + '%'; } }
// Generate notable programs based on focus function generatePrograms(focus) { const programs = [...collegeData.programs[focus]]; const extraCount = getRandomInt(0, 3);
// Add some random programs from other focuses const otherFocuses = Object.keys(collegeData.programs).filter(f => f !== focus); for (let i = 0; i < extraCount; i++) { const randomFocus = getRandomElement(otherFocuses); const randomProgram = getRandomElement(collegeData.programs[randomFocus]); if (!programs.includes(randomProgram)) { programs.push(randomProgram); } } return programs.slice(0, 5).join(', '); } // Generate institution type function generateInstitutionType(type, focus) { const possibleTypes = collegeData.institutionTypes[type]; let institutionType = getRandomElement(possibleTypes); if (type === 'university' || type === 'college') { if (focus === 'technical' || focus === 'stem') { institutionType = institutionType.replace('Arts', 'Technology'); } else if (focus === 'arts') { institutionType = institutionType.replace('Technology', 'Arts'); } } return institutionType; } // Generate a random college function generateCollege() { const type = document.getElementById('college-type').value; const location = document.getElementById('location').value; const focus = document.getElementById('focus').value; const prestige = document.getElementById('prestige').value; const name = generateCollegeName(type); const motto = getRandomElement(collegeData.mottos); const collegeLocation = generateLocation(location); const founded = generateFoundedYear(prestige); const enrollment = generateEnrollment(prestige).toLocaleString(); const acceptance = generateAcceptanceRate(prestige); const institutionType = generateInstitutionType(type, focus); const colors = getRandomElement(collegeData.colors); const mascot = getRandomElement(collegeData.mascots); const programs = generatePrograms(focus); return { name, motto, location: collegeLocation, founded, enrollment, acceptance, type: institutionType, colors, mascot, programs }; } // Display college in the UI function displayCollege(college) { collegeCard.style.display = 'block'; collegeLogo.textContent = college.name.split(' ').map(w => w[0]).join('').substring(0, 3); collegeNameEl.textContent = college.name; collegeMotto.textContent = `"${college.motto}"`; collegeLocation.textContent = college.location; collegeFounded.textContent = college.founded; collegeEnrollment.textContent = college.enrollment; collegeAcceptance.textContent = college.acceptance; collegeType.textContent = college.type; collegeColors.textContent = college.colors; collegeMascot.textContent = college.mascot; collegePrograms.textContent = college.programs;
// Random logo color const colors = ['#3498db', '#e74c3c', '#2ecc71', '#f39c12', '#9b59b6', '#1abc9c', '#d35400']; collegeLogo.style.backgroundColor = getRandomElement(colors); }
// Save college to local storage function saveCollege(college) { let savedColleges = JSON.parse(localStorage.getItem('savedColleges')) || []; savedColleges.unshift(college); if (savedColleges.length > 10) { savedColleges = savedColleges.slice(0, 10); } localStorage.setItem('savedColleges', JSON.stringify(savedColleges)); renderSavedColleges(); }
// Render saved colleges from local storage function renderSavedColleges() { const savedColleges = JSON.parse(localStorage.getItem('savedColleges')) || []; savedList.innerHTML = '';
savedColleges.forEach(college => { const item = document.createElement('div'); item.className = 'saved-item'; item.textContent = college.name; item.addEventListener('click', () => displayCollege(college)); savedList.appendChild(item); }); }
// Generate button click handler generateBtn.addEventListener('click', () => { const college = generateCollege(); currentCollege = college; displayCollege(college); });
// Save button click handler saveBtn.addEventListener('click', () => { if (currentCollege) { saveCollege(currentCollege); saveBtn.textContent = 'Saved!'; setTimeout(() => { saveBtn.textContent = 'Save This College'; }, 2000); } });
// Initialize let currentCollege = null; renderSavedColleges();
// Generate a college on first load
generateBtn.click();