diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-06-10 18:40:56 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-15 09:25:01 -0700 |
commit | 5169adbeb375b79d2a0701c0ba49f17a1c56580a (patch) | |
tree | 63a74b2d960955d79f8262108c515896a4befae0 /theme/dive_export.html | |
parent | 8ea5441b79c860520f8bc28ad905196ac58ad37c (diff) | |
download | subsurface-5169adbeb375b79d2a0701c0ba49f17a1c56580a.tar.gz |
HTML: Dynamically loading an external JavaScript or CSS file
This enable the HTML template from linking JS and CSS files dynamically
when starting. This helps to recognize the folder name where js and css
where exported dynamically.
The HTML template will succesfully find the attached files as long as they
exist in a directory named as the HTML file.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'theme/dive_export.html')
-rw-r--r-- | theme/dive_export.html | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/theme/dive_export.html b/theme/dive_export.html index 4d7efa20c..2374c0758 100644 --- a/theme/dive_export.html +++ b/theme/dive_export.html @@ -2,13 +2,31 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>dive log export</title> -<link rel="stylesheet" type="text/css" href="theme.css"> -<script src="file.json"></script> -<script src="settings.json"></script> -<script src="list_lib.js" type="text/javascript"></script> <script> ////////////////////////////////// //advance settings window// +load_scripts(); + +function load_scripts(){ + var fileref=document.createElement("link"); + fileref.setAttribute("rel", "stylesheet"); + fileref.setAttribute("type", "text/css"); + fileref.setAttribute("href", location.pathname+"_files/theme.css"); + document.getElementsByTagName("head")[0].appendChild(fileref); + + fileref=document.createElement('script'); + fileref.setAttribute("src", location.pathname+"_files/file.json"); + document.getElementsByTagName("head")[0].appendChild(fileref); + + fileref=document.createElement('script'); + fileref.setAttribute("src", location.pathname+"_files/settings.json"); + document.getElementsByTagName("head")[0].appendChild(fileref); + + fileref=document.createElement('script'); + fileref.setAttribute("type","text/javascript"); + fileref.setAttribute("src", location.pathname+"_files/list_lib.js"); + document.getElementsByTagName("head")[0].appendChild(fileref); +} var advanced_shown=false; function showdiv(){ @@ -80,6 +98,7 @@ window.onload=function(){ sizeofpage=10; showAllDives(); document.getElementById("divePanel").style.display='none'; + document.body.style.visibility='visible'; } function changeAdvSearch(e){ |