From 7b0982f155b29263f2caae931b7be3f57b70844a Mon Sep 17 00:00:00 2001 From: Vincent Nivoliers <vincent.nivoliers@univ-lyon1.fr> Date: Fri, 23 Sep 2016 16:04:45 +0200 Subject: [PATCH] fixing non standard innerText --- explorer.php | 8 ++++---- js/explorer.js | 10 +++++++--- js/pgm_construction.js | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/explorer.php b/explorer.php index b2417b1..8081c44 100644 --- a/explorer.php +++ b/explorer.php @@ -21,20 +21,20 @@ href="<?php echo $rootpath?>/css/style.css" /> <!--}}}--> </head> - <body onload="javascript:Explosurf.explorer.init( + <body> + <div class="hidden" id="planet-file"> <?php // get the XML planet descriptor $search = glob("*.xml") ; $len = count($search) ; if($len > 0) { $file = $search[0] ; - echo "'$file'" ; + echo $file ; } else { echo "" ; } ?> - );" - > + </div> <div class="container"> <!--{{{ top bar--> <div class="navbar navbar-default"> diff --git a/js/explorer.js b/js/explorer.js index 3a617db..44ced0c 100644 --- a/js/explorer.js +++ b/js/explorer.js @@ -127,7 +127,9 @@ function openXML(filename, handler) { xhttp.addEventListener("error", handle_request_error); xhttp.addEventListener("readystatechange", function() {handler(this);}); xhttp.open("GET",filename) ; - xhttp.overrideMimeType('text/xml'); + if(xhttp.overrideMimeType) { + xhttp.overrideMimeType('text/xml'); + } xhttp.send(null) ; } @@ -260,7 +262,8 @@ function check_boundary(edge) { /*export*/ Xpl.check_boundary = check_boundary ; -function init(filename) { +function init() { + var filename = document.getElementById('planet-file').innerHTML ; openXML(filename, function(response) { if (response.readyState == 4 && response.status == 200) { load_planet(response.responseXML) ; @@ -270,6 +273,7 @@ function init(filename) { }) ; } -Xpl.init = init +document.addEventListener("DOMContentLoaded", init) ; + }) //end of namespace diff --git a/js/pgm_construction.js b/js/pgm_construction.js index e0a05eb..a44a729 100644 --- a/js/pgm_construction.js +++ b/js/pgm_construction.js @@ -196,7 +196,7 @@ document.getElementById('pgm-load-local').addEventListener( for(var i = 0; i < pgm_list.children.length; ++i) { var item = pgm_list.children[i] ; if(item.className.match(/active/)) { - var name = item.children[1].innerText ; + var name = item.children[1].innerHTML ; local_load('Explosurf:all:pgm:' + name) ; } } -- GitLab