Skip to content
Snippets Groups Projects
Commit 49fa4714 authored by srosse's avatar srosse
Browse files

OPENOLAT-65,OPENOLAT-66,OPENOLAT-67: fix some issues with jsMath and jQuery (especially for Safari)

parent 6e288194
No related branches found
No related tags found
No related merge requests found
......@@ -497,7 +497,7 @@ public class Formatter {
sb.append("<").append(elem).append(" id=\"").append(domid).append("\">");
sb.append(htmlFragment);
sb.append("</").append(elem).append(">");
sb.append("<script type='text/javascript'>/* <![CDATA[ */ BFormatter.formatLatexFormulas('").append(domid).append("');/* ]]> */</script>");
sb.append("\n<script type='text/javascript'>\n/* <![CDATA[ */\n setTimeout(function() { BFormatter.formatLatexFormulas('").append(domid).append("');}, 100);\n/* ]]> */\n</script>");
return sb.toString();
}
return htmlFragment;
......
......@@ -35,6 +35,7 @@ import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.id.context.ContextEntry;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper;
import org.olat.core.util.filter.Filter;
import org.olat.core.util.filter.FilterFactory;
......@@ -76,7 +77,6 @@ public class FeedViewHelper {
// Per default show the first page
private int page = 0;
private List<Item> cachedItems;
private FeedSecurityCallback callback;
//
private FeedManager feedManager = FeedManager.getInstance();
......@@ -94,7 +94,6 @@ public class FeedViewHelper {
this.locale = translator.getLocale();
this.courseId = courseId;
this.nodeId = nodeId;
this.callback = callback;
this.cachedItems = feed.getFilteredItems(callback, identity);
this.setURIs();
}
......@@ -424,6 +423,7 @@ public class FeedViewHelper {
itemDescription = mediaUrlFilter.filter(itemDescription);
}
}
itemDescription = Formatter.formatLatexFormulas(itemDescription);
return itemDescription;
}
......
......@@ -206,18 +206,22 @@ var BFormatter = {
formatLatexFormulas : function(domId) {
try {
if (jsMath) { // only when js math available
if (jsMath.loaded) {
jsMath.ProcessBeforeShowing.curry(domId).delay(0.01);
if (jsMath.loaded) {
setTimeout(function() {
jQuery('#' + domId).each(function(index, el){
jsMath.ProcessBeforeShowing(el);
});
}, 10);
} else { // not yet loaded (autoload), load first
jsMath.Autoload.LoadJsMath();
// retry formatting when ready (recursively until loaded)
BFormatter.formatLatexFormulas.delay(0.1);
setTimeout(function() {
BFormatter.formatLatexFormulas(domId);
}, 100);
}
} else {
if(jQuery(document).ooLog().isDebugEnabled()) jQuery(document).ooLog('debug','BFormatter::formatLatexFormulas: can not format latex formulas, jsMath not installed. Check your logfile', "functions.js::BFormatter::formatLatexFormulas");
}
} catch(e) {
if (o_info.debug) o_log("error in BFormatter.formatLatexFormulas: "+showerror(e));
if (console) console.log("error in BFormatter.formatLatexFormulas: ", e);
}
}
};
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment