JavaScript - Js Obfuscator - What To Choose?
Hey all,
I've developed a nice javascript code library and wish to sell it. I don't wish competitors to be able to cut and paste pieces from it into their code. The only way to protect it somehow is to rename variables, remove comments and so on - i.e. to apply a javascript obfuscator to it. Please recommend me a javascript obfuscator, and tell me your experience with it. In google I've found javascript obfuscator from Stunnix. It looks good to me, but I didn't try it though. Similar TutorialsHi all together! I have downloaded a javascript obfuscator and checked it out. It seems as it takes my code an put it together with a new function "function(x)" in the eval()-statement. But what does this "function(x)"? I do not understand it... And why is all putted in the eval()-Statement? Can someone help me? -- START-- eval( ( function(x){ var d=""; var p=0; while(p<x.length) { if(x.charAt(p)!="`") { d+=x.charAt(p++); } else { var l=x.charCodeAt(p+3)-28; if(l>4) { d+=d.substr(d.length-x.charCodeAt(p+1)*96-x.charCodeAt(p+2)+3104-l,l); } else { d+="`"; p+=4 } } } return d } ) (" ...MY OLD JAVA SCRIPT... ") ) -- END-- Hi, Can please someone advice me a good Javascript encoder and obfuscator? If it's freeware, the better. Thanks. Kind regards, Kepler What I am doing is working on a shooting app that will randomly call out different targets to shoot. I have it so it will randomly organize them but I need it so it pulls a single one. Any help would be appreciated! Code: <html> <body> <p id="demo">Click the Button to Call out a target</p> <button onclick="myFunction()">Call Out</button> <script type="text/javascript"> function myFunction() { var myarray=["red","blue", "yellow", "orange"] myarray.sort(function() {return 0.5 - Math.random()}) var x=document.getElementById("demo"); x.innerHTML=myarray; } </script> </body> </html> hi, I have this keypressed function: Code: function keyPressed(event, input) { if (event.keyCode == 8) { return true; } var char = event.which ? event.which : event.keyCode; char = String.fromCharCode(char); var exers = "1234 1234 1234"; return (exers.charAt(input.value.length) == char); } This function allow me to press in order the numbers in array (index0). It is works very well. But i want to add an array with more exercises like: Code: var exerc = new Array(); exerc[0]= "1234 1234 1234"; exerc[1] = "5678 5678 5678"; exerc[2] = "9012 9012 9012"; Also, i have a dropdown menu that parser options from a xml file: Code: <form> <select style="width:100px" id='courses'> </select> </form> and my xml file looks like: Code: <courses> <course title="exercise 1"> <lesson>1234 1234 1234</lesson> </course> <course title="exercise 2"> <lesson>5678 5678 5678</lesson> </course> <course title="exercise 3"> <lesson>9012 9012 9012</lesson> </course> . . . </courses> *I write the same index because i have two input field. I see the first choose (depend on dropdown) in first input, and i rewrite the same exercise in the second input. So, it's something like an exercise for me and i stack here. - I repeat. It is work with only one index very well. The problem is that, when i add more that one index in the array. Any suggestion about my problem?Javascript it is not my strong point I try this but it is doesn't work.Baybe it is totally wrong! Code: function keyPressed(event, input) { if (event.keyCode == 8) { return true; } var char = event.which ? event.which : event.keyCode; char = String.fromCharCode(char); var exerc = new Array(); exerc[0]= "1234 1234 1234"; exerc[1] = "5678 5678 5678"; exerc[2] = "9012 9012 9012"; for (i=0;i<exerc.length;i++) { document.getElementById("courses").selectedIndex; } return (exers.charAt(input.value.length) == char); } Hello, I am hoping someone can help me with following search form. As you can see I have created a form but I don't know how to fix the coding so when a user select a category it will add a different hidden filed for that option for example: When the user selects category "Men" the hidden filed Code: <INPUT TYPE="HIDDEN" NAME="REFERRER" VALUE="http://men.com/acatalog/"> will be added and when the user selects category "Kids" the hidden filed Code: <INPUT TYPE="HIDDEN" NAME="REFERRER" VALUE="http://kids.com/acatalog/"> will be added and so on... Here is my form coding I am using: Code: <form name="simplesearch" method="get" action="" onsubmit="ssite=document.getElementById('sitelist');this.action=ssite.options[ssite.selectedIndex].value;return true;"> <input type="hidden" name="page" value="search" /> <input type="hidden" name="PR" value="-1" /> <input type="hidden" name="TB" value="A" /> <input type="hidden" name="NOLOGIN" value="1" /><input align="top" class="main_search_box" name="SS" type="text" value="search for ..." onfocus="this.value='';"> Search within: <select id="sitelist"> <option value="">Select Catagory</option> <option value="http://kids.com/cgi-bin/ss000001.pl">kids</option> <option value="http://men.com/cgi-bin/ss000001.pl">men</option> <option value="http://women.com/cgi-bin/ss000001.pl">women</option> </select><input type="submit" class="button" name="ACTION" value="Go!"> </form> Also I have one more question how do I make the "Select Catagory" a Must Choose and if not chosen to give message that say"Please Select a Category" Thank you in advance for any help you can give me... I am a bigginer so please go easy on me I'm just starting out with javascripting and am trying to make a Choose your own Adventure game. My goal is to have the scenes and alerts change depending on the button clicked, but I'm stuck, unfortunately. I keep getting the same alerts repeated and my image doesn't change. I think I'm missing code or have made a mistake somewhere, but have no idea what I've done wrong or left out. I don't know if this type of programming has a more specific name, too, so I wasn't sure what to search for to get help. Hopefully someone can guide me in the right direction. I've included my beginning code below. Thanks Code: <script type="text/javascript"> var curScene = "0"; function userChoice(decision){ alert(decision); /*welcomepage*/ if(curScene == 0) { alert("Welcome to the game. Chose 1 or 2."); }if(decision == 1) { alert(); curScene = 1; }else if(decision == 2){ alert(); curScene = 1; } /*Scene1*/ if(curScene == 1){ alert("go left or right"); }if(decision == 1) { alert("you went left and fell in a hole"); curScene = 3; }else if(decision == 2){ alert("you go right and come upon a zebra"); curScene = 4; } } document.getElementById("sceneimg").src= "scene" + curScene + ".jpg"; </script> <img id="sceneimg" src="scene0.jpg" alt= "Stick Figure Adventure" /> <input type="button" value="1" onClick= "userChoice(1)"> <input type="button" value="2" onClick= "userChoice(2)"> </script> I'm using the autofill forms plugin for firefox which can be found he https://addons.mozilla.org/en-US/firefox/addon/4775 I use it to automatically fill various web forms, duh. But I would like certain values to be chosend randomly from a list I create. I contacted the developer and he said the add on probably does not need a new feature because there is a 'dynamic tags' function to fill certain forms with dynamic values (e.g. the current time or date). He has given over the project to another developer and told me I probably would find a solution in a good javascript programming forum. So here I am! Can anyone help me with this? Basically, I just need a javascript code which chooses on item from an array randomly, I guess? I'm not a programmer myself, so any help would be greatly (!) appreciated. Thanks a lot in advance for any further guidance! Note: Here are sample dynamic tags from the plugin: <datetime> new Date().toLocaleString() <useragent> navigator.userAgent <langcode> navigator.language <resolution> screen.width+'x'+screen.height <clipboard> this.getClipboardText() Hi, I want the user to choose one option in each of the radio group. But when I click only one button out of all 12 buttons, it allows the user to submit. How do I change it to a way that the user must click one option for each group in order to allow him/her to submit the form? Javascript Code: function valbutton(thisform) { // place any other field validations that you require here // validate myradiobuttons myOption = -1; for (i=thisform.myradiobutton.length-1; i > -1; i--) { if (thisform.myradiobutton[i].checked) { myOption = i; i = -1; } } for (i=thisform.myradiobutton1.length-1; i > -1; i--) { if (thisform.myradiobutton1[i].checked) { myOption = i; i = -1; } } for (i=thisform.myradiobutton2.length-1; i > -1; i--) { if (thisform.myradiobutton2[i].checked) { myOption = i; i = -1; } } for (i=thisform.myradiobutton3.length-1; i > -1; i--) { if (thisform.myradiobutton3[i].checked) { myOption = i; i = -1; } } for (i=thisform.myradiobutton4.length-1; i > -1; i--) { if (thisform.myradiobutton4[i].checked) { myOption = i; i = -1; } } for (i=thisform.myradiobutton5.length-1; i > -1; i--) { if (thisform.myradiobutton5[i].checked) { myOption = i; i = -1; } } if (myOption == -1) { alert("You must select a radio button"); return false; } // place any other field validations that you require here thisform.submit(); // this line submits the form after validation } HTML Code: <p>Cookies</p> <input type="radio" value="1st value" name="myradiobutton" class="style31" />Enable <input type="radio" value="2nd value" name="myradiobutton" class="style31" />Enable<br /> <p>Java</p> <input type="radio" value="3rd value" name="myradiobutton1" class="style31" />Enable <input type="radio" value="4th value" name="myradiobutton1" class="style31" />Enable<br /> <p>Javascript</p> <input type="radio" value="5th value" name="myradiobutton2" class="style31" />Enable <input type="radio" value="6th value" name="myradiobutton2" class="style31" />Enable<br /> <p>PHP</p> <input type="radio" value="7th value" name="myradiobutton3" class="style31" />Enable <input type="radio" value="8th value" name="myradiobutton3" class="style31" />Enable<br /> <p>C#</p> <input type="radio" value="9th value" name="myradiobutton4" class="style31" />Enable <input type="radio" value="10th value" name="myradiobutton4" class="style31" />Enable<br /> <p>CSS</p> <input type="radio" value="11st value" name="myradiobutton5" class="style31" />Enable <input type="radio" value="12nd value" name="myradiobutton5" class="style31" />Enable<br /> <input type="submit" name="submitit" onclick="valbutton(myform);return false;" value="Validate" /> <input type="reset" name="reset" value="Clear" /> |