mirror of
https://github.com/TeamNewPipe/website
synced 2025-10-06 00:22:38 +02:00
[CSP] Move inline scripts into separate files
This commit is contained in:
@@ -78,7 +78,3 @@
|
||||
{%- endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
clickListener();
|
||||
</script>
|
||||
|
@@ -16,11 +16,3 @@
|
||||
<script src="{{ site.baseurl }}/lunrjs/press_searchData.js"></script>
|
||||
<script src="{{ site.baseurl }}/lunrjs/lunr.min.js"></script>
|
||||
<script src="{{ site.baseurl }}/lunrjs/press_search.js"></script>
|
||||
|
||||
<script>
|
||||
$("#search-box").on('keyup', function (e) {
|
||||
if (e.keyCode == 13) { // Enter key
|
||||
search('manual');
|
||||
}
|
||||
});
|
||||
</script>
|
@@ -8,6 +8,7 @@ navBrand: "FAQ"
|
||||
navActive: "FAQ"
|
||||
footerBuffer: "True"
|
||||
extraCSS: [tutorials.css]
|
||||
extraJS: tutorial.js
|
||||
---
|
||||
|
||||
{% if page.type == "tutorial" %}
|
||||
@@ -44,13 +45,5 @@ extraCSS: [tutorials.css]
|
||||
<i class="fa fa-lg fa-times" aria-hidden="true" data-dismiss="modal" ></i>
|
||||
</div> <!-- Modal -->
|
||||
<script src="{{ site.baseurl }}/js/mediaview.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
let images = document.querySelectorAll('.figure-wrapper > figure > img, .figure-wrapper > figure > video');
|
||||
for (let image in images) {
|
||||
images[image].onclick = function(){viewMediaFile(this, true)};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -26,6 +26,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
$('html, body').animate({scrollTop: scrollPos}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
clickListener();
|
||||
});
|
||||
|
||||
function clickListener() {
|
||||
|
8
js/tutorial.js
Normal file
8
js/tutorial.js
Normal file
@@ -0,0 +1,8 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
let images = document.querySelectorAll('.figure-wrapper > figure > img, .figure-wrapper > figure > video');
|
||||
for (let image in images) {
|
||||
images[image].onclick = function () {
|
||||
viewMediaFile(this, true)
|
||||
};
|
||||
}
|
||||
});
|
@@ -46,6 +46,7 @@ function getQueryVariable(variable) {
|
||||
}
|
||||
}
|
||||
|
||||
var idx;
|
||||
function search(type) {
|
||||
let searchTerm;
|
||||
if (type === "manual")
|
||||
@@ -60,7 +61,7 @@ function search(type) {
|
||||
|
||||
// Initialize lunr with the fields it will be searching on. I've given title
|
||||
// a boost of 10 to indicate matches on this field are more important.
|
||||
var idx = lunr(function () {
|
||||
idx = lunr(function () {
|
||||
this.field('id');
|
||||
this.field('title', {boost: 10});
|
||||
this.field('date');
|
||||
@@ -81,4 +82,12 @@ function search(type) {
|
||||
}
|
||||
}
|
||||
|
||||
search("onload");
|
||||
search("onload");
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
$("#search-box").on('keyup', function (e) {
|
||||
if (e.keyCode === 13) { // Enter key
|
||||
search('manual');
|
||||
}
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user