Skip to content

Commit

Permalink
Built Open GoPro docs from Internal Repo
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed May 6, 2024
1 parent 83f36b8 commit 2149465
Show file tree
Hide file tree
Showing 45 changed files with 13,988 additions and 14,682 deletions.
2 changes: 1 addition & 1 deletion assets/css/main.css

Large diffs are not rendered by default.

90 changes: 45 additions & 45 deletions assets/css/main.css.map

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions assets/css/main_spec.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

168 changes: 123 additions & 45 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,18 @@
jQuery plugin settings and other scripts
========================================================================== */

$(function() {
$(document).ready(function () {
// FitVids init
$("#main").fitVids();

// Sticky sidebar
var stickySideBar = function() {
var show =
$(".author__urls-wrapper").find("button").length === 0
? $(window).width() > 1024 // width should match $large Sass variable
: !$(".author__urls-wrapper").find("button").is(":visible");
if (show) {
// fix
$(".sidebar").addClass("sticky");
} else {
// unfix
$(".sidebar").removeClass("sticky");
}
};

stickySideBar();

$(window).resize(function() {
stickySideBar();
});

// Follow menu drop down
$(".author__urls-wrapper").find("button").on("click", function() {
$(".author__urls-wrapper button").on("click", function () {
$(".author__urls").toggleClass("is--visible");
$(".author__urls-wrapper").find("button").toggleClass("open");
});

// Close search screen with Esc key
$(document).keyup(function(e) {
$(document).keyup(function (e) {
if (e.keyCode === 27) {
if ($(".initial-content").hasClass("is--hidden")) {
$(".search-content").toggleClass("is--visible");
Expand All @@ -44,12 +23,12 @@ $(function() {
});

// Search toggle
$(".search__toggle").on("click", function() {
$(".search__toggle").on("click", function () {
$(".search-content").toggleClass("is--visible");
$(".initial-content").toggleClass("is--hidden");
// set focus on input
setTimeout(function() {
$(".search-content").find("input").focus();
setTimeout(function () {
$(".search-content input").focus();
}, 400);
});

Expand All @@ -58,11 +37,11 @@ $(function() {
offset: 20,
speed: 400,
speedAsDuration: true,
durationMax: 500
durationMax: 500,
});

// Gumshoe scroll spy init
if($("nav.toc").length > 0) {
if ($("nav.toc").length > 0) {
var spy = new Gumshoe("nav.toc a", {
// Active classes
navClass: "active", // applied to the nav list item
Expand All @@ -77,10 +56,27 @@ $(function() {
reflow: true, // if true, listen for reflows

// Event support
events: true // if true, emit custom events
events: true, // if true, emit custom events
});
}

// Auto scroll sticky ToC with content
document.addEventListener("gumshoeActivate", function (event) {
var target = event.target;
var scrollOptions = { behavior: "auto", block: "nearest", inline: "start" };

var tocElement = document.querySelector("aside.sidebar__right.sticky");
if (!tocElement) return;
if (window.getComputedStyle(tocElement).position !== "sticky") return;

if (target.parentElement.classList.contains("toc__menu") && target == target.parentElement.firstElementChild) {
// Scroll to top instead
document.querySelector("nav.toc header").scrollIntoView(scrollOptions);
} else {
target.scrollIntoView(scrollOptions);
}
});

// add lightbox class to all image links
$(
"a[href$='.jpg'],a[href$='.jpeg'],a[href$='.JPG'],a[href$='.png'],a[href$='.gif'],a[href$='.webp']"
Expand All @@ -99,38 +95,120 @@ $(function() {
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
preload: [0, 1], // Will preload 0 - before current, and 1 after the current image
},
image: {
tError: '<a href="%url%">Image #%curr%</a> could not be loaded.'
tError: '<a href="%url%">Image #%curr%</a> could not be loaded.',
},
removalDelay: 500, // Delay in milliseconds before popup is removed
// Class that is added to body when popup is open.
// make it unique to apply your CSS animations just to this exact popup
mainClass: "mfp-zoom-in",
callbacks: {
beforeOpen: function() {
beforeOpen: function () {
// just a hack that adds mfp-anim class to markup
this.st.image.markup = this.st.image.markup.replace(
"mfp-figure",
"mfp-figure mfp-with-anim"
);
}
},
},
closeOnContentClick: true,
midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
midClick: true, // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
});

// Add anchors for headings
$('.page__content').find('h1, h2, h3, h4, h5, h6').each(function() {
var id = $(this).attr('id');
if (id) {
var anchor = document.createElement("a");
anchor.className = 'header-link';
anchor.href = '#' + id;
anchor.innerHTML = '<span class=\"sr-only\">Permalink</span><i class=\"fas fa-link\"></i>';
anchor.title = "Permalink";
$(this).append(anchor);
document
.querySelector(".page__content")
.querySelectorAll("h1, h2, h3, h4, h5, h6")
.forEach(function (element) {
var id = element.getAttribute("id");
if (id) {
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML =
'<span class="sr-only">Permalink</span><i class="fas fa-link"></i>';
anchor.title = "Permalink";
element.appendChild(anchor);
}
});

// Add copy button for <pre> blocks
var copyText = function (text) {
if (document.queryCommandEnabled("copy") && navigator.clipboard) {
navigator.clipboard.writeText(text).then(
() => true,
() => console.error("Failed to copy text to clipboard: " + text)
);
return true;
} else {
var isRTL = document.documentElement.getAttribute("dir") === "rtl";

var textarea = document.createElement("textarea");
textarea.className = "clipboard-helper";
textarea.style[isRTL ? "right" : "left"] = "-9999px";
// Move element to the same position vertically
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
textarea.style.top = yPosition + "px";

textarea.setAttribute("readonly", "");
textarea.value = text;
document.body.appendChild(textarea);

var success = true;
try {
textarea.select();
success = document.execCommand("copy");
} catch (e) {
success = false;
}
textarea.parentNode.removeChild(textarea);
return success;
}
});
};

var copyButtonEventListener = function (event) {
var thisButton = event.target;

// Locate the <code> element
var codeBlock = thisButton.nextElementSibling;
while (codeBlock && codeBlock.tagName.toLowerCase() !== "code") {
codeBlock = codeBlock.nextElementSibling;
}
if (!codeBlock) {
// No <code> found - wtf?
console.warn(thisButton);
throw new Error("No code block found for this button.");
}

// Skip line numbers if present (i.e. {% highlight lineno %})
var realCodeBlock = codeBlock.querySelector("td.code, td.rouge-code");
if (realCodeBlock) {
codeBlock = realCodeBlock;
}
var result = copyText(codeBlock.innerText);
// Restore the focus to the button
thisButton.focus();
return result;
};

if (window.enable_copy_code_button) {
document
.querySelectorAll(".page__content pre > code")
.forEach(function (element, index, parentList) {
// Locate the <pre> element
var container = element.parentElement;
// Sanity check - don't add an extra button if there's already one
if (container.firstElementChild.tagName.toLowerCase() !== "code") {
return;
}
var copyButton = document.createElement("button");
copyButton.title = "Copy to clipboard";
copyButton.className = "clipboard-copy-button";
copyButton.innerHTML = '<span class="sr-only">Copy code</span><i class="far fa-copy"></i>';
copyButton.addEventListener("click", copyButtonEventListener);
container.prepend(copyButton);
});
}
});
4 changes: 2 additions & 2 deletions assets/js/main.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/js/main.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/js/plugins/jquery.greedy-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ $(function() {
// Mouse has left, start the timer
timer = setTimeout(function() {
$hlinks.addClass('hidden');
$('.greedy-nav__toggle').removeClass('close');
}, closingTime);
}).on('mouseenter', function() {
// Mouse is back, cancel the timer
Expand Down
Loading

0 comments on commit 2149465

Please sign in to comment.