Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Custom NYU Libraries Footer #66

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,184 @@ function loadNYUPerstareFonts() {

loadNYUPerstareFonts();

function appendChatWidget() {
const CHATWIDGET_EMBED_CSS_URL = 'https://cdn.library.nyu.edu/chatwidget-embed/index.min.css';
const CHATWIDGET_EMBED_PROD_URL = 'https://cdn.library.nyu.edu/chatwidget-embed/index.min.js';

if (!document.querySelector('link[href="' + CHATWIDGET_EMBED_CSS_URL + '"]')) {
const linkTag = document.createElement('link');
linkTag.rel = 'stylesheet';
linkTag.href = CHATWIDGET_EMBED_CSS_URL;
document.head.appendChild(linkTag);
}

if (!document.querySelector('script[src="' + CHATWIDGET_EMBED_PROD_URL + '"]')) {
const scriptTag = document.createElement('script');
scriptTag.src = CHATWIDGET_EMBED_PROD_URL;
document.head.appendChild(scriptTag);
}
}

appendChatWidget();

function loadSSNYULibrariesFont() {
const style = document.createElement("style");
const cssRule = `
@font-face {
font-family: "SS NYULibraries";
src: url("https://library.nyu.edu/assets/fonts/ss-nyu-libraries.eot");
src: url("https://library.nyu.edu/assets/fonts/ss-nyu-libraries.eot?#iefix") format("embedded-opentype"),
url("https://library.nyu.edu/assets/fonts/ss-nyu-libraries.woff") format("woff"),
url("https://library.nyu.edu/assets/fonts/ss-nyu-libraries.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}
`;

if (style.styleSheet) {
style.styleSheet.cssText = cssRule;
} else {
style.appendChild(document.createTextNode(cssRule));
}

document.head.appendChild(style);
}

loadSSNYULibrariesFont();

/* Uncomment to run the script locally */
// document.addEventListener("DOMContentLoaded", function () {
// function updateFooter() {
// function createNewFooter() {
// const footer = document.createElement("footer");
// footer.id = "footer";
// footer.className = "primary-footer";
// footer.setAttribute("data-swiftype-index", "false");
// footer.innerHTML = `
// <div class="wrap">
// <div class="block-container">
// <div class="block block--25 footer__give">
// <form class="footer__search">
// <label class="sr-only" for="f_footer__search__field"> search this site </label>
// <input id="f_footer__search__field" type="text" class="footer__search__field st-default-search-input" name="q" placeholder=" search this site " autocomplete="off" autocorrect="off" autocapitalize="off">
// <input type="submit" class="footer__search__button ss-icon" value="&#x1F50D;" >
// </form>

// <a class="button" href="https://library.nyu.edu/giving/">Give to the Libraries</a>
// </div>

// <div class="block block--25 footer__menu">
// <ul class="list">
// <li class="menu__li menu__li--login-to-nyu-home">
// <a href="https://home.nyu.edu" class="menu__link menu__link--login-to-nyu-home" target="_blank">
// Login to NYU Home
// </a>
// </li>
// <li class="menu__li menu__li--departments">
// <a href="https://library.nyu.edu/departments/" class="menu__link menu__link--departments">
// Departments
// </a>
// </li>
// <li class="menu__li menu__li--staff-wiki">
// <a href="https://wiki.library.nyu.edu/" class="menu__link menu__link--staff-wiki" target="_blank">
// Staff Wiki
// </a>
// </li>
// <li class="menu__li menu__li--staff-directory">
// <a href="https://library.nyu.edu/people/" class="menu__link menu__link--staff-directory">
// Staff Directory
// </a>
// </li>
// <li class="menu__li menu__li--status-page">
// <a href="https://nyulibraries.statuspage.io" class="menu__link menu__link--status-page" target="_blank">
// Status Page
// </a>
// </li>
// </ul>
// </div>
// <div class="block block--25 footer__menu">
// <ul class="list">
// <li class="menu__li menu__li--research-guides">
// <a href="https://guides.nyu.edu/" class="menu__link menu__link--research-guides" target="_blank">
// Research Guides
// </a>
// </li>
// <li class="menu__li menu__li--faqs">
// <a href="http://library.answers.nyu.edu" class="menu__link menu__link--faqs" target="_blank">
// FAQs
// </a>
// </li>
// <li class="menu__li menu__li--career-opportunities">
// <a href="https://library.nyu.edu/about/our-team/career-opportunities/" class="menu__link menu__link--career-opportunities">
// Career Opportunities
// </a>
// </li>
// <li class="menu__li menu__li--contact-us">
// <a href="https://library.nyu.edu/contact/" class="menu__link menu__link--contact-us">
// Contact Us
// </a>
// </li>
// <li class="menu__li menu__li--accessibility">
// <a href="https://www.nyu.edu/footer/accessibility.html" class="menu__link menu__link--accessibility" target="_blank">
// Accessibility
// </a>
// </li>
// </ul>
// </div> <!-- block block--25 footer__menu -->
// <div class="block block--25 footer__social">
// <p>
// Find out about upcoming programs, events, and resources.<br>
// <a class="ss-navigateright right" href="https://bit.ly/nyu-liblink">Subscribe to our email list</a>
// </p>
// <a href="https://www.facebook.com/nyulibraries" class="ss-icon" target="_blank" aria-label="NYU Libraries Facebook">&#xF610;</a>
// <a href="https://www.instagram.com/nyulibraries" class="ss-icon" target="_blank" aria-label="NYU Libraries Instagram">&#xF641;</a>
// <a href="https://www.linkedin.com/company/nyu-libraries" class="ss-icon" target="_blank" aria-label="NYU Libraries LinkedIn">&#xF612;</a>
// </div>
// </div> <!-- block-container -->
// <div class="footer__copyright">
// Unless otherwise noted, all content copyright New York University. All rights reserved.
// <a href="https://library.nyu.edu/privacy-policy/">Privacy policy</a>

// <a class="footer__logo" href="https://www.nyu.edu">
// <img src="/assets/images/nyu-footer-logo.svg" alt="New York University homepage." height="27">
// </a>
// </div>
// </div> <!-- wrap -->
// `;
// return footer;
// }

// function replaceFooter() {
// const oldFooter = document.querySelector(".public-footer-container");
// if (oldFooter) {
// const newFooter = createNewFooter();
// oldFooter.parentNode.replaceChild(newFooter, oldFooter);
// console.log("Footer replaced successfully");
// } else {
// console.log("Footer container not found");
// }
// }

// const observer = new MutationObserver((mutationsList, observer) => {
// for (const mutation of mutationsList) {
// console.log("DOM change detected");
// if (mutation.type === "childList" && document.querySelector(".public-footer-container")) {
// replaceFooter();
// observer.disconnect();
// break;
// }
// }
// });

// if (document.body) {
// observer.observe(document.body, { childList: true, subtree: true });
// } else {
// console.error("document.body is null. Observer cannot start.");
// }
// }

// updateFooter();
// });



98 changes: 91 additions & 7 deletions layouts/footer.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,91 @@
<div class="public-footer-container">
<div class="container">
<a href="https://www.nyu.edu/footer/accessibility.html" target="_blank">Accessibility <span class="sr-only">(opens
in new window)</span></a>
</div>
</div>
<script src="https://cdn.library.nyu.edu/statuspage-embed/index.min.js"></script>
<footer id="footer" class="primary-footer" data-swiftype-index="false">
<div class="wrap">
<div class="block-container">
<div class="block block--25 footer__give">
<form class="footer__search">
<label class="sr-only" for="f_footer__search__field"> search this site </label>
<input id="f_footer__search__field" type="text" class="footer__search__field st-default-search-input" name="q" placeholder=" search this site " autocomplete="off" autocorrect="off" autocapitalize="off">
<input type="submit" class="footer__search__button ss-icon" value="&#x1F50D;" >
</form>

<a class="button" href="https://library.nyu.edu/giving/">Give to the Libraries</a>
</div>

<div class="block block--25 footer__menu">
<ul class="list">
<li class="menu__li menu__li--login-to-nyu-home">
<a href="https://home.nyu.edu" class="menu__link menu__link--login-to-nyu-home" target="_blank">
Login to NYU Home
</a>
</li>
<li class="menu__li menu__li--departments">
<a href="https://library.nyu.edu/departments/" class="menu__link menu__link--departments">
Departments
</a>
</li>
<li class="menu__li menu__li--staff-wiki">
<a href="https://wiki.library.nyu.edu/" class="menu__link menu__link--staff-wiki" target="_blank">
Staff Wiki
</a>
</li>
<li class="menu__li menu__li--staff-directory">
<a href="https://library.nyu.edu/people/" class="menu__link menu__link--staff-directory">
Staff Directory
</a>
</li>
<li class="menu__li menu__li--status-page">
<a href="https://nyulibraries.statuspage.io" class="menu__link menu__link--status-page" target="_blank">
Status Page
</a>
</li>
</ul>
</div>
<div class="block block--25 footer__menu">
<ul class="list">
<li class="menu__li menu__li--research-guides">
<a href="https://guides.nyu.edu/" class="menu__link menu__link--research-guides" target="_blank">
Research Guides
</a>
</li>
<li class="menu__li menu__li--faqs">
<a href="http://library.answers.nyu.edu" class="menu__link menu__link--faqs" target="_blank">
FAQs
</a>
</li>
<li class="menu__li menu__li--career-opportunities">
<a href="https://library.nyu.edu/about/our-team/career-opportunities/" class="menu__link menu__link--career-opportunities">
Career Opportunities
</a>
</li>
<li class="menu__li menu__li--contact-us">
<a href="https://library.nyu.edu/contact/" class="menu__link menu__link--contact-us">
Contact Us
</a>
</li>
<li class="menu__li menu__li--accessibility">
<a href="https://www.nyu.edu/footer/accessibility.html" class="menu__link menu__link--accessibility" target="_blank">
Accessibility
</a>
</li>
</ul>
</div> <!-- block block--25 footer__menu -->
<div class="block block--25 footer__social">
<p>
Find out about upcoming programs, events, and resources.<br>
<a class="ss-navigateright right" href="https://bit.ly/nyu-liblink">Subscribe to our email list</a>
</p>
<a href="https://www.facebook.com/nyulibraries" class="ss-icon" target="_blank" aria-label="NYU Libraries Facebook">&#xF610;</a>
<a href="https://www.instagram.com/nyulibraries" class="ss-icon" target="_blank" aria-label="NYU Libraries Instagram">&#xF641;</a>
<a href="https://www.linkedin.com/company/nyu-libraries" class="ss-icon" target="_blank" aria-label="NYU Libraries LinkedIn">&#xF612;</a>
</div>
</div> <!-- block-container -->
<div class="footer__copyright">
Unless otherwise noted, all content copyright New York University. All rights reserved.
<a href="https://library.nyu.edu/privacy-policy/">Privacy policy</a>

<a class="footer__logo" href="https://www.nyu.edu">
<img src="/assets/images/nyu-footer-logo.svg" alt="New York University homepage." height="27">
</a>
</div>
</div> <!-- wrap -->
</footer>
Loading