• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

help please math type helper..

#1
Screen Shot 2013-03-02 at 12.55.11 PM.jpg I have implemented a small script on some of my pages to help people write math equations using mathjax

for example to type fraction A/B as above...

i give users the option to insert the latex code like this.. by clicking ont he buttons on the left. Screen Shot 2013-03-02 at 12.54.51 PM.jpg


the code looks something like this.

$.fn.extend({
insertAtCaret: function(myValue){
var obj;
if( typeof this[0].name !='undefined' ) obj = this[0];
else obj = this;

if ($.browser.msie) {
obj.focus();
sel = document.selection.createRange();
sel.text = myValue;
obj.focus();
}
else if ($.browser.mozilla || $.browser.webkit) {
var startPos = obj.selectionStart;
var endPos = obj.selectionEnd;
var scrollTop = obj.scrollTop;
obj.value = obj.value.substring(0, startPos)+myValue+obj.value.substring(endPos,obj.value.length);
obj.focus();
obj.selectionStart = startPos + myValue.length;
obj.selectionEnd = startPos + myValue.length;
obj.scrollTop = scrollTop;
} else {
obj.value += myValue;
obj.focus();
}
}
})

function put(somthing){
var thisSTuff = somthing;
$('.onFocussed').insertAtCaret(thisSTuff);
}


Now.. I would like to add this menu for students on my forum so the menu should appear everywhere where students can post questions or start threads .. if possible would like a floating menu..but whatever gets the job done would be greatly appreciated.. currently on my non-forum pages all i add is this line
<?
include_once($_SERVER['DOCUMENT_ROOT'] . "/configs/mJaxHelper.php");
?>
and contains all the stuff i need.. what would you suggest to add this to my forum?
much appreciated
thx
j