Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix error

  • Loading branch information...
commit 40b9d95f50ce11d2883aae0f50b2a6a32b620068 1 parent 50b9a61
@JohnMcLear JohnMcLear authored
View
1  .ep_initialized
@@ -0,0 +1 @@
+done
View
4 ep.json
@@ -1,12 +1,12 @@
{
"parts": [
{
- "name": "LaTeX",
+ "name": "latex",
"hooks": {
"eejsBlock_editbarMenuLeft": "ep_latex/server_main:createIcon"
},
"client_hooks": {
- "documentReady": "ep_latex/client_main:documentReady"
+ "documentReady": "ep_latex/static/js/client_main:documentReady"
}
}
]
View
11 static/js/client.js
@@ -0,0 +1,11 @@
+exports.postAceInit = function(hook, context)
+{
+ $("#myswatchbox").off();
+ $("#clearAuthorship").remove();
+ $("#settingslink").remove();
+ $("#usericon").prev().remove(); // seperator
+ $("#embedlink").remove();
+ $("#editorcontainerbox").css("left", "0px");
+ $("#editorcontainerbox").css("right", "65px");
+ $("#editorcontainerbox").css("width", "auto");
+}
View
43 static/js/client_main.js
@@ -0,0 +1,43 @@
+var root = '../..';
+
+$.runScript(root+'texlive/website/pdftex.js/release/pdftex-webworker.js');
+$.runScript(root+'texlive/website/pdftex.js/release/pdftex.js');
+$.runScript(root+'texlive/website/texlive.js');
+
+exports.documentReady = function(hook, context){
+ var button = $('#compileLatex');
+ var mode = 'compile';
+
+ var pdf;
+ button.click(function() {
+ if(mode==='compile') {
+ button.append('<div id="msg">compiling</div>');
+
+ var pdftex = new PDFTeX();
+
+ pdftex.on_stdout = function(txt) { }
+ pdftex.on_stderr = function(txt) { }
+
+ var texlive = new TeXLive(pdftex);
+
+ var url = document.URL+'/export/txt';
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', url, false);
+
+ xhr.onreadystatechange = function(ev) {
+ var code = ev.responseText;
+ texlive.compile(code, root, function(data) {
+ button.find('#msg').text('click to open');
+ pdf = data;
+ mode = 'open';
+ });
+ };
+
+ xhr.send(null);
+ }
+ else {
+ mode = 'compile';
+ window.open('data:application/pdf;base64,'+window.btoa(pdf));
+ }
+ });
+}
Please sign in to comment.
Something went wrong with that request. Please try again.