xhtml compatibility in single file embed mode
authorChristian Weiske <cweiske@cweiske.de>
Tue, 3 Feb 2015 19:51:04 +0000 (20:51 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 3 Feb 2015 19:55:15 +0000 (20:55 +0100)
data/templates/embed-file.htm

index 46075de..f573ac3 100644 (file)
@@ -1,7 +1,9 @@
 /* embedding {{file.getFilename()}} of {{repo.getLink('display', null, true)}} */
-document.write('<link rel="stylesheet" href="{{htmlhelper.fullUrl('css/embed.css')}}"/>');
-document.write(
-    '<div class="phork" id="{{repo.id}}">'
+var me = document.getElementById('phork-script-{{repo.id}}-{{file.getFilename()}}');
+me.insertAdjacentHTML(
+    'afterend',
+    '<link rel="stylesheet" href="{{htmlhelper.fullUrl('css/embed.css')}}"/>'
+    + '<div class="phork" id="{{repo.id}}">'
     + {% filter json_encode(constant('JSON_UNESCAPED_SLASHES'))|raw -%}{% include 'embed-part-file.htm' %}{%- endfilter %}
     + '</div>'
 );