mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
8ea5441b79
commit
5169adbeb3
3 changed files with 25 additions and 4 deletions
|
@ -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){
|
||||
|
|
|
@ -3,6 +3,7 @@ body{
|
|||
background-color:#dfdfdf;
|
||||
font-size:12px;
|
||||
font-family: 'Lobster', helvetica, arial;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
|
|
@ -3,6 +3,7 @@ body{
|
|||
background-color:#F7F4DD;
|
||||
font-size:12px;
|
||||
font-family: 'Lobster', helvetica, arial;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
|
Loading…
Add table
Reference in a new issue