Permalink
Browse files

Fix client side script paths

  • Loading branch information...
1 parent 485fdf3 commit 99d9d6290d74e85885c4849ff252663992caa97d @manuels committed Jan 22, 2013
Showing with 18 additions and 10 deletions.
  1. +2 −2 .gitmodules
  2. +3 −0 README
  3. +12 −8 static/js/client_main.js
  4. +1 −0 static/js/texlive.js
View
@@ -1,3 +1,3 @@
-[submodule "texlive"]
- path = static/js/texlive
+[submodule "static/js/texlive.js"]
+ path = static/js/texlive.js
url = git://github.com/manuels/texlive.js.git
View
@@ -0,0 +1,3 @@
+This is a plugin to compile Etherpad-lite pads that contain (only) LaTeX in the browser.
+
+Note: You better set 'minify' to false in Etherpad's settings.json, otherwise it will minify huge files that are already minified!
@@ -1,19 +1,19 @@
-var root = '../..';
+var root = '../../static/plugins/ep_latex/static/js/';
exports.documentReady = function(hook, context){
var button = $('#compileLatex');
var mode = 'compile';
- jQuery.getScript(root+'texlive/website/pdftex.js/release/pdftex-webworker.js');
- jQuery.getScript(root+'texlive/website/pdftex.js/release/pdftex.js');
- jQuery.getScript(root+'texlive/website/texlive.js');
+ jQuery.getScript(root+'texlive.js/website/pdftex.js/release/pdftex-webworker.js');
+ jQuery.getScript(root+'texlive.js/website/pdftex.js/release/pdftex.js');
+ jQuery.getScript(root+'texlive.js/website/texlive.js');
var pdf;
button.click(function() {
if(mode==='compile') {
- button.append('<div id="msg">compiling</div>');
+ button.children().append('<div id="msg">compiling</div>');
- var pdftex = new PDFTeX();
+ var pdftex = new PDFTeX(root+'texlive.js/website/');
pdftex.on_stdout = function(txt) { }
pdftex.on_stderr = function(txt) { }
@@ -25,8 +25,11 @@ exports.documentReady = function(hook, context){
xhr.open('GET', url, false);
xhr.onreadystatechange = function(ev) {
- var code = ev.responseText;
- texlive.compile(code, root, function(data) {
+ if (xhr.readyState !== 4)
+ return;
+
+ var code = xhr.responseText;
+ texlive.compile(code, '../../', function(data) {
button.find('#msg').text('click to open');
pdf = data;
mode = 'open';
@@ -38,6 +41,7 @@ exports.documentReady = function(hook, context){
else {
mode = 'compile';
window.open('data:application/pdf;base64,'+window.btoa(pdf));
+ button.find('#msg').remove();
}
});
}
Submodule texlive.js added at 4e7d27

0 comments on commit 99d9d62

Please sign in to comment.