-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'current' into cafzal-patch-1
- Loading branch information
Showing
8 changed files
with
107 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
const path = require("path"); | ||
const math = require("remark-math"); | ||
const katex = require("rehype-katex"); | ||
|
||
const { versions, versionedPages, versionedCategories } = require("./dbt-versions"); | ||
require("dotenv").config(); | ||
|
||
|
@@ -258,6 +259,8 @@ var siteSettings = { | |
src: "https://cdn.jsdelivr.net/npm/[email protected]/release/featherlight.min.js", | ||
defer: true, | ||
}, | ||
"https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js", | ||
"/js/headerLinkCopy.js", | ||
"/js/gtm.js", | ||
"/js/onetrust.js", | ||
"https://kit.fontawesome.com/7110474d41.js", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* eslint-disable */ | ||
|
||
// Get all the headers with anchor links. | ||
// The 'click' event worked over 'popstate' because click captures page triggers, as well as back/forward button triggers | ||
// Adding the 'load' event to also capture the initial page load | ||
window.addEventListener("click", copyHeader); | ||
window.addEventListener("load", copyHeader); | ||
|
||
// separating function from eventlistener to understand they are two separate things | ||
function copyHeader () { | ||
const headers = document.querySelectorAll("h2.anchor, h3.anchor"); | ||
|
||
headers.forEach((header) => { | ||
header.style.cursor = "pointer"; | ||
const clipboard = new ClipboardJS(header, { | ||
text: function(trigger) { | ||
const anchorLink = trigger.getAttribute("id"); | ||
return window.location.href.split('#')[0] + '#' + anchorLink; | ||
} | ||
}); | ||
|
||
clipboard.on('success', function(e) { | ||
// Provide user feedback (e.g., alert or tooltip) here | ||
const popup = document.createElement('div'); | ||
popup.classList.add('copy-popup'); | ||
popup.innerText = 'Link copied!'; | ||
document.body.appendChild(popup); | ||
|
||
// Set up timeout to remove the popup after 3 seconds | ||
setTimeout(() => { | ||
document.body.removeChild(popup); | ||
}, 3000); | ||
|
||
// Add close button ('x') | ||
const closeButton = document.createElement('span'); | ||
closeButton.classList.add('close-button'); | ||
closeButton.innerHTML = ' ×'; // '×' symbol for 'x' | ||
closeButton.addEventListener('click', () => { | ||
if (document.body.contains(popup)) { | ||
document.body.removeChild(popup); | ||
} | ||
}); | ||
popup.appendChild(closeButton); | ||
|
||
// Add and remove the 'clicked' class for styling purposes | ||
e.trigger.classList.add("clicked"); | ||
setTimeout(() => { | ||
if (document.body.contains(popup)) { | ||
document.body.removeChild(popup); | ||
} | ||
}, 3000); | ||
}); | ||
|
||
clipboard.on('error', function(e) { | ||
console.error("Unable to copy to clipboard: " + e.text); | ||
}); | ||
}); | ||
}; |