|
| 1 | +// Footer toggle functionality for small screens |
| 2 | +(function() { |
| 3 | + const footer = document.getElementById('footer'); |
| 4 | + const footerToggle = document.getElementById('footer-toggle'); |
| 5 | + |
| 6 | + if (!footer || !footerToggle) return; |
| 7 | + |
| 8 | + // Toggle footer visibility |
| 9 | + footerToggle.addEventListener('click', function() { |
| 10 | + footer.classList.toggle('expanded'); |
| 11 | + footerToggle.classList.toggle('hidden'); |
| 12 | + }); |
| 13 | + |
| 14 | + // Close footer when clicking outside |
| 15 | + document.addEventListener('click', function(event) { |
| 16 | + const isClickInsideFooter = footer.contains(event.target); |
| 17 | + const isClickOnToggle = footerToggle.contains(event.target); |
| 18 | + |
| 19 | + // Only close if footer is expanded, click is outside, and not on toggle button |
| 20 | + if (footer.classList.contains('expanded') && !isClickInsideFooter && !isClickOnToggle) { |
| 21 | + footer.classList.remove('expanded'); |
| 22 | + footerToggle.classList.remove('hidden'); |
| 23 | + } |
| 24 | + }); |
| 25 | +})(); |
| 26 | + |
1 | 27 | // YASGUI is loaded via CDN in index.html and available as a global variable |
2 | | -const yasgui = new Yasgui(document.getElementById("yasgui"), { |
3 | | - // Set the SPARQL endpoint |
4 | | - requestConfig: { |
5 | | - endpoint: "https://dbpedia.org/sparql", |
6 | | - }, |
| 28 | +if (typeof Yasgui !== 'undefined') { |
| 29 | + const yasgui = new Yasgui(document.getElementById("yasgui"), { |
| 30 | + // Set the SPARQL endpoint |
| 31 | + requestConfig: { |
| 32 | + endpoint: "https://dbpedia.org/sparql", |
| 33 | + }, |
7 | 34 |
|
8 | | - // Allow resizing of the Yasqe editor |
9 | | - resizeable: true, |
| 35 | + // Allow resizing of the Yasqe editor |
| 36 | + resizeable: true, |
10 | 37 |
|
11 | | - // Whether to autofocus on Yasqe on page load |
12 | | - autofocus: true, |
| 38 | + // Whether to autofocus on Yasqe on page load |
| 39 | + autofocus: true, |
13 | 40 |
|
14 | | - // Use the default endpoint when a new tab is opened |
15 | | - copyEndpointOnNewTab: true, |
| 41 | + // Use the default endpoint when a new tab is opened |
| 42 | + copyEndpointOnNewTab: true, |
16 | 43 |
|
17 | | - // Configuring which endpoints appear in the endpoint catalogue list |
18 | | - endpointCatalogueOptions: { |
19 | | - getData: () => { |
20 | | - return [ |
21 | | - //List of objects should contain the endpoint field |
22 | | - //Feel free to include any other fields (e.g. a description or icon |
23 | | - //that you'd like to use when rendering) |
24 | | - { |
25 | | - endpoint: "https://data-interop.era.europa.eu/api/sparql", |
26 | | - }, |
27 | | - { |
28 | | - endpoint: "https://dbpedia.org/sparql", |
29 | | - }, |
30 | | - { |
31 | | - endpoint: "https://query.wikidata.org", |
32 | | - }, |
33 | | - // ... |
34 | | - ]; |
35 | | - }, |
36 | | - //Data object keys that are used for filtering. The 'endpoint' key already used by default |
37 | | - keys: [], |
38 | | - //Data argument contains a `value` property for the matched data object |
39 | | - //Source argument is the suggestion DOM element to append your rendered item to |
40 | | - renderItem: (data, source) => { |
41 | | - const contentDiv = document.createElement("div"); |
42 | | - contentDiv.innerText = data.value.endpoint; |
43 | | - source.appendChild(contentDiv); |
| 44 | + // Configuring which endpoints appear in the endpoint catalogue list |
| 45 | + endpointCatalogueOptions: { |
| 46 | + getData: () => { |
| 47 | + return [ |
| 48 | + //List of objects should contain the endpoint field |
| 49 | + //Feel free to include any other fields (e.g. a description or icon |
| 50 | + //that you'd like to use when rendering) |
| 51 | + { |
| 52 | + endpoint: "https://data-interop.era.europa.eu/api/sparql", |
| 53 | + }, |
| 54 | + { |
| 55 | + endpoint: "https://dbpedia.org/sparql", |
| 56 | + }, |
| 57 | + { |
| 58 | + endpoint: "https://query.wikidata.org", |
| 59 | + }, |
| 60 | + // ... |
| 61 | + ]; |
| 62 | + }, |
| 63 | + //Data object keys that are used for filtering. The 'endpoint' key already used by default |
| 64 | + keys: [], |
| 65 | + //Data argument contains a `value` property for the matched data object |
| 66 | + //Source argument is the suggestion DOM element to append your rendered item to |
| 67 | + renderItem: (data, source) => { |
| 68 | + const contentDiv = document.createElement("div"); |
| 69 | + contentDiv.innerText = data.value.endpoint; |
| 70 | + source.appendChild(contentDiv); |
| 71 | + }, |
44 | 72 | }, |
45 | | - }, |
46 | | -}); |
| 73 | + }); |
| 74 | +} |
0 commit comments