Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

IE has problem with cloneNode on <script>

  • Loading branch information...
commit c2b4474bb7426b0c0581969ac3a5a915dc4cf602 1 parent b800c3d
@dzejkej authored
Showing with 22 additions and 26 deletions.
  1. +21 −25 bookmarklet.js
  2. +1 −1  index.html
View
46 bookmarklet.js
@@ -1,6 +1,6 @@
javascript:(function() {
- var frames = document.getElementsByTagName('iframe'), script, index, win;
+ var frames = document.getElementsByTagName('iframe'), index, win;
/* execute MathJax on the window object */
executeMathJax(window);
@@ -20,31 +20,27 @@ javascript:(function() {
/* insert the MathJax script dynamically into the document */
function insertScript(doc) {
- var config;
-
- /* don't create script for each window */
- if (script === undefined) {
-
- script = doc.createElement('script');
-
- script.type = 'text/javascript';
-
- /* see http://www.mathjax.org/resources/faqs/#problem-https */
- script.src = 'https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js';
-
- /* configuration for MathJax */
- /* see http://www.mathjax.org/docs/1.1/options/tex2jax.html */
- config = 'MathJax.Hub.Config({tex2jax:{inlineMath:[[\'$\',\'$\']],processEscapes: true}});MathJax.Hub.Startup.onload();';
-
- /* include the configuration with the script */
- if (window.opera) {
- script.innerHTML = config;
- } else {
- script.text = config;
- }
- }
+ var script, config;
+
+ script = doc.createElement('script');
+
+ script.type = 'text/javascript';
+
+ /* see http://www.mathjax.org/resources/faqs/#problem-https */
+ script.src = 'https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js';
+
+ /* configuration for MathJax */
+ /* see http://www.mathjax.org/docs/1.1/options/tex2jax.html */
+ config = 'MathJax.Hub.Config({tex2jax:{inlineMath:[[\'$\',\'$\']],processEscapes: true}});MathJax.Hub.Startup.onload();';
+
+ /* include the configuration with the script */
+ if (window.opera) {
+ script.innerHTML = config;
+ } else {
+ script.text = config;
+ }
- doc.getElementsByTagName('head')[0].appendChild(script.cloneNode(true));
+ doc.getElementsByTagName('head')[0].appendChild(script);
}
/* execute MathJax for given window */
View
2  index.html
@@ -58,7 +58,7 @@
</p>
</div>
<div class="span8">
- <a href="javascript:(function(){function e(a){var c;b===undefined&&(b=a.createElement('script'),b.type='text/javascript',b.src='https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js',c='MathJax.Hub.Config({tex2jax:{inlineMath:[[\'$\',\'$\']],processEscapes: true}});MathJax.Hub.Startup.onload();',window.opera?b.innerHTML=c:b.text=c),a.getElementsByTagName('head')[0].appendChild(b.cloneNode(!0))}function f(a){a.MathJax===undefined?e(a.document):a.MathJax.Hub.Queue(new a.Array('Typeset',a.MathJax.Hub))}var a=document.getElementsByTagName('iframe'),b,c,d;f(window);for(c=0;c<a.length;c++)d=a[c].contentWindow||a[c].contentDocument,d.document||(d=d.parentNode),f(d)})()">
+ <a href="javascript:(function(){function d(a){var b,c;b=a.createElement('script'),b.type='text/javascript',b.src='https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js',c='MathJax.Hub.Config({tex2jax:{inlineMath:[[\'$\',\'$\']],processEscapes: true}});MathJax.Hub.Startup.onload();',window.opera?b.innerHTML=c:b.text=c,a.getElementsByTagName('head')[0].appendChild(b)}function e(a){a.MathJax===undefined?d(a.document):a.MathJax.Hub.Queue(new a.Array('Typeset',a.MathJax.Hub))}var a=document.getElementsByTagName('iframe'),b,c;e(window);for(b=0;b<a.length;b++)c=a[b].contentWindow||a[b].contentDocument,c.document||(c=c.parentNode),e(c)})()">
<img id="bookmarklet" src="http://www.mathjax.org/wp-content/themes/mathjax/images/logo.gif" alt="MathJax">
</a>
<div id="install"><em>Drag&amp;Drop image to your bookmarks (righ-click under IE)!</em></div>
Please sign in to comment.
Something went wrong with that request. Please try again.