Skip to content

Commit

Permalink
Merge pull request #4279 from galaxyproject/prefs
Browse files Browse the repository at this point in the history
User Preferences
  • Loading branch information
shiltemann authored Sep 28, 2023
2 parents 4ee4761 + 1e8c2a1 commit c93ee50
Show file tree
Hide file tree
Showing 41 changed files with 1,084 additions and 331 deletions.
63 changes: 49 additions & 14 deletions _includes/analytics.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,59 @@
<!--
<script async defer data-domain="training.galaxyproject.org" src="https://plausible.galaxyproject.eu/js/plausible.js"></script>
-->
<!-- We let users opt-out, so if they've opted in, we need to append the plausible script to the body -->

<script>
var scriptElement = document.createElement("script");
scriptElement.async = true;
scriptElement.defer = true;
scriptElement.setAttribute("data-domain", "training.galaxyproject.org");
scriptElement.src = "https://plausible.galaxyproject.eu/js/plausible.js";

// Appending the script element to the body
if(localStorage.getItem('plausible-opt-out') !== 'opt-out' && navigator.doNotTrack !== "1") {
console.log("Plausible: opt-in");
// Wait for the document to be available
document.addEventListener("DOMContentLoaded", function(event) {
document.body.appendChild(scriptElement);
});
}
</script>

<!-- JavaScript Error Monitoring, and performance tracking. -->
<!--
<script
src="https://browser.sentry-cdn.com/7.52.1/bundle.tracing.min.js"
integrity="sha384-muuFXKS3752PNA4rPm9Uq6BLvOfV4CXyr9MHDBPvozOJJUWLKkogEFWOIRoVps43"
crossorigin="anonymous"
></script>
-->
<script type="text/javascript">
Sentry.init({
dsn: "https://[email protected]/10",
release: "galaxy-training-network@{{ site.git_revision }}",
integrations: [new Sentry.BrowserTracing(), new Sentry.Replay()],
sampleRate: 0.1,
tracesSampleRate: 0.1,
// Capture Replay for no sessions by default
replaysSessionSampleRate: 0.01,
// plus for 1% of sessions with an error
replaysOnErrorSampleRate: 0.01,
// PII OFF
sendDefaultPii: false, // Off by default but just in case.
environment: "{{ jekyll.environment }}",
});
var scriptElement = document.createElement("script");
scriptElement.src = "https://browser.sentry-cdn.com/7.52.1/bundle.tracing.min.js";
scriptElement.integrity = "sha384-muuFXKS3752PNA4rPm9Uq6BLvOfV4CXyr9MHDBPvozOJJUWLKkogEFWOIRoVps43";
scriptElement.crossOrigin = "anonymous";

if(localStorage.getItem('sentry-opt-out') !== 'opt-out' && navigator.doNotTrack !== "1") {
console.log("Sentry: opt-in");
// Appending the script element to the body
document.addEventListener("DOMContentLoaded", function(event) {
document.body.appendChild(scriptElement);
});

Sentry.init({
dsn: "https://[email protected]/10",
release: "galaxy-training-network@{{ site.git_revision }}",
integrations: [new Sentry.BrowserTracing(), new Sentry.Replay()],
sampleRate: 0.1,
tracesSampleRate: 0.1,
// Capture Replay for no sessions by default
replaysSessionSampleRate: 0.01,
// plus for 1% of sessions with an error
replaysOnErrorSampleRate: 0.01,
// PII OFF
sendDefaultPii: false, // Off by default but just in case.
environment: "{{ jekyll.environment }}",
});
}
</script>
20 changes: 3 additions & 17 deletions _includes/extras.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,9 @@
</a>
{% endif %}

<div class="dropdown-item">
<div>
{% icon gtn-theme %} Theme
</div>

<div id="theme-selector" data-toggle="buttons">
<button class="btn" data-theme="default">Default</button>
<button class="btn" data-theme="night">Night</button>
<button class="btn" data-theme="midnight">Midnight</button>
<button class="btn" data-theme="rainbow">Rainbow</button>
<button class="btn" data-theme="blm">✊🏿</button>
<button class="btn" data-theme="progress" >🏳️‍🌈</button>
<button class="btn" data-theme="halloween">🎃</button>
<button class="btn" data-theme="straya">🇦🇺</button>
</div>

</div>
<a href="{% link preferences.md %}" class="dropdown-item">
{% icon gtn-theme %} Themes have moved <span class="badge badge-secondary">New</span>
</a>

<div class="dropdown-item">
<div>
Expand Down
2 changes: 1 addition & 1 deletion _includes/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</form>
-->

<a class="dropdown-item" href="{{ site.baseurl }}/faq" title="Check our FAQs">
<a class="dropdown-item" href="{% link faqs/index.md %}" title="Check our FAQs">
{% icon question %} FAQs
</a>
{% if topic %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</script>
{% endif %}
</head>
<body data-spy="scroll" data-target="#toc">
<body data-spy="scroll" data-target="#toc" data-brightness="auto" data-contrast="auto">
{{ 'theme' | load_bundle }}
{% include _includes/default-header.html %}
{% if topic.custom_css %}
Expand Down
4 changes: 2 additions & 2 deletions _layouts/base_slides.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{% include _includes/material.jsonld material=page topic=topic site=site %}
</script>
</head>
<body>
<body data-brightness="auto" data-contrast="auto">
{% if topic.custom_css %}
<style>
{{ topic.custom_css }}
Expand All @@ -59,7 +59,7 @@
{% else %}
{% capture link %}{{ site.github_repository }}/edit/{{ site.github_repository_branch }}/topics/{{ topic.name }}/tutorials/{{ page.tutorial_name }}/slides.html{% endcapture %}
{% endif %}
<a class="nav-link" href="{{ link }}"><i class="fa fa-pencil" aria-hidden="true"></i></a>
<a href="{{ link }}"><i class="fa fa-pencil" aria-hidden="true"></i></a>

</span></div>

Expand Down
2 changes: 1 addition & 1 deletion _layouts/base_slides_ai4life.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{% include _includes/material.jsonld material=page topic=topic site=site %}
</script>
</head>
<body>
<body data-brightness="auto" data-contrast="auto">
{% if topic.custom_css %}
<style>
{{ topic.custom_css }}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/tutorial_hands_on.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ <h4 class="alert-heading">Under Development!</h4>
<div class="container">
<div class="row">
<!-- sidebar, which will move to the top on a small screen -->
<div class="col-sm-2">
<div class="col-sm-2 hide-when-printing">
<nav id="toc" data-toggle="toc" class="sticky-top" aria-label="Table of Contents"></nav>
</div>
<div class="col-sm-10">
Expand Down
4 changes: 4 additions & 0 deletions _plugins/jekyll-figurify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ def figurify(page, site)
image = insert_image(url, alt, style, dimensions, actual_path)

%(
<a href="#{url}" rel="noopener noreferrer">
<figure id="figure-#{num_figure}" style="max-width: 90%; margin:auto;">
#{image}
<figcaption>
<span class="figcaption-prefix"><strong>#{prefix}#{num_figure}</strong>:</span> #{title}
</figcaption>
</figure>
</a>
).split("\n").map(&:strip).join
end
end
Expand All @@ -103,7 +105,9 @@ def figurify(page, site)
end

%(
<a href="#{url}" rel="noopener noreferrer">
<img src="#{url}" alt="#{alt}" #{style} #{dimensions} loading="lazy">
</a>
).split("\n").map(&:strip).join
end
end
Expand Down
14 changes: 11 additions & 3 deletions _plugins/notebook-jupyter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def json_boxify(h, page)
h
end

Jekyll::Hooks.register :site, :pre_render do |site|
def jupyter_pre_render(site)
puts '[GTN/Notebooks] Rendering'

site.config['__rendered_notebook_cache'] = {}
Expand Down Expand Up @@ -117,8 +117,7 @@ def json_boxify(h, page)
end
end

# Basically like `PageWithoutAFile`, we just write out the ones we'd created earlier.
Jekyll::Hooks.register :site, :post_write do |site|
def jupyter_post_write(site)
site.config['__rendered_notebook_cache'].each do |_path, info|
# Create if missing
FileUtils.mkdir_p(info['dir'])
Expand All @@ -127,3 +126,12 @@ def json_boxify(h, page)
File.write(info['path2'], info['content2'])
end
end

Jekyll::Hooks.register :site, :pre_render do |site|
jupyter_pre_render(site)
end

# Basically like `PageWithoutAFile`, we just write out the ones we'd created earlier.
Jekyll::Hooks.register :site, :post_write do |site|
jupyter_post_write(site)
end
8 changes: 8 additions & 0 deletions _plugins_dev/notebook.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
def jupyter_pre_render(site)
nil
end

def jupyter_post_write(site)
nil
end

module Jekyll
class RmarkdownGenerator < Generator
def generate(site)
Expand Down
31 changes: 3 additions & 28 deletions assets/css/fonts.css
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
/* cyrillic */
@font-face {
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url(/training-material/assets/fonts/yanonekaffeesatz/v24/3y9I6aknfjLm_3lMKjiMgmUUYBs04aUXNxt9gW2LIfto9tWZc2GKOnU.woff2) format('woff2');
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url(/training-material/assets/fonts/yanonekaffeesatz/v24/3y9I6aknfjLm_3lMKjiMgmUUYBs04aUXNxt9gW2LIfto9tWZeGGKOnU.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url(/training-material/assets/fonts/yanonekaffeesatz/v24/3y9I6aknfjLm_3lMKjiMgmUUYBs04aUXNxt9gW2LIfto9tWZeWGKOnU.woff2) format('woff2');
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Yanone Kaffeesatz';
font-style: normal;
font-weight: 400;
src: url(/training-material/assets/fonts/yanonekaffeesatz/v24/3y9I6aknfjLm_3lMKjiMgmUUYBs04aUXNxt9gW2LIfto9tWZd2GK.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
font-weight: 100 900;
font-style: normal oblique;
src: url(/training-material/assets/fonts/yanonekaffeesatz/YanoneKaffeesatz-VariableFont_wght.woff2);
}
66 changes: 66 additions & 0 deletions assets/css/fontsmain.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@font-face {
font-family: "Atkinson Hyperlegible";
src: url(/training-material/assets/fonts/AtkinsonHyperlegible/Atkinson-Hyperlegible-Regular-102a.woff2);
font-display: swap;
}

@font-face {
font-family: "Atkinson Hyperlegible";
src: url(/training-material/assets/fonts/AtkinsonHyperlegible/Atkinson-Hyperlegible-BoldItalic-102a.woff2);
font-weight: bold;
font-style: oblique;
font-display: swap;
}

@font-face {
font-family: "Atkinson Hyperlegible";
src: url(/training-material/assets/fonts/AtkinsonHyperlegible/Atkinson-Hyperlegible-Italic-102a.woff2);
font-style: oblique;
font-display: swap;
}

@font-face {
font-family: "Atkinson Hyperlegible";
src: url(/training-material/assets/fonts/AtkinsonHyperlegible/Atkinson-Hyperlegible-Bold-102a.woff2);
font-weight: bold;
font-display: swap;
}


@font-face {
font-family: "OpenDyslexic";
src: url(/training-material/assets/fonts/OpenDyslexic/OpenDyslexic-Bold-Italic.woff2);
font-weight: bold;
font-style: oblique;
font-display: swap;
}
@font-face {
font-family: "OpenDyslexic";
src: url(/training-material/assets/fonts/OpenDyslexic/OpenDyslexic-Bold.woff2);
font-weight: bold;
font-display: swap;
}
@font-face {
font-family: "OpenDyslexic";
src: url(/training-material/assets/fonts/OpenDyslexic/OpenDyslexic-Italic.woff2);
font-style: oblique;
font-display: swap;
}
@font-face {
font-family: "OpenDyslexic";
src: url(/training-material/assets/fonts/OpenDyslexic/OpenDyslexic-Regular.woff2);
font-display: swap;
}


@font-face {
font-family: "Comic Mono";
src: url(/training-material/assets/fonts/ComicMono/ComicMono-Bold.ttf);
font-weight: bold;
font-display: swap;
}
@font-face {
font-family: "Comic Mono";
src: url(/training-material/assets/fonts/ComicMono/ComicMono.ttf);
font-display: swap;
}
Loading

0 comments on commit c93ee50

Please sign in to comment.