Auto-foco no input quando se entra na pesquisa

Also, apagar um bando de ficheiros do template que não usamos.
This commit is contained in:
Hugo Peixoto 2022-01-06 19:12:10 +00:00
parent de43235814
commit 49c9bcb25b
15 changed files with 21 additions and 691 deletions

View File

@ -1,68 +0,0 @@
---
# Display name
title: "{{ replace .Name "-" " " | title }}"
# Username (this should match the folder name and the name on publications)
authors:
- "{{ urlize .Name }}"
# Is this the primary user of the site?
superuser: false
# Role/position (e.g., Professor of Artificial Intelligence)
role:
# Organizations/Affiliations
organizations:
- name:
url: ""
# Short bio (displayed in user profile at end of posts)
bio:
# List each interest with a dash
interests:
- Interest 1
- Interest 2
education:
courses:
- course: Title course 1
institution: Name of Institution
year: 2012
- course: Title course 1
institution: Name of Institution
year: 2012
# Social/Academic Networking
# For available icons, see: https://sourcethemes.com/academic/docs/page-builder/#icons
# For an email link, use "fas" icon pack, "envelope" icon, and a link in the
# form "mailto:your-email@example.com" or "#contact" for contact widget.
social:
- icon: envelope
icon_pack: fas
link: '#contact' # For a direct email link, use "mailto:test@example.org".
- icon: twitter
icon_pack: fab
link: https://twitter.com/USERNAME
- icon: google-scholar
icon_pack: ai
link: https://scholar.google.com/citations?user=PERSON-ID
- icon: github
icon_pack: fab
link: https://github.com/USERNAME
# Link to a PDF of your resume/CV from the About widget.
# To enable, copy your resume/CV to `static/files/cv.pdf` and uncomment the lines below.
# - icon: cv
# icon_pack: ai
# link: files/cv.pdf
# Enter email to display Gravatar (if Gravatar enabled in Config)
email: ""
# Organizational groups that you belong to (for People widget)
# Set this to `[]` or comment out if you are not using People widget.
user_groups:
- Group 1
- Group 2
---

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -1,29 +0,0 @@
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
title: "{{ replace .Name "-" " " | title }}"
subtitle: ""
summary: ""
authors: []
tags: []
categories: []
date: {{ .Date }}
lastmod: {{ .Date }}
featured: false
draft: false
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
caption: ""
focal_point: ""
preview_only: false
# Projects (optional).
# Associate this post with one or more of your projects.
# Simply enter your project's folder or file name without extension.
# E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
# Otherwise, set `projects = []`.
projects: []
---

View File

@ -1,41 +0,0 @@
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
title: "{{ replace .Name "-" " " | title }}"
summary: ""
authors: []
tags: []
categories: []
date: {{ .Date }}
# Optional external URL for project (replaces project detail page).
external_link: ""
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
caption: ""
focal_point: ""
preview_only: false
# Custom links (optional).
# Uncomment and edit lines below to show custom links.
# links:
# - name: Follow
# url: https://twitter.com
# icon_pack: fab
# icon: twitter
url_code: ""
url_pdf: ""
url_slides: ""
url_video: ""
# Slides (optional).
# Associate this project with Markdown slides.
# Simply enter your slide deck's filename without extension.
# E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
# Otherwise, set `slides = ""`.
slides: ""
---

View File

@ -1,69 +0,0 @@
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
title: "{{ replace .Name "-" " " | title }}"
authors: []
date: {{ .Date }}
doi: ""
# Schedule page publish date (NOT publication's date).
publishDate: {{ .Date }}
# Publication type.
# Legend: 0 = Uncategorized; 1 = Conference paper; 2 = Journal article;
# 3 = Preprint / Working Paper; 4 = Report; 5 = Book; 6 = Book section;
# 7 = Thesis; 8 = Patent
publication_types: ["0"]
# Publication name and optional abbreviated publication name.
publication: ""
publication_short: ""
abstract: ""
# Summary. An optional shortened abstract.
summary: ""
tags: []
categories: []
featured: false
# Custom links (optional).
# Uncomment and edit lines below to show custom links.
# links:
# - name: Follow
# url: https://twitter.com
# icon_pack: fab
# icon: twitter
url_pdf:
url_code:
url_dataset:
url_poster:
url_project:
url_slides:
url_source:
url_video:
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
caption: ""
focal_point: ""
preview_only: false
# Associated Projects (optional).
# Associate this publication with one or more of your projects.
# Simply enter your project's folder or file name without extension.
# E.g. `internal-project` references `content/project/internal-project/index.md`.
# Otherwise, set `projects: []`.
projects: []
# Slides (optional).
# Associate this publication with Markdown slides.
# Simply enter your slide deck's filename without extension.
# E.g. `slides: "example"` references `content/slides/example/index.md`.
# Otherwise, set `slides: ""`.
slides: ""
---

View File

@ -1,26 +0,0 @@
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
title: "{{ replace .Name "-" " " | title }}"
summary: ""
authors: []
tags: []
categories: []
date: {{ .Date }}
slides:
# Choose a theme from https://github.com/hakimel/reveal.js#theming
theme: black
# Choose a code highlighting style (if highlighting enabled in `params.toml`)
# Light style: github. Dark style: dracula (default).
highlight_style: dracula
---
# Title
Author Name
---
## Slide 2
...

View File

@ -1,68 +0,0 @@
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
title: "{{ replace .Name "-" " " | title }}"
event:
event_url:
location:
address:
street:
city:
region:
postcode:
country:
summary:
abstract:
# Talk start and end times.
# End time can optionally be hidden by prefixing the line with `#`.
date: {{ .Date }}
date_end: {{ .Date }}
all_day: false
# Schedule page publish date (NOT talk date).
publishDate: {{ .Date }}
authors: []
tags: []
# Is this a featured talk? (true/false)
featured: false
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
caption: ""
focal_point: ""
preview_only: false
# Custom links (optional).
# Uncomment and edit lines below to show custom links.
# links:
# - name: Follow
# url: https://twitter.com
# icon_pack: fab
# icon: twitter
# Optional filename of your slides within your talk's folder or a URL.
url_slides:
url_code:
url_pdf:
url_video:
# Markdown Slides (optional).
# Associate this talk with Markdown slides.
# Simply enter your slide deck's filename without extension.
# E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
# Otherwise, set `slides = ""`.
slides: ""
# Projects (optional).
# Associate this post with one or more of your projects.
# Simply enter your project's folder or file name without extension.
# E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
# Otherwise, set `projects = []`.
projects: []
---

View File

@ -149,53 +149,6 @@ function initMap() {
}
}
/* ---------------------------------------------------------------------------
* GitHub API.
* --------------------------------------------------------------------------- */
function printLatestRelease(selector, repo) {
$.getJSON('https://api.github.com/repos/' + repo + '/tags').done(function (json) {
let release = json[0];
$(selector).append(' ' + release.name);
}).fail(function (jqxhr, textStatus, error) {
let err = textStatus + ", " + error;
console.log("Request Failed: " + err);
});
}
/* ---------------------------------------------------------------------------
* Toggle search dialog.
* --------------------------------------------------------------------------- */
function toggleSearchDialog() {
if ($('body').hasClass('searching')) {
// Clear search query and hide search modal.
$('[id=search-query]').blur();
$('body').removeClass('searching compensate-for-scrollbar');
// Remove search query params from URL as user has finished searching.
removeQueryParamsFromUrl();
// Prevent fixed positioned elements (e.g. navbar) moving due to scrollbars.
$('#fancybox-style-noscroll').remove();
} else {
// Prevent fixed positioned elements (e.g. navbar) moving due to scrollbars.
if (!$('#fancybox-style-noscroll').length && document.body.scrollHeight > window.innerHeight) {
$('head').append(
'<style id="fancybox-style-noscroll">.compensate-for-scrollbar{margin-right:' +
(window.innerWidth - document.documentElement.clientWidth) +
'px;}</style>'
);
$('body').addClass('compensate-for-scrollbar');
}
// Show search modal.
$('body').addClass('searching');
$('.search-results').css({opacity: 0, visibility: 'visible'}).animate({opacity: 1}, 200);
$('#search-query').focus();
}
}
/* ---------------------------------------------------------------------------
* Change Theme Mode (0: Day, 1: Night, 2: Auto).
* --------------------------------------------------------------------------- */
@ -384,23 +337,6 @@ function initThemeVariation() {
renderThemeVariation(isDarkTheme, true);
}
/* ---------------------------------------------------------------------------
* Normalize Bootstrap Carousel Slide Heights.
* --------------------------------------------------------------------------- */
function normalizeCarouselSlideHeights() {
$('.carousel').each(function () {
// Get carousel slides.
let items = $('.carousel-item', this);
// Reset all slide heights.
items.css('min-height', 0);
// Normalize all slide heights.
let maxHeight = Math.max.apply(null, items.map(function () {
return $(this).outerHeight()
}).get());
items.css('min-height', maxHeight + 'px');
})
}
/* ---------------------------------------------------------------------------
* Fix Hugo's Goldmark output and Mermaid code blocks.
@ -500,54 +436,6 @@ $(document).ready(function () {
* --------------------------------------------------------------------------- */
$(window).on('load', function () {
// Filter projects.
$('.projects-container').each(function (index, container) {
let $container = $(container);
let $section = $container.closest('section');
let layout;
if ($section.find('.isotope').hasClass('js-layout-row')) {
layout = 'fitRows';
} else {
layout = 'masonry';
}
$container.imagesLoaded(function () {
// Initialize Isotope after all images have loaded.
$container.isotope({
itemSelector: '.isotope-item',
layoutMode: layout,
masonry: {
gutter: 20
},
filter: $section.find('.default-project-filter').text()
});
// Filter items when filter link is clicked.
$section.find('.project-filters a').click(function () {
let selector = $(this).attr('data-filter');
$container.isotope({filter: selector});
$(this).removeClass('active').addClass('active').siblings().removeClass('active all');
return false;
});
// If window hash is set, scroll to hash.
// Placing this within `imagesLoaded` prevents scrolling to the wrong location due to dynamic image loading
// affecting page layout and position of the target anchor ID.
// Note: If there are multiple project widgets on a page, ideally only perform this once after images
// from *all* project widgets have finished loading.
if (window.location.hash) {
scrollToAnchor();
}
});
});
// Enable publication filter for publication index page.
if ($('.pub-filters-select')) {
filter_publications();
// Useful for changing hash manually (e.g. in development):
// window.addEventListener('hashchange', filter_publications, false);
}
// Scroll to top of page.
$('.back-to-top').click(function (event) {
event.preventDefault();
@ -557,72 +445,8 @@ $(window).on('load', function () {
window.location.hash = "";
});
});
// Load citation modal on 'Cite' click.
$('.js-cite-modal').click(function (e) {
e.preventDefault();
let filename = $(this).attr('data-filename');
let modal = $('#modal');
modal.find('.modal-body code').load(filename, function (response, status, xhr) {
if (status == 'error') {
let msg = "Error: ";
$('#modal-error').html(msg + xhr.status + " " + xhr.statusText);
} else {
$('.js-download-cite').attr('href', filename);
}
});
modal.modal('show');
});
// Copy citation text on 'Copy' click.
$('.js-copy-cite').click(function (e) {
e.preventDefault();
// Get selection.
let range = document.createRange();
let code_node = document.querySelector('#modal .modal-body');
range.selectNode(code_node);
window.getSelection().addRange(range);
try {
// Execute the copy command.
document.execCommand('copy');
} catch (e) {
console.log('Error: citation copy failed.');
}
// Remove selection.
window.getSelection().removeRange(range);
});
// Initialise Google Maps if necessary.
initMap();
// Print latest version of GitHub projects.
let githubReleaseSelector = '.js-github-release';
if ($(githubReleaseSelector).length > 0)
printLatestRelease(githubReleaseSelector, $(githubReleaseSelector).data('repo'));
// On search icon click toggle search dialog.
$('.js-search').click(function (e) {
e.preventDefault();
toggleSearchDialog();
});
$(document).on('keydown', function (e) {
if (e.which == 27) {
// `Esc` key pressed.
if ($('body').hasClass('searching')) {
toggleSearchDialog();
}
} else if (e.which == 191 && e.shiftKey == false && !$('input,textarea').is(':focus')) {
// `/` key pressed outside of text input.
e.preventDefault();
toggleSearchDialog();
}
});
});
// Normalize Bootstrap carousel slide heights.
$(window).on('load resize orientationchange', normalizeCarouselSlideHeights);
// Automatic main menu dropdowns on mouse over.
$('body').on('mouseenter mouseleave', '.dropdown', function (e) {
var dropdown = $(e.target).closest('.dropdown');

View File

@ -5,6 +5,26 @@
if (window.location.hostname == "www.ansol.org") {
window.location = window.location.href.replace("www.ansol.org", "ansol.org");
}
function showSearch() {
document.querySelector('body').classList.toggle('searching');
document.getElementById('search-query').focus();
return false;
}
function hideSearch() {
document.querySelector('body').classList.toggle('searching');
document.getElementById('search-query').blur();
return false;
}
document.addEventListener('keydown', function (e) {
if (e.which == 27) {
if (document.querySelector('body.searching')) {
hideSearch();
}
}
});
</script>
<body>
<nav class="main">
@ -18,7 +38,7 @@
<li><a href="{{ (site.GetPage "Section" "eventos").Permalink }}">Eventos</a></li>
<li><a href="{{ (site.GetPage "sobre").Permalink }}">Sobre</a></li>
</ul>
<a class='nav-search' href="#" onclick="document.querySelector('body').classList.toggle('searching'); return false;">Pesquisar</a>
<a class='nav-search' href="#" onclick="return showSearch();">Pesquisar</a>
</div>
</nav>
<main>

View File

@ -1,25 +0,0 @@
<!-- Citation modal -->
<div id="modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{ i18n "btn_cite" }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<pre><code class="tex hljs"></code></pre>
</div>
<div class="modal-footer">
<a class="btn btn-outline-primary my-1 js-copy-cite" href="#" target="_blank">
<i class="fas fa-copy"></i> {{ i18n "btn_copy" }}
</a>
<a class="btn btn-outline-primary my-1 js-download-cite" href="#" target="_blank">
<i class="fas fa-download"></i> {{ i18n "btn_download" }}
</a>
<div id="modal-error"></div>
</div>
</div>
</div>
</div>

View File

@ -1,35 +0,0 @@
<div class="pub-list-item" style="margin-bottom: 1rem">
<i class="far fa-file-alt pub-icon" aria-hidden="true"></i>
{{/* APA Style */}}
{{ if eq (site.Params.publications.citation_style | default "apa") "apa" }}
<span class="article-metadata li-cite-author">
{{ partial "page_metadata_authors" . }}
</span>
({{- .Date.Format "2006" -}}).
<a href="{{ .RelPermalink }}">{{ .Title }}</a>.
{{ if .Params.publication_short }}
{{- .Params.publication_short | markdownify -}}.
{{ else if .Params.publication }}
{{- .Params.publication | markdownify -}}.
{{ end }}
<p>{{ partial "page_links" (dict "page" . "is_list" 1) }}</p>
{{/* MLA Style */}}
{{ else }}
<span class="article-metadata li-cite-author">
{{ partial "page_metadata_authors" . }}.
</span>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>.
{{ if .Params.publication_short }}
{{- .Params.publication_short | markdownify -}},
{{ else if .Params.publication }}
{{- .Params.publication | markdownify -}},
{{ end }}
{{- .Date.Format "2006" -}}.
<p>{{ partial "page_links" (dict "page" . "is_list" 1) }}</p>
{{ end }}
</div>

View File

@ -1,85 +0,0 @@
{{ $item := . }}
{{/* Dynamic view adjusts to content type. */}}
{{ $show_authors_only := false }}{{/* Show authors only or full metadata? */}}
{{ $show_buttons := false }}
{{ $link := $item.RelPermalink }}
{{ $target := "" }}
{{ if $item.Params.external_link }}
{{ $link = $item.Params.external_link }}
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}
{{ if eq $item.Type "talk" }}
{{ $show_authors_only = true }}
{{ $show_buttons = true }}
{{ else if eq $item.Type "publication" }}
{{ $show_authors_only = true }}
{{ $show_buttons = true }}
{{ else if eq $item.Type "project" }}
{{ $show_authors_only = true }}
{{ $show_buttons = true }}
{{ end }}
{{/* Get summary. */}}
{{ $summary := "" }}
{{ if $item.Params.summary }}
{{ $summary = $item.Params.summary | markdownify | emojify }}
{{ else if .Params.abstract }}
{{ $summary = .Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
{{ else if $item.Summary }}
{{ $summary = $item.Summary }}
{{ end }}
<div class="media stream-item">
<div class="media-body">
<h3 class="article-title mb-0 mt-0">
<a href="{{$link}}" {{ $target | safeHTMLAttr }}>{{ $item.Title }}</a>
</h3>
{{ with $summary }}
<div class="article-style">
{{ . }}
</div>
{{ end }}
<div class="stream-meta article-metadata">
{{ if eq $item.Type "talk" }}
<div>
<span>
{{ partial "functions/get_event_dates" $item }}
</span>
{{ with $item.Params.location }}
<span class="middot-divider"></span>
<span>{{ . }}</span>
{{ end }}
</div>
{{ end }}
{{ if and $show_authors_only $item.Params.authors }}
<div>
{{ partial "page_metadata_authors" $item }}
</div>
{{ else if not $show_authors_only }}
{{ partial "page_metadata" (dict "page" $item "is_list" 1) }}
{{ end }}
</div>
{{ if $show_buttons }}
<div class="btn-links">
{{ partial "page_links" (dict "page" $item "is_list" 1) }}
</div>
{{ end }}
</div>
<div class="ml-3">
{{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
{{ with $resource }}
{{ $image := .Resize "150x" }}
<a href="{{$link}}" {{ $target | safeHTMLAttr }}>
<img src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}">
</a>
{{end}}
</div>
</div>

View File

@ -1,56 +0,0 @@
{{ $item := . }}
{{/* Dynamic view adjusts to content type. */}}
{{ $icon_pack := "far" }}
{{ $icon := "fa-file-alt" }}
{{ $show_authors := false }}
{{ $show_buttons := false }}
{{ $link := $item.RelPermalink }}
{{ $target := "" }}
{{ if $item.Params.external_link }}
{{ $link = $item.Params.external_link }}
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}
{{ if eq $item.Type "post" }}
{{ $icon = "fa-newspaper" }}
{{ else if eq $item.Type "talk" }}
{{ $icon = "fa-calendar-alt" }}
{{ else if eq $item.Type "publication" }}
{{ $show_authors = true }}
{{ $show_buttons = true }}
{{ else if eq $item.Type "project" }}
{{ $icon_pack = "fas" }}
{{ $icon = "fa-project-diagram" }}
{{ $show_authors = true }}
{{ $show_buttons = true }}
{{ end }}
<div class="view-list-item">
<i class="{{$icon_pack}} {{$icon}} pub-icon" aria-hidden="true"></i>
<a href="{{$link}}" {{ $target | safeHTMLAttr }}>{{ $item.Title }}</a>
{{ if eq $item.Type "talk" }}
<div class="article-metadata">
<span>
{{ partial "functions/get_event_dates" $item }}
</span>
{{ with $item.Params.location }}
<span class="middot-divider"></span>
<span>{{ . }}</span>
{{ end }}
</div>
{{ end }}
{{ if and $show_authors $item.Params.authors }}
<div class="article-metadata">
{{ partial "page_metadata_authors" $item }}
</div>
{{ end }}
{{ if $show_buttons }}
<div class="btn-links">
{{ partial "page_links" (dict "page" $item "is_list" 1) }}
</div>
{{ end }}
</div>

View File

@ -1,6 +0,0 @@
{{ $item := .item }}
{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}
<div class="col-12 isotope-item {{ $js_tag_classes | safeHTMLAttr }}">
{{ partial "li_compact" $item }}
</div>

View File

@ -1,6 +0,0 @@
{{ $item := .item }}
{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}
<div class="col-12 isotope-item {{ $js_tag_classes | safeHTMLAttr }}">
{{ partial "li_list" $item }}
</div>