Solved

javascript obfuscator error.

Posted on 2014-02-03
2
578 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 500 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

WHY MVC is the future technology... As many of you know, MVC is Model,View,Controller pattern. Model View Controller pattern was invented in a Smalltalk context at Xerox in late 1970s. Why is this buzz about MVC: --------------------------- …
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now