Skip to content

Commit

Permalink
Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
Browse files Browse the repository at this point in the history
  • Loading branch information
distler committed Dec 4, 2016
2 parents ad63760 + 0c01acc commit 3f89d3e
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 17 deletions.
31 changes: 24 additions & 7 deletions app/views/layouts/default.rhtml
Expand Up @@ -55,13 +55,30 @@
});
//--><!]]>
</script>
<script type="text/javascript">
if (!(Prototype.Browser.Gecko || navigator.userAgent.match(/MathPlayer/))) {
var s = document.createElement('script');
s.src = "<%= compute_public_path('MathJax.js', 'MathJax').split('?')[0] %>?config=MML_HTMLorMML-full";
document.querySelector('head').appendChild(s);
};
</script>

<script type="text/javascript">
<!--//--><![CDATA[//><!--
window.addEventListener("DOMContentLoaded", function () {
var div = document.createElement('div');
var math = document.createElementNS('http://www.w3.org/1998/Math/MathML', 'math');
document.body.appendChild(div);
div.appendChild(math);
// Test for MathML support comparable to WebKit version https://trac.webkit.org/changeset/203640 or higher.
div.setAttribute('style', 'font-style: italic');
var mathml_unsupported = !(window.getComputedStyle(div.firstChild).getPropertyValue('font-style') === 'normal');
div.parentNode.removeChild(div);
if (mathml_unsupported) {
// MathML does not seem to be supported...
var s = document.createElement('script');
s.src = "<%= compute_public_path('MathJax.js', 'MathJax').split('?')[0] %>?config=MML_HTMLorMML";
document.querySelector('head').appendChild(s);
} else {
document.head.insertAdjacentHTML("beforeend", '<style>svg {max-width: 100%}</style>');
}
});
//--><!]]>
</script>

<%- end -%>
<%= auto_discovery_link_tag(:atom, {:controller => 'wiki', :web => @web.address, :action => 'atom_with_headlines'},
:title => 'Atom with headlines') %>
Expand Down
25 changes: 20 additions & 5 deletions app/views/wiki/s5.rhtml
Expand Up @@ -42,11 +42,26 @@
//--><!]]>
</script>
<script type="text/javascript">
if (!(Prototype.Browser.Gecko || navigator.userAgent.match(/MathPlayer/))) {
var s = document.createElement('script');
s.src = "<%= compute_public_path('MathJax.js', 'MathJax').split('?')[0] %>?config=MML_HTMLorMML-full";
document.querySelector('head').appendChild(s);
};
<!--//--><![CDATA[//><!--
window.addEventListener("DOMContentLoaded", function () {
var div = document.createElement('div');
var math = document.createElementNS('http://www.w3.org/1998/Math/MathML', 'math');
document.body.appendChild(div);
div.appendChild(math);
// Test for MathML support comparable to WebKit version https://trac.webkit.org/changeset/203640 or higher.
div.setAttribute('style', 'font-style: italic');
var mathml_unsupported = !(window.getComputedStyle(div.firstChild).getPropertyValue('font-style') === 'normal');
div.parentNode.removeChild(div);
if (mathml_unsupported) {
// MathML does not seem to be supported...
var s = document.createElement('script');
s.src = "<%= compute_public_path('MathJax.js', 'MathJax').split('?')[0] %>?config=MML_HTMLorMML";
document.querySelector('head').appendChild(s);
} else {
document.head.insertAdjacentHTML("beforeend", '<style>svg {max-width: 100%}</style>');
}
});
//--><!]]>
</script>
<%- end -%>
<%= javascript_include_tag "/s5/ui/core/slides.js" %>
Expand Down
15 changes: 15 additions & 0 deletions public/javascripts/page_helper.js
Expand Up @@ -315,6 +315,20 @@ function initializeYoutubePlayer() {
}
}

function columnAlignShim() {
var mtables = document.querySelectorAll('mtable[columnalign]');
for (var i = 0; i < mtables.length; i++) {
var mtable = mtables[i];
var colAligns = mtable.getAttribute('columnalign').split(/\s+/);
if (colAligns.length > 1) {
var mtds = mtable.querySelectorAll(':scope > mtr > mtd');
for (var j = 0; j < mtds.length; j++) {
mtds[j].style.textAlign = colAligns[j];
}
}
}
}

document.observe("dom:loaded", function (){
extractBlockquoteCitations();
fixRunIn();
Expand All @@ -323,4 +337,5 @@ document.observe("dom:loaded", function (){
embedCDFs();
retrieveTexSource();
initializeYoutubePlayer();
columnAlignShim();
});
5 changes: 0 additions & 5 deletions public/stylesheets/instiki.css
Expand Up @@ -516,11 +516,6 @@ span.theorem_label {font-style:normal; font-weight:bold;}
[actiontype="toggle"]:hover {text-shadow: #ccc 2px 2px 5px;}
.maruku_toc ul { list-style: none; }

/* hack to work around https://bugs.webkit.org/show_bug.cgi?id=160075 */
[columnalign="right left right left right left right left right left"] mtd:nth-child(2n+1) {text-align: right;}
[columnalign="right left right left right left right left right left"] mtd:nth-child(2n+0) {text-align: left;}
[columnalign="left left"] mtd {text-align:left;}

/* The STIX Two fonts are licensed under the SIL Open Font License, Version 1.1, http://scripts.sil.org/OFL */
math {font-family: STIX Two Math;}
mtext {font-family: STIX Two Text;}
Expand Down

0 comments on commit 3f89d3e

Please sign in to comment.