Skip to content

Commit bedbe79

Browse files
committed
portal fixes
1 parent c1b7fa2 commit bedbe79

File tree

9 files changed

+193
-245
lines changed

9 files changed

+193
-245
lines changed

CLAUDE.md

Lines changed: 0 additions & 118 deletions
This file was deleted.

assets/footer.js

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
// Shared Footer Component
2+
// This component renders a consistent footer across all pages
3+
4+
class Footer {
5+
constructor(isRootPage = true) {
6+
this.isRootPage = isRootPage;
7+
this.baseUrl = isRootPage ? '' : '../';
8+
}
9+
10+
getCSS() {
11+
return `
12+
/* Footer */
13+
.footer {
14+
background: var(--bg-secondary);
15+
border-top: 1px solid var(--border-light);
16+
padding: 3rem 0 2rem;
17+
}
18+
19+
.footer-content {
20+
max-width: 1200px;
21+
margin: 0 auto;
22+
padding: 0 2rem;
23+
}
24+
25+
.footer-grid {
26+
display: grid;
27+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
28+
gap: 2rem;
29+
margin-bottom: 2rem;
30+
}
31+
32+
.footer-section h3 {
33+
font-weight: 600;
34+
margin-bottom: 1rem;
35+
color: var(--text-primary);
36+
}
37+
38+
.footer-section ul {
39+
list-style: none;
40+
}
41+
42+
.footer-section ul li {
43+
margin-bottom: 0.5rem;
44+
}
45+
46+
.footer-section ul li a {
47+
color: var(--text-secondary);
48+
text-decoration: none;
49+
transition: color 0.2s ease;
50+
}
51+
52+
.footer-section ul li a:hover {
53+
color: var(--primary-color);
54+
}
55+
56+
.footer-bottom {
57+
border-top: 1px solid var(--border-light);
58+
padding-top: 2rem;
59+
text-align: center;
60+
color: var(--text-muted);
61+
}
62+
`;
63+
}
64+
65+
getHTML() {
66+
const pagesPath = this.isRootPage ? 'pages/' : '';
67+
68+
return `
69+
<footer class="footer">
70+
<div class="footer-content">
71+
<div class="footer-grid">
72+
<div class="footer-section">
73+
<h3>ServiceNow Code Snippets</h3>
74+
<ul>
75+
<li><a href="${pagesPath}core-apis.html">Core ServiceNow APIs</a></li>
76+
<li><a href="${pagesPath}server-side-components.html">Server-Side Components</a></li>
77+
<li><a href="${pagesPath}client-side-components.html">Client-Side Components</a></li>
78+
<li><a href="${pagesPath}modern-development.html">Modern Development</a></li>
79+
<li><a href="${pagesPath}integration.html">Integration</a></li>
80+
<li><a href="${pagesPath}specialized-areas.html">Specialized Areas</a></li>
81+
</ul>
82+
</div>
83+
84+
<div class="footer-section">
85+
<h3>Community</h3>
86+
<ul>
87+
<li><a href="https://github.com/ServiceNowDevProgram/code-snippets" target="_blank">GitHub Repository</a></li>
88+
<li><a href="https://github.com/ServiceNowDevProgram/code-snippets/blob/main/CONTRIBUTING.md" target="_blank">Contributing Guide</a></li>
89+
<li><a href="https://github.com/ServiceNowDevProgram/code-snippets/issues" target="_blank">Report Issues</a></li>
90+
<li><a href="https://sndevs.slack.com/" target="_blank">sndevs Slack</a></li>
91+
<li><a href="https://github.com/ServiceNowDevProgram/code-snippets/blob/main/README.md" target="_blank">README</a></li>
92+
<li><a href="https://github.com/ServiceNowDevProgram/Hacktoberfest" target="_blank">Hacktoberfest repo</a></li>
93+
</ul>
94+
</div>
95+
96+
<div class="footer-section">
97+
<h3>ServiceNow</h3>
98+
<ul>
99+
<li><a href="https://developer.servicenow.com/" target="_blank">Developer Program</a></li>
100+
<li><a href="https://docs.servicenow.com/" target="_blank">Documentation</a></li>
101+
<li><a href="https://www.servicenow.com/community" target="_blank">Community</a></li>
102+
</ul>
103+
</div>
104+
</div>
105+
106+
<div class="footer-bottom">
107+
<p>2025 - Hosted by the ServiceNow Developer Program</p>
108+
<p>This repository is provided as-is, without warranties. Use at your own risk.</p>
109+
</div>
110+
</div>
111+
</footer>
112+
`;
113+
}
114+
115+
render() {
116+
// Add CSS if not already added
117+
if (!document.getElementById('footer-styles')) {
118+
const style = document.createElement('style');
119+
style.id = 'footer-styles';
120+
style.textContent = this.getCSS();
121+
document.head.appendChild(style);
122+
}
123+
124+
// Create footer element
125+
const footerContainer = document.createElement('div');
126+
footerContainer.innerHTML = this.getHTML();
127+
128+
return footerContainer.firstElementChild;
129+
}
130+
131+
// Static method to easily add footer to any page
132+
static addToPage(isRootPage = true) {
133+
const footer = new Footer(isRootPage);
134+
const footerElement = footer.render();
135+
136+
// Add footer to the page
137+
document.body.appendChild(footerElement);
138+
139+
return footerElement;
140+
}
141+
}
142+
143+
// Auto-initialize if script is loaded with data-auto-init
144+
document.addEventListener('DOMContentLoaded', function() {
145+
const script = document.querySelector('script[src*="footer.js"]');
146+
if (script && script.hasAttribute('data-auto-init')) {
147+
const isRootPage = script.getAttribute('data-root-page') === 'true';
148+
Footer.addToPage(isRootPage);
149+
}
150+
});
151+
152+
// Make Footer available globally
153+
window.Footer = Footer;

0 commit comments

Comments
 (0)