Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kay-who-codes authored Feb 21, 2025
1 parent 4a9d6aa commit 1e94bd9
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 129 deletions.
79 changes: 79 additions & 0 deletions header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* Header Bar Styles */
.header-bar {
position: absolute; /* Ensures it stays at the top of the page, not fixed on the screen */
top: 0;
left: 0;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 5px 10px;
background-color: #3b3b3b00;
color: var(--text-color);
z-index: 1000; /* Ensures it stays above other content */
transition: background-color 0.3s ease, color 0.3s ease;
margin-bottom: 50px;
}

.header-link {
color: #4e4e4e;
font-size: 20px;
text-decoration: none;
font-weight: bold;
margin-left: 10px;
}

.header-link:hover {
color: #757575;
}

/* Dropdown menu styles */
.dropdown {
position: relative;
}

.dropbtn {
background-color: #505050ec;
color: white;
padding: 8px 16px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-right: 15px;
}

.dropbtn:hover {
background-color: #333;
}

.dropdown-content {
display: none;
position: absolute;
right: 0;
background-color: #1d1d1d;
border: 1px solid #535353;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
z-index: 1001;
min-width: 220px;
max-height: 380px; /* Set a maximum height for the dropdown */
overflow-y: auto; /* Enable vertical scrolling */
padding: 10px 0;
}

.dropdown-content a {
color: white;
text-decoration: none;
padding: 8px 16px;
display: block;
font-size: 14px;
}

.dropdown-content a:hover {
background-color: #535353;
}

.dropdown.show .dropdown-content {
display: block;
}
47 changes: 47 additions & 0 deletions header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// ADD HEADER
fetch('https://kay-who-codes.github.io/Kay-App-Assets/Full-Header.html')
.then(response => {
if (!response.ok) {
throw new Error('Failed to load header');
}
return response.text();
})
.then(data => {
document.getElementById('header').innerHTML = data;

// Update the header link dynamically
const headerLink = document.querySelector('.header-link');
if (headerLink) {
// Option 1: Extract from URL
const pathSegments = window.location.pathname.split('/').filter(segment => segment);
const repoName = pathSegments[0] || 'APP_NAME_GOES_HERE';
const appName = repoName.replace(/-/g, ' ');

headerLink.textContent = appName;
headerLink.href = `https://github.com/kay-who-codes/${repoName}`;
}

// Add event listeners after injecting the header
const dropbtn = document.querySelector('.dropbtn');
if (dropbtn) {
dropbtn.addEventListener('click', toggleDropdown);
}

// Close dropdown when clicking outside
window.addEventListener('click', (event) => {
const dropdown = document.querySelector('.dropdown');
if (dropdown && !dropdown.contains(event.target)) {
dropdown.classList.remove('show');
}
});
})
.catch(error => {
console.error('Error loading header:', error);
document.getElementById('header').innerHTML = '<p>Header failed to load.</p>';
});

// Toggle dropdown visibility
function toggleDropdown() {
const dropdown = document.querySelector('.dropdown');
dropdown.classList.toggle('show');
}
48 changes: 11 additions & 37 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🌍 World Times</title>
<link rel="stylesheet" href="style.css">
</head>
<body>

<!-- Header Bar -->
<header class="header-bar">
<a href="https://github.com/kay-who-codes/World-Times/" class="header-link">🌍 World Times</a>
<div class="dropdown">
<button class="dropbtn" onclick="toggleDropdown()">More Apps</button>
<div class="dropdown-content" id="dropdownMenu">
<a href="https://kay-who-codes.github.io/Cards-Against-Humanity/">⬜ Cards Against Humanity</a>
<a href="https://kay-who-codes.github.io/Ultimate-Drinking-Cards">🍻 Ultimate Drinking Cards</a>
<a href="https://kay-who-codes.github.io/Kings-Cup/">🍺 Kings Cup</a>
<a href="https://kay-who-codes.github.io/Question-Cards/">❓ Question Cards</a>
<a href="https://kay-who-codes.github.io/Daily-Comic-Strips/">🗞️ Comic Strips</a>
<a href="https://kay-who-codes.github.io/Percentage-Calculators/">➗ Percentage Calculators</a>
<a href="https://kay-who-codes.github.io/Bitcoin-Holdings-Value-Calculator/">🟠 BTC Holdings Value</a>
<a href="https://kay-who-codes.github.io/Drink-Value-Calculator/">🍸 Drink Value Calculator</a>
<a href="https://kay-who-codes.github.io/Soundboard/">🔊 Soundboard</a>
<a href="https://kay-who-codes.github.io/Greek-Quiz/">🇬🇷 Greek Quiz</a>
<a href="https://kay-who-codes.github.io/HTML-Displayer/">👁️ HTML Viewer</a>
<a href="https://kay-who-codes.github.io/Calendar-Holiday-Countdown/">📅 Calendar Countdown</a>
<a href="https://kay-who-codes.github.io/Time-Progress-Meters/">⏳ Time Progress Meters</a>
<a href="https://kay-who-codes.github.io/13-Month-Calendar-Converter/">📅 13-Month Calendar Converter</a>
<a href="https://kay-who-codes.github.io/Skint-Countdown/">⌛ Skint Countdown</a>
<a href="https://kay-who-codes.github.io/Song-Inspirator/">🎶 Song Inspirator</a>
<a href="https://kay-who-codes.github.io/Advertising-Character-Generator/">👤 Advertising Character Generator</a>
<a href="https://kay-who-codes.github.io/Bible-Completion-Calculator/">✝️ Bible Completion Calculator</a>
<a href="https://kay-who-codes.github.io/Random-Bible-Verse/">✝️ Random Bible Verses</a>
<a href="https://kay-who-codes.github.io/Random-Numbers/">🔢 Random Number Generator</a>
<a href="https://kay-who-codes.github.io/Coinflip/">🪙 Coinflip</a>
<a href="https://kay-who-codes.github.io/Game-Point-Tracker/">⚽ Game Point Tracker</a>
</div>
</div>
</header>
<link rel="stylesheet" href="header.css">
</head>
<body>
<!-- Header Bar -->
<div id="header"></div>

<!-- Main Content -->

<div class="time-container" id="before-london"></div>

Expand All @@ -54,7 +27,8 @@ <h1>🏴󠁧󠁢󠁥󠁮󠁧󠁿 London: <span id="london-time"></span></h1>
</a>
</p>
</footer>

<script src="script.js"></script>
</body>

<script src="script.js" defer></script>
<script src="header.js" defer></script>
</body>
</html>
14 changes: 0 additions & 14 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
// HEADER BAR

// Toggle dropdown visibility
function toggleDropdown() {
const dropdown = document.querySelector('.dropdown');
dropdown.classList.toggle('show');
}

// Close dropdown when clicking outside
window.addEventListener('click', (event) => {
const dropdown = document.querySelector('.dropdown');
if (!dropdown.contains(event.target)) {
dropdown.classList.remove('show');
}
});

// Predefined offsets relative to GMT
const countries = [
Expand Down
79 changes: 1 addition & 78 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,87 +1,10 @@
/* Header Bar Styles */
.header-bar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 5px 10px;
background-color: #00000000;
color: var(--text-color);
top: 0;
left: 0;
right: 0;
z-index: 1000; /* Ensure it stays on top */
transition: grey 0.3s ease, color 0.3s ease;
}

.header-link {
color: #4e4e4e;
font-size: 20px;
text-decoration: none;
font-weight: bold;
margin-left: 20px;
}

.header-link:hover {
color: #757575;
}

/* Dropdown menu styles */
.dropdown {
position: relative;
}

.dropbtn {
background-color: #505050;
color: white;
padding: 8px 16px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-right: 10px;
}

.dropbtn:hover {
background-color: #333;
}

.dropdown-content {
display: none;
position: absolute;
right: 0;
background-color: #1d1d1d;
border: 1px solid #535353;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
z-index: 1001;
min-width: 220px;
max-height: 380px; /* Set a maximum height for the dropdown */
overflow-y: auto; /* Enable vertical scrolling */
padding: 10px 0;
}

.dropdown-content a {
color: white;
text-decoration: none;
padding: 8px 16px;
display: block;
font-size: 14px;
}

.dropdown-content a:hover {
background-color: #535353;
}

.dropdown.show .dropdown-content {
display: block;
}

body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #121212;
color: #fff;
margin: 20px;
margin: 60px 0px 20px 0px;
}

h1 {
Expand Down

0 comments on commit 1e94bd9

Please sign in to comment.