From b81536ad49001abf292bd31a0dcbf57e387387b1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 May 2011 16:27:50 -0400 Subject: Fiddle with emacs config (when to use -n, -c), get emacs using el-get. --- .../scripts/staticmathjax/chrome/chrome.manifest | 1 - .../scripts/staticmathjax/chrome/content/main.js | 198 --------------------- .../scripts/staticmathjax/chrome/content/main.xul | 11 -- 3 files changed, 210 deletions(-) delete mode 100644 .emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/chrome.manifest delete mode 100644 .emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.js delete mode 100644 .emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.xul (limited to '.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome') diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/chrome.manifest b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/chrome.manifest deleted file mode 100644 index a05d8c8..0000000 --- a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/chrome.manifest +++ /dev/null @@ -1 +0,0 @@ -content staticmathjax file:content/ diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.js b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.js deleted file mode 100644 index 2e71f3b..0000000 --- a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.js +++ /dev/null @@ -1,198 +0,0 @@ -var docFrame; -var logtextbox; -var destFile; -var embedFonts = false; -var finalMathJaxURL = null; - -function log(text) -{ - logtextbox.setAttribute("value", logtextbox.getAttribute("value") + "\n" + text); -} - -function init() -{ - try { - docFrame = document.getElementById("docFrame"); - logtextbox = document.getElementById("logtextbox"); - - // parse command line arguments - var cmdLine = window.arguments[0]; - cmdLine = cmdLine.QueryInterface(Components.interfaces.nsICommandLine); - - embedFonts = cmdLine.handleFlag("embed-fonts", false); - finalMathJaxURL = cmdLine.handleFlagWithParam("final-mathjax-url", false); - - if (!embedFonts && !finalMathJaxURL) { - alert("You must eiher specify --embed-fonts or --final-mathjax-url"); - window.close(); - return; - } - - sourceFilePath = cmdLine.getArgument(0); - destFilePath = cmdLine.getArgument(1); - if ( !sourceFilePath || !destFilePath ) { - alert("Not enough parameters, expecting two arguments:\nInput file, output file"); - window.close(); - return; - } - - sourceFile = cmdLine.resolveFile(sourceFilePath); - if (! (sourceFile.exists() && sourceFile.isFile()) ) { - alert("Invalid source file path."); - window.close(); - return; - } - sourceURI = cmdLine.resolveURI(sourceFilePath); - - // create a nsIFile object for the output file - try{ - destFile = cmdLine.resolveURI(destFilePath).QueryInterface(Components.interfaces.nsIFileURL).file; - }catch(e){ - alert("Invalid destination file.\n\nException:\n" + e); - window.close(); - return; - } - - // add iframeLoaded() as an onload event handler, then navigate to the source file - docFrame.addEventListener("DOMContentLoaded", iframeLoaded, true); - docFrame.setAttribute("src", sourceURI.spec); - - } catch (e) { - alert("Error in init():\n\n" + e); - window.close(); - return; - } -} - -function iframeLoaded() -{ - /* - // print every MathJax signal to the log - docFrame.contentWindow.MathJax.Hub.Startup.signal.Interest( - function (message) {log("Startup: "+message)} - ); - docFrame.contentWindow.MathJax.Hub.signal.Interest( - function (message) {log("Hub: "+message)} - ); - */ - - // tell MathJax to call serialize() when finished - docFrame.contentWindow.MathJax.Hub.Register.StartupHook("End", function() {serialize();}); -} - -function fileURLtoDataURI(url) -{ - var ios = Components.classes["@mozilla.org/network/io-service;1"] - .getService(Components.interfaces.nsIIOService); - var url_object = ios.newURI(url, "", null); - var file = url_object.QueryInterface(Components.interfaces.nsIFileURL).file; - - var data = ""; - var fstream = Components.classes["@mozilla.org/network/file-input-stream;1"]. - createInstance(Components.interfaces.nsIFileInputStream); - fstream.init(file, -1, -1, false); - var bstream = Components.classes["@mozilla.org/binaryinputstream;1"]. - createInstance(Components.interfaces.nsIBinaryInputStream); - bstream.setInputStream(fstream); - - var bytes = bstream.readBytes(bstream.available()); - b64bytes = btoa(bytes); - - return "data:;base64," + b64bytes; - -} - -function serialize() -{ - var MathJaxURL = docFrame.contentWindow.MathJax.Hub.config.root; - - var searchURIList = new Array(); - var replacementURIList = new Array(); - - log("serialize: preprocessing"); - - // remove the MathJax status message window - msgdiv = docFrame.contentDocument.getElementById("MathJax_Message"); - msgdiv.parentNode.removeChild(msgdiv); - - /* Loop through all CSS rules to find all @font-face rules. - At this point, they refer to local absolute paths using file:// URLs. - Replace them either with appropriate URLs relative to finalMathJaxURL - or with data URIs. */ - - for (var i = 0; i tag - try{ - var scriptTags = docFrame.contentDocument.getElementsByTagName("script"); - for (var i=0; i - - - - -