mirror of
https://github.com/caddyserver/website.git
synced 2025-04-20 12:15:08 -04:00
New Website: Phase I (#357)
* Initial commit; starting new design Dropdown menu * Begin docs layout of new design * Get themes under control; button hover splash * Some basic responsiveness * Finish responsive layout; several bug fixes * Avoid flash during color scheme change * Begin building top of homepage * docs: Start building quick-assist feature * Work on homepage a little more * Keep working on homepage * More homepage progress * Some sponsor SVGs * Add sponsor features * Implement basic Sponsor Experience box * Reorganize some styles * WIP sponsors page * Start features page WIP * Minor improvements * Fix headings; work on features page * WIP features page * Continue work on marketing pages * Continue work on features page * More features WIP * Continue features page... * More work on features page * Keeping going :) * Continue home and features pages * More homepage/features content, screenshots, tweaks * Minor fixes to features page * Minor tweaks * Work on testimonials * Work on homepage more * More homepage work * Continue work on homepage * Add some sponsor logos * Some citation screenshots * Add citations * Start making homepage responsive * Re-add cache busting Fix docs * Use markdown syntax highlighting on frontpage * Rework AJQuery to $_ to not interfere with jQuery * Rewrite quick assist with AlpineJS, use markdown for contents * More work on marketing pages * Rebase and fix code displays * Syntax highlight on-demand example, fix rollover * Adjust on-demand demo * Work on responsiveness * Keep working on responsiveness * Mainly finish making design responsive * Thiccer favicon * More work on marketing pages * Keep on going * Fix link * Move new site into src folder * Add open graph image * Add recorded demo for homepage * Tweak caption * Fix Poppins font for now * Minor tweaks * Trim demo ending * Remove unfinished pages Also update Framer logo --------- Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
parent
5bb6d92c63
commit
07c51663ab
191 changed files with 13008 additions and 4970 deletions
87
src/old/resources/js/docs.js
Normal file
87
src/old/resources/js/docs.js
Normal file
|
@ -0,0 +1,87 @@
|
|||
$(function() {
|
||||
function hasPrefix(str, prefix) {
|
||||
if (!prefix) return true;
|
||||
if (!str) return false;
|
||||
return str.indexOf(prefix) === 0;
|
||||
}
|
||||
|
||||
// highlight current page in left nav
|
||||
var $currentPageLink = $('main nav a[href="'+window.location.pathname+'"]');
|
||||
if (hasPrefix(window.location.pathname, "/docs/json/")) {
|
||||
// as a special case, highlight the JSON structure link anywhere within it
|
||||
$currentPageLink = $('main nav a[href="/docs/json/"]');
|
||||
}
|
||||
if (hasPrefix(window.location.pathname, "/docs/modules/")) {
|
||||
// as another special case, highlight the modules link anywhere within it
|
||||
$currentPageLink = $('main nav a[href="/docs/modules/"]');
|
||||
}
|
||||
$currentPageLink.addClass('current');
|
||||
|
||||
// add anchor links, inspired by https://github.com/bryanbraun/anchorjs
|
||||
$('article > h1[id], article > h2[id], article > h3[id], article > h4[id], article > h5[id], article > h6[id]').each(function() {
|
||||
var $anchor = $('<a href="#'+this.id+'" class="anchor-link" title="Direct link">🔗</a>');
|
||||
$(this).append($anchor);
|
||||
});
|
||||
|
||||
// the server-side markdown renderer annoyingly renders
|
||||
// colored code blocks differently from plain ones, in that
|
||||
// colorized ones do not have the additional <code> inside
|
||||
// the <pre>; this line finds those and adds a .chroma class
|
||||
// to the outer pre element, and our CSS file has a style to
|
||||
// ensure the inner code block does not produce extra padding
|
||||
$('article > pre:not(.chroma) > code:not(.cmd)').parent().addClass('chroma');
|
||||
|
||||
// Add links to Caddyfile directive tokens in code blocks.
|
||||
// See include/docs-head.html for the whitelist bootstrapping logic
|
||||
$('pre.chroma .k')
|
||||
.filter((k, item) =>
|
||||
window.CaddyfileDirectives.includes(item.innerText)
|
||||
|| item.innerText === '<directives...>'
|
||||
)
|
||||
.map(function(k, item) {
|
||||
let text = item.innerText;
|
||||
let url = text === '<directives...>'
|
||||
? '/docs/caddyfile/directives'
|
||||
: '/docs/caddyfile/directives/' + text;
|
||||
text = text.replace(/</g,'<').replace(/>/g,'>');
|
||||
$(item).html('<a href="' + url + '" style="color: inherit;" title="Directive">' + text + '</a>');
|
||||
});
|
||||
|
||||
// Add links to [<matcher>] or named matcher tokens in code blocks.
|
||||
// The matcher text includes <> characters which are parsed as HTML,
|
||||
// so we must use text() to change the link text.
|
||||
$('pre.chroma .nd')
|
||||
.map(function(k, item) {
|
||||
let text = item.innerText.replace(/</g,'<').replace(/>/g,'>');
|
||||
$(item).html('<a href="/docs/caddyfile/matchers#syntax" style="color: inherit;" title="Matcher token">' + text + '</a>');
|
||||
});
|
||||
});
|
||||
|
||||
// addLinkaddLinksToSubdirectivessToAnchors finds all the ID anchors
|
||||
// in the article, and turns any directive or subdirective span into
|
||||
// links that have an ID on the page. This is opt-in for each page,
|
||||
// because it's not necessary to run everywhere.
|
||||
function addLinksToSubdirectives() {
|
||||
let anchors = $('article *[id]').map((i, el) => el.id).toArray();
|
||||
$('pre.chroma .k')
|
||||
.filter((k, item) => anchors.includes(item.innerText))
|
||||
.map(function(k, item) {
|
||||
let text = item.innerText.replace(/</g,'<').replace(/>/g,'>');
|
||||
let url = '#' + item.innerText;
|
||||
$(item).html('<a href="' + url + '" style="color: inherit;" title="' + text + '">' + text + '</a>');
|
||||
});
|
||||
}
|
||||
|
||||
function stripScheme(url) {
|
||||
return url.substring(url.indexOf("://")+3);
|
||||
}
|
||||
|
||||
// splitTypeName splits a fully qualified type name into
|
||||
// its package path and type name components, for example:
|
||||
// "github.com/foo/bar.Type" => "github.com/foo/bar" and "Type".
|
||||
function splitTypeName(fqtn) {
|
||||
let lastDotPos = fqtn.lastIndexOf('.');
|
||||
let pkg = fqtn.substr(0, lastDotPos);
|
||||
let typeName = fqtn.substr(lastDotPos+1);
|
||||
return {pkg: pkg, typeName: typeName};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue