*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 4e3dcd01 authored by Wörister, Florian's avatar Wörister, Florian
Browse files

Merge branch 'dev2' into 'master'

Move inline scripts into their separate files

See merge request fairdata/invenio-theme-tuw!6
parents db45fe36 3bcd6282
No related branches found
No related tags found
1 merge request!6Move inline scripts into their separate files
// This file is part of InvenioRDM
// Copyright (C) 2021 TU Wien.
//
// Invenio Theme TUW is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.
document.addEventListener("DOMContentLoaded", function () {
document.getElementById("pf-link-a").addEventListener("click", function () {
$("#pf-list").transition("zoom");
$("#pf-link").show();
});
document.getElementById("pf-list-a").addEventListener("click", function () {
$("#pf-list").transition("zoom");
$("#pf-link").hide();
});
});
// This file is part of InvenioRDM
// Copyright (C) 2021 TU Wien.
//
// Invenio Theme TUW is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.
document.addEventListener("DOMContentLoaded", function () {
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = document.getElementById("matomo-url").value;
var siteId = document.getElementById("matomo-site-id").value;
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId', siteId]);
var d = document;
var g = d.createElement('script');
var s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.async = true;
g.src = u + 'matomo.js';
s.parentNode.insertBefore(g, s);
})();
});
......@@ -20,7 +20,7 @@
{%- block tuw_metadata %}
{%- set schemaorg_metadata = tuw_create_schemaorg_metadata(metadata) %}
{%- if schemaorg_metadata %}
<script type="application/ld+json">
<script type="application/ld+json" nonce="{{ csp_nonce() }}">
{{ schemaorg_metadata|safe }}
</script>
{%- endif %}
......
......@@ -30,7 +30,7 @@
</section>
<section id="features" class="ui four column stackable grid container">
<h2 style="display: none;">Features</h2>
<h2 class="hidden">Features</h2>
<div class="column">
<div class="feature-icon box-shaddow">
<a href="{{ url_for('invenio_search_ui.search') }}">
......@@ -76,13 +76,12 @@
<section id="planned-features" class="ui container">
<div id="pf-link">
<a onclick="$('#pf-list').transition('zoom');$('#pf-link').hide();">Learn more about planned
features...</a>
<a id="pf-link-a">Learn more about planned features...</a>
</div>
<div id="pf-list" style="display: none;">
<div id="pf-list" class="hidden">
<h2>Planned Features:</h2>
<div id="pf-hide-link">
<a onclick="$('#pf-list').transition('zoom');$('#pf-link').show();">(hide)</a>
<a id="pf-list-a">(hide)</a>
</div>
<div class="ui stackable vertically padded grid">
<div class="two wide center aligned column">
......@@ -169,3 +168,8 @@
</div>
</section>
{%- endblock page_body%}
{%- block javascript %}
{{ super() }}
{{ webpack["invenio-theme-tuw-planned-features.js"] }}
{%- endblock %}
......@@ -23,7 +23,7 @@
<ul class="navbar-menu right">
{%- for item in current_menu.submenu('main').children|sort(attribute='order') if item.visible recursive %}
<li class="navbar-item">
<a href="{{ item.url }}">{{ item.text|safe }}</a></li>
<a href="{{ item.url }}">{{ item.text|safe }}</a>
</li>
{%- endfor %}
<li class="navbar-item navbar-button">
......
......@@ -57,25 +57,7 @@
{%- block tracking %}
{%- if config.get("THEME_TUW_MATOMO_ENABLED", False) %}
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = "{{ config.get('THEME_TUW_MATOMO_URL') }}";
_paq.push(['setTrackerUrl', u + 'matomo.php']);
{%- if config.THEME_TUW_DISPLAY_STAGING_WARNING -%}
_paq.push(['setSiteId', '1']);
{%- else %}
_paq.push(['setSiteId', '2']);
{%- endif -%}
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript'; g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s);
})();
</script>
<!-- End Matomo Code -->
{{ webpack["invenio-theme-tuw-tracking.js"] }}
{%- endif -%}
{%- endblock tracking -%}
{%- endblock head -%}
......@@ -95,6 +77,22 @@
</div>
{%- endif -%}
{%- if config.get("THEME_TUW_MATOMO_ENABLED", False) %}
{%- set matomo_url = config.get("THEME_TUW_MATOMO_URL") %}
{%- set matomo_site_id = 2 %}
{%- if config.get("THEME_TUW_DISPLAY_STAGING_WARNING", False) %}
{% set matomo_site_id = 1 %}
{%- endif %}
{%- if not matomo_url.endswith("/") %}
{%- set matomo_url = matomo_url + "/" %}
{%- endif %}
<input id="matomo-url" type="hidden" value="{{ matomo_url }}" />
<input id="matomo-site-id" type="hidden" value="{{ matomo_site_id }}" />
{%- endif %}
{%- block body %}
{%- block body_inner %}
{%- block page_header %}
......
......@@ -17,6 +17,8 @@ theme = WebpackThemeBundle(
"semantic-ui": {
"entry": {
"invenio-theme-tuw-theme": "./less/invenio_theme_tuw/theme.less",
"invenio-theme-tuw-tracking": "./js/invenio_theme_tuw/tracking/index.js",
"invenio-theme-tuw-planned-features": "./js/invenio_theme_tuw/planned-features/index.js",
},
"dependencies": {},
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment