Enable guided tour with CSP switched on
Change-Id: I3235a3fc45f5a28ce6eb4995fe6c767551370643
diff --git a/Changes b/Changes
index 810acc9..c24da7f 100755
--- a/Changes
+++ b/Changes
@@ -21,6 +21,7 @@
- Removed deprecated default behaviour
of the Piwik/Matomo plugin.
- Support CSP in overview SVG image.
+ - Fix guided tour to work with CSP.
0.40 2020-12-17
- Modernize ES and fix in-loops.
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 4f6074f..be58b60 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -84,13 +84,17 @@
};
KorAP.vc = vcClass.create(vcArray);
-
- KorAP.tourshow = function(){
- tourClass.gTstartSearch().start();
- };
-
- KorAP.tourshowR = function(){
- tourClass.gTshowResults().start();
+
+ let gt;
+ if (gt = document.getElementById('link-guided-tour')) {
+ gt.setAttribute('href', '#');
+ gt.addEventListener('click', function(){
+ tourClass.gTstartSearch().start();
+ });
+
+ KorAP.tourshowR = function(){
+ tourClass.gTshowResults().start();
+ };
};
domReady(function (event) {
diff --git a/t/intro.t b/t/intro.t
index 0069713..3178098 100644
--- a/t/intro.t
+++ b/t/intro.t
@@ -14,6 +14,8 @@
->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
->element_exists('div.intro')
->text_is('div.intro > p > strong', 'KorAP')
+ ->content_unlike(qr!onload!)
+ ->text_is('#link-guided-tour', 'guided tour')
;
# Only routed when existing
diff --git a/templates/de/intro.html.ep b/templates/de/intro.html.ep
index 20bd707..433cc1a 100644
--- a/templates/de/intro.html.ep
+++ b/templates/de/intro.html.ep
@@ -6,7 +6,7 @@
<p><strong>KorAP</strong> ist eine neue Korpusanalyseplattform, optimiert für große, mehrfach annotierte Korpora und komplexe Suchmechanismen. Dabei versucht KorAP unabhängig von spezifischen Forschungsfragen zu sein.</p>
<p><noscript>KorAP erwartet für einige Funktionen die Aktivierung von JavaScript.</noscript></p>
- <p><strong>Neu bei KorAP?</strong> Dann starten Sie doch mit unserer <a href="#" onclick="KorAP.tourshow()"> Tour</a> oder lesen Sie unsere <%= doc_opener 'korap', begin %>Einführung<% end %>!</p>
+ <p><strong>Neu bei KorAP?</strong> Dann starten Sie doch mit unserer <a id="link-guided-tour">Tour</a> oder lesen Sie unsere <%= doc_opener 'korap', begin %>Einführung<% end %>!</p>
%= include 'announcement', lang => 'de'
diff --git a/templates/intro.html.ep b/templates/intro.html.ep
index 6b38ad6..c077bf6 100644
--- a/templates/intro.html.ep
+++ b/templates/intro.html.ep
@@ -6,11 +6,11 @@
<p><noscript>KorAP expects activated JavaScript for some features.</noscript></p>
- <p><strong>New to KorAP?</strong> Please check out our <a href="#" onclick="KorAP.tourshow()">guided tour</a> or our <%= doc_opener 'korap', begin %>tutorial<% end %>!</p>
+ <p><strong>New to KorAP?</strong> Please check out our <a id="link-guided-tour">guided tour</a> or our <%= doc_opener 'korap', begin %>tutorial<% end %>!</p>
%= include 'announcement', lang => 'en'
- <p>KorAP is developed at the <a href="http://www.ids-mannheim.de">Leibniz Institute for the German Language</a>, member of the <a href="http://www.leibniz-gemeinschaft.de">Leibniz Association</a>. The separated modules are being published as open source at <a href="http://github.com/KorAP">GitHub</a>.</p>
+ <p>KorAP is developed at the <a href="https://www.ids-mannheim.de">Leibniz Institute for the German Language</a>, member of the <a href="http://www.leibniz-gemeinschaft.de">Leibniz Association</a>. The separated modules are being published as open source at <a href="http://github.com/KorAP">GitHub</a>.</p>
</div>