1
0
mirror of https://github.com/oupala/apaxy.git synced 2025-08-19 16:01:28 +02:00

feat(): move javascript code into a separate js file

Move javascript code into a separate js file as it enable apaxy to be compliant with the most secure content security policy (aka CSP). You can now use the following Content Security Policy :

Content-Security-Policy: default-src 'self'
This commit is contained in:
oupala
2017-01-15 23:54:43 +01:00
parent 3ba49c1bfb
commit 57ea1a8416
2 changed files with 13 additions and 14 deletions

12
apaxy/theme/apaxy.js Normal file
View File

@@ -0,0 +1,12 @@
// grab the 2nd child and add the parent class. tr:nth-child(2)
document.getElementsByTagName('tr')[1].className = 'parent';
// fix links when not adding a / at the end of the URI
var uri = window.location.pathname.substr(1);
if (uri.substring(uri.length-1) != '/'){
var indexes = document.getElementsByClassName('indexcolname'),
i = indexes.length;
while (i--){
var a = indexes[i].getElementsByTagName('a')[0];
a.href = '/' + uri + '/' + a.getAttribute('href',2);
}
}

View File

@@ -7,17 +7,4 @@
<div class="footer"> <div class="footer">
Apaxy by <a href="https://twitter.com/adamwhitcroft">@adamwhitcroft</a> Apaxy by <a href="https://twitter.com/adamwhitcroft">@adamwhitcroft</a>
</div><!--/.footer--> </div><!--/.footer-->
<script type="text/javascript"> <script src=theme/apaxy.js></script>
// grab the 2nd child and add the parent class. tr:nth-child(2)
document.getElementsByTagName('tr')[1].className = 'parent';
// fix links when not adding a / at the end of the URI
var uri = window.location.pathname.substr(1);
if (uri.substring(uri.length-1) != '/'){
var indexes = document.getElementsByClassName('indexcolname'),
i = indexes.length;
while (i--){
var a = indexes[i].getElementsByTagName('a')[0];
a.href = '/' + uri + '/' + a.getAttribute('href',2);
}
}
</script>