1. Thomas Waldmann
  2. moin-2.0

Commits

Roger Haase  committed 7bfcad3

display svg objects with IE8

  • Participants
  • Parent commits 7f93823
  • Branches default

Comments (0)

Files changed (5)

File MoinMoin/converter/html_out.py

View file
     visit_style = Attribute('style')
     visit_title = Attribute('title')
     visit_id = Attribute('id')
+    visit_type = Attribute('type') # IE8 needs <object... type="image/svg+xml" ...> to display svg images
 
     def __init__(self, element):
         self.element = element
             return "object"
 
     def visit_moinpage_object(self, elem):
+        # TODO: maybe IE8 would display transcluded external pages if we could do <object... type="text/html" ...>
         href = elem.get(xlink.href, None)
         attrib = {}
         mimetype = Type(_type=elem.get(moin_page.type_, 'application/x-nonexistent'))

File MoinMoin/templates/base.html

View file
     {%- endif %}
     {% endblock %}
 
-    {% block head_scripts %}
-    <script src="{{ url_for('serve.files', name='jquery', filename='jquery.min.js') }}"></script>
-    <script src="{{ url_for('serve.files', name='svgweb', filename='svg.js') }}"></script>
-    <script src="{{ url_for('frontend.template', filename='common.js') }}"></script>
-    {{ scripts }}
-    <!--[if lt IE 9]>
-        {# TODO: use a local copy later #}
-        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
-    <![endif]-->
-    <!--[if lt IE 8]>
-        {# required to save user settings with IE7 and earlier #}
-        <script src="{{ url_for('serve.files', name='json_js', filename='json2.js') }}"></script>
-    <![endif]-->
-    {% endblock %}
+
 {% endblock %}
 </head>
 <body{% if body_onload %} onload="{{ body_onload }}"{% endif %} lang="{{ theme_supp.ui_lang }}" dir="{{ theme_supp.ui_dir }}">
 {% endblock %}
 </div>
 
+{% block body_scripts %} {# js before </body> reduces IE8 js errors related to svgweb #}
+    <!--[if IE 8]>
+        <script src="{{ url_for('serve.files', name='svgweb', filename='svg.js') }}"></script>
+    <![endif]-->
+    <script src="{{ url_for('serve.files', name='jquery', filename='jquery.min.js') }}"></script>
+    <script src="{{ url_for('frontend.template', filename='common.js') }}"></script>
+    {{ scripts }}
+    <!--[if lt IE 9]>
+        {# TODO: use a local copy later #}
+        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+    <!--[if lt IE 8]>
+        {# required to save user settings with IE7 and earlier #}
+        <script src="{{ url_for('serve.files', name='json_js', filename='json2.js') }}"></script>
+    <![endif]-->
+{% endblock %}
+
 </body>
 </html>

File MoinMoin/templates/common.js

View file
             if ($(elem).parent()[0].tagName === 'A') {
                 elem = $(elem).parent()[0];
             }
-            // wrap element, add UL and LR overlay siblings, and replace old elem with wrapped elem
-            $(wrapper).append($(elem).clone(true));
+            // insert wrapper after elem, append (move) elem, append overlays
+            $(elem).after(wrapper);
+            $(wrapper).append(elem);
             $(wrapper).append(overlayUL);
             $(wrapper).append(overlayLR);
-            $(elem).replaceWith(wrapper);
         }
     });
     // if an element was wrapped above, then make the Transclusions buttons visible

File MoinMoin/templates/forms.html

View file
   </dd>
 {% endmacro %}
 
-{% macro render_file_uploader(submit_url) %}
+{% macro render_file_uploader(submit_url) %} {# pages that use this macro must also use file_uploader_scripts macro below #}
     <div id="file_upload">
         <div class="upload-form">
         <form action="{{ submit_url }}" method="POST" enctype="multipart/form-data" class="upload_file">
             </tr>
         </table>
     </div>
+{% endmacro %}
+{% macro file_uploader_scripts() %}
     <link rel="stylesheet" href="{{ url_for('serve.files', name='jquery_file_upload', filename='jquery.fileupload-ui.css') }}">
     <script src="{{ url_for('serve.files', name='jquery_file_upload', filename='jquery.fileupload.js') }}"></script>
     <script src="{{ url_for('serve.files', name='jquery_file_upload', filename='jquery.fileupload-ui.js') }}"></script>

File MoinMoin/templates/index.html

View file
     {% set title = _("Global Index") %}
 {% endif %}
 
-{% block head_scripts %}
-{{ super() }}
-    <script src="{{ url_for('frontend.template', filename='index_action.js') }}"></script>
-{% endblock %}
-
 {% block action_bars_inner %}
     <ul>
         {% if index %}
     {{ forms.render_file_uploader(submit_url) }}
     </div>
     <span class="moin-drag">{{ _("(Drag and drop multiple files to this white area to upload them.)") }}</span>
-    <script src="{{ url_for('static', filename='js/jfu.js') }}"></script>
     <div id="lightbox">&nbsp;</div>
 {% endblock %}
+
+{% block body_scripts %}
+{{ super() }}
+    <script src="{{ url_for('frontend.template', filename='index_action.js') }}"></script>
+    <script src="{{ url_for('static', filename='js/jfu.js') }}"></script>
+    {{ forms.file_uploader_scripts() }}
+{% endblock %}