mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
2 lines
6.1 KiB
JavaScript
2 lines
6.1 KiB
JavaScript
function checkBox(a,b,c,d,e,f,g,h,i,j,k,l,m){var n=13,o=!0;arguments.length==n?(this.id=a,this.parentNode=b,this.x=c,this.y=d,this.checkboxId=e,this.checkcrossId=f,this.checkedStatus=g,this.labelText=h,this.textStyles=i,this.textStyles["font-size"]||(this.textStyles["font-size"]=12),this.labelDistance=j,this.labelYOffset=k,this.radioButtonGroup=l,this.functionToCall=m,this.exists=!0,this.label=void 0):(o=!1,alert("Error in checkbox ("+a+"): wrong nr of arguments! You have to pass over "+n+" parameters.")),o?(this.timer=new Timer(this),this.timerMs=this.radioButtonGroup?0:200,this.createCheckBox()):alert("Could not create checkbox with id '"+a+"' due to errors in the constructor parameters")}function radioButtonGroup(a,b){var c=2;arguments.length==c?(this.id=a,"function"==typeof b||"object"==typeof b||void 0==typeof b?this.functionToCall=b:alert("Error in radiobutton with ("+a+"): argument functionToCall is not of type 'function', 'object' or undefined!"),this.checkBoxes=new Array,this.selectedId=void 0,this.selectedIndex=void 0,this.timer=new Timer(this),this.timerMs=200):alert("Error in radiobutton with ("+a+"): wrong nr of arguments! You have to pass over "+c+" parameters.")}checkBox.prototype.createCheckBox=function(){if("string"==typeof this.parentNode&&(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,!1),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),0==this.checkedStatus&&this.checkCross.setAttributeNS(null,"display","none"),this.labelText&&this.labelText.length>0){this.label=document.createElementNS(svgNS,"text");for(var a in this.textStyles){var b=this.textStyles[a];"font-size"==a&&(b+="px"),this.label.setAttributeNS(null,a,b)}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,!1),this.parentNode.appendChild(this.label)}this.radioButtonGroup&&this.radioButtonGroup.addCheckBox(this)},checkBox.prototype.handleEvent=function(a){"click"==a.type&&(1==this.checkedStatus?(this.checkCross.setAttributeNS(null,"display","none"),this.checkedStatus=!1):(this.checkCross.setAttributeNS(null,"display","inline"),this.checkedStatus=!0)),this.timer.setTimeout("fireFunction",this.timerMs)},checkBox.prototype.fireFunction=function(){if(this.radioButtonGroup)this.radioButtonGroup.selectById(this.id,!0);else if("function"==typeof this.functionToCall&&this.functionToCall(this.id,this.checkedStatus,this.labelText),"object"==typeof this.functionToCall&&this.functionToCall.checkBoxChanged(this.id,this.checkedStatus,this.labelText),void 0==typeof this.functionToCall)return},checkBox.prototype.check=function(a){this.checkCross.setAttributeNS(null,"display","inherit"),this.checkedStatus=!0,a&&this.timer.setTimeout("fireFunction",this.timerMs)},checkBox.prototype.uncheck=function(a){this.checkCross.setAttributeNS(null,"display","none"),this.checkedStatus=!1,a&&this.timer.setTimeout("fireFunction",this.timerMs)},checkBox.prototype.moveTo=function(a,b){this.x=a,this.y=b,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),this.labelText&&(this.label.setAttributeNS(null,"x",this.x+this.labelDistance),this.label.setAttributeNS(null,"y",this.y+this.labelYOffset))},checkBox.prototype.remove=function(){this.checkBox.removeEventListener("click",this,!1),this.parentNode.removeChild(this.checkBox),this.parentNode.removeChild(this.checkCross),this.label&&this.parentNode.removeChild(this.label),this.exists=!1},checkBox.prototype.setLabelText=function(a){if(this.labelText=a,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],"font-size"==b&&(value+="px"),this.label.setAttributeNS(null,b,value);this.label.setAttributeNS(null,"x",this.x+this.labelDistance),this.label.setAttributeNS(null,"y",this.y+.3*this.textStyles["font-size"]);var c=document.createTextNode(this.labelText);this.label.appendChild(c),this.parentNode.appendChild(this.label)}},radioButtonGroup.prototype.addCheckBox=function(a){this.checkBoxes.push(a),a.checkedStatus&&(this.selectedId=a.id,this.selectedIndex=this.checkBoxes.length-1)},radioButtonGroup.prototype.selectById=function(a,b){for(var c=!1,d=0;d<this.checkBoxes.length;d++)this.checkBoxes[d].id==a?(this.selectedId=a,this.selectedIndex=d,0==this.checkBoxes[d].checkedStatus&&this.checkBoxes[d].check(!1),c=!0):this.checkBoxes[d].uncheck(!1);c?b&&this.timer.setTimeout("fireFunction",this.timerMs):alert("Error in radiobutton with ("+this.id+"): could not find checkbox with id '"+a+"'")},radioButtonGroup.prototype.selectByLabelname=function(a,b){for(var c=-1,d=0;d<this.checkBoxes.length;d++)this.checkBoxes[d].labelText==a&&(c=this.checkBoxes[d].id);-1==c?alert("Error in radiobutton with ("+this.id+"): could not find checkbox with label '"+a+"'"):this.selectById(c,b)},radioButtonGroup.prototype.fireFunction=function(){"function"==typeof this.functionToCall&&this.functionToCall(this.id,this.selectedId,this.checkBoxes[this.selectedIndex].labelText),"object"==typeof this.functionToCall&&this.functionToCall.radioButtonChanged(this.id,this.selectedId,this.checkBoxes[this.selectedIndex].labelText),void 0==typeof this.functionToCall};
|
|
//# sourceMappingURL=../../maps/rgenetics/checkbox_and_radiobutton.js.map
|