From 670f5809f881c283cfdba3d9363d7b9f974a5cc3 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 20 Aug 2014 14:49:29 -0400 Subject: [PATCH] Use large chunks and reduce processUpdateTime to get browser responsiveness. Remove the processing messages during output, since it will now be slower and the math is showing. --- unpacked/extensions/CHTML-preview.js | 30 ++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/unpacked/extensions/CHTML-preview.js b/unpacked/extensions/CHTML-preview.js index e0805232e..09d78e477 100644 --- a/unpacked/extensions/CHTML-preview.js +++ b/unpacked/extensions/CHTML-preview.js @@ -32,12 +32,14 @@ version: "1.0", // - // Configuration for the chinking of the main output - // after the previews have been created + // Configuration for the chunking of the main output + // after the previews have been created, and other configuration. // config: HUB.CombineConfig("CHTML-preview",{ - Chunks: {EqnChunk: 5, EqnChunkFactor: 1, EqnChunkDelay: 150}, - color:"inherit" + Chunks: {EqnChunk: 10000, EqnChunkFactor: 1, EqnChunkDelay: 0}, + color: "inherit", + updateTime: 10, updateDelay: 50, + messageStyle: "none" }), // @@ -49,6 +51,26 @@ SVG: this.config.Chunks, }); MathJax.Ajax.Styles({".MathJax_Preview":{color:this.config.color}}); + var update, delay, style, done; + var config = this.config; + HUB.Register.MessageHook("Begin Math Output",function () { + if (!done) { + update = HUB.processUpdateTime; delay = HUB.processUpdateDelay; + style = HUB.config.messageStyle; + HUB.processUpdateTime = config.updateTime; + HUB.processUpdateDelay = config.updateDelay; + HUB.Config({messageStyle: config.messageStyle}); + MathJax.Message.Clear(0,0); + } + }); + HUB.Register.MessageHook("End Math Output",function () { + if (!done) { + HUB.processUpdateTime = update; + HUB.processUpdateDelay = delay; + HUB.Config({messageStyle: style}); + done = true; + } + }); }, //