?
Solved

javascript obfuscator error.

Posted on 2014-02-03
2
Medium Priority
?
626 Views
Last Modified: 2014-02-04
I have developing quiz activity. I want to hide answer and scores from src code. So I have chose javascript obfuscator "http://javascriptobfuscator.com/". It throws strange error. How to solve this issue?
JS code:

		$(function()
		    {

		        $("#quiz-content1").sliding_quiz ({
					 'instruction':
					 {
					 	'title': 'Sliding Quiz',
					 	'description' : 'Sliding Quiz is a powerful solution for creating interactive quizzes..'
					 },
					'questions':
					[
                        {
                            'id'        : 1,
                            'question'  : 'What years did Brazil win the world cup?',
                            'answers'   : ['1994', '1998', '2006', '2010'],
                            'weight'     : [10, 1, 2, 3],
                            'explanation'  : 'Visit here to check <a href="http://en.wikipedia.org/wiki/FIFA_World_Cup" target="_blank">http://en.wikipedia.org/wiki/FIFA_World_Cup</a>'
                        },
                        {
                            'id'        : 2,
                            'question'  : 'Which is the only country to have played in every World Cup since it started in 1930?',
                            'answers'   : ['England', 'Germany', 'Brazil'],
                            'weight'     : [3, 5, 10],

                        }
					],
					'locale': //optional
					{
						'msg_not_found' : 'Cannot find questions',
						'msg_please_select_an_option' : 'Please select an option',
						'msg_question' : 'Question',
						'msg_you_scored' : 'You scored',
						'msg_click_to_review' : 'Click to Question button to review your answers',
						'bt_next' : 'Next',
						'bt_back' : 'Back',
						'bt_finish' : 'Finish',
						'bt_contact' : 'Submit Your Score',
						'contact_heading' : 'Submit Your Score',
						'contact_name' : 'Name',
						'contact_email' : 'Email',
						'contact_phone' : 'Phone',
						'contact_message' : 'Message',
						'contact_thankyou' : 'Thank you for your submission. <a href="http://goo.gl/kPdmL" target="_blank">Click here to check mail</a>'
					},
					'when_finish_submit_url': 'server_response.php',
					'contact_form_submit_url': 'submit_answers.php',
					//'effect': 'fade'
				});
			});
	

Open in new window


Obfuscator Error:

JScriptCodeDom.CodeParseException: Unexcepted Token : Comma , Requires QuoteEnd , Line 15, Char 65 ---> System.Exception: Unexcepted Token : Comma , Requires QuoteEnd
   at JScriptCodeDom.CodeParser.ReadAndCheckToken(CodeTokenType equalto)
   at JScriptCodeDom.CodeParser.ContinueExpressionCore(CodeExpression leftexp)
   at JScriptCodeDom.CodeParser.ContinueExpression(CodeExpression leftexp)
   at JScriptCodeDom.CodeParser.ParseFullExpression(Boolean bthrowerror)
   at JScriptCodeDom.CodeParser.InternalParseStatementCore()
   at JScriptCodeDom.CodeParser.InternalParseStatement()
   at JScriptCodeDom.CodeParser.ParseStatement()
   at JScriptCodeDom.CodeParser.Parse(String code)
   --- End of inner exception stack trace ---
   at JScriptCodeDom.CodeParser.Parse(String code)
   at JScriptProtector.Protector.Protect(String[] codes)
   at JScriptProtector.Protector.Protect(String code)
   at Jsps._Default.Button1_Click(Object sender, EventArgs e)

Open in new window

0
Comment
Question by:JohnLourdu
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 2000 total points
ID: 39831920
When you delete a line (line 24) or comment it out (line 47) you need to take care that the comma at the end of the previous line is also removed/commented out.

Here is a corrected version:
		$(function()
		    {

		        $("#quiz-content1").sliding_quiz ({
					 'instruction':
					 {
					 	'title': 'Sliding Quiz',
					 	'description' : 'Sliding Quiz is a powerful solution for creating interactive quizzes..'
					 },
					'questions':
					[
                        {
                            'id'        : 1,
                            'question'  : 'What years did Brazil win the world cup?',
                            'answers'   : ['1994', '1998', '2006', '2010'],
                            'weight'     : [10, 1, 2, 3],
                            'explanation'  : 'Visit here to check <a href="http://en.wikipedia.org/wiki/FIFA_World_Cup" target="_blank">http://en.wikipedia.org/wiki/FIFA_World_Cup</a>'
                        },
                        {
                            'id'        : 2,
                            'question'  : 'Which is the only country to have played in every World Cup since it started in 1930?',
                            'answers'   : ['England', 'Germany', 'Brazil'],
                            'weight'     : [3, 5, 10] //,

                        }
					],
					'locale': //optional
					{
						'msg_not_found' : 'Cannot find questions',
						'msg_please_select_an_option' : 'Please select an option',
						'msg_question' : 'Question',
						'msg_you_scored' : 'You scored',
						'msg_click_to_review' : 'Click to Question button to review your answers',
						'bt_next' : 'Next',
						'bt_back' : 'Back',
						'bt_finish' : 'Finish',
						'bt_contact' : 'Submit Your Score',
						'contact_heading' : 'Submit Your Score',
						'contact_name' : 'Name',
						'contact_email' : 'Email',
						'contact_phone' : 'Phone',
						'contact_message' : 'Message',
						'contact_thankyou' : 'Thank you for your submission. <a href="http://goo.gl/kPdmL" target="_blank">Click here to check mail</a>'
					},
					'when_finish_submit_url': 'server_response.php',
					'contact_form_submit_url': 'submit_answers.php' //,
					//'effect': 'fade'
				});
			});

Open in new window

0
 

Author Closing Comment

by:JohnLourdu
ID: 39832060
Thanks, it works like a charm.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month16 days, 20 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question