?
Solved

javascript obfuscator error.

Posted on 2014-02-03
2
Medium Priority
?
607 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Read about why website design really matters in today's demanding market.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

752 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