Permalink
Browse files

fix error

  • Loading branch information...
1 parent 50b9a61 commit 40b9d95f50ce11d2883aae0f50b2a6a32b620068 @JohnMcLear JohnMcLear committed Jan 21, 2013
Showing with 57 additions and 2 deletions.
  1. +1 −0 .ep_initialized
  2. +2 −2 ep.json
  3. +11 −0 static/js/client.js
  4. +43 −0 static/js/client_main.js
View
@@ -0,0 +1 @@
+done
View
@@ -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
@@ -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
@@ -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));
+ }
+ });
+}

0 comments on commit 40b9d95

Please sign in to comment.