Aae34a7973a8d98e53764a1c89090c55

Join the lines and save it as a bookmark.

This one aims to help users to embed latex equations in their blogs and wikis by using Mathtex and a little javascript bookmarklet.

<a href="javascript:popw='';y=window;str=prompt(%22Type%20your%20tex:%22,%22%s%22);if(str)%7Bpopw=window.open('http://www.forkosh.dreamhost.com/mathtex.cgi?'+escape(str),'latexbox','width=300,height=200');popw.focus();if (!document.all) T = setTimeout('popw.focus()',50)%7Dvoid(0);" >mathtex box</a>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
javascript:
popw='';
y=window;
str=prompt("Type your tex:","%s");
if(str){
    popw=window.open(
        'http://www.forkosh.dreamhost.com/mathtex.cgi?'+escape(str),
        'latexbox',
        'width=300,height=200'
    );
    popw.focus();
    if (!document.all) T = setTimeout('popw.focus()',50)
}
void(0);

Refactorings

No refactoring yet !

Aae34a7973a8d98e53764a1c89090c55

griflet

February 17, 2008, February 17, 2008 03:13, permalink

No rating. Login to rate!

Ok, I've made this one a little bit more handy. I've added text areas with image url and embeddable html code for your webpage, wiki or blog.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
javascript:

popw='';
str=prompt("Type your tex:","%s");

cols=50;
match=/<([^<>]*)>/g;
subs="&lt;$1&gt;";

if(str){

    popw=window.open(
        '',
        'latexbox',
        'width=440,height=250'
    );
    popw.focus();


    imglnk='http://www.forkosh.dreamhost.com/mathtex.cgi?'+escape(str);
    textimglnk='<textarea rows="1" cols="'+cols+'">'+imglnk.replace(match,subs)+'</textarea>';

    imgtag='<img src="'+imglnk+'" alt="'+str+'"></img>';

    divtag='<div style="text-align:center;width:100%" >'+imgtag+'</div>';
    textdivtag='<textarea rows="3" cols="'+cols+'">'+divtag.replace(match,subs)+'</textarea>';

    popd=popw.document;
    popd.write(imgtag+'</br>');
    popd.write('link: '+textimglnk+'</br>');
    popd.write('html: '+textdivtag+'</br>');

}
Ed9c50a6db8b5e078b5ef84306a8477c

hubfactor

February 21, 2008, February 21, 2008 17:58, permalink

No rating. Login to rate!

Ignoring the second version, which should be using document.createElement and document.appendChild

1
2
3
4
5
6
7
8
9
javascript:
(function(){
  var tex=prompt("TeX input:","");
  if(tex){
    var w=window.open("http://www.forkosh.dreamhost.com/mathtex.cgi?"+encodeURIComponent(tex),"latexbox","width=300,height=200");
    w.focus();
  }
}
)();

Your refactoring





Format Copy from initial code

or Cancel