details: http://www.bx.psu.edu/hg/galaxy/rev/7f5489d7c3d8 changeset: 2885:7f5489d7c3d8 user: Kanwei Li <kanwei@gmail.com> date: Wed Oct 14 18:43:38 2009 -0400 description: pack the new scripts for rgenetics 3 file(s) affected in this change: static/scripts/packed/checkbox_and_radiobutton.js static/scripts/packed/helper_functions.js static/scripts/packed/timer.js diffs (18 lines): diff -r c2d042ba8cd0 -r 7f5489d7c3d8 static/scripts/packed/checkbox_and_radiobutton.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/static/scripts/packed/checkbox_and_radiobutton.js Wed Oct 14 18:43:38 2009 -0400 @@ -0,0 +1,1 @@ +function checkBox(d,g,m,j,n,l,c,f,k,b,h,o,a){var e=13;var i=true;if(arguments.length==e){this.id=d;this.parentNode=g;this.x=m;this.y=j;this.checkboxId=n;this.checkcrossId=l;this.checkedStatus=c;this.labelText=f;this.textStyles=k;if(!this.textStyles["font-size"]){this.textStyles["font-size"]=12}this.labelDistance=b;this.labelYOffset=h;this.radioButtonGroup=o;this.functionToCall=a;this.exists=true;this.label=undefined}else{i=false;alert("Error in checkbox ("+d+"): wrong nr of arguments! You have to pass over "+e+" parameters.")}if(i){this.timer=new Timer(this);if(this.radioButtonGroup){this.timerMs=0}else{this.timerMs=200}this.createCheckBox()}else{alert("Could not create checkbox with id '"+d+"' due to errors in the constructor parameters")}}checkBox.prototype.createCheckBox=function(){if(typeof(this.parentNode)=="string"){this.parentNode=document.getElementById(this.parentNode)}this.checkBox=document.createElementNS(svgNS,"use");this.checkBox.setAttributeNS(null,"x",this.x); this.checkBox.setAttributeNS(null,"y",this.y);this.checkBox.setAttributeNS(xlinkNS,"href","#"+this.checkboxId);this.checkBox.addEventListener("click",this,false);this.checkBox.setAttributeNS(null,"cursor","pointer");this.parentNode.appendChild(this.checkBox);this.checkCross=document.createElementNS(svgNS,"use");this.checkCross.setAttributeNS(null,"x",this.x);this.checkCross.setAttributeNS(null,"y",this.y);this.checkCross.setAttributeNS(xlinkNS,"href","#"+this.checkcrossId);this.parentNode.appendChild(this.checkCross);if(this.checkedStatus==false){this.checkCross.setAttributeNS(null,"display","none")}if(this.labelText){if(this.labelText.length>0){this.label=document.createElementNS(svgNS,"text");for(var b in this.textStyles){var a=this.textStyles[b];if(b=="font-size"){a+="px"}this.label.setAttributeNS(null,b,a)}this.label.setAttributeNS(null,"x",(this.x+this.labelDistance));this.label.setAttributeNS(null,"y",(this.y+this.labelYOffset));this.label.setAttributeNS(null,"cursor", "pointer");var c=document.createTextNode(this.labelText);this.label.appendChild(c);this.label.setAttributeNS(null,"pointer-events","all");this.label.addEventListener("click",this,false);this.parentNode.appendChild(this.label)}}if(this.radioButtonGroup){this.radioButtonGroup.addCheckBox(this)}};checkBox.prototype.handleEvent=function(a){if(a.type=="click"){if(this.checkedStatus==true){this.checkCross.setAttributeNS(null,"display","none");this.checkedStatus=false}else{this.checkCross.setAttributeNS(null,"display","inline");this.checkedStatus=true}}this.timer.setTimeout("fireFunction",this.timerMs)};checkBox.prototype.fireFunction=function(){if(this.radioButtonGroup){this.radioButtonGroup.selectById(this.id,true)}else{if(typeof(this.functionToCall)=="function"){this.functionToCall(this.id,this.checkedStatus,this.labelText)}if(typeof(this.functionToCall)=="object"){this.functionToCall.checkBoxChanged(this.id,this.checkedStatus,this.labelText)}if(typeof(this.functionToCall)==unde fined){return}}};checkBox.prototype.check=function(a){this.checkCross.setAttributeNS(null,"display","inherit");this.checkedStatus=true;if(a){this.timer.setTimeout("fireFunction",this.timerMs)}};checkBox.prototype.uncheck=function(a){this.checkCross.setAttributeNS(null,"display","none");this.checkedStatus=false;if(a){this.timer.setTimeout("fireFunction",this.timerMs)}};checkBox.prototype.moveTo=function(b,a){this.x=b;this.y=a;this.checkBox.setAttributeNS(null,"x",this.x);this.checkBox.setAttributeNS(null,"y",this.y);this.checkCross.setAttributeNS(null,"x",this.x);this.checkCross.setAttributeNS(null,"y",this.y);if(this.labelText){this.label.setAttributeNS(null,"x",(this.x+this.labelDistance));this.label.setAttributeNS(null,"y",(this.y+this.labelYOffset))}};checkBox.prototype.remove=function(a){this.checkBox.removeEventListener("click",this,false);this.parentNode.removeChild(this.checkBox);this.parentNode.removeChild(this.checkCross);if(this.label){this.parentNode.removeChild(t his.label)}this.exists=false};checkBox.prototype.setLabelText=function(a){this.labelText=a;if(this.label){this.label.firstChild.nodeValue=a}else{if(this.labelText.length>0){this.label=document.createElementNS(svgNS,"text");for(var b in this.textStyles){value=this.textStyles[b];if(b=="font-size"){value+="px"}this.label.setAttributeNS(null,b,value)}this.label.setAttributeNS(null,"x",(this.x+this.labelDistance));this.label.setAttributeNS(null,"y",(this.y+this.textStyles["font-size"]*0.3));var c=document.createTextNode(this.labelText);this.label.appendChild(c);this.parentNode.appendChild(this.label)}}};function radioButtonGroup(c,a){var b=2;if(arguments.length==b){this.id=c;if(typeof(a)=="function"||typeof(a)=="object"||typeof(a)==undefined){this.functionToCall=a}else{alert("Error in radiobutton with ("+c+"): argument functionToCall is not of type 'function', 'object' or undefined!")}this.checkBoxes=new Array();this.selectedId=undefined;this.selectedIndex=undefined;this.timer=ne w Timer(this);this.timerMs=200}else{alert("Error in radiobutton with ("+c+"): wrong nr of arguments! You have to pass over "+b+" parameters.")}}radioButtonGroup.prototype.addCheckBox=function(a){this.checkBoxes.push(a);if(a.checkedStatus){this.selectedId=a.id;this.selectedIndex=this.checkBoxes.length-1}};radioButtonGroup.prototype.selectById=function(c,a){var d=false;for(var b=0;b<this.checkBoxes.length;b++){if(this.checkBoxes[b].id==c){this.selectedId=c;this.selectedIndex=b;if(this.checkBoxes[b].checkedStatus==false){this.checkBoxes[b].check(false)}d=true}else{this.checkBoxes[b].uncheck(false)}}if(d){if(a){this.timer.setTimeout("fireFunction",this.timerMs)}}else{alert("Error in radiobutton with ("+this.id+"): could not find checkbox with id '"+c+"'")}};radioButtonGroup.prototype.selectByLabelname=function(a,b){var d=-1;for(var c=0;c<this.checkBoxes.length;c++){if(this.checkBoxes[c].labelText==a){d=this.checkBoxes[c].id}}if(d==-1){alert("Error in radiobutton with ("+this.id+ "): could not find checkbox with label '"+a+"'")}else{this.selectById(d,b)}};radioButtonGroup.prototype.fireFunction=function(){if(typeof(this.functionToCall)=="function"){this.functionToCall(this.id,this.selectedId,this.checkBoxes[this.selectedIndex].labelText)}if(typeof(this.functionToCall)=="object"){this.functionToCall.radioButtonChanged(this.id,this.selectedId,this.checkBoxes[this.selectedIndex].labelText)}if(typeof(this.functionToCall)==undefined){return}}; \ No newline at end of file diff -r c2d042ba8cd0 -r 7f5489d7c3d8 static/scripts/packed/helper_functions.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/static/scripts/packed/helper_functions.js Wed Oct 14 18:43:38 2009 -0400 @@ -0,0 +1,1 @@ +var svgNS="http://www.w3.org/2000/svg";var xlinkNS="http://www.w3.org/1999/xlink";var cartoNS="http://www.carto.net/attrib";var attribNS="http://www.carto.net/attrib";var batikNS="http://xml.apache.org/batik/ext";function toPolarDir(a,c){var b=(Math.atan2(c,a));return(b)}function toPolarDist(a,b){var c=Math.sqrt(a*a+b*b);return(c)}function toRectX(b,c){var a=c*Math.cos(b);return(a)}function toRectY(a,b){y=b*Math.sin(a);return(y)}function DegToRad(a){return(a/180*Math.PI)}function RadToDeg(a){return(a/Math.PI*180)}function dd2dms(a){var b=(Math.abs(a)-Math.floor(Math.abs(a)))*60;var d=(b-Math.floor(b))*60;var b=Math.floor(b);if(a>=0){var c=Math.floor(a)}else{var c=Math.ceil(a)}return{deg:c,min:b,sec:d}}function dms2dd(c,a,b){if(c<0){return c-(a/60)-(b/3600)}else{return c+(a/60)+(b/3600)}}function log(c,a){if(a==null){a=Math.E}return Math.log(c)/Math.log(a)}function intBilinear(m,k,g,c,o,b,a,u,t){var q=(o-a)/t;var p=(b-u)/t;var n=(1-q)*(1-p);var l=q*(1-p);var j=q*p;var d=p*(1- q);var r=n*g+l*c+j*m+d*k;return r}function leftOfTest(b,j,d,g,c,f){var a=(g-j)*(c-d)-(d-b)*(f-g);if(a<0){var e=1}else{var e=0}return e}function distFromLine(e,f,d,a,c,j){var k=c-d;var g=j-a;var b=(g*(e-d)-k*(f-a))/Math.sqrt(Math.pow(k,2)+Math.pow(g,2));return b}function angleBetwTwoLines(b,a,e,c){var d=Math.acos((b*e+a*c)/(Math.sqrt(Math.pow(b,2)+Math.pow(a,2))*Math.sqrt(Math.pow(e,2)+Math.pow(c,2))));return d}function calcBisectorVector(b,a,g,e){var f=Math.sqrt(Math.pow(b,2)+Math.pow(a,2));var d=Math.sqrt(Math.pow(g,2)+Math.pow(e,2));var j=new Array();j[0]=b/f+g/d;j[1]=a/f+e/d;return j}function calcBisectorAngle(a,k,j,g){var c=Math.sqrt(Math.pow(a,2)+Math.pow(k,2));var b=Math.sqrt(Math.pow(j,2)+Math.pow(g,2));var f=a/c+j/b;var e=k/c+g/b;var d=toPolarDir(f,e);return d}function intersect2lines(l,f,k,e,n,j,m,g){var c=new Object();var d=(g-j)*(k-l)-(m-n)*(e-f);if(d==0){alert("lines are parallel")}else{var b=((m-n)*(f-j)-(g-j)*(l-n))/d;var a=((k-l)*(f-j)-(e-f)*(l-n))/d}c.x=l+b*( k-l);c.y=f+b*(e-f);return c}function formatNumberString(a,e){if(typeof(a)=="Number"){var c=a.toString()}else{var c=a}var b="";var d=c.split(".");var f=d[0].length;if(f>3){while(f>0){if(f>3){b=e+d[0].substr(f-3,3)+b}else{b=d[0].substr(0,f)+b}f-=3}}else{b=d[0]}if(d[1]){b=b+"."+d[1]}return b}function statusChange(a){document.getElementById("statusText").firstChild.nodeValue="Statusbar: "+a}function scaleObject(a,e){var d=a.currentTarget;var c=d.getAttributeNS(null,"x");var b=d.getAttributeNS(null,"y");var f="scale("+e+") translate("+(c*1/e-c)+" "+(b*1/e-b)+")";d.setAttributeNS(null,"transform",f)}function getTransformToRootElement(b){try{var c=b.getTransformToElement(document.documentElement)}catch(a){var c=b.getCTM();while((b=b.parentNode)!=document){c=b.getCTM().multiply(c)}}return c}function getTransformToElement(b,c){try{var d=b.getTransformToElement(c)}catch(a){var d=b.getCTM();while((b=b.parentNode)!=c){d=b.getCTM().multiply(d)}}return d}function hsv2rgb(j,c,b){var l=new Object();if(c==0){l.red=Math.round(b*255);l.green=Math.round(b*255);l.blue=Math.round(b*255)}else{var g=j/60;var e=Math.floor(g);var k=g-e;if(e%2==0){k=1-k}var d=b*(1-c);var a=b*(1-c*k);switch(e){case 0:l.red=b;l.green=a;l.blue=d;break;case 1:l.red=a;l.green=b;l.blue=d;break;case 2:l.red=d;l.green=b;l.blue=a;break;case 3:l.red=d;l.green=a;l.blue=b;break;case 4:l.red=a;l.green=d;l.blue=b;break;case 5:l.red=b;l.green=d;l.blue=a;break;case 6:l.red=b;l.green=a;l.blue=d;break}l.red=Math.round(l.red*255);l.green=Math.round(l.green*255);l.blue=Math.round(l.blue*255)}return l}function rgb2hsv(c,b,a){var d=new Object();c=c/255;b=b/255;a=a/255;myMax=Math.max(c,Math.max(b,a));myMin=Math.min(c,Math.min(b,a));v=myMax;if(myMax>0){s=(myMax-myMin)/myMax}else{s=0}if(s>0){myDiff=myMax-myMin;rc=(myMax-c)/myDiff;gc=(myMax-b)/myDiff;bc=(myMax-a)/myDiff;if(c==myMax){h=(bc-gc)/6}if(b==myMax){h=(2+rc-bc)/6}if(a==myMax){h=(4+gc-rc)/6}}else{h=0}if(h<0){h+=1}d.hue=Math.round(h*360);d.sat=s;d.val=v;ret urn d}function arrayPopulate(a,b){var c=new Array();if(a.length!=b.length){alert("error: arrays do not have the same length!")}else{for(i=0;i<a.length;i++){c[a[i]]=b[i]}}return c}function getData(d,c,e,f,b,a){this.url=d;this.callBackFunction=c;this.returnFormat=e;this.method=f;this.additionalParams=a;if(f!="get"&&f!="post"){alert("Error in network request: parameter 'method' must be 'get' or 'post'")}this.postText=b;this.xmlRequest=null}getData.prototype.getData=function(){if(window.getURL){if(this.method=="get"){getURL(this.url,this)}if(this.method=="post"){postURL(this.url,this.postText,this)}}else{if(window.XMLHttpRequest){var b=this;this.xmlRequest=new XMLHttpRequest();if(this.method=="get"){if(this.returnFormat=="xml"){this.xmlRequest.overrideMimeType("text/xml")}this.xmlRequest.open("GET",this.url,true)}if(this.method=="post"){this.xmlRequest.open("POST",this.url,true)}this.xmlRequest.onreadystatechange=function(){b.handleEvent()};if(this.method=="get"){this.xmlRequest .send(null)}if(this.method=="post"){var a=true;if(!this.postText){a=false;alert("Error in network post request: missing parameter 'postText'!")}if(typeof(this.postText)!="string"){a=false;alert("Error in network post request: parameter 'postText' has to be of type 'string')")}if(a){this.xmlRequest.send(this.postText)}}}else{alert("your browser/svg viewer neither supports window.getURL nor window.XMLHttpRequest!")}}};getData.prototype.operationComplete=function(b){if(b.success){if(this.returnFormat=="xml"){var a=parseXML(b.content,document);if(typeof(this.callBackFunction)=="function"){this.callBackFunction(a.firstChild,this.additionalParams)}if(typeof(this.callBackFunction)=="object"){this.callBackFunction.receiveData(a.firstChild,this.additionalParams)}}if(this.returnFormat=="json"){if(typeof(this.callBackFunction)=="function"){this.callBackFunction(b.content,this.additionalParams)}if(typeof(this.callBackFunction)=="object"){this.callBackFunction.receiveData(b.content,this. additionalParams)}}}else{alert("something went wrong with dynamic loading of geometry!")}};getData.prototype.handleEvent=function(){if(this.xmlRequest.readyState==4){if(this.returnFormat=="xml"){var a=document.importNode(this.xmlRequest.responseXML.documentElement,true);if(typeof(this.callBackFunction)=="function"){this.callBackFunction(a,this.additionalParams)}if(typeof(this.callBackFunction)=="object"){this.callBackFunction.receiveData(a,this.additionalParams)}}if(this.returnFormat=="json"){if(typeof(this.callBackFunction)=="function"){this.callBackFunction(this.xmlRequest.responseText,this.additionalParams)}if(typeof(this.callBackFunction)=="object"){this.callBackFunction.receiveData(this.xmlRequest.responseText,this.additionalParams)}}}};function serializeNode(b){if(typeof XMLSerializer!="undefined"){return new XMLSerializer().serializeToString(b)}else{if(typeof b.xml!="undefined"){return b.xml}else{if(typeof printNode!="undefined"){return printNode(b)}else{if(typeof Pac kages!="undefined"){try{var a=new java.io.StringWriter();Packages.org.apache.batik.dom.util.DOMUtilities.writeNode(b,a);return a.toString()}catch(c){alert("Sorry, your SVG viewer does not support the printNode/serialize function.");return""}}else{alert("Sorry, your SVG viewer does not support the printNode/serialize function.");return""}}}}}function startAnimation(a){document.getElementById(a).beginElement()}; \ No newline at end of file diff -r c2d042ba8cd0 -r 7f5489d7c3d8 static/scripts/packed/timer.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/static/scripts/packed/timer.js Wed Oct 14 18:43:38 2009 -0400 @@ -0,0 +1,1 @@ +function Timer(){this.obj=(arguments.length)?arguments[0]:window;return this}Timer.prototype.setInterval=function(c,d){var b=Timer.getNew();var a=Timer.buildCall(this.obj,b,arguments);Timer.set[b].timer=window.setInterval(a,d);return b};Timer.prototype.setTimeout=function(b,c){var a=Timer.getNew();Timer.buildCall(this.obj,a,arguments);Timer.set[a].timer=window.setTimeout("Timer.callOnce("+a+");",c);return a};Timer.prototype.clearInterval=function(a){if(!Timer.set[a]){return}window.clearInterval(Timer.set[a].timer);Timer.set[a]=null};Timer.prototype.clearTimeout=function(a){if(!Timer.set[a]){return}window.clearTimeout(Timer.set[a].timer);Timer.set[a]=null};Timer.set=new Array();Timer.buildCall=function(e,d,b){var c="";Timer.set[d]=new Array();if(e!=window){Timer.set[d].obj=e;c="Timer.set["+d+"].obj."}c+=b[0]+"(";if(b.length>2){Timer.set[d][0]=b[2];c+="Timer.set["+d+"][0]";for(var a=1;(a+2)<b.length;a++){Timer.set[d][a]=b[a+2];c+=", Timer.set["+d+"]["+a+"]"}}c+=");";Timer.set[ d].call=c;return c};Timer.callOnce=function(i){if(!Timer.set[i]){return}eval(Timer.set[i].call);Timer.set[i]=null};Timer.getNew=function(){var a=0;while(Timer.set[a]){a++}return a}; \ No newline at end of file